/**
 * FluxPanel UI/UX 2.0 Responsive Design System
 * Clean, modern SaaS design system for IPTV/OTT operations.
 */

:root {
    /* Color Palette */
    --bg: #f8fafc;
    --surface: #ffffff;
    --surface-secondary: #f1f5f9;
    --surface-tertiary: #e2e8f0;
    --border: #e2e8f0;
    --border-subtle: #f1f5f9;
    --border-focus: #3b82f6;

    --text: #0f172a;
    --text-secondary: #475569;
    --muted: #64748b;
    --muted-light: #94a3b8;

    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #eff6ff;
    --primary-border: #bfdbfe;

    --success: #10b981;
    --success-hover: #059669;
    --success-light: #ecfdf5;
    --success-border: #a7f3d0;
    --success-text: #065f46;

    --warning: #f59e0b;
    --warning-hover: #d97706;
    --warning-light: #fffbeb;
    --warning-border: #fde68a;
    --warning-text: #92400e;

    --danger: #ef4444;
    --danger-hover: #dc2626;
    --danger-light: #fef2f2;
    --danger-border: #fecaca;
    --danger-text: #991b1b;

    --info: #0ea5e9;
    --info-light: #f0f9ff;
    --info-border: #bae6fd;
    --info-text: #0369a1;

    /* Dark Modern Sidebar */
    --sidebar-bg: #090e1a;
    --sidebar-surface: #121a2d;
    --sidebar-border: #1a253c;
    --sidebar-text: #94a3b8;
    --sidebar-text-hover: #e2e8f0;
    --sidebar-text-active: #ffffff;
    --sidebar-active-bg: #1e293b;
    --sidebar-group: #475569;

    /* Dimensions & Spacing */
    --sidebar-width: 236px;
    --sidebar-collapsed-width: 68px;
    --topbar-height: 60px;
    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 14px;
    --radius-xl: 18px;

    /* Shadows */
    --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.04);
    --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.07), 0 1px 2px -1px rgb(0 0 0 / 0.05);
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.06), 0 2px 4px -2px rgb(0 0 0 / 0.05);
    --shadow-md: 0 10px 15px -3px rgb(0 0 0 / 0.07), 0 4px 6px -4px rgb(0 0 0 / 0.05);
    --shadow-lg: 0 20px 25px -5px rgb(0 0 0 / 0.08), 0 8px 10px -6px rgb(0 0 0 / 0.04);

    --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

/* Base Reset & Typography */
*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.5;
    color: var(--text);
    background-color: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    max-width: 100vw;
}

body.drawer-active {
    overflow: hidden;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.15s ease;
}

a:hover {
    color: var(--primary-hover);
}

h1, h2, h3, h4, h5, h6 {
    margin: 0;
    color: var(--text);
    font-weight: 700;
    letter-spacing: -0.02em;
}

p {
    margin: 0 0 1rem;
}

code, kbd, samp, pre {
    font-family: var(--font-mono);
    font-size: 0.875em;
}

code {
    background: var(--surface-secondary);
    border: 1px solid var(--border);
    padding: 0.15em 0.4em;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
}

/* App Shell Structure */
.app {
    display: flex;
    min-height: 100vh;
    background-color: var(--bg);
}

/* Sidebar Styles */
.sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    overflow-y: auto;
}

.sidebar-header {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    border-bottom: 1px solid var(--sidebar-border);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #ffffff;
    font-weight: 700;
    font-size: 1.15rem;
    letter-spacing: -0.02em;
    text-decoration: none;
}

.brand:hover {
    color: #ffffff;
}

.brand-icon {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: linear-gradient(135deg, var(--primary), #4f46e5);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    box-shadow: 0 2px 10px rgba(37, 99, 235, 0.4);
    flex-shrink: 0;
}

.brand-text {
    display: flex;
    flex-direction: column;
}

.brand-text .brand-name {
    line-height: 1.15;
    font-size: 1.1rem;
}

.brand-text .brand-sub {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #64748b;
    font-weight: 700;
    margin-top: 2px;
}

.drawer-close-btn {
    display: none;
    background: transparent;
    border: none;
    color: var(--sidebar-text);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
}

.drawer-close-btn:hover {
    color: #ffffff;
    background: var(--sidebar-surface);
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-group-title {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--sidebar-group);
    padding: 14px 10px 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
    color: var(--sidebar-text);
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-weight: 500;
    transition: all 0.15s ease;
}

.nav-item:hover {
    color: var(--sidebar-text-hover);
    background-color: var(--sidebar-surface);
}

.nav-item.active {
    color: var(--sidebar-text-active);
    background-color: var(--primary);
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
}

.nav-icon {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 14px 16px;
    border-top: 1px solid var(--sidebar-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.system-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: var(--muted);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--success);
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
}

/* App Main Wrapper */
.app-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    margin-left: var(--sidebar-width);
    min-width: 0;
    min-height: 100vh;
}

/* Topbar Styles */
.topbar {
    height: var(--topbar-height);
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 40;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.hamburger-btn {
    display: none;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    padding: 8px 10px;
    cursor: pointer;
    min-height: 42px;
    min-width: 42px;
    align-items: center;
    justify-content: center;
}

.hamburger-btn:hover {
    background: var(--surface-secondary);
    color: var(--text);
}

.breadcrumb-area {
    display: flex;
    align-items: center;
    gap: 8px;
}

.page-title-top {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text);
    margin: 0;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* User Account & Dropdown */
.dropdown {
    position: relative;
}

.user-badge-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 5px 12px 5px 6px;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.15s ease;
    color: var(--text);
    min-height: 44px;
}

.user-badge-btn:hover {
    background: var(--surface-secondary);
    border-color: var(--muted-light);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #6366f1);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    flex-shrink: 0;
}

.user-meta {
    display: flex;
    flex-direction: column;
    text-align: left;
    line-height: 1.15;
}

.user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

.user-role {
    font-size: 10.5px;
    color: var(--muted);
    text-transform: capitalize;
}

