:root {
    --bg-dark: #121212;
    --bg-panel: #1e1e1e;
    --bg-card: #262626;
    --meet-btn: #3c4043;
    --meet-btn-hover: #4d5156;
    --meet-red: #ea4335;
    --meet-red-hover: #d93025;
    --meet-blue: #8ab4f8;
    --redlink: #e63946;
    --teal: #2a9d8f;
    --gold: #f4a261;
    --text-light: #f1faee;
    --text-muted: #9aa0a6;
    --border: #333333;
    --vu-green: #2a9d8f;
    --vu-yellow: #e9c46a;
    --vu-red: #e76f51;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Google Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-light);
    height: 100vh;
    overflow: hidden;
}

/* ==================== LOGIN SCREEN ==================== */
#login-screen {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 16px;
    overflow-y: auto;
}

.login-box {
    background: var(--bg-panel);
    padding: 24px 26px;
    border-radius: 16px;
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.65);
    border: 1px solid var(--border);
    width: 100%;
    max-width: 510px;
}

.brand-header {
    text-align: center;
    margin-bottom: 14px;
}

.brand-header h1 {
    margin: 0 0 4px 0;
    font-size: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.badge-pro {
    background: var(--teal);
    color: #fff;
    font-size: 11px;
    padding: 2px 7px;
    border-radius: 5px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

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

.row-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 10px;
}

input, select {
    width: 100%;
    padding: 9px 11px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-dark);
    color: var(--text-light);
    font-size: 13px;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--redlink);
}

.settings-card {
    background: var(--bg-card);
    padding: 12px 13px;
    border-radius: 10px;
    border: 1px solid var(--border);
    margin-bottom: 11px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 600;
    gap: 8px;
    flex-wrap: wrap;
}

.network-details summary::-webkit-details-marker {
    display: none;
}

.device-status-msg {
    font-size: 11px;
    padding: 6px 9px;
    border-radius: 6px;
    margin-bottom: 8px;
    background: rgba(234, 67, 53, 0.14);
    border: 1px solid rgba(234, 67, 53, 0.45);
    color: #ff9e96;
    line-height: 1.4;
}

.device-status-msg.ok {
    background: rgba(42, 157, 143, 0.14);
    border-color: rgba(42, 157, 143, 0.45);
    color: #7ee2d5;
}

.field-label {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin: 7px 0 3px 0;
}

.btn-small {
    padding: 5px 10px;
    font-size: 11px;
    border-radius: 6px;
    border: 1px solid #444;
    background: #333;
    color: var(--text-light);
    cursor: pointer;
    font-weight: 600;
}

.btn-small:hover {
    background: #444;
}

.preset-pills {
    display: flex;
    gap: 6px;
}

.pill-btn {
    padding: 4px 10px;
    font-size: 11px;
    border-radius: 14px;
    border: 1px solid #444;
    background: var(--bg-dark);
    color: var(--text-muted);
    cursor: pointer;
    font-weight: 600;
    transition: 0.2s;
}

.pill-btn.active, .pill-btn:hover {
    background: var(--redlink);
    border-color: var(--redlink);
    color: white;
}

.audio-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 9px;
    margin-top: 6px;
}

.control-item label {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 3px;
}

.control-item.full-span {
    grid-column: span 2;
}

.btn-enter {
    width: 100%;
    padding: 13px;
    border: none;
    border-radius: 10px;
    background: var(--redlink);
    color: white;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    margin-top: 4px;
}

.btn-enter:hover {
    background: #d62839;
}

.btn-enter:disabled {
    opacity: 0.6;
    cursor: wait;
}

