/* AES67 Monitor – Professional Audio UI */

:root {
    /* Refined dark palette – less blue, more neutral with warm accents */
    --bg-0: #090b0f;
    --bg-1: #0d1017;
    --bg-2: #13171f;
    --bg-3: #191e28;
    --bg-4: #1f2533;
    --bg-hover: #252d3d;
    --bg-glass: rgba(19, 23, 31, 0.85);
    --border: #1e2536;
    --border-light: #2a3348;
    --border-glow: rgba(79, 143, 247, 0.08);

    --text-1: #eaecf0;
    --text-2: #9ca3b4;
    --text-3: #636d82;

    --accent: #5b9cf5;
    --accent-hover: #4a8be3;
    --accent-dim: rgba(91, 156, 245, 0.12);
    --accent-glow: rgba(91, 156, 245, 0.06);
    --green: #3dd68c;
    --green-dim: rgba(61, 214, 140, 0.1);
    --red: #f06868;
    --red-dim: rgba(240, 104, 104, 0.1);
    --yellow: #f0c040;
    --yellow-dim: rgba(240, 192, 64, 0.1);
    --orange: #f09848;

    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-xs: 5px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,.2), 0 1px 2px rgba(0,0,0,.15);
    --shadow: 0 4px 16px rgba(0,0,0,.25), 0 2px 6px rgba(0,0,0,.15);
    --shadow-lg: 0 16px 48px rgba(0,0,0,.4), 0 4px 12px rgba(0,0,0,.2);
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
[hidden] { display: none !important; }

body {
    font-family: var(--font);
    background: var(--bg-0);
    color: var(--text-1);
    min-height: 100vh;
    overflow: hidden;
    font-size: 13.5px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    line-height: 1.5;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* ===== LOGIN ===== */
.screen { width: 100vw; height: 100vh; }
#app-screen { display: none; }

#login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(ellipse 80% 60% at 50% 40%, rgba(91,156,245,.05) 0%, transparent 60%),
        radial-gradient(ellipse 60% 50% at 70% 70%, rgba(61,214,140,.03) 0%, transparent 50%),
        var(--bg-0);
}

.login-card {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 2.75rem 2.5rem;
    width: 380px;
    box-shadow: var(--shadow-lg), 0 0 80px rgba(91,156,245,.04);
    text-align: center;
    backdrop-filter: blur(20px);
}

.login-logo {
    width: 56px; height: 56px;
    margin: 0 auto 1.25rem;
    background: linear-gradient(135deg, var(--accent) 0%, #7c5bf5 100%);
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.3rem; color: #fff;
    box-shadow: 0 4px 20px rgba(91,156,245,.3);
}

.login-card h1 { font-size: 1.35rem; font-weight: 700; letter-spacing: -0.02em; }
.subtitle { color: var(--text-3); font-size: .82rem; margin-bottom: 2rem; letter-spacing: 0.02em; }

/* ===== FORM ELEMENTS ===== */
.form-group { margin-bottom: .875rem; text-align: left; }
.form-group label {
    display: block;
    font-size: .7rem;
    font-weight: 600;
    color: var(--text-3);
    margin-bottom: .35rem;
    text-transform: uppercase;
    letter-spacing: .7px;
}

input[type="text"], input[type="password"], input[type="number"], input[type="email"], select {
    width: 100%;
    padding: .65rem .85rem;
    background: var(--bg-1);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-1);
    font-size: .85rem;
    font-family: var(--font);
    transition: all var(--transition);
    outline: none;
}

input:focus, select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim), 0 0 20px rgba(91,156,245,.06);
}

input::placeholder { color: var(--text-3); opacity: .6; }