.dropdown-caret {
    width: 14px;
    height: 14px;
    color: var(--muted);
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 240px;
    padding: 8px 0;
    z-index: 150;
    display: none;
    animation: dropdownFadeIn 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes dropdownFadeIn {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dropdown-menu.show {
    display: block;
}

.dropdown-header {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: 4px;
}

.dropdown-header .dropdown-user-name {
    font-weight: 700;
    font-size: 13.5px;
    color: var(--text);
}

.dropdown-header .dropdown-user-email {
    font-size: 11.5px;
    color: var(--muted);
    word-break: break-all;
    margin-top: 2px;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 16px;
    color: var(--text-secondary);
    font-size: 13px;
    text-decoration: none;
    transition: background 0.12s ease;
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
    cursor: pointer;
}

.dropdown-item:hover {
    background: var(--surface-secondary);
    color: var(--text);
}

.dropdown-divider {
    height: 1px;
    background: var(--border-subtle);
    margin: 6px 0;
}

.dropdown-item.text-danger {
    color: var(--danger);
}

.dropdown-item.text-danger:hover {
    background: var(--danger-light);
}

/* Backdrop for mobile drawer */
.drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(2px);
    z-index: 90;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.drawer-backdrop.active {
    opacity: 1;
    visibility: visible;
}

/* Main Content Area */
.main-content {
    flex: 1;
    padding: 28px;
    max-width: 1520px;
    width: 100%;
    margin: 0 auto;
}

/* Page Headers */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.page-header-title {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.025em;
    margin: 0 0 4px;
}

.page-header-subtitle {
    font-size: 13.5px;
    color: var(--muted);
    margin: 0;
}

.page-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* Buttons System */
.btn, button, .button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
    white-space: nowrap;
    min-height: 40px;
}

.btn-primary, button:not(.btn-secondary):not(.secondary):not(.btn-danger):not(.btn-ghost):not(.user-badge-btn):not(.hamburger-btn):not(.drawer-close-btn):not(.password-toggle-btn):not(.dropdown-item):not(.fp-button):not(.fp-tab):not(.fp-icon-button):not(.row-action-menu-item):not(.playlist-copy) {
    background-color: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
    box-shadow: 0 1px 2px rgba(37, 99, 235, 0.2);
}

.btn-primary:hover, button:not(.btn-secondary):not(.secondary):not(.btn-danger):not(.btn-ghost):not(.user-badge-btn):not(.hamburger-btn):not(.drawer-close-btn):not(.password-toggle-btn):not(.dropdown-item):not(.fp-button):not(.fp-tab):not(.fp-icon-button):not(.row-action-menu-item):not(.playlist-copy):hover {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
    color: #ffffff;
}

.btn-secondary, .button.secondary, .secondary {
    background-color: var(--surface);
    color: var(--text-secondary);
    border-color: var(--border);
    box-shadow: var(--shadow-xs);
}

.btn-secondary:hover, .button.secondary:hover, .secondary:hover {
    background-color: var(--surface-secondary);
    border-color: var(--muted-light);
    color: var(--text);
}

.btn-danger {
    background-color: var(--danger);
    color: #ffffff;
    border-color: var(--danger);
}

.btn-danger:hover {
    background-color: var(--danger-hover);
    color: #ffffff;
}

.btn-success {
    background-color: var(--success);
    color: #ffffff;
    border-color: var(--success);
}

.btn-success:hover {
    background-color: var(--success-hover);
    color: #ffffff;
}

.btn-sm {
    padding: 6px 10px;
    font-size: 12px;
    min-height: 32px;
}

.btn-icon {
    padding: 8px;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
}

/* Cards & Surfaces */
.card {
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 22px;
    margin-bottom: 20px;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0 0 8px;
    color: var(--text);
}

.card-subtitle {
    font-size: 13px;
    color: var(--muted);
    margin: 0 0 16px;
}

/* Stat Cards (Dashboard) */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 18px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 22px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.stat-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.stat-card-title {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

.stat-card-icon-wrap {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-card-icon-wrap.primary {
    background: var(--primary-light);
    color: var(--primary);
}

.stat-card-icon-wrap.success {
    background: var(--success-light);
    color: var(--success);
}

.stat-card-icon-wrap.warning {
    background: var(--warning-light);
    color: var(--warning);
}

.stat-card-icon-wrap.danger {
    background: var(--danger-light);
    color: var(--danger);
}

.stat-card-icon-wrap.info {
    background: var(--info-light);
    color: var(--info);
}

.stat-card-value {
    font-size: 2.1rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text);
    line-height: 1.1;
    margin: 4px 0 8px;
}

.stat-card-context {
    font-size: 12.5px;
    color: var(--muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Badges */
.badge, .notice, .error {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.03em;
    line-height: 1.3;
    white-space: nowrap;
}

.badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: currentColor;
}

.badge-online, .badge.online, .badge.active, .notice {
    background-color: var(--success-light);
    color: var(--success-text);
    border: 1px solid var(--success-border);
}

.badge-offline, .badge.offline, .badge.missing, .error {
    background-color: var(--danger-light);
    color: var(--danger-text);
    border: 1px solid var(--danger-border);
}

.badge-unknown, .badge.unknown, .badge.suspended {
    background-color: var(--warning-light);
    color: var(--warning-text);
    border: 1px solid var(--warning-border);
}

.badge-expired, .badge.expired, .badge.disabled {
    background-color: var(--surface-secondary);
    color: var(--muted);
    border: 1px solid var(--border);
}

.badge-primary, .badge.primary {
    background-color: var(--primary-light);
    color: var(--primary);
    border: 1px solid var(--primary-border);
}

/* Alert Banners */
.alert, .alert-box {
    padding: 14px 18px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 13.5px;
    border: 1px solid transparent;
}

.alert-success, p.notice {
    background-color: var(--success-light);
    border-color: var(--success-border);
    color: var(--success-text);
    display: block;
    padding: 12px 16px;
    border-radius: var(--radius);
    margin: 0 0 16px;
}

.alert-danger, p.error {
    background-color: var(--danger-light);
    border-color: var(--danger-border);
    color: var(--danger-text);
    display: block;
    padding: 12px 16px;
    border-radius: var(--radius);
    margin: 0 0 16px;
}

.alert-dismiss {
    background: transparent;
    border: none;
    cursor: pointer;
    color: currentColor;
    opacity: 0.7;
    padding: 4px;
    line-height: 1;
    min-height: auto;
}

.alert-dismiss:hover {
    opacity: 1;
    background: transparent;
}

/* Modern Tables */
.table-container {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    margin-bottom: 24px;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th {
    background: var(--surface-secondary);
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 12px 18px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

td {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text);
    font-size: 13.5px;
    vertical-align: middle;
}

tbody tr:last-child td {
    border-bottom: none;
}

tbody tr:hover {
    background-color: #fcfdfe;
}

.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--muted);
}

.empty-state-icon {
    width: 48px;
    height: 48px;
    color: var(--muted-light);
    margin-bottom: 12px;
}

/* Toolbars & Filter Bars */
.toolbar {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
    margin-bottom: 20px;
    display: flex;
    align-items: flex-end;
    gap: 14px;
    flex-wrap: wrap;
    box-shadow: var(--shadow-xs);
}

.toolbar label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}

.toolbar input[type="text"],
.toolbar input[type="search"],
.toolbar input[type="date"],
.toolbar select {
    min-height: 38px;
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background-color: var(--surface);
    font-family: inherit;
    font-size: 13px;
    color: var(--text);
}

.toolbar .checkbox-filter {
    flex-direction: row;
    align-items: center;
    padding-bottom: 8px;
    cursor: pointer;
}

/* Forms & Inputs */
.form-page {
    max-width: 960px;
    margin: 0 auto;
}

.form-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.form-grid.grid-1 {
    grid-template-columns: 1fr;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group.col-span-2 {
    grid-column: span 2;
}

.form-label, label {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text);
    display: block;
    margin-bottom: 4px;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="date"],
input[type="datetime-local"],
select,
textarea {
    width: 100%;
    min-height: 42px;
    padding: 9px 13px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background-color: var(--surface);
    color: var(--text);
    font-family: inherit;
    font-size: 14px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.password-input-group {
    position: relative;
    display: flex;
    align-items: center;
}

.password-input-group input {
    padding-right: 44px;
}

.password-toggle-btn {
    position: absolute;
    right: 4px;
    background: transparent;
    border: none;
    color: var(--muted);
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    min-width: 36px;
}

.password-toggle-btn:hover {
    color: var(--text);
    background: transparent;
}

.form-hint {
    font-size: 12px;
    color: var(--muted);
    margin-top: 4px;
}

.form-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-top: 20px;
    border-top: 1px solid var(--border-subtle);
    margin-top: 24px;
}

/* Picklist / Checkbox Chips */
.picklist {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 10px;
    max-height: 280px;
    overflow-y: auto;
    padding: 12px;
    background: var(--surface-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin: 10px 0 20px;
}

.picklist label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
    font-size: 13px;
    color: var(--text);
    cursor: pointer;
    background: var(--surface);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
    margin: 0;
}

.picklist label:hover {
    border-color: var(--primary-border);
}

/* Mobile Card Lists (Hidden on Desktop, Visible on <= 768px) */
.mobile-card-list {
    display: none;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 24px;
}

.mobile-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.mobile-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.mobile-card-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    margin: 0;
}