/* ==================== TOP HEADER & TOAST ==================== */
.header {
    height: 52px;
    background: var(--bg-panel);
    padding: 0 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.header-left h2 {
    margin: 0;
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.badge {
    background: var(--bg-card);
    padding: 4px 10px;
    border-radius: 16px;
    font-size: 12px;
    border: 1px solid var(--border);
}

.badge-role {
    color: var(--gold);
    border-color: rgba(244, 162, 97, 0.4);
    font-weight: 600;
}

.badge-audio {
    color: var(--meet-blue);
    border-color: rgba(138, 180, 248, 0.35);
}

.badge-server {
    color: #7ee2d5;
    border-color: rgba(42, 157, 143, 0.45);
}

.badge-server.warn {
    color: #ff9e96;
    border-color: rgba(234, 67, 53, 0.5);
}

.btn-invite {
    padding: 6px 13px;
    background: var(--bg-card);
    color: var(--text-light);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.btn-invite:hover {
    background: #333;
}

.live-toast {
    position: fixed;
    top: 108px;
    left: 50%;
    transform: translateX(-50%) translateY(-16px);
    background: #202124;
    color: #fff;
    border: 1px solid var(--teal);
    padding: 9px 18px;
    border-radius: 24px;
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s, transform 0.25s;
    z-index: 200;
}

.live-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ==================== TIMECODE & MTC SYNC BAR ==================== */
.timecode-bar {
    min-height: 48px;
    background: #16171a;
    border-bottom: 1px solid #2c2e33;
    padding: 5px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.tc-display-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.tc-mode-pill {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.5px;
    padding: 4px 8px;
    border-radius: 6px;
    background: #2a2d32;
    color: #cbd5e1;
    border: 1px solid #3f434a;
    white-space: nowrap;
}

.tc-mode-pill.mtc-active {
    background: rgba(42, 157, 143, 0.22);
    border-color: var(--teal);
    color: #7ee2d5;
    box-shadow: 0 0 10px rgba(42, 157, 143, 0.28);
}

.tc-mode-pill.manual-run {
    background: rgba(138, 180, 248, 0.2);
    border-color: var(--meet-blue);
    color: var(--meet-blue);
}

.tc-readout {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Courier New", monospace;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: 1.5px;
    color: #ffffff;
    background: #0b0c0e;
    padding: 3px 12px;
    border-radius: 8px;
    border: 1px solid #2f333a;
    user-select: all;
}

.tc-select-compact {
    width: auto;
    padding: 5px 8px;
    font-size: 12px;
    border-radius: 6px;
    background: #232529;
}

.tc-sync-group {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.midi-box, .manual-transport-box {
    display: flex;
    align-items: center;
    gap: 5px;
    background: #202226;
    padding: 3px 7px;
    border-radius: 8px;
    border: 1px solid #32353b;
}

.midi-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--gold);
    white-space: nowrap;
}

.tc-select-midi {
    width: auto;
    max-width: 185px;
    padding: 4px 7px;
    font-size: 11px;
    border-radius: 5px;
    background: #141518;
}

.tc-offset-input {
    width: 92px;
    padding: 4px 6px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 12px;
    text-align: center;
    border-radius: 5px;
    background: #141518;
}

.btn-tc-mini {
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 700;
    border-radius: 5px;
    border: 1px solid #444;
    background: #2f3238;
    color: #f1faee;
    cursor: pointer;
    transition: 0.15s;
}

.btn-tc-mini:hover {
    background: #43474f;
}

.btn-tc-mini.active {
    background: var(--meet-blue);
    color: #121212;
    border-color: var(--meet-blue);
}

.tc-markers-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.tc-note-input {
    width: 170px;
    padding: 5px 9px;
    font-size: 12px;
    border-radius: 6px;
    background: #0f1013;
}

.btn-marker {
    padding: 5px 10px;
    font-size: 11px;
    font-weight: 700;
    border-radius: 6px;
    border: 1px solid transparent;
    cursor: pointer;
    white-space: nowrap;
    transition: 0.15s;
}

.btn-marker.good {
    background: rgba(42, 157, 143, 0.22);
    border-color: #2a9d8f;
    color: #7ee2d5;
}
.btn-marker.good:hover { background: #2a9d8f; color: #fff; }

.btn-marker.retake {
    background: rgba(233, 196, 106, 0.2);
    border-color: #e9c46a;
    color: #f6dc96;
}
.btn-marker.retake:hover { background: #d4a338; color: #121212; }

.btn-marker.note {
    background: rgba(234, 67, 53, 0.2);
    border-color: #ea4335;
    color: #ff9e96;
}
.btn-marker.note:hover { background: #ea4335; color: #fff; }

/* ==================== WORKSPACE & VIDEO ==================== */
.main-workspace {
    display: flex;
    height: calc(100vh - 176px);
    background: #141414;
}

.video-grid {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 14px;
    align-content: flex-start;
    overflow-y: auto;
}

.video-container {
    position: relative;
    background: #0b0b0b;
    border-radius: 12px;
    border: 1px solid var(--border);
    overflow: hidden;
    flex: 1 1 360px;
    height: 41vh;
    min-height: 210px;
}

.video-container.expanded {
    flex: 1 1 100%;
    height: 72vh;
    order: -1;
    border-color: var(--meet-blue);
}

video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #080808;
}

.p2p-status-pill {
    position: absolute;
    top: 10px;
    left: 12px;
    background: rgba(0, 0, 0, 0.78);
    padding: 4px 9px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    border: 1px solid #444;
    z-index: 12;
}



.label {
    position: absolute;
    bottom: 14px;
    left: 12px;
    background: rgba(0, 0, 0, 0.76);
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
}

.video-actions {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 6px;
    z-index: 12;
}

.btn-action {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(32, 33, 36, 0.8);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-action:hover {
    background: var(--redlink);
}

/* ==================== SIDE DRAWER ==================== */
.side-drawer {
    width: 380px;
    background: var(--bg-panel);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.side-drawer.hidden {
    display: none;
}

.drawer-tabs {
    display: flex;
    align-items: center;
    background: #171717;
    border-bottom: 1px solid var(--border);
    padding: 6px 5px;
    gap: 2px;
}

.tab-btn {
    position: relative;
    flex: 1;
    padding: 7px 3px;
    font-size: 11px;
    font-weight: 600;
    background: transparent;
    color: var(--text-muted);
    border: none;
    border-radius: 7px;
    cursor: pointer;
    transition: 0.15s;
    white-space: nowrap;
}

.tab-btn:hover {
    background: #262626;
    color: var(--text-light);
}

.tab-btn.active {
    background: var(--bg-card);
    color: var(--text-light);
    box-shadow: inset 0 -2px 0 var(--redlink);
}

.tab-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    background: var(--meet-blue);
    border-radius: 50%;
    margin-left: 2px;
}

.btn-close-drawer {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px 6px;
    font-size: 14px;
}

.btn-close-drawer:hover {
    color: white;
}

.drawer-content {
    flex: 1;
    padding: 14px;
    overflow-y: auto;
}

.drawer-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.preset-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-bottom: 10px;
}

#preset-mastering.active, #live-preset-mastering.active {
    background: var(--gold);
    border-color: var(--gold);
    color: #121212;
}

.live-form .audio-grid {
    margin-top: 10px;
}

/* ==================== CUE-SHEET MARKERS ==================== */
.markers-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.empty-hint {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
    background: var(--bg-card);
    padding: 12px;
    border-radius: 8px;
}

.marker-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 4px solid var(--teal);
    border-radius: 8px;
    padding: 9px 11px;
}

.marker-card.RETAKE { border-left-color: #e9c46a; }
.marker-card.NOTE { border-left-color: #ea4335; }

.marker-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.marker-tc {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 14px;
    font-weight: 800;
    color: #fff;
}

.marker-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
    background: #333;
}

.marker-meta {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.marker-note-text {
    font-size: 12px;
    color: #f1faee;
}

/* ==================== PARTICIPANTS & HOST REMOTE MIXER ==================== */
.participants-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.participant-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px;
}

.participant-card.is-me {
    border-color: rgba(42, 157, 143, 0.5);
}

.p-card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    gap: 6px;
}

.p-name {
    font-weight: 700;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.p-role-tag {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    background: #333;
    color: var(--gold);
    font-weight: 700;
}

.p-specs {
    font-size: 11px;
    color: var(--meet-blue);
    margin-bottom: 8px;
    background: rgba(138, 180, 248, 0.08);
    padding: 4px 8px;
    border-radius: 6px;
}

.p-conn-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    margin-bottom: 8px;
    padding: 4px 8px;
    background: #1a1a1a;
    border-radius: 6px;
}

.p-mixer-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.p-mixer-row label {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
}

.p-mixer-row input[type="range"] {
    flex: 1;
    padding: 0;
    accent-color: var(--teal);
    cursor: pointer;
}

.p-host-box {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed #3d3d3d;
}

.p-host-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--gold);
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.btn-remote-mute {
    padding: 4px 8px;
    font-size: 11px;
    border-radius: 6px;
    border: 1px solid var(--meet-red);
    background: rgba(234, 67, 53, 0.15);
    color: #ff8a80;
    cursor: pointer;
    font-weight: 600;
}

.btn-remote-mute:hover {
    background: var(--meet-red);
    color: white;
}

.btn-apply-remote {
    width: 100%;
    margin-top: 8px;
    padding: 8px;
    border: none;
    border-radius: 7px;
    background: var(--teal);
    color: white;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.btn-apply-remote:hover {
    background: #238276;
}

/* ==================== DIAGNOSTICA LOG ==================== */
.diag-log-list {
    background: #111;
    border: 1px solid #2b2b2b;
    border-radius: 8px;
    padding: 8px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 11px;
    line-height: 1.45;
    max-height: 58vh;
    overflow-y: auto;
}

.diag-item {
    padding: 3px 0;
    border-bottom: 1px solid #1d1d1d;
    word-break: break-word;
}

.diag-item.err { color: #ff8a80; }
.diag-item.ok { color: #7ee2d5; }
.diag-item.info { color: #cbd5e1; }

/* ==================== CHAT TAB ==================== */
.chat-tab-layout {
    display: flex;
    flex-direction: column;
    padding: 0;
}

.chat-messages {
    flex: 1;
    padding: 12px;
    overflow-y: auto;
    font-size: 13px;
    line-height: 1.45;
}

.chat-messages p {
    margin: 0 0 8px 0;
    word-wrap: break-word;
}

.chat-tc-tag {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 11px;
    background: #2a2d34;
    color: var(--meet-blue);
    padding: 1px 5px;
    border-radius: 4px;
    margin-right: 4px;
}

.chat-input {
    display: flex;
    padding: 10px;
    gap: 6px;
    border-top: 1px solid var(--border);
}

.chat-input input {
    margin: 0;
    flex: 1;
    padding: 9px 12px;
}

.chat-input button {
    padding: 9px 14px;
    background: var(--redlink);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
}

/* ==================== GOOGLE MEET STYLE BOTTOM BAR ==================== */
.meet-controls-bar {
    height: 76px;
    background: #18191c;
    border-top: 1px solid #2b2d31;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px;
}

.meet-left-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 500;
    color: #e8eaed;
    min-width: 140px;
}

.meet-left-info .sep {
    color: #5f6368;
}

.meet-right-spacer {
    min-width: 140px;
}

.meet-center-buttons {
    display: flex;
    align-items: center;
    gap: 9px;
}

.meet-btn {
    position: relative;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    border: none;
    background-color: var(--meet-btn);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.12s;
}

.meet-btn:hover {
    background-color: var(--meet-btn-hover);
}

.meet-btn:active {
    transform: scale(0.94);
}

.meet-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.meet-btn.is-off {
    background-color: var(--meet-red);
    color: #ffffff;
}

.meet-btn.is-off:hover {
    background-color: var(--meet-red-hover);
}

.meet-btn.active-blue {
    background-color: var(--meet-blue);
    color: #202124;
}

.meet-btn.active-teal {
    background-color: #394457;
    color: var(--meet-blue);
}

.meet-btn.is-recording {
    background-color: var(--meet-red);
    animation: pulse-rec 1.4s infinite;
}

@keyframes pulse-rec {
    0% { box-shadow: 0 0 0 0 rgba(234, 67, 53, 0.6); }
    70% { box-shadow: 0 0 0 10px rgba(234, 67, 53, 0); }
    100% { box-shadow: 0 0 0 0 rgba(234, 67, 53, 0); }
}

.meet-btn-leave {
    width: 62px;
    height: 45px;
    border-radius: 23px;
    background-color: var(--meet-red);
    color: #ffffff;
    margin-left: 5px;
}

.meet-btn-leave:hover {
    background-color: var(--meet-red-hover);
}

.unread-dot {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background-color: var(--meet-blue);
}

/* ==================== RESPONSIVE MOBILE / TABLET ==================== */
@media (max-width: 960px) {
    .timecode-bar { padding: 6px 12px; gap: 8px; }
    .tc-readout { font-size: 18px; }
    .tc-note-input { width: 130px; }
}

@media (max-width: 768px) {
    body { overflow: auto; height: auto; }
    .row-2col, .audio-grid { grid-template-columns: 1fr; }
    .control-item.full-span { grid-column: span 1; }
    .badge-audio, .badge-server { display: none; }
    .main-workspace { flex-direction: column; height: auto; }
    .video-container { flex: 1 1 100%; height: 35vh; }
    .side-drawer { width: 100%; height: 380px; border-left: none; border-top: 1px solid var(--border); }
    .meet-left-info, .meet-right-spacer { display: none; }
    .meet-controls-bar {
        position: sticky;
        bottom: 0;
        justify-content: center;
        padding: 8px;
        height: 66px;
        z-index: 50;
    }
    .meet-center-buttons { gap: 6px; }
    .meet-btn { width: 39px; height: 39px; }
    .meet-btn-leave { width: 50px; height: 39px; }
}


/* ==================== ROLE BANNER & ROLE TAGS ==================== */
.role-hint-banner {
    font-size: 11.5px;
    line-height: 1.4;
    padding: 7px 10px;
    border-radius: 8px;
    margin-bottom: 10px;
    background: rgba(244, 162, 97, 0.12);
    border: 1px solid rgba(244, 162, 97, 0.35);
    color: #f7c59f;
}

.role-hint-banner.speaker {
    background: rgba(42, 157, 143, 0.14);
    border-color: rgba(42, 157, 143, 0.45);
    color: #7ee2d5;
}

.role-hint-banner.client {
    background: rgba(138, 180, 248, 0.14);
    border-color: rgba(138, 180, 248, 0.45);
    color: #b8d4ff;
}

.p-role-tag.speaker {
    color: #7ee2d5;
    background: rgba(42, 157, 143, 0.22);
}

.p-role-tag.client {
    color: #8ab4f8;
    background: rgba(138, 180, 248, 0.2);
}

.btn-small.recording {
    background: var(--meet-red);
    border-color: var(--meet-red);
    color: white;
    animation: pulse 1.5s infinite;
}

.vu-meter-group {
    position: absolute;
    bottom: 12px;
    left: 12px;
    right: 12px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    z-index: 10;
}
.vu-meter-bar {
    width: 100%;
    height: 4px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 2px;
    overflow: hidden;
    position: relative;
    border: 1px solid rgba(255,255,255,0.1);
}
.vu-meter-fill {
    height: 100%;
    width: 0%;
    background: var(--vu-green);
    transition: width 0.08s, background 0.1s;
}
.vu-label-mini {
    position: absolute;
    right: 4px;
    top: -1px;
    font-size: 7px;
    color: rgba(255,255,255,0.7);
    font-weight: 800;
    z-index: 11;
}

/* Riposiziona la label del nome per non coprire i VU */
.video-container .label {
    bottom: 30px;
}

/* Stili per il badge diagnostica rete sul video */
.p2p-net-stats {
    position: absolute;
    top: 10px;
    left: 12px;
    background: rgba(0, 0, 0, 0.85);
    padding: 5px 10px;
    border-radius: 8px;
    font-size: 10px;
    font-family: ui-monospace, monospace;
    color: #cbd5e1;
    border: 1px solid #444;
    z-index: 12;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.stat-row {
    display: flex;
    justify-content: space-between;
    gap: 15px;
}
.stat-val.ok { color: #7ee2d5; }
.stat-val.warn { color: #e9c46a; }
.stat-val.err { color: #ff8a80; }


/* ==================== V13 MOBILE & TOUCH OPTIMIZATIONS ==================== */
.mobile-only-btn {
    display: none;
}

.drawer-backdrop {
    display: none;
}

.drawer-drag-handle {
    display: none;
}

#app-screen {
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

.main-workspace {
    flex: 1;
    min-height: 0;
    height: auto !important;
    position: relative;
}

@media (max-width: 768px) {
    html, body {
        height: 100%;
        height: 100dvh;
        overflow: hidden;
        overscroll-behavior: none;
        -webkit-tap-highlight-color: transparent;
    }

    /* Previene auto-zoom iOS Safari quando si toccano input o select */
    input, select, textarea {
        font-size: 16px !important;
    }

    /* Login Screen compatto e comodo da scorrere */
    #login-screen {
        display: block;
        height: 100dvh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 12px 12px calc(24px + env(safe-area-inset-bottom)) 12px;
    }

    .login-box {
        padding: 20px 16px;
        border-radius: 14px;
        margin: 0 auto;
    }

    .brand-header h1 {
        font-size: 22px;
    }

    .row-2col, .audio-grid {
        grid-template-columns: 1fr;
    }

    .control-item.full-span {
        grid-column: span 1;
    }

    /* Header compatto e adattivo su mobile */
    .header {
        height: auto;
        min-height: 46px;
        padding: 5px 10px;
        gap: 6px;
        flex-wrap: wrap;
        flex-shrink: 0;
    }

    .header-left {
        gap: 5px;
        flex-wrap: wrap;
        overflow: visible;
    }

    .header-left h2 {
        font-size: 15px;
        white-space: nowrap;
    }

    .header-left h2 .badge-pro {
        display: none;
    }

    .badge {
        padding: 3px 8px;
        font-size: 11px;
        white-space: nowrap;
    }

    .badge-audio, .badge-server, .hide-xs {
        display: none !important;
    }

    .btn-invite {
        padding: 6px 9px;
        font-size: 12px;
    }

    /* Timecode Bar compatta ed espandibile su mobile */
    .timecode-bar {
        min-height: 42px;
        padding: 4px 10px;
        gap: 6px;
        flex-shrink: 0;
    }

    .tc-display-group {
        flex: 1;
        justify-content: space-between;
        gap: 6px;
    }

    .tc-readout {
        font-size: 16px;
        letter-spacing: 0.8px;
        padding: 2px 8px;
    }

    .tc-select-compact {
        padding: 3px 6px;
        font-size: 12px !important;
    }

    .mobile-only-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        padding: 5px 8px;
    }

    .tc-sync-group {
        display: none;
        width: 100%;
        padding-top: 4px;
        border-top: 1px solid #2a2c32;
    }

    .timecode-bar.tc-expanded .tc-sync-group {
        display: flex;
    }

    .tc-markers-group {
        width: 100%;
        justify-content: space-between;
        gap: 5px;
    }

    .tc-note-input {
        flex: 1;
        width: auto;
        min-width: 0;
        padding: 5px 8px;
    }

    .btn-marker {
        padding: 6px 9px;
        font-size: 12px;
    }

    .marker-btn-lbl {
        display: none;
    }

    /* Workspace & Griglia Video ottimizzata per smartphone */
    .main-workspace {
        flex-direction: column;
        flex: 1;
        min-height: 0;
        overflow: hidden;
    }

    .video-grid {
        flex: 1;
        height: 100%;
        padding: 8px;
        gap: 8px;
        position: relative;
        align-content: stretch;
    }

    /* Quando c'è 1 ospite remoto: l'ospite prende tutto lo schermo e TU sei in PiP in basso a destra */
    .video-grid[data-remote-count="1"] .video-container:not(.local) {
        flex: 1 1 100%;
        height: 100%;
        min-height: 0;
    }

    .video-grid[data-remote-count="1"] .video-container.local {
        position: absolute;
        right: 14px;
        bottom: 14px;
        width: 112px;
        height: 156px;
        min-height: 0;
        z-index: 25;
        border: 2px solid rgba(255, 255, 255, 0.35);
        box-shadow: 0 8px 22px rgba(0, 0, 0, 0.75);
        border-radius: 12px;
        transition: width 0.2s, height 0.2s;
    }

    .video-grid[data-remote-count="1"] .video-container.local.pip-minimized {
        width: 72px;
        height: 96px;
    }

    .video-grid[data-remote-count="1"] .video-container.local .label {
        font-size: 10px;
        padding: 2px 6px;
        bottom: 14px;
        left: 6px;
    }

    .video-grid[data-remote-count="1"] .video-container.local .video-actions {
        display: none;
    }

    /* Quando sei da solo (0 ospiti) o con 2+ ospiti */
    .video-grid[data-remote-count="0"] .video-container.local {
        flex: 1 1 100%;
        height: 100%;
    }

    .video-grid:not([data-remote-count="0"]):not([data-remote-count="1"]) .video-container {
        flex: 1 1 100%;
        height: calc(50% - 6px);
        min-height: 140px;
    }

    /* Bottom Sheet Drawer sovrapposto (non schiaccia il video) */
    .drawer-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.55);
        z-index: 110;
        backdrop-filter: blur(2px);
    }

    .drawer-backdrop.hidden {
        display: none;
    }

    .side-drawer {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 74dvh;
        max-height: 82dvh;
        z-index: 120;
        border-left: none;
        border-top: 1px solid #444;
        border-radius: 18px 18px 0 0;
        box-shadow: 0 -10px 35px rgba(0, 0, 0, 0.75);
        padding-bottom: env(safe-area-inset-bottom);
    }

    .drawer-drag-handle {
        display: flex;
        justify-content: center;
        padding: 8px 0 4px 0;
        cursor: pointer;
    }

    .drawer-drag-handle span {
        width: 40px;
        height: 4px;
        border-radius: 4px;
        background: #555;
    }

    .drawer-tabs {
        overflow-x: auto;
        padding: 4px 8px;
    }

    .tab-btn {
        padding: 9px 8px;
        font-size: 12px;
    }

    /* Barra controlli Meet pulita, centrata e 100% entro 360px */
    .meet-left-info, .meet-right-spacer {
        display: none;
    }

    .meet-controls-bar {
        position: relative;
        flex-shrink: 0;
        justify-content: center;
        padding: 8px 8px calc(8px + env(safe-area-inset-bottom)) 8px;
        height: auto;
        min-height: 64px;
        z-index: 50;
    }

    .meet-center-buttons {
        gap: 7px;
        justify-content: center;
        width: 100%;
    }

    .meet-btn {
        width: 43px;
        height: 43px;
        flex-shrink: 0;
    }

    .meet-btn-leave {
        width: 54px;
        height: 43px;
        margin-left: 2px;
    }

    /* Nasconde il tasto Log ridondante dalla barra inferiore mobile (resta accessibile nelle tab del pannello) */
    #btn-diag-toggle {
        display: none;
    }
}


/* ==================== V18 SPLIT TALKBACK CONTROLS ==================== */
.talkback-status-pill {
    position: absolute;
    top: 10px;
    left: 12px;
    padding: 4px 10px;
    border-radius: 14px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.4px;
    background: rgba(234, 67, 53, 0.88);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.35);
    z-index: 15;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.talkback-status-pill.mode-speaker {
    background: rgba(42, 157, 143, 0.92);
}

.talkback-status-pill.mode-client {
    background: rgba(59, 130, 246, 0.92);
}

.talkback-status-pill.mode-none {
    background: rgba(60, 64, 67, 0.9);
    color: #cbd5e1;
}

.talkback-controls-group {
    display: flex;
    align-items: center;
    gap: 5px;
    background: #25272c;
    padding: 4px 6px;
    border-radius: 26px;
    border: 1px solid #3a3d45;
}

.tb-pill-btn {
    height: 37px;
    padding: 0 12px;
    border-radius: 20px;
    border: 1px solid transparent;
    background: #3c4043;
    color: #e8eaed;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    transition: background-color 0.15s, transform 0.1s, box-shadow 0.15s;
    white-space: nowrap;
}

.tb-pill-btn:hover {
    background: #4d5156;
}

.tb-pill-btn:active {
    transform: scale(0.95);
}

.tb-pill-btn.active-speaker {
    background: var(--teal);
    color: #ffffff;
    border-color: #7ee2d5;
    box-shadow: 0 0 12px rgba(42, 157, 143, 0.55);
}

.tb-pill-btn.active-client {
    background: #2563eb;
    color: #ffffff;
    border-color: #93c5fd;
    box-shadow: 0 0 12px rgba(37, 99, 235, 0.55);
}

.tb-pill-btn.active-all {
    background: var(--meet-red);
    color: #ffffff;
    border-color: #fca5a5;
    box-shadow: 0 0 12px rgba(234, 67, 53, 0.55);
}

@media (max-width: 768px) {
    .talkback-controls-group {
        padding: 3px 4px;
        gap: 3px;
    }

    .tb-pill-btn {
        height: 37px;
        padding: 0 8px;
        font-size: 11px;
        gap: 3px;
    }

    .meet-center-buttons {
        gap: 4px;
    }

    .meet-btn {
        width: 39px;
        height: 39px;
    }

    .meet-btn-leave {
        width: 48px;
        height: 39px;
    }
}


/* ==================== V25.1 CLOUDFLARE QUOTA MONITOR (HOST ONLY) ==================== */
.badge-quota {
    color: #f1faee;
    border-color: rgba(244, 162, 97, 0.45);
    cursor: pointer;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: background 0.15s, border-color 0.15s;
}

.badge-quota:hover {
    background: #333;
    border-color: var(--gold);
}

.cf-quota-card {
    background: var(--bg-card);
    border: 1px solid #3a3d45;
    border-radius: 10px;
    padding: 11px 12px;
    margin-bottom: 14px;
}

.cf-quota-item {
    margin-bottom: 9px;
}

.cf-quota-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    margin-bottom: 4px;
    gap: 8px;
}

.cf-quota-row span {
    color: var(--text-muted);
}

.cf-quota-row strong {
    color: var(--text-light);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 10.5px;
}

.cf-quota-track {
    width: 100%;
    height: 7px;
    background: #141518;
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid #2e3138;
}

.cf-quota-fill {
    height: 100%;
    width: 0%;
    transition: width 0.35s ease, background-color 0.25s ease;
    border-radius: 4px;
}

.cf-quota-fill.ok {
    background: var(--teal);
}

.cf-quota-fill.warn {
    background: var(--vu-yellow);
}

.cf-quota-fill.danger {
    background: var(--meet-red);
}

.cf-quota-meta {
    font-size: 10.5px;
    color: var(--text-muted);
    margin-top: 6px;
    line-height: 1.4;
}


/* ==================== V27.0 SCRIPT TELEPROMPTER & MIXER SOLO/MUTE ==================== */
.sync-subtitle-overlay {
    position: absolute;
    bottom: 10px;
    left: 10px;
    right: 10px;
    background: rgba(10, 12, 16, 0.86);
    border: 1px solid rgba(244, 162, 97, 0.5);
    border-radius: 8px;
    padding: 6px 10px;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    color: #ffffff;
    z-index: 12;
    line-height: 1.35;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.75);
}

.sync-subtitle-overlay .sub-char {
    display: inline-block;
    background: var(--gold);
    color: #121212;
    font-size: 10px;
    font-weight: 800;
    padding: 1px 6px;
    border-radius: 4px;
    margin-right: 6px;
    text-transform: uppercase;
}

.script-teleprompter-box {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 10px 14px;
    overflow: hidden;
}

.script-box-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.script-active-banner {
    background: rgba(42, 157, 143, 0.18);
    border: 1px solid var(--teal);
    border-radius: 8px;
    padding: 8px 10px;
    margin-bottom: 8px;
    font-size: 13px;
    line-height: 1.4;
    color: #ffffff;
}

.script-lines-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-right: 2px;
}

.script-line-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 3px solid #444;
    border-radius: 7px;
    padding: 7px 9px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.script-line-card:hover {
    background: #2e3036;
}

.script-line-card.is-active {
    background: rgba(42, 157, 143, 0.2);
    border-color: var(--teal);
    border-left-width: 4px;
}

.script-line-card.is-cued {
    border-color: var(--gold);
    box-shadow: 0 0 0 1px rgba(244, 162, 97, 0.45);
}

.script-line-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
    margin-bottom: 3px;
}