.error-msg {
    background: var(--red-dim);
    border: 1px solid rgba(240,104,104,.2);
    color: var(--red);
    padding: .55rem .85rem;
    border-radius: var(--radius-xs);
    font-size: .8rem;
    margin-bottom: .75rem;
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
    padding: .5rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-3);
    color: var(--text-2);
    font-size: .8rem; font-weight: 500; font-family: var(--font);
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    outline: none;
    position: relative;
    overflow: hidden;
}
.btn::after {
    content: '';
    position: absolute; inset: 0;
    background: linear-gradient(180deg, rgba(255,255,255,.04) 0%, transparent 100%);
    pointer-events: none;
}
.btn:hover { background: var(--bg-hover); border-color: var(--border-light); color: var(--text-1); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .3; cursor: default; pointer-events: none; transform: none; }
.btn-primary { background: var(--accent); border-color: transparent; color: #fff; box-shadow: 0 2px 8px rgba(91,156,245,.25); }
.btn-primary:hover { background: var(--accent-hover); box-shadow: 0 4px 16px rgba(91,156,245,.3); }
.btn-danger { color: var(--red); border-color: transparent; }
.btn-danger:hover { background: var(--red-dim); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-3); }
.btn-ghost:hover { color: var(--text-1); background: var(--bg-4); }
.btn-icon { padding: .45rem .55rem; border-radius: var(--radius-xs); }
.btn-sm { padding: .3rem .6rem; font-size: .72rem; }
.btn-xs { padding: .2rem .45rem; font-size: .7rem; }
.btn-block { width: 100%; justify-content: center; padding: .7rem; font-size: .85rem; }

.btn-play {
    background: linear-gradient(135deg, #2fb879, var(--green));
    border-color: transparent; color: #fff;
    padding: .55rem 1.1rem; font-size: .95rem;
    box-shadow: 0 2px 12px rgba(61,214,140,.3);
}
.btn-play:hover { box-shadow: 0 4px 20px rgba(61,214,140,.4); filter: brightness(1.08); }
.btn-stop { padding: .55rem 1.1rem; font-size: .95rem; }

/* ===== HEADER ===== */
.app-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 0 1rem;
    height: 50px;
    background: var(--bg-glass);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(16px) saturate(1.2);
    -webkit-backdrop-filter: blur(16px) saturate(1.2);
    position: relative;
    z-index: 10;
}

.header-left, .header-right { display: flex; align-items: center; gap: .6rem; }

.header-logo {
    width: 30px; height: 30px;
    background: linear-gradient(135deg, var(--accent), #7c5bf5);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: .75rem; color: #fff;
    box-shadow: 0 2px 8px rgba(91,156,245,.2);
}

.app-header h1 { font-size: .95rem; font-weight: 600; letter-spacing: -0.01em; }

#user-info {
    font-size: .78rem; color: var(--text-3);
    display: flex; align-items: center; gap: .35rem;
}

.status-badge {
    font-size: .65rem; padding: .18rem .55rem;
    border-radius: 20px; font-weight: 600; letter-spacing: .3px;
    display: inline-flex; align-items: center; gap: .3rem;
    transition: all var(--transition);
}
.status-badge i { font-size: .4rem; }
.badge-text { }
.status-badge.connected { background: var(--green-dim); color: var(--green); }
.status-badge.disconnected { background: var(--red-dim); color: var(--red); }
.status-badge.connecting { background: var(--yellow-dim); color: var(--yellow); }

/* ===== LAYOUT ===== */
.app-content { display: flex; height: calc(100vh - 50px); }

/* ===== SIDEBAR ===== */
.sidebar {
    width: 280px; min-width: 280px;
    background: var(--bg-1);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    display: flex; flex-direction: column;
}
.sidebar-inner { flex: 1; }

.sidebar-section { padding: .75rem; }
.sidebar-section + .sidebar-section { border-top: 1px solid var(--border); }

.section-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: .5rem;
}
.section-header h2 {
    font-size: .68rem; font-weight: 600; color: var(--text-3);
    text-transform: uppercase; letter-spacing: .8px;
    display: flex; align-items: center; gap: .45rem;
}
.section-header h2 i { font-size: .65rem; opacity: .7; }

.stream-list { display: flex; flex-direction: column; gap: .3rem; }

.stream-card {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: .55rem .7rem;
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
}
.stream-card::before {
    content: '';
    position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
    background: transparent;
    border-radius: 3px 0 0 3px;
    transition: background var(--transition);
}
.stream-card:hover { border-color: var(--border-light); background: var(--bg-3); }
.stream-card:hover::before { background: var(--accent); }
.stream-card.active {
    border-color: var(--accent);
    background: var(--accent-dim);
    box-shadow: 0 0 0 1px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,.03);
}
.stream-card.active::before { background: var(--accent); }