.mobile-card-meta {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 12.5px;
    color: var(--muted);
    background: var(--surface-secondary);
    padding: 10px 12px;
    border-radius: var(--radius-sm);
}

.mobile-card-meta-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mobile-card-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    padding-top: 8px;
    border-top: 1px solid var(--border-subtle);
}

.mobile-card-actions > * {
    flex: 1;
}

.channel-monitor-modal { position:fixed; inset:0; z-index:300; display:none; align-items:center; justify-content:center; padding:20px; }
.channel-monitor-modal[aria-hidden="false"] { display:flex; }
.channel-monitor-backdrop { position:absolute; inset:0; background:rgba(2,6,23,.78); backdrop-filter:blur(4px); }
.channel-monitor-card { position:relative; z-index:1; width:min(900px,100%); max-height:calc(100vh - 40px); overflow:auto; background:var(--surface); color:var(--text); border:1px solid var(--border); border-radius:16px; padding:22px; box-shadow:var(--shadow-lg); }
.channel-monitor-card header { padding-right:42px; margin-bottom:12px; }.channel-monitor-card h2 { margin:0 0 5px; }.channel-monitor-close { position:absolute; top:12px; right:12px; width:38px; min-height:38px; padding:0; font-size:26px; background:var(--surface-secondary); color:var(--text); border:1px solid var(--border); }
.monitor-player { position:relative; display:grid; place-items:center; width:100%; aspect-ratio:16/9; max-height:60vh; margin:14px 0 10px; overflow:hidden; background:#020617; border:1px solid #17233d; border-radius:10px; }
.monitor-player.is-loading::before { content:""; position:absolute; left:50%; top:calc(50% - 31px); width:34px; height:34px; margin-left:-17px; border:3px solid rgba(255,255,255,.22); border-top-color:#60a5fa; border-radius:50%; animation:monitor-spin .8s linear infinite; }
.monitor-player.is-loading::after { content:"Preparando reproducción…"; position:absolute; top:calc(50% + 22px); left:50%; transform:translateX(-50%); color:#cbd5e1; font-size:13px; white-space:nowrap; }
.monitor-player.is-loading #monitor-video { opacity:0; }
.monitor-player.is-error::after { content:"No se pudo iniciar la reproducción"; color:#fca5a5; font-size:14px; }
#monitor-video, .monitor-embed { display:block; width:100%; height:100%; margin:0; background:#020617; border:0; border-radius:inherit; transition:opacity .16s ease; }.monitor-metrics { display:grid; grid-template-columns:repeat(3,1fr); gap:10px; margin:16px 0; }.monitor-metrics span { padding:10px; border:1px solid var(--border); border-radius:8px; font-size:12px; color:var(--muted); }.monitor-metrics strong { display:block; color:var(--text); margin-top:3px; word-break:break-word; }.channel-play[disabled] { opacity:.5; cursor:not-allowed; }
@keyframes monitor-spin { to { transform:rotate(360deg); } }
.channel-monitor-card header { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; }
.monitor-live { color:#4ade80; font-size:12px; font-weight:800; letter-spacing:.04em; white-space:nowrap; padding:6px 9px; border-radius:999px; background:rgba(34,197,94,.12); }
.monitor-metrics { display:flex; flex-wrap:wrap; gap:8px; margin:12px 0; }.monitor-metrics span { padding:7px 9px; min-height:0; }.monitor-metrics strong { display:inline; margin:0; }

/* Auth / Login Redesign */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 10% 20%, #1e293b 0%, #090e1a 90%);
    padding: 24px;
}

.auth-card {
    width: 100%;
    max-width: 430px;
    background: var(--surface);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    padding: 38px 32px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.auth-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-bottom: 28px;
}

.auth-brand-logo {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--primary), #4f46e5);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.4);
    margin-bottom: 14px;
}

.auth-brand h1 {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text);
    margin: 0 0 4px;
}

.auth-brand p {
    color: var(--muted);
    font-size: 13px;
    margin: 0;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.auth-form .form-group {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.auth-form input {
    height: 48px;
    border-radius: var(--radius);
    padding: 0 16px;
    font-size: 14.5px;
}

.auth-form button {
    height: 48px;
    border-radius: var(--radius);
    font-size: 15px;
    font-weight: 700;
    margin-top: 6px;
}

/* Grid Utilities */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.muted {
    color: var(--muted);
    font-size: 12.5px;
}

/* =========================================================
   RESPONSIVE BREAKPOINTS (Desktop, Notebook, Tablet, Mobile)
   ========================================================= */

/* Notebook (1366px) */
@media (max-width: 1366px) {
    .main-content {
        padding: 24px;
    }
}

/* Tablet & Mobile (<= 768px) */
@media (max-width: 768px) {
    :root {
        --sidebar-width: 280px;
    }

    .app-wrapper {
        margin-left: 0;
    }

    .sidebar {
        transform: translateX(-100%);
        box-shadow: var(--shadow-lg);
    }

    .sidebar.sidebar-open {
        transform: translateX(0);
    }

    .drawer-close-btn {
        display: block;
    }

    .hamburger-btn {
        display: inline-flex;
    }

    .topbar {
        padding: 0 16px;
    }

    .main-content {
        padding: 16px;
    }

    .user-meta {
        display: none;
    }

    .user-badge-btn {
        padding: 4px;
        border-radius: 50%;
    }

    .dropdown-caret {
        display: none;
    }

    .page-header {
        flex-direction: column;
        align-items: stretch;
    }

    .page-header-actions {
        width: 100%;
    }

    .page-header-actions > * {
        flex: 1;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .form-group.col-span-2 {
        grid-column: span 1;
    }

    .form-actions {
        flex-direction: column-reverse;
    }

    .form-actions > * {
        width: 100%;
    }

    /* Switch desktop table to mobile card list */
    .table-desktop {
        display: none !important;
    }

    .mobile-card-list {
        display: flex !important;
    }

    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .toolbar label {
        width: 100%;
    }

    .toolbar button, .toolbar a {
        width: 100%;
        text-align: center;
    }

    .channel-monitor-modal { padding:12px; align-items:flex-end; }
    .channel-monitor-card { max-height:90vh; border-radius:16px; padding:16px; }
    .monitor-metrics { grid-template-columns:repeat(2,1fr); gap:8px; }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .stat-card {
        padding: 16px;
    }

    .stat-card-value {
        font-size: 1.6rem;
    }
}

/* Mobile Small (<= 430px, 390px, 360px) */
@media (max-width: 430px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .topbar {
        padding: 0 12px;
    }

    .main-content {
        padding: 12px;
    }

    .auth-card {
        padding: 28px 20px;
    }

    .btn, button, .button {
        min-height: 44px; /* Ensure 44px touch targets */
    }
}

/* Real UI/UX 2.0 component layer. Views compose these instead of legacy tables/forms. */
.fp-page-header { display:flex; align-items:flex-end; justify-content:space-between; gap:20px; margin:0 0 22px; }
.fp-page-header h1 { margin:0; font-size:clamp(1.45rem,2.1vw,1.9rem); letter-spacing:-.035em; }
.fp-page-header p:not(.fp-eyebrow) { margin:5px 0 0; color:var(--muted); }
.fp-eyebrow { margin:0 0 5px; color:var(--primary); font-size:10px; font-weight:800; letter-spacing:.12em; }
.fp-button { display:inline-flex; align-items:center; justify-content:center; min-height:38px; gap:7px; padding:9px 13px; border:1px solid transparent; border-radius:8px; font:600 13px var(--font-sans); text-decoration:none; cursor:pointer; white-space:nowrap; }
.fp-button-primary { color:#fff; background:var(--primary); border-color:var(--primary); box-shadow:0 1px 2px rgb(37 99 235 / .18); }.fp-button-primary:hover{color:#fff;background:var(--primary-hover)}
.fp-button-secondary { color:var(--ink-soft); background:#fff; border-color:#d9e2ec; }.fp-button-secondary:hover{color:var(--text);background:#f8fafc}
.fp-button-sm{min-height:32px;padding:6px 10px;font-size:12px}.fp-icon-button{display:inline-grid;place-items:center;width:34px;height:34px;min-height:34px;padding:0;border:1px solid #d9e2ec;border-radius:8px;background:#fff;color:var(--ink-soft);font:700 19px/1 var(--font-sans);cursor:pointer;text-decoration:none}.fp-icon-button:hover{background:#f8fafc;color:var(--text)}
.fp-alert{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:11px 14px;margin:0 0 16px;border:1px solid;border-radius:10px;font-size:13px}.fp-alert-success{background:var(--success-light);border-color:var(--success-border);color:var(--success-text)}.fp-alert button{min-height:auto;padding:3px;border:0;background:transparent;color:currentColor;font-size:18px}
.fp-filterbar{display:flex;align-items:center;gap:14px;flex-wrap:wrap;padding:12px;margin-bottom:14px;border:1px solid #e1e8f0;border-radius:12px;background:#fff;box-shadow:0 1px 2px rgb(15 23 42 / .025)}
.fp-search{flex:1 1 260px}.fp-search input{width:100%;height:38px;min-height:38px;background:#f8fafc}.fp-tabs{display:flex;gap:4px;flex-wrap:wrap}.fp-tabs button{min-height:32px;padding:6px 10px;border:0;border-radius:7px;background:transparent;color:var(--muted);font:650 12px var(--font-sans);cursor:pointer}.fp-tabs button:hover{background:#f1f5f9;color:var(--text)}.fp-tabs button.is-active{background:var(--primary-light);color:var(--primary)}
.fp-table-shell{position:relative;margin-bottom:20px;border:1px solid #e1e8f0;border-radius:12px;background:#fff;box-shadow:0 1px 2px rgb(15 23 42 / .035)}.fp-table-scroll{width:100%;overflow-x:auto;overflow-y:visible}.fp-table{width:100%;border-collapse:separate;border-spacing:0}.fp-table th{padding:11px 14px;background:#f8fafc;border-bottom:1px solid #e5ebf2;color:#526176;font-size:10px;font-weight:800;letter-spacing:.06em;text-align:left;text-transform:uppercase;white-space:nowrap}.fp-table td{padding:12px 14px;border-bottom:1px solid #edf1f5;color:var(--ink-soft);vertical-align:middle}.fp-table tbody tr:last-child td{border-bottom:0}.fp-table tbody tr:hover td{background:#fcfdff}.fp-actions-heading,.fp-actions-cell{text-align:right}
.subscriber-table-shell,.subscriber-table-scroll{overflow:visible}.subscriber-table{table-layout:fixed}.subscriber-table th:nth-child(1){width:19%}.subscriber-table th:nth-child(2){width:16%}.subscriber-table th:nth-child(3){width:11%}.subscriber-table th:nth-child(4){width:15%}.subscriber-table th:nth-child(5){width:14%}.subscriber-table th:nth-child(6){width:15%}.subscriber-table th:nth-child(7){width:10%}
.fp-identity{display:flex;align-items:center;gap:10px;min-width:0}.fp-identity strong,.fp-identity small,.fp-owner,.fp-owner+small,.fp-expiry strong,.fp-expiry small,.fp-channel-cell small,.fp-table td small{display:block}.fp-identity strong,.fp-expiry strong,.fp-owner{font-size:13px;color:var(--text);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.fp-identity small,.fp-owner+small,.fp-expiry small,.fp-channel-cell small,.fp-table td small{margin-top:2px;color:var(--muted);font-size:11px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.fp-expiry small.is-danger{color:var(--danger-text)}.fp-avatar{display:grid;place-items:center;width:30px;height:30px;flex:0 0 30px;border-radius:9px;background:#eaf1ff;color:var(--primary);font-size:12px;font-weight:800}.fp-badge{display:inline-flex;align-items:center;gap:5px;padding:4px 8px;border:1px solid;border-radius:999px;font-size:10px;font-weight:800;letter-spacing:.04em;white-space:nowrap}.fp-badge i{width:5px;height:5px;border-radius:50%;background:currentColor}.fp-badge-primary{color:var(--primary);background:var(--primary-light);border-color:var(--primary-border)}.fp-badge-online{color:var(--success-text);background:var(--success-light);border-color:var(--success-border)}.fp-badge-warning{color:var(--warning-text);background:var(--warning-light);border-color:var(--warning-border)}.fp-badge-danger{color:var(--danger-text);background:var(--danger-light);border-color:var(--danger-border)}.fp-badge-muted{color:var(--muted);background:#f1f5f9;border-color:#e2e8f0}.fp-connection{font-size:12px;white-space:nowrap}.fp-connection b{color:#94a3b8}.fp-row-actions{display:flex;align-items:center;justify-content:flex-end;gap:6px}.fp-row-actions form{margin:0}
.fp-dropdown{position:relative;z-index:5}.fp-dropdown[open]{z-index:60}.fp-dropdown summary{list-style:none}.fp-dropdown summary::-webkit-details-marker{display:none}.fp-dropdown-menu{position:absolute;z-index:100;top:calc(100% + 6px);left:0;display:grid;min-width:160px;padding:5px;border:1px solid #dbe4ee;border-radius:10px;background:#fff;box-shadow:0 12px 28px rgb(15 23 42 / .14)}.fp-dropdown-menu-right{right:0;left:auto}.fp-dropdown-menu a,.fp-dropdown-menu button{display:block;width:100%;min-height:33px;padding:7px 9px;border:0;border-radius:6px;background:transparent;color:var(--ink-soft);font:600 12px var(--font-sans);text-align:left;text-decoration:none;cursor:pointer;box-shadow:none}.fp-dropdown-menu a:hover,.fp-dropdown-menu button:hover{background:#f1f5f9;color:var(--text)}.fp-dropdown-menu .is-danger{color:var(--danger-text)}.fp-dropdown-divider{height:1px;margin:4px 2px;background:#e8edf3}
.fp-mobile-list{display:none}.fp-mobile-subscriber{padding:14px;border:1px solid #e1e8f0;border-radius:12px;background:#fff;box-shadow:0 1px 2px rgb(15 23 42 / .035)}.fp-mobile-subscriber header,.fp-mobile-subscriber footer{display:flex;align-items:center;justify-content:space-between;gap:10px}.fp-mobile-subscriber dl{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin:14px 0}.fp-mobile-subscriber dt{margin-bottom:3px;color:var(--muted);font-size:10px;font-weight:800;text-transform:uppercase}.fp-mobile-subscriber dd{margin:0;color:var(--ink-soft);font-size:12px}.fp-mobile-subscriber dd small{display:block;color:var(--muted);font-size:11px}
.fp-empty-state{display:grid;justify-items:center;gap:8px;padding:46px 22px;border:1px dashed #cbd5e1;border-radius:12px;background:#fff;text-align:center}.fp-empty-state h2{font-size:16px}.fp-empty-state p{margin:0 0 8px;color:var(--muted)}
.fp-channel-cell{display:flex;align-items:center;gap:10px;min-width:210px}.fp-channel-cell>div:last-child{min-width:0}.channel-table td:nth-child(2){min-width:150px}.channel-table td:nth-child(3){min-width:92px}.channel-table td:nth-child(4){min-width:125px}.channel-table td:nth-child(5){min-width:150px}.channel-table td:nth-child(6){min-width:92px}
@media(max-width:1024px){.subscriber-table th:nth-child(6),.subscriber-table td:nth-child(6){display:none}.channel-table th:nth-child(5),.channel-table td:nth-child(5){display:none}}
@media(max-width:768px){.fp-page-header{align-items:flex-start;flex-direction:column}.fp-page-header>.fp-button{width:100%}.fp-filterbar{align-items:stretch;flex-direction:column}.fp-tabs{overflow-x:auto;flex-wrap:nowrap;padding-bottom:2px}.fp-tabs button{white-space:nowrap}.fp-mobile-list{display:grid!important;gap:10px}.subscriber-table-shell{display:none!important}.fp-mobile-subscriber .fp-row-actions{justify-content:flex-start}.fp-dropdown-menu{position:absolute}.channel-filterbar label{width:100%}}
@media(max-width:430px){.fp-mobile-subscriber dl{grid-template-columns:1fr}.fp-mobile-subscriber footer .fp-row-actions{width:100%}.fp-mobile-subscriber .fp-button{flex:1}.fp-page-header{margin-bottom:16px}}

/* Compact subscriber playlist action menu. */
.subscriber-action-menu { position:relative; display:inline-block; text-align:left; }
.subscriber-action-menu summary { list-style:none; cursor:pointer; }
.subscriber-action-menu summary::-webkit-details-marker { display:none; }
.subscriber-action-menu-panel { display:none; position:absolute; z-index:20; right:0; top:calc(100% + 6px); min-width:150px; padding:6px; border:1px solid var(--border); border-radius:10px; background:var(--surface); box-shadow:0 12px 28px rgba(0,0,0,.22); }
.subscriber-action-menu[open] .subscriber-action-menu-panel { display:grid; gap:2px; }
.subscriber-action-menu-panel a, .subscriber-action-menu-panel button { display:block; width:100%; padding:8px 10px; border:0; border-radius:7px; background:transparent; color:var(--text); font:inherit; font-size:12px; text-align:left; text-decoration:none; cursor:pointer; }
.subscriber-action-menu-panel a:hover, .subscriber-action-menu-panel button:hover { background:var(--surface-secondary); }
.subscriber-action-menu-mobile { width:100%; }
.subscriber-action-menu-mobile summary { width:100%; text-align:center; }
.subscriber-action-menu-mobile .subscriber-action-menu-panel { left:0; right:0; }

/* Dense operational tables: keep action controls contained on notebook widths. */
.channel-actions-cell, .subscriber-actions-cell { text-align:right; min-width:220px; }
.channel-row-actions, .subscriber-row-actions { display:flex; justify-content:flex-end; align-items:center; flex-wrap:wrap; gap:6px; }
.channel-table th, .channel-table td { padding-left:12px; padding-right:12px; }
.sortable-row { cursor:grab; }
.sortable-row:active { cursor:grabbing; }
.sortable-row.is-dragging { opacity:.45; }
.sortable-row.is-drag-over { box-shadow:inset 0 2px 0 var(--primary); }
.channel-category-row td { padding:10px 14px; background:var(--surface-secondary); color:var(--text); font-size:12px; font-weight:800; letter-spacing:.02em; }
.channel-category-row small { margin-left:8px; color:var(--muted); font-weight:600; }
.channel-table th:nth-child(4), .channel-table td:nth-child(4) { min-width:132px; }
.channel-table th:nth-child(6), .channel-table td:nth-child(6) { min-width:150px; }
.channel-table th:nth-child(11), .channel-table td:nth-child(11) { min-width:220px; }
.subscriber-table th, .subscriber-table td { padding-left:12px; padding-right:12px; }
.subscriber-table th:last-child, .subscriber-table td:last-child { min-width:300px; }
@media (max-width: 1600px) {
    .channel-table th:nth-child(4), .channel-table td:nth-child(4) { display:none; }
    .channel-table th:nth-child(6), .channel-table td:nth-child(6) { display:none; }
    .channel-actions-cell, .subscriber-actions-cell { min-width:0; }
    .channel-row-actions, .subscriber-row-actions { max-width:250px; margin-left:auto; }
    .subscriber-table th:nth-child(2), .subscriber-table td:nth-child(2) { display:none; }
}

/* =========================================================
   UI/UX 2.0 refinement — operational density and consistency
   ========================================================= */
:root {
    --canvas: #f5f7fb;
    --surface-raised: #ffffff;
    --ink-soft: #334155;
    --focus-ring: 0 0 0 3px rgb(37 99 235 / .14);
}
body { background: var(--canvas); }
.topbar { height: var(--topbar-height); padding-inline: 24px; box-shadow: 0 1px 0 rgb(15 23 42 / .02); }
.main-content { padding: 30px; }
.sidebar { background: #0b1220; }
.sidebar-nav { padding: 12px 10px 20px; }
.nav-group-title { margin: 18px 10px 7px; font-size: 9px; letter-spacing: .12em; }
.nav-item { min-height: 38px; border-radius: 9px; margin: 2px 0; font-size: 13px; }
.nav-item.active { background: #1d4ed8; box-shadow: 0 3px 10px rgb(37 99 235 / .18); }
.nav-item:not(.active):hover { background: rgb(148 163 184 / .09); }
.sidebar-footer { min-height: 62px; padding: 12px 14px; }
.sidebar-footer-actions { display:flex; gap:8px; align-items:center; }
.environment-badge { color:#7dd3fc; font-size:9px; font-weight:800; letter-spacing:.1em; }
.sidebar-collapse-btn { width:30px; height:30px; min-height:30px; padding:0; border:1px solid #273449; border-radius:8px; background:transparent; color:#94a3b8; }
.sidebar-collapse-btn svg { width:15px; height:15px; }

body.sidebar-collapsed .sidebar { width:var(--sidebar-collapsed-width); overflow:visible; }
body.sidebar-collapsed .app-wrapper { margin-left:var(--sidebar-collapsed-width); }
body.sidebar-collapsed .brand-text,
body.sidebar-collapsed .nav-group-title,
body.sidebar-collapsed .nav-item span,
body.sidebar-collapsed .system-status span:last-child,
body.sidebar-collapsed .environment-badge { display:none; }
body.sidebar-collapsed .sidebar-header { padding-inline:17px; }
body.sidebar-collapsed .brand { gap:0; }
body.sidebar-collapsed .nav-item { justify-content:center; padding-inline:0; }
body.sidebar-collapsed .nav-icon { margin:0; }
body.sidebar-collapsed .sidebar-footer { justify-content:center; }
body.sidebar-collapsed .sidebar-footer-actions { display:flex; }
body.sidebar-collapsed .sidebar-collapse-btn svg { transform:rotate(180deg); }
body.sidebar-collapsed .system-status { justify-content:center; }

.page-header { margin-bottom:22px; }
.page-header-title { font-size:clamp(1.35rem, 2vw, 1.75rem); }
.page-header-subtitle { max-width:760px; line-height:1.5; }
.card, .table-container { border-color:#e4eaf2; box-shadow:0 1px 2px rgb(15 23 42 / .035); }
.card { padding:20px; margin-bottom:18px; }
.card-title { font-size:1rem; margin-bottom:4px; }
.card-subtitle { margin-bottom:14px; }
.grid { grid-template-columns:repeat(auto-fill,minmax(260px,1fr)); gap:14px; }
.grid > .card { margin-bottom:0; }
.product-grid, .bouquet-grid { grid-template-columns:repeat(auto-fill,minmax(280px,1fr)); }
.product-card, .bouquet-card { display:flex; flex-direction:column; gap:12px; min-height:212px; }
.product-card-head { display:flex; justify-content:space-between; align-items:flex-start; gap:12px; }
.product-card .card-subtitle, .bouquet-card .card-subtitle { margin:0; min-height:38px; }
.product-facts { display:flex; flex-wrap:wrap; gap:7px; color:var(--ink-soft); font-size:12px; }
.product-facts > * { padding:5px 8px; border-radius:7px; background:var(--surface-secondary); }
.product-facts strong { color:var(--primary); background:var(--primary-light); }
.product-bouquets { margin:0; color:var(--ink-soft); font-size:12.5px; min-height:20px; }
.product-card .form-actions { margin-top:auto; }
.stats-grid { grid-template-columns:repeat(4,minmax(0,1fr)); gap:14px; margin-bottom:18px; }
.stat-card { min-height:144px; padding:17px 18px; border-radius:12px; }
.stat-card:hover { transform:translateY(-1px); }
.stat-card-value { font-size:2rem; }
.stat-card-icon-wrap { width:36px; height:36px; }

.btn, button, .button { border-radius:8px; font-weight:650; min-height:38px; }
.btn-primary { background:#2563eb; }
.btn-secondary { background:#fff; }
.btn-ghost { background:transparent; border-color:transparent; color:var(--ink-soft); }
.btn:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline:none; box-shadow:var(--focus-ring); border-color:var(--primary); }
.btn-sm { min-height:32px; border-radius:7px; }
.badge { font-size:10px; padding:4px 8px; letter-spacing:.045em; }

input:not([type="checkbox"]):not([type="radio"]), select, textarea { border-color:#d7e0eb; border-radius:8px; min-height:40px; background:#fff; }
textarea { min-height:104px; }
.form-label, label > span:first-child { color:#334155; font-size:12px; font-weight:700; }
.form-hint { font-size:11.5px; color:#64748b; }
.toolbar { padding:14px; border:1px solid #e4eaf2; border-radius:12px; background:var(--surface); box-shadow:0 1px 2px rgb(15 23 42 / .025); }
.table-container { border-radius:12px; }
table thead th { background:#f8fafc; color:#475569; font-size:10px; letter-spacing:.055em; }
table tbody tr:hover td { background:#fbfdff; }
table td { border-color:#edf1f5; }
.channel-category-row td { background:#f4f7fb !important; }
.channel-row-actions, .subscriber-row-actions { gap:5px; }
.row-action-menu { position:relative; }
.row-action-menu summary { list-style:none; }
.row-action-menu summary::-webkit-details-marker { display:none; }
.row-action-menu-panel { display:none; position:absolute; z-index:35; right:0; top:calc(100% + 5px); min-width:154px; padding:5px; border:1px solid var(--border); border-radius:10px; background:var(--surface); box-shadow:var(--shadow-md); }
.row-action-menu[open] .row-action-menu-panel { display:grid; gap:2px; }
.row-action-menu-panel form { margin:0 !important; }
details.row-action-menu .row-action-menu-panel button.row-action-menu-item { width:100%; min-height:34px; padding:7px 9px; border:0; border-radius:7px; background:transparent; color:var(--text); font:inherit; font-size:12px; text-align:left; box-shadow:none; }
details.row-action-menu .row-action-menu-panel button.row-action-menu-item:hover { background:var(--surface-secondary); color:var(--text); }
details.row-action-menu .row-action-menu-panel button.row-action-menu-item.is-danger { color:var(--danger-text); }
details.row-action-menu .row-action-menu-panel a.row-action-menu-item { display:block; width:100%; min-height:34px; padding:7px 9px; border-radius:7px; color:var(--text); font:inherit; font-size:12px; text-align:left; text-decoration:none; }
details.row-action-menu .row-action-menu-panel a.row-action-menu-item:hover { background:var(--surface-secondary); color:var(--text); }

.empty-state { padding:42px 24px; border:1px dashed #cbd5e1; background:linear-gradient(180deg,#fff,#fbfcfe); }
.inline-editor { padding:0; overflow:hidden; }
.inline-editor-summary { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:14px 18px; cursor:pointer; list-style:none; font-weight:750; }
.inline-editor-summary::-webkit-details-marker { display:none; }
.inline-editor[open] .inline-editor-summary { border-bottom:1px solid var(--border); }
.inline-editor-content { padding:18px 20px 20px; }
.inline-editor[open] { position:fixed; z-index:180; top:0; right:0; bottom:0; width:min(520px,100vw); margin:0; overflow:auto; border-radius:0; box-shadow:-18px 0 45px rgb(15 23 42 / .18); }
.inline-editor[open] .inline-editor-summary { position:sticky; top:0; z-index:2; background:#fff; }
.fp-bouquet-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(245px,1fr));gap:12px}.fp-bouquet-card{display:flex;flex-direction:column;justify-content:space-between;min-height:138px;padding:16px;border:1px solid #e1e8f0;border-radius:12px;background:#fff;box-shadow:0 1px 2px rgb(15 23 42 / .035)}.fp-bouquet-card header,.fp-bouquet-card footer{display:flex;align-items:flex-start;justify-content:space-between;gap:12px}.fp-bouquet-card h2{margin:0;font-size:15px}.fp-bouquet-card p{margin:6px 0 0;color:var(--muted);font-size:12px}.fp-bouquet-card footer{align-items:center;color:var(--muted);font-size:12px}
.fp-order-number{display:inline-grid;place-items:center;min-width:28px;height:28px;border-radius:7px;background:#f1f5f9;color:#475569;font:800 11px var(--font-mono)}
.fp-package-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(280px,1fr));gap:14px}.fp-package-card{display:flex;flex-direction:column;min-height:225px;padding:18px;border:1px solid #e1e8f0;border-radius:13px;background:#fff;box-shadow:0 1px 2px rgb(15 23 42 / .04)}.fp-package-card header,.fp-package-card footer{display:flex;align-items:flex-start;justify-content:space-between;gap:12px}.fp-package-card h2{margin:0;color:var(--text);font-size:16px;letter-spacing:-.015em}.fp-package-card header p{margin:5px 0 0;color:var(--muted);font-size:12px;line-height:1.4}.fp-package-statuses{display:flex;align-items:center;justify-content:flex-end;gap:5px}.fp-package-facts{display:grid;grid-template-columns:repeat(3,1fr);gap:7px;margin:16px 0 13px}.fp-package-facts span{display:grid;gap:2px;padding:8px;border-radius:8px;background:#f8fafc}.fp-package-facts b{color:var(--text);font-size:13px}.fp-package-facts small{color:var(--muted);font-size:10px}.fp-package-bouquets{display:grid;gap:4px;margin:0;color:var(--ink-soft);font-size:12px;line-height:1.45}.fp-package-bouquets strong{color:var(--muted);font-size:10px;letter-spacing:.06em;text-transform:uppercase}.fp-package-card footer{align-items:center;margin-top:auto;padding-top:16px}.fp-package-card footer .fp-button{flex:1}.fp-package-error{margin:10px 0 0;color:var(--danger-text)}
.alert { border-radius:10px; box-shadow:0 1px 2px rgb(15 23 42 / .03); }
.mobile-card { border-radius:12px; border-color:#e2e8f0; box-shadow:0 1px 2px rgb(15 23 42 / .035); }
.mobile-card-actions { gap:8px; }

.channel-monitor-card { border-radius:14px; box-shadow:0 20px 50px rgb(15 23 42 / .25); }
.monitor-player { border-radius:10px; overflow:hidden; background:#020617; }

@media (max-width: 1440px) {
    .main-content { padding:24px; }
    .stats-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
@media (max-width: 1024px) {
    :root { --sidebar-width:220px; }
    .main-content { padding:20px; }
    .topbar { padding-inline:20px; }
    .grid-2 { gap:14px; }
}
@media (max-width: 768px) {
    body.sidebar-collapsed .sidebar { width:var(--sidebar-width); }
    body.sidebar-collapsed .app-wrapper { margin-left:0; }
    body.sidebar-collapsed .brand-text,
    body.sidebar-collapsed .nav-group-title,
    body.sidebar-collapsed .nav-item span,
    body.sidebar-collapsed .system-status span:last-child,
    body.sidebar-collapsed .environment-badge { display:initial; }
    body.sidebar-collapsed .nav-item { justify-content:flex-start; padding-inline:12px; }
    body.sidebar-collapsed .nav-icon { margin-right:10px; }
    body.sidebar-collapsed .sidebar-footer { justify-content:space-between; }
    body.sidebar-collapsed .sidebar-footer-actions { display:flex; }
    .sidebar-collapse-btn { display:none; }
    .main-content { padding:16px; }
    .topbar { height:56px; padding-inline:14px; }
    .page-header-actions .btn { min-height:42px; }
    .stats-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
    .grid-2 { grid-template-columns:1fr; }
    .card { padding:16px; }
}
@media (max-width: 430px) {
    .stats-grid { grid-template-columns:1fr; }
    .page-header-title { font-size:1.35rem; }
    .card { padding:14px; }
}

/* UI 2.0 final polish: compact channel filters and consistent form surfaces. */
.channel-filterbar label{display:flex;flex-direction:column;align-items:stretch;gap:5px}.channel-filterbar label>span:first-child{font-size:11px}.channel-filterbar input,.channel-filterbar select{width:100%;min-width:0;height:38px;min-height:38px}.channel-filterbar{display:grid;grid-template-columns:minmax(220px,2fr) repeat(4,minmax(125px,1fr)) auto;align-items:end;gap:10px}.channel-filterbar>div{align-items:center;padding-bottom:0}.channel-groups>strong{display:block;color:var(--text);font-size:12px}.channel-bouquets{display:flex;flex-wrap:wrap;gap:4px;margin-top:5px}.channel-bouquet-chip{display:inline-flex;align-items:center;max-width:100px;padding:2px 6px;border:1px solid #e2e8f0;border-radius:999px;background:#f8fafc;color:#536176;font-size:9px;line-height:1.4;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.channel-bouquet-more{background:#eef2ff;border-color:#dbe4ff;color:#465fc3;font-weight:750}.channel-no-bouquet{color:#94a3b8;font-size:10px}.channel-viewers{display:inline-flex;min-width:24px;height:22px;align-items:center;justify-content:center;padding:0 6px;border:1px solid transparent;border-radius:999px;font-size:10px;font-weight:750}.channel-viewers.no-viewers{background:transparent;color:#94a3b8}.channel-viewers.has-viewers{background:#eaf7f0;border-color:#b8e4ca;color:#177245}
.fp-form-page{max-width:980px}.fp-form .fp-form-card,.fp-form-page>form>.form-card{padding:18px 20px;margin-bottom:14px;border:1px solid #e1e8f0;border-radius:12px;background:#fff;box-shadow:0 1px 2px rgb(15 23 42 / .035)}.fp-form-card>header{margin-bottom:14px}.fp-form-card>header h2{margin:0;color:var(--text);font-size:15px;letter-spacing:-.015em}.fp-form-card>header p:not(.fp-eyebrow){margin:4px 0 0;color:var(--muted);font-size:11.5px}.fp-form-card .fp-eyebrow{margin:0 0 4px}.fp-form-card .form-grid{gap:14px 16px}.fp-form-page .page-header,.fp-form-page .fp-page-header{max-width:100%;margin-bottom:18px}.fp-form-page .form-card .card-title{margin:0 0 4px}.fp-form-page .form-card .card-subtitle{margin:0 0 12px;font-size:11.5px}.fp-form-page .form-actions{align-items:center;padding:14px 0 0;margin-top:16px}.fp-form-page .form-actions>.btn-primary,.fp-form-page .form-actions>button[type=submit]{order:2;margin-left:auto}.fp-form-page .form-actions>.btn-secondary,.fp-form-page .form-actions>a{order:1}.fp-form-actions{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:14px 0 0;border-top:1px solid #e2e8f0}.fp-form-actions .fp-button-primary{margin-left:auto}.fp-probe-row{display:flex;align-items:flex-start;justify-content:flex-start;gap:10px}.fp-probe-row p{margin:0}.fp-picklist{max-height:220px;padding:8px;margin:4px 0 0}.fp-picklist label{min-height:36px;padding:7px 9px;background:#fff}.fp-advanced{margin-top:12px;padding-top:10px;border-top:1px solid #edf1f5}.fp-advanced summary{color:var(--muted);font-size:11px;font-weight:700;cursor:pointer}.fp-advanced .form-group{max-width:320px;margin-top:10px}
.subscriber-table tr[data-status="active"] td:nth-child(3) .fp-badge,.subscriber-table tr[data-status="suspended"] td:nth-child(3) .fp-badge,.subscriber-table tr[data-status="expired"] td:nth-child(3) .fp-badge,.subscriber-table tr[data-status="archived"] td:nth-child(3) .fp-badge,.subscriber-table tr[data-status="disabled"] td:nth-child(3) .fp-badge,.fp-mobile-subscriber[data-status] header>.fp-badge{font-size:0}.subscriber-table tr[data-status="active"] td:nth-child(3) .fp-badge::after,.fp-mobile-subscriber[data-status="active"] header>.fp-badge::after{content:"ACTIVO";font-size:10px}.subscriber-table tr[data-status="suspended"] td:nth-child(3) .fp-badge::after,.fp-mobile-subscriber[data-status="suspended"] header>.fp-badge::after{content:"SUSPENDIDO";font-size:10px}.subscriber-table tr[data-status="expired"] td:nth-child(3) .fp-badge::after,.fp-mobile-subscriber[data-status="expired"] header>.fp-badge::after{content:"VENCIDO";font-size:10px}.subscriber-table tr[data-status="archived"] td:nth-child(3) .fp-badge::after,.fp-mobile-subscriber[data-status="archived"] header>.fp-badge::after{content:"ARCHIVADO";font-size:10px}.subscriber-table tr[data-status="disabled"] td:nth-child(3) .fp-badge::after,.fp-mobile-subscriber[data-status="disabled"] header>.fp-badge::after{content:"DESHABILITADO";font-size:10px}
.form-page .form-card{padding:18px 20px;margin-bottom:14px;border-color:#e1e8f0;border-radius:12px;box-shadow:0 1px 2px rgb(15 23 42 / .035)}.form-page .form-grid{gap:14px 16px}.form-page .form-group{gap:5px}.form-page .form-label,.form-page label{margin-bottom:0;font-size:11.5px;font-weight:700}.form-page input:not([type=checkbox]):not([type=radio]),.form-page select{min-height:38px;padding:8px 11px;font-size:13px}.form-page textarea{min-height:84px;padding:9px 11px;font-size:13px}.form-page .form-hint,.form-page .form-helper{margin-top:2px;font-size:11px;line-height:1.4}.form-page .form-actions{justify-content:space-between;gap:12px;padding-top:14px;margin-top:16px;border-top:1px solid #e2e8f0}.form-page .form-actions>.btn-primary,.form-page .form-actions>button[type=submit]{order:2;margin-left:auto}.form-page .form-actions>.btn-secondary,.form-page .form-actions>a{order:1}.form-page .form-actions .btn{min-height:38px}
@media(max-width:768px){.form-page .form-grid{grid-template-columns:1fr}.form-page .form-group.col-span-2{grid-column:span 1}.form-page .form-actions{align-items:stretch;flex-direction:column-reverse}.form-page .form-actions>*{width:100%;min-height:44px;margin-left:0!important}.form-page .form-actions>.btn-primary,.form-page .form-actions>button[type=submit]{order:1}.form-page .form-actions>.btn-secondary,.form-page .form-actions>a{order:2}}
@media(max-width:1280px){.channel-filterbar{grid-template-columns:repeat(2,minmax(0,1fr))}.channel-filterbar .fp-search{grid-column:1/-1}.channel-filterbar>div{justify-content:flex-end}}
@media(max-width:768px){.channel-filterbar{grid-template-columns:1fr}.channel-filterbar .fp-search{grid-column:auto}.fp-form-page .form-grid{grid-template-columns:1fr}.fp-form-page .form-group.col-span-2{grid-column:span 1}.fp-form-actions{align-items:stretch;flex-direction:column-reverse}.fp-form-actions .fp-button{width:100%;min-height:44px}.fp-form-actions .fp-button-primary{margin-left:0}.fp-form-page .form-actions{flex-direction:column-reverse;align-items:stretch}.fp-form-page .form-actions>*{width:100%;min-height:44px;margin-left:0!important}.fp-form-page .form-actions>.btn-primary,.fp-form-page .form-actions>button[type=submit]{order:1}.fp-form-page .form-actions>.btn-secondary,.fp-form-page .form-actions>a{order:2}.fp-form .fp-form-card,.fp-form-page>form>.form-card{padding:15px}.fp-probe-row{align-items:flex-start;flex-direction:column}.fp-probe-row .fp-button{min-height:42px}.fp-package-grid{grid-template-columns:1fr}.fp-bouquet-grid{grid-template-columns:1fr}.fp-filterbar>*{min-width:0;max-width:100%;box-sizing:border-box}.fp-search{flex:0 0 auto;width:100%;min-width:0;box-sizing:border-box}.fp-search input{width:100%;min-width:0;box-sizing:border-box}.fp-tabs{width:100%;min-width:0;box-sizing:border-box}}
@media(max-width:768px){.fp-page-header>.fp-button{flex:0 0 auto;width:100%}}
@media(min-width:769px) and (max-width:1600px){.channel-table th:nth-child(4),.channel-table td:nth-child(4),.channel-table th:nth-child(5),.channel-table td:nth-child(5),.channel-table th:nth-child(6),.channel-table td:nth-child(6),.channel-table th:nth-child(7),.channel-table td:nth-child(7){display:table-cell!important}}
@media(min-width:769px) and (max-width:1024px){.channel-table th:nth-child(6),.channel-table td:nth-child(6){display:none!important}}
.channel-table-shell .fp-table-scroll{overflow:visible}.fp-tabs{scrollbar-width:none}.fp-tabs::-webkit-scrollbar{display:none}
.channel-mobile-select-all{display:none}
@media(max-width:1024px){.channel-table-shell{display:none!important}.channel-table-shell+.mobile-card-list{display:flex!important;gap:10px}.channel-mobile-select-all{display:flex;align-items:center;gap:7px;order:-1;color:var(--muted);font-size:11px}.channel-mobile-select-all input{width:16px;height:16px;accent-color:var(--primary)}}
.channel-bulk-toolbar{position:sticky;bottom:10px;z-index:12;display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;padding:11px 14px;margin:10px 0;background:#fff;border:1px solid #cddbf3;border-radius:12px;box-shadow:0 8px 24px rgb(15 23 42 / .12)}.channel-bulk-toolbar[hidden]{display:none}.channel-bulk-toolbar>div{display:flex;flex-wrap:wrap;gap:7px}.channel-bulk-toolbar label{display:flex;align-items:center;gap:7px;font-size:11px;color:var(--muted)}.channel-bulk-toolbar strong{font-size:12px}.channel-select-cell,.channel-select-all{text-align:center;width:36px}.channel-select-cell input,.channel-select-all input,.channel-mobile-select input{width:16px;height:16px;accent-color:var(--primary);cursor:pointer}.channel-mobile-select{display:flex;align-items:center;min-width:22px}.channel-bulk-dialog{width:min(520px,calc(100vw - 28px));max-width:none;padding:0;border:1px solid #dbe3ef;border-radius:16px;color:var(--text);box-shadow:0 24px 80px rgb(15 23 42 / .28)}.channel-bulk-dialog::backdrop{background:rgb(15 23 42 / .48);backdrop-filter:blur(2px)}.channel-bulk-dialog form{padding:20px}.channel-bulk-dialog header{display:flex;align-items:center;justify-content:space-between;gap:12px}.channel-bulk-dialog header h2{margin:0;font-size:17px}.channel-bulk-dialog p{padding:12px;margin:14px 0;background:#f5f8fc;border-radius:9px;font-size:13px;line-height:1.5}.channel-bulk-dialog .form-group{display:grid;gap:6px}.channel-bulk-dialog select{width:100%;min-height:40px}.channel-bulk-dialog fieldset{display:flex;gap:16px;flex-wrap:wrap;margin:12px 0;padding:10px;border:1px solid #e2e8f0;border-radius:9px}.channel-bulk-dialog fieldset label{display:flex;align-items:center;gap:6px;font-size:12px}.channel-bulk-dialog footer{display:flex;justify-content:flex-end;gap:8px;padding-top:16px;margin-top:16px;border-top:1px solid #e2e8f0}.channel-metric-freshness{margin:-8px 0 10px;color:var(--muted);font-size:10px}.channel-viewers.metric-unavailable{background:transparent;color:var(--muted);font-weight:500}
.channel-bulk-dialog [hidden]{display:none!important}
@media(max-width:768px){.channel-bulk-toolbar{bottom:6px;align-items:stretch;flex-direction:column;padding:10px}.channel-bulk-toolbar>div{display:grid;grid-template-columns:repeat(2,minmax(0,1fr))}.channel-bulk-toolbar .btn{min-height:40px}.channel-bulk-dialog form{padding:16px}.channel-bulk-dialog footer{flex-direction:column-reverse}.channel-bulk-dialog footer .btn{width:100%;min-height:44px}}