.script-line-tc {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 11px;
    font-weight: 700;
    color: var(--meet-blue);
}

.script-line-char {
    font-size: 10px;
    font-weight: 800;
    color: var(--gold);
    text-transform: uppercase;
}

.script-line-text {
    font-size: 12px;
    color: #f1faee;
    line-height: 1.35;
}

.btn-mixer-ms {
    padding: 2px 6px;
    font-size: 10px;
    font-weight: 800;
    border-radius: 4px;
    border: 1px solid #444;
    background: #232529;
    color: #cbd5e1;
    cursor: pointer;
    line-height: 1.2;
}

.btn-mixer-ms.mute-active {
    background: var(--meet-red);
    border-color: var(--meet-red);
    color: #fff;
}

.btn-mixer-ms.solo-active {
    background: var(--gold);
    border-color: var(--gold);
    color: #121212;
}


/* ==================== V28.0 GUIDE BUS & STAGE MODE VIDEO SYNC ==================== */
.guide-bus-box {
    margin-top: 8px;
    padding: 8px 9px;
    background: rgba(244, 162, 97, 0.08);
    border: 1px solid rgba(244, 162, 97, 0.35);
    border-radius: 8px;
}

.guide-controls-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 7px;
}

.guide-autoduck-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    font-size: 11px;
    color: var(--text-light);
    cursor: pointer;
    user-select: none;
}