.stream-card .stream-name {
    font-size: .8rem; font-weight: 600;
    display: flex; align-items: center; gap: .4rem;
    margin-bottom: .1rem;
}
.stream-card .stream-meta {
    font-size: .68rem; color: var(--text-3);
    font-family: var(--mono); padding-left: 1.05rem;
}

.stream-state {
    display: inline-block; width: 7px; height: 7px;
    border-radius: 50%; flex-shrink: 0;
    transition: all var(--transition);
}
.stream-state.running { background: var(--green); box-shadow: 0 0 8px var(--green); }
.stream-state.error { background: var(--red); box-shadow: 0 0 8px var(--red); animation: pulse-dot 1.5s ease infinite; }
.stream-state.stopped { background: var(--text-3); }
@keyframes pulse-dot { 0%,100% { opacity:1; } 50% { opacity:.4; } }

.sap-card {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: .5rem .7rem;
    cursor: pointer;
    transition: all var(--transition);
    border-left: 3px solid var(--yellow);
}
.sap-card:hover { background: var(--bg-3); border-left-color: var(--accent); }
.sap-card .stream-name { font-size: .75rem; font-weight: 500; margin-bottom: .05rem; display: flex; align-items: center; gap: .3rem; }
.sap-card .stream-meta { font-size: .66rem; color: var(--text-3); font-family: var(--mono); }

.empty-state {
    font-size: .78rem; color: var(--text-3);
    padding: .75rem; display: flex; align-items: center; gap: .45rem;
    font-style: italic; opacity: .8;
}

/* ===== MAIN PANEL ===== */
.main-panel {
    flex: 1; padding: 1.25rem;
    overflow-y: auto; background: var(--bg-0);
}

.placeholder {
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    height: 100%; color: var(--text-3); gap: .4rem;
}
.placeholder i { font-size: 2.5rem; opacity: .15; margin-bottom: .5rem; }
.placeholder p { font-size: 1rem; font-weight: 500; opacity: .6; }
.placeholder span { font-size: .82rem; opacity: .4; }

/* ===== FAVORITES BAR ===== */
/* Desktop: horizontal chip bar */
.favorites-bar {
    display: flex;
    gap: .4rem;
    padding: .5rem 0;
    margin-bottom: .5rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.favorites-bar::-webkit-scrollbar { display: none; }

.fav-chip {
    display: flex; align-items: center; gap: .35rem;
    padding: .35rem .7rem;
    background: var(--bg-3);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: .75rem; font-weight: 500;
    color: var(--text-2);
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: all var(--transition);
}
.fav-chip:hover { border-color: var(--accent); color: var(--text-1); }
.fav-chip.active {
    background: var(--accent-dim);
    border-color: var(--accent);
    color: var(--text-1);
}
.fav-chip .fav-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}
.fav-chip .fav-dot.running { background: var(--green); box-shadow: 0 0 4px var(--green); }
.fav-chip .fav-dot.error { background: var(--red); }
.fav-chip .fav-dot.stopped { background: var(--text-3); }
.fav-chip .fav-star { color: var(--yellow); font-size: .6rem; }
.fav-chip .fav-remove { color: var(--text-3); font-size: .55rem; margin-left: .1rem; }
.fav-chip .fav-remove:hover { color: var(--red); }

/* Mobile: favorites as full-width cards */
.fav-card {
    display: none; /* hidden on desktop, shown on mobile */
}

/* Stream card favorite star */
.stream-fav { color: var(--yellow); font-size: .6rem; margin-left: auto; flex-shrink: 0; }

/* Active favorite button */
#btn-favorite .fa-star { color: var(--yellow); }

/* ===== MONITOR HEADER ===== */
.monitor-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 1rem;
}
.monitor-title { display: flex; align-items: center; gap: .5rem; }
.monitor-title i { color: var(--green); font-size: 1rem; }
.monitor-title h2 { font-size: 1.15rem; font-weight: 600; letter-spacing: -0.01em; }