.sync-video-wrapper {
    min-height: 185px;
    max-height: 240px;
    background: #000;
    position: relative;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-top: 1px solid #2b2d31;
    border-bottom: 1px solid #2b2d31;
    overflow: hidden;
}

.sync-video-wrapper video {
    width: 100%;
    height: 100%;
    max-height: 240px;
    object-fit: contain;
}

.btn-stage-toggle {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(20, 22, 26, 0.85);
    color: #fff;
    border: 1px solid rgba(244, 162, 97, 0.55);
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    z-index: 15;
    transition: background 0.15s, border-color 0.15s;
}

.btn-stage-toggle:hover {
    background: var(--teal);
    border-color: var(--teal);
}

/* Quando il Video Sync è portato sul Palco Principale (#video-grid) */
.sync-stage-card.on-stage {
    flex: 1 1 64%;
    height: 76vh;
    min-height: 300px;
    order: -2;
    background: #050505;
    border-radius: 12px;
    border: 2px solid var(--teal);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.sync-stage-card.on-stage .sync-video-wrapper {
    flex: 1;
    min-height: 100%;
    max-height: none;
    border: none;
}

.sync-stage-card.on-stage .sync-video-wrapper video {
    max-height: none;
    height: 100%;
}

.sync-stage-card.on-stage .sync-subtitle-overlay {
    font-size: 18px;
    padding: 10px 16px;
    bottom: 18px;
    left: 24px;
    right: 24px;
}

.video-grid.has-stage-video .video-container {
    flex: 1 1 260px;
    height: 36vh;
    min-height: 170px;
}

@media (max-width: 768px) {
    .sync-stage-card.on-stage {
        flex: 1 1 100%;
        height: 52%;
        min-height: 180px;
    }
    .sync-stage-card.on-stage .sync-subtitle-overlay {
        font-size: 13px;
        padding: 5px 8px;
        bottom: 8px;
        left: 8px;
        right: 8px;
    }
}


/* ==================== V30.1 MASTERING SOURCE SWITCHER (DAW <-> TALKBACK) ==================== */
.talkback-status-pill.clickable-pill {
    cursor: pointer;
    transition: transform 0.12s, background-color 0.2s, box-shadow 0.2s;
}

.talkback-status-pill.clickable-pill:hover {
    transform: scale(1.03);
}

.talkback-status-pill.mode-daw {
    background: linear-gradient(135deg, rgba(42, 157, 143, 0.95), rgba(244, 162, 97, 0.92));
    color: #0f1115;
    border-color: #fde68a;
    box-shadow: 0 0 14px rgba(244, 162, 97, 0.45);
}

.tb-pill-btn.active-daw {
    background: linear-gradient(135deg, var(--teal), var(--gold));
    color: #111317;
    border-color: #fde68a;
    box-shadow: 0 0 12px rgba(244, 162, 97, 0.5);
}

.tb-pill-btn.active-mute {
    background: #4b5563;
    color: #ffffff;
    border-color: #9ca3af;
}

.mastering-drawer-switch {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin-top: 8px;
}

.mastering-drawer-switch .tb-pill-btn {
    justify-content: center;
    height: 33px;
    font-size: 11px;
}


/* ==================== V30.3 AGCOM LUFS & TRUE PEAK METER ==================== */
.lufs-meter-badge {
    position: absolute;
    bottom: 30px;
    left: 12px;
    background: rgba(12, 13, 16, 0.94);
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 8px 10px;
    border-radius: 8px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    color: #e2e8f0;
    z-index: 12;
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.lufs-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 9px;
    font-weight: 800;
    color: var(--gold);
    letter-spacing: 0.5px;
    border-bottom: 1px dashed rgba(255,255,255,0.15);
    padding-bottom: 4px;
}
.btn-lufs-reset {
    background: #333;
    border: 1px solid #555;
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    border-radius: 4px;
    padding: 2px 6px;
    cursor: pointer;
}
.btn-lufs-reset:hover { background: #444; border-color: #777; }
.lufs-grid {
    display: flex;
    gap: 12px;
    align-items: center;
}
.lufs-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}
.lufs-val {
    font-size: 13px;
    font-weight: 800;
    color: #fff;
}
.lufs-lbl {
    font-size: 9px;
    font-weight: 600;
    color: #94a3b8;
}
.lufs-col.target-ok .lufs-val { color: #7ee2d5; }
.lufs-col.target-warn .lufs-val { color: #fca5a5; }
.lufs-col.target-high .lufs-val { color: #ff6b6b; }


/* ==================== V31.0 STUDIO DAW SELECTOR & MMC LOCATE ==================== */
.badge-daw {
    color: #fde68a;
    background: rgba(244, 162, 97, 0.14);
    border-color: rgba(244, 162, 97, 0.45);
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.badge-daw:hover {
    background: rgba(244, 162, 97, 0.25);
    border-color: var(--gold);
}

.marker-tc.clickable-tc {
    cursor: pointer;
    text-decoration: underline dotted rgba(138, 180, 248, 0.65);
    transition: color 0.15s;
}

.marker-tc.clickable-tc:hover {
    color: var(--meet-blue);
}


/* ==================== V31.1 MULTICHANNEL & SURROUND UI ==================== */
.preset-row-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    margin-bottom: 10px;
}

#preset-surround.active, #live-preset-surround.active {
    background: #6366f1;
    border-color: #6366f1;
    color: #ffffff;
}

.multi-fader-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 6px;
    padding: 6px 8px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 6px;
}

.fader-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.fader-row label {
    font-size: 10px;
    font-weight: 700;
    color: var(--meet-blue);
    width: 28px;
    white-space: nowrap;
}

.fader-row input[type="range"] {
    flex: 1;
    height: 3px;
}
.fader-row input[type="range"]::-webkit-slider-thumb {
    height: 12px;
    width: 12px;
}

.surround-badge {
    background: #4f46e5;
    color: #fff;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.5px;
    margin-left: 6px;
}


/* ==================== V41.8 ADAPTIVE DAW SKINS & ROLE ERGONOMICS ==================== */
:root {
    --daw-accent: #e63946;
    --daw-accent-soft: rgba(230, 57, 70, 0.16);
    --daw-tc-bg: #0b0c0e;
    --daw-tc-fg: #ffffff;
    --daw-tc-border: #2f333a;
    --daw-tc-glow: none;
}

.badge-skin-toggle {
    cursor: pointer;
    color: var(--text-muted);
    background: var(--bg-card);
    border-color: var(--border);
    font-weight: 700;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.badge-skin-toggle.is-active {
    color: var(--daw-tc-fg);
    border-color: var(--daw-accent);
    background: var(--daw-accent-soft);
}

.rec-live-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.6px;
    padding: 4px 9px;
    border-radius: 6px;
    background: rgba(234, 67, 53, 0.22);
    border: 1px solid var(--meet-red);
    color: #ff9e96;
    animation: pulse-rec 1.4s infinite;
    white-space: nowrap;
}

/* Applicazione token LCD e plancia quando il tema DAW è attivo */
html[data-daw-skin="on"] .tc-readout {
    background: var(--daw-tc-bg);
    color: var(--daw-tc-fg);
    border-color: var(--daw-tc-border);
    box-shadow: var(--daw-tc-glow);
}

html[data-daw-skin="on"] .tab-btn.active {
    box-shadow: inset 0 -2px 0 var(--daw-accent);
}

html[data-daw-skin="on"] .badge-daw {
    color: var(--daw-tc-fg);
    background: var(--daw-accent-soft);
    border-color: var(--daw-accent);
}

/* 1. AVID PRO TOOLS — Antracite Console, LCD Verde Fosforo & Memory Locations Viola */
html[data-daw-skin="on"][data-daw="protools"] {
    --bg-dark: #141517;
    --bg-panel: #1d1f23;
    --bg-card: #26292e;
    --border: #383c44;
    --daw-accent: #9b72f2;
    --daw-accent-soft: rgba(155, 114, 242, 0.18);
    --daw-tc-bg: #07140c;
    --daw-tc-fg: #39ff88;
    --daw-tc-border: #1e5635;
    --daw-tc-glow: inset 0 0 12px rgba(57, 255, 136, 0.18);
}

html[data-daw-skin="on"][data-daw="protools"] .timecode-bar {
    background: #181a1e;
    border-bottom-color: #343841;
}

html[data-daw-skin="on"][data-daw="protools"] .marker-card {
    border-left-color: #9b72f2;
}

/* 2. STEINBERG NUENDO / CUBASE — Slate Blu-Grigio, LCD Ciano Elettrico & ADR Spotting */
html[data-daw-skin="on"][data-daw="nuendo"] {
    --bg-dark: #12171e;
    --bg-panel: #19202a;
    --bg-card: #222b38;
    --border: #313e50;
    --daw-accent: #0ea5e9;
    --daw-accent-soft: rgba(14, 165, 233, 0.18);
    --daw-tc-bg: #08141f;
    --daw-tc-fg: #38bdf8;
    --daw-tc-border: #1d4e73;
    --daw-tc-glow: inset 0 0 12px rgba(56, 189, 248, 0.18);
}

html[data-daw-skin="on"][data-daw="nuendo"] .timecode-bar {
    background: #141b24;
    border-bottom-color: #2b384a;
}

html[data-daw-skin="on"][data-daw="nuendo"] .tc-mode-pill.mtc-active {
    background: rgba(14, 165, 233, 0.24);
    border-color: #38bdf8;
    color: #bae6fd;
}

/* 3. APPLE LOGIC PRO — Grafite macOS & Display LCD Centrale Blu-Ardesia */
html[data-daw-skin="on"][data-daw="logic"] {
    --bg-dark: #161618;
    --bg-panel: #202024;
    --bg-card: #2a2a30;
    --border: #3c3c44;
    --daw-accent: #38bdf8;
    --daw-accent-soft: rgba(56, 189, 248, 0.16);
    --daw-tc-bg: #182b40;
    --daw-tc-fg: #e0f2fe;
    --daw-tc-border: #3b638c;
    --daw-tc-glow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 2px 8px rgba(0, 0, 0, 0.35);
}

html[data-daw-skin="on"][data-daw="logic"] .tc-readout {
    border-radius: 10px;
    padding: 4px 16px;
}

html[data-daw-skin="on"][data-daw="logic"] .settings-card,
html[data-daw-skin="on"][data-daw="logic"] .participant-card,
html[data-daw-skin="on"][data-daw="logic"] .marker-card {
    border-radius: 11px;
}

/* 4. COCKOS REAPER — Consolle Scura Smeraldo & Accenti Teal/Rame */
html[data-daw-skin="on"][data-daw="reaper"] {
    --bg-dark: #131615;
    --bg-panel: #1b201e;
    --bg-card: #242b28;
    --border: #343e3a;
    --daw-accent: #14b8a6;
    --daw-accent-soft: rgba(20, 184, 166, 0.18);
    --daw-tc-bg: #081715;
    --daw-tc-fg: #2dd4bf;
    --daw-tc-border: #1b4d46;
    --daw-tc-glow: inset 0 0 10px rgba(45, 212, 191, 0.16);
}

/* 5. DAVINCI RESOLVE FAIRLIGHT — Ossidiana Profonda & Accenti Ambra Broadcast */
html[data-daw-skin="on"][data-daw="fairlight"] {
    --bg-dark: #0c0d10;
    --bg-panel: #15171c;
    --bg-card: #1e2128;
    --border: #2e333d;
    --daw-accent: #f59e0b;
    --daw-accent-soft: rgba(245, 158, 11, 0.18);
    --daw-tc-bg: #171207;
    --daw-tc-fg: #fbbf24;
    --daw-tc-border: #5c4314;
    --daw-tc-glow: inset 0 0 12px rgba(251, 191, 36, 0.16);
}

html[data-daw-skin="on"][data-daw="fairlight"] .timecode-bar {
    background: #101216;
    border-bottom-color: #292d36;
}

html[data-daw-skin="on"][data-daw="fairlight"] .lufs-meter-badge {
    border-color: rgba(245, 158, 11, 0.45);
}

/* ==================== ROLE-AWARE ERGONOMICS (SPEAKER & CLIENT) ==================== */
body[data-user-role="client"] #tc-master-controls,
body[data-user-role="speaker"] #tc-master-controls {
    display: none !important;
}

body[data-user-role="client"] #tab-btn-diag {
    display: none !important;
}

body[data-user-role="client"] .tc-note-input {
    width: 210px;
}

body[data-user-role="client"] #daw-selector-row,
body[data-user-role="client"] #live-studio-daw-select,
body[data-user-role="client"] #midi-diag-box,
body[data-user-role="client"] #btn-export-daw-markers,
body[data-user-role="client"] #btn-export-midi-fallback,
body[data-user-role="client"] button[onclick="clearMarkers()"],
body[data-user-role="speaker"] button[onclick="clearMarkers()"] {
    display: none !important;
}


.btn-client-signoff {
    padding: 2px 6px;
    font-size: 10px;
    font-weight: 800;
    border-radius: 4px;
    border: 1px solid #444;
    background: #232529;
    color: #cbd5e1;
    cursor: pointer;
}
.btn-client-signoff.approved { background: rgba(42, 157, 143, 0.22); border-color: #2a9d8f; color: #7ee2d5; }
.btn-client-signoff.rejected { background: rgba(234, 67, 53, 0.22); border-color: #ea4335; color: #ff9e96; }

/* ==================== V42.6 VIRTUAL SOUNDCHECK WIZARD (SPEAKER) ==================== */
.soundcheck-card {
    border-color: rgba(42, 157, 143, 0.45);
    background: linear-gradient(180deg, rgba(42, 157, 143, 0.08) 0%, var(--bg-card) 100%);
}

.sc-pill {
    font-size: 10px;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.sc-pill.pending { background: #333; color: #aaa; }
.sc-pill.running { background: rgba(244, 162, 97, 0.22); color: var(--gold); border: 1px solid var(--gold); }
.sc-pill.pass { background: rgba(42, 157, 143, 0.22); color: #7ee2d5; border: 1px solid var(--teal); }
.sc-pill.warn { background: rgba(233, 196, 106, 0.22); color: #f6dc96; border: 1px solid #e9c46a; }
.sc-pill.fail { background: rgba(234, 67, 53, 0.22); color: #ff9e96; border: 1px solid var(--meet-red); }

.sc-progress-track {
    width: 100%;
    height: 6px;
    background: #141518;
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid #2e3138;
}

.sc-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--teal), var(--meet-blue));
    transition: width 0.12s linear;
}

.sc-prompt-box {
    margin-top: 7px;
    padding: 7px 9px;
    border-radius: 7px;
    background: #16181d;
    border: 1px dashed #3f4451;
    font-size: 11.5px;
    color: #f1faee;
    line-height: 1.4;
}

.sc-results-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-top: 8px;
}

.sc-metric-box {
    background: #17191e;
    border: 1px solid #2f333c;
    border-radius: 7px;
    padding: 6px 7px;
}

.sc-metric-box.ok { border-color: rgba(42, 157, 143, 0.6); }
.sc-metric-box.warn { border-color: rgba(233, 196, 106, 0.6); }
.sc-metric-box.fail { border-color: rgba(234, 67, 53, 0.6); }

.sc-m-title {
    font-size: 10px;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.sc-m-val {
    font-size: 11px;
    font-weight: 700;
    color: #fff;
}

.p-soundcheck-badge {
    font-size: 11px;
    padding: 5px 8px;
    border-radius: 6px;
    margin-bottom: 8px;
    line-height: 1.35;
}

.p-soundcheck-badge.pass {
    background: rgba(42, 157, 143, 0.14);
    border: 1px solid rgba(42, 157, 143, 0.45);
    color: #7ee2d5;
}

.p-soundcheck-badge.warn {
    background: rgba(233, 196, 106, 0.14);
    border: 1px solid rgba(233, 196, 106, 0.45);
    color: #f6dc96;
}

.p-soundcheck-badge.fail {
    background: rgba(234, 67, 53, 0.14);
    border: 1px solid rgba(234, 67, 53, 0.45);
    color: #ff9e96;
}

@media (max-width: 768px) {
    .sc-results-grid { grid-template-columns: 1fr; }
}

/* ==================== V42.9 DYNAMIC ANTI-LEAK VIDEO WATERMARK ==================== */
.antileak-watermark-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
    overflow: hidden;
    z-index: 14;
}

.antileak-tiled-grid {
    position: absolute;
    inset: -40%;
    display: flex;
    flex-wrap: wrap;
    align-content: space-around;
    justify-content: space-around;
    gap: 36px 48px;
    transform: rotate(-24deg);
    opacity: 0.16;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 11px;
    font-weight: 800;
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
    white-space: nowrap;
}

.antileak-floating-badge {
    position: absolute;
    top: 22%;
    left: 14%;
    background: rgba(10, 12, 16, 0.56);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 6px;
    padding: 4px 9px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 10.5px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.88);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.95);
    letter-spacing: 0.3px;
    transition: top 2.2s ease-in-out, left 2.2s ease-in-out;
    white-space: nowrap;
}

.sync-stage-card.on-stage .antileak-floating-badge {
    font-size: 13px;
    padding: 6px 12px;
}