.monitor-badges { display: flex; gap: .4rem; }
.badge {
    background: var(--bg-3);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: .2rem .6rem;
    font-size: .68rem; color: var(--text-2);
    font-family: var(--mono); font-weight: 500;
    display: inline-flex; align-items: center; gap: .3rem;
    transition: all var(--transition);
}
.badge i { font-size: .55rem; color: var(--text-3); }
.badge-live { border-color: var(--green-dim); }
.badge-live i { color: var(--green); }

/* ===== PLAYER BAR ===== */
.player-bar {
    display: flex; align-items: center; gap: .6rem;
    padding: .6rem .85rem;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 1rem;
    box-shadow: var(--shadow-sm);
}

.volume-control {
    display: flex; align-items: center; gap: .4rem;
    color: var(--text-3); font-size: .75rem;
}

.slider {
    -webkit-appearance: none;
    width: 100px; height: 4px;
    background: var(--bg-4);
    border-radius: 2px; outline: none;
    transition: background var(--transition);
}
.slider:hover { background: var(--border-light); }
.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px; height: 14px;
    background: var(--accent);
    border-radius: 50%; cursor: pointer;
    box-shadow: 0 1px 4px rgba(91,156,245,.3);
    transition: all var(--transition);
}
.slider::-webkit-slider-thumb:hover { transform: scale(1.15); box-shadow: 0 2px 8px rgba(91,156,245,.4); }

#volume-label, #latency-value { font-size: .72rem; color: var(--text-3); font-family: var(--mono); min-width: 32px; }

.player-status {
    margin-left: auto; font-size: .75rem; color: var(--text-3);
    display: flex; align-items: center; gap: .3rem;
}

.latency-control {
    display: flex; align-items: center; gap: .35rem;
    color: var(--text-3); font-size: .72rem;
    margin-left: .3rem; padding-left: .6rem;
    border-left: 1px solid var(--border);
}
.slider-sm { width: 65px; }

/* ===== CARDS ===== */
.card {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 1rem;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: border-color var(--transition);
}
.card:hover { border-color: var(--border-light); }

.card-header {
    padding: .55rem .85rem;
    font-size: .72rem; font-weight: 600;
    color: var(--text-3);
    text-transform: uppercase; letter-spacing: .6px;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: .4rem;
    background: linear-gradient(180deg, rgba(255,255,255,.015) 0%, transparent 100%);
}
.card-header i { font-size: .68rem; opacity: .7; }
.card-body { padding: .85rem; }

.card-header-actions { margin-left: auto; display: flex; gap: .25rem; }

.select-sm {
    padding: .2rem .4rem; font-size: .68rem;
    background: var(--bg-1); border: 1px solid var(--border);
    border-radius: var(--radius-xs); color: var(--text-2);
    cursor: pointer; outline: none;
    transition: all var(--transition);
}
.select-sm:focus { border-color: var(--accent); }

/* ===== METERS ROW (spectrum + VU side by side on desktop) ===== */
.meters-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: .75rem;
    margin-bottom: .75rem;
    align-items: stretch;
}
.meters-row > .card { margin-bottom: 0; display: flex; flex-direction: column; }
.meters-row > .card > .card-body { flex: 1; }

/* ===== ANALYZER (audiomotion) ===== */
.spectrum-card-full { min-width: 0; }
.analyzer-body {
    padding: 0 !important;
    height: 280px;
    background: #000;
    border-radius: 0 0 var(--radius) var(--radius);
    overflow: hidden;
    position: relative;
}
.analyzer-body canvas { border-radius: 0 0 var(--radius) var(--radius); }

/* VU */
.vu-card-full { margin-bottom: .75rem; }
.vu-card-body { display: flex; justify-content: center; align-items: center; padding: .65rem; }
#vu-canvas { image-rendering: auto; max-width: 100%; }

/* ===== INFO ===== */
.info-cards-row { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: .4rem;
}

.info-item {
    display: flex; flex-direction: column; gap: .1rem;
    padding: .45rem .55rem;
    background: var(--bg-1);
    border-radius: var(--radius-xs);
    border: 1px solid transparent;
    transition: border-color var(--transition);
}
.info-item:hover { border-color: var(--border); }

.info-label {
    font-size: .62rem; color: var(--text-3);
    text-transform: uppercase; letter-spacing: .5px;
    display: flex; align-items: center; gap: .3rem;
}
.info-label i { font-size: .55rem; width: 10px; text-align: center; opacity: .6; }

.info-value {
    font-family: var(--mono); font-size: .82rem; font-weight: 500;
    color: var(--text-1); letter-spacing: -0.01em;
}

/* ===== BUFFER MONITOR ===== */
.buffer-card { margin-bottom: .75rem; }
.buffer-stats { display: flex; gap: 1rem; margin-bottom: .6rem; }
.buffer-stat { flex: 1; display: flex; align-items: center; gap: .5rem; }
.buffer-label { font-size: .7rem; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .5px; min-width: 55px; }
.buffer-bar-wrap {
    flex: 1; height: 8px;
    background: var(--bg-1); border-radius: 4px; overflow: hidden;
    border: 1px solid var(--border);
}
.buffer-bar {
    height: 100%; border-radius: 3px;
    background: linear-gradient(90deg, var(--accent), #7c5bf5);
    transition: width 0.3s ease;
}
.buffer-bar-green { background: linear-gradient(90deg, var(--green), #2fb879); }
.buffer-bar-red { background: linear-gradient(90deg, var(--red), #c43030); }
.buffer-value { font-family: var(--mono); font-size: .72rem; color: var(--text-2); min-width: 45px; text-align: right; }
.buffer-details {
    display: flex; flex-wrap: wrap; gap: .5rem .75rem;
    font-size: .72rem; color: var(--text-3);
}
.buffer-details span { display: flex; align-items: center; gap: .25rem; }
.buffer-details i { font-size: .6rem; width: 12px; text-align: center; }

/* ===== INFO COLLAPSE ===== */
.info-collapse { margin-bottom: 1rem; }
.info-collapse-header {
    display: flex; align-items: center; gap: .45rem;
    padding: .5rem .75rem;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: .78rem; font-weight: 500; color: var(--text-3);
    list-style: none;
    user-select: none; -webkit-user-select: none;
    transition: all var(--transition);
}
.info-collapse-header:hover { border-color: var(--border-light); }
.info-collapse-header::-webkit-details-marker { display: none; }
.collapse-icon { margin-left: auto; font-size: .6rem; transition: transform var(--transition); }
.info-collapse[open] .collapse-icon { transform: rotate(180deg); }
.info-collapse[open] .info-collapse-header { border-radius: var(--radius-sm) var(--radius-sm) 0 0; }

/* ===== MODALS ===== */
.modal {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.6);
    backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000;
    animation: modalFadeIn .2s ease;
}
@keyframes modalFadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-content {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 16px;
    width: 480px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: modalSlideIn .25s ease;
}
@keyframes modalSlideIn { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-wide { width: 640px; }

.modal-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 1.1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(180deg, rgba(255,255,255,.02) 0%, transparent 100%);
}
.modal-header h2 { font-size: 1rem; font-weight: 600; display: flex; align-items: center; gap: .4rem; }
.modal-header h2 i { color: var(--accent); font-size: .9rem; }

.modal-content form, .modal-content .settings-section, .modal-content > div:not(.modal-header) {
    padding: 1.1rem 1.25rem;
}
.modal-content h3 {
    font-size: .8rem; color: var(--text-3);
    margin-bottom: .65rem;
    display: flex; align-items: center; gap: .35rem;
    font-weight: 600;
}

.modal-footer { display: flex; justify-content: flex-end; gap: .4rem; padding-top: .75rem; }
.settings-section { border-top: 1px solid var(--border); }
.settings-section:first-of-type { border-top: none; }
.setting-val { font-family: var(--mono); font-size: .72rem; color: var(--accent); display: inline-block; min-width: 48px; text-align: right; }
#save-admin-note { color: var(--green); }

.form-row { display: flex; gap: .65rem; }
.form-row .form-group { flex: 1; }

/* ===== USERS TABLE ===== */
.users-table { width: 100%; border-collapse: collapse; margin-bottom: .75rem; }
.users-table th, .users-table td {
    padding: .45rem .55rem; text-align: left;
    border-bottom: 1px solid var(--border); font-size: .8rem;
}
.users-table th {
    color: var(--text-3); font-size: .65rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: .6px;
}
.users-table select { width: auto; padding: .2rem .35rem; font-size: .75rem; }

/* ===== MOBILE/DESKTOP ===== */
.mobile-only { display: none !important; }
.desktop-only { display: flex; }

.sidebar-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,.5); z-index: 99;
    backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
}

/* ===== RESPONSIVE: TABLET ===== */
@media (max-width: 1100px) {
    .meters-grid { grid-template-columns: 1fr; }
    .vu-card { min-width: auto; }
    #vu-canvas { max-width: 100%; }
}

/* ===== RESPONSIVE: MOBILE ===== */
@media (max-width: 768px) {
    .mobile-only { display: flex !important; }
    .desktop-only { display: none !important; }
    body { overflow: auto; }

    .app-header { padding: 0 .65rem; height: 48px; position: sticky; top: 0; z-index: 50; }

    .app-content { flex-direction: column; height: auto; min-height: calc(100vh - 48px); }

    /* Favorites: vertical card list on mobile */
    .favorites-bar {
        flex-direction: column;
        gap: .35rem;
        padding: .4rem 0;
        overflow-x: visible;
    }
    .fav-chip {
        border-radius: var(--radius-sm);
        padding: .65rem .85rem;
        font-size: .82rem;
        min-height: 44px;
    }
    .fav-chip .fav-dot { width: 8px; height: 8px; }
    .fav-chip .fav-remove { font-size: .7rem; padding: .2rem; }

    .sidebar {
        position: fixed; top: 0; left: 0; bottom: 0;
        width: 290px; max-width: 85vw;
        z-index: 100;
        transform: translateX(-100%);
        transition: transform .3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: var(--shadow-lg);
    }
    .sidebar.open { transform: translateX(0); }
    .sidebar.open + .sidebar-overlay { display: block; }
    .sidebar-inner { height: 100%; overflow-y: auto; padding-top: env(safe-area-inset-top, 0px); }

    .main-panel { padding: .65rem; min-height: calc(100vh - 48px); }

    .placeholder { min-height: 50vh; }
    .placeholder i { font-size: 2rem; }

    .monitor-header { flex-direction: column; gap: .4rem; align-items: flex-start; }
    .monitor-title h2 { font-size: 1rem; }
    .monitor-badges { flex-wrap: wrap; }

    .player-bar { flex-wrap: wrap; gap: .4rem; padding: .5rem .65rem; }
    .player-bar .volume-control { order: 3; width: 100%; }
    .volume-control .slider { flex: 1; }

    .meters-grid { grid-template-columns: 1fr; gap: .65rem; }
    .meters-row { grid-template-columns: 1fr; }
    .vu-card-full { min-width: auto; }
    #vu-canvas { max-width: 100%; height: auto; }

    .info-cards-row { grid-template-columns: 1fr; gap: .65rem; }
    .info-grid { grid-template-columns: repeat(2, 1fr); }

    .modal-content { width: 100%; max-width: 100%; height: 100%; max-height: 100%; border-radius: 0; }
    .modal-wide { width: 100%; }
    .form-row { flex-direction: column; gap: .4rem; }

    .btn { min-height: 44px; min-width: 44px; }
    .btn-icon { padding: .55rem; }
    .btn-xs { min-height: 36px; min-width: 36px; }
    .select-sm { min-height: 36px; padding: .35rem; font-size: .75rem; }
    .slider { height: 6px; }
    .slider::-webkit-slider-thumb { width: 20px; height: 20px; }

    .stream-card { padding: .65rem .75rem; }
    .sap-card { padding: .55rem .75rem; }

    .app-header { padding-left: max(.65rem, env(safe-area-inset-left)); padding-right: max(.65rem, env(safe-area-inset-right)); }
    .main-panel { padding-bottom: max(.65rem, env(safe-area-inset-bottom)); }
}

@media (max-width: 400px) {
    .monitor-badges .badge { font-size: .6rem; padding: .15rem .4rem; }
    .info-grid { grid-template-columns: 1fr; }
}
