/*
 * RC_Overlay — panel operatora w identyfikacji WTS.
 * Jeden system wizualny: tokeny kolorów, typografia Exo i wspólne komponenty.
 * Szablony nie używają stylów inline — nowe elementy buduj z klas poniżej.
 */

/* ---------- Fonty WTS (Exo, lokalnie) ---------- */
@font-face { font-family: "Exo"; font-weight: 400; font-style: normal; font-display: swap; src: url("../fonts/exo/Exo-Regular.ttf") format("truetype"); }
@font-face { font-family: "Exo"; font-weight: 500; font-style: normal; font-display: swap; src: url("../fonts/exo/Exo-Medium.ttf") format("truetype"); }
@font-face { font-family: "Exo"; font-weight: 600; font-style: normal; font-display: swap; src: url("../fonts/exo/Exo-SemiBold.ttf") format("truetype"); }
@font-face { font-family: "Exo"; font-weight: 700; font-style: normal; font-display: swap; src: url("../fonts/exo/Exo-Bold.ttf") format("truetype"); }
@font-face { font-family: "Exo"; font-weight: 800; font-style: normal; font-display: swap; src: url("../fonts/exo/Exo-ExtraBold.ttf") format("truetype"); }

/* ---------- Tokeny ---------- */
:root {
    --bg: #0d0f12;
    --surface: #15181d;
    --surface-2: #1c2027;
    --surface-3: #242932;
    --border: #2a2f37;
    --border-strong: #3a414c;

    --text: #eef0f3;
    --text-muted: #a3abb6;
    --text-subtle: #737c88;

    --accent: #ff6600;
    --accent-hover: #ff7d29;
    --accent-press: #e65c00;
    --accent-soft: rgba(255, 102, 0, 0.12);
    --accent-border: rgba(255, 102, 0, 0.45);
    --on-accent: #160b02;

    --success: #36c77b;
    --success-soft: rgba(54, 199, 123, 0.12);
    --warning: #f4b740;
    --warning-soft: rgba(244, 183, 64, 0.12);
    --danger: #f2555a;
    --danger-soft: rgba(242, 85, 90, 0.12);
    --info: #5aa9ff;

    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 14px;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    --focus: 0 0 0 3px rgba(255, 102, 0, 0.35);

    --font: "Exo", "Segoe UI", system-ui, -apple-system, sans-serif;
    --font-mono: "JetBrains Mono", "Cascadia Mono", Consolas, monospace;

    --header-h: 60px;
}

/* ---------- Baza ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; line-height: 1.2; font-weight: 700; color: var(--text); }
p { margin: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }
img { max-width: 100%; }
code, kbd, .mono { font-family: var(--font-mono); }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--radius-sm); }
[hidden] { display: none !important; }

.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ---------- Nagłówek aplikacji ---------- */
.app-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(13, 15, 18, 0.92);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
}

.app-header__inner {
    max-width: 1200px;
    height: var(--header-h);
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    gap: 28px;
}

.brand { display: flex; align-items: center; gap: 10px; color: var(--text); flex-shrink: 0; }
.brand:hover { color: var(--text); text-decoration: none; }
/* Kadr samego znaku WTS z pełnego logo (plik 1402×500, znak w obszarze x 25–315, y 95–345) */
.brand-mark { position: relative; width: 40px; height: 34px; overflow: hidden; flex-shrink: 0; }
.brand-mark img { position: absolute; height: 68px; width: auto; max-width: none; left: -3px; top: -13px; }
.brand-name { font-weight: 800; font-size: 16px; letter-spacing: 0.02em; }
.brand-name span { color: var(--accent); }

.main-nav { display: flex; align-items: center; gap: 4px; flex: 1; }
.main-nav a {
    color: var(--text-muted);
    font-weight: 600;
    font-size: 14px;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    white-space: nowrap;
}
.main-nav a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.main-nav a.is-active { color: var(--text); background: var(--surface-2); box-shadow: inset 0 -2px 0 var(--accent); }

.header-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }

/* ---------- Menu rozwijane (details/summary) ---------- */
.dropdown { position: relative; }
.dropdown > summary { list-style: none; cursor: pointer; }
.dropdown > summary::-webkit-details-marker { display: none; }

.dropdown-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    min-width: 200px;
    padding: 6px;
    background: var(--surface-2);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    z-index: 200;
}
.dropdown-menu a,
.dropdown-menu button {
    display: flex;
    width: 100%;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: 14px;
    text-align: left;
    cursor: pointer;
}
.dropdown-menu a:hover,
.dropdown-menu button:hover { background: var(--surface-3); text-decoration: none; color: var(--text); }
.dropdown-menu .is-danger { color: var(--danger); }
.dropdown-menu hr { border: 0; border-top: 1px solid var(--border); margin: 6px 0; }
.dropdown-menu form { margin: 0; }
.dropdown-menu__label { padding: 6px 10px 8px; font-size: 13px; color: var(--text-muted); }
.dropdown-menu__label strong { display: block; color: var(--text); font-size: 14px; }

.user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 10px 5px 5px;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
}
.user-chip:hover { border-color: var(--border-strong); background: var(--surface-2); }
.avatar {
    width: 28px; height: 28px;
    display: grid; place-items: center;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 800;
    font-size: 13px;
    text-transform: uppercase;
}

/* ---------- Główna treść ---------- */
.app-main { flex: 1; width: 100%; padding: 32px 20px 56px; }
.container { max-width: 1120px; margin: 0 auto; }
.container--narrow { max-width: 760px; }
.container--auth { max-width: 420px; padding-top: 24px; }
.container--xs { max-width: 420px; }

.page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}
.page-title { font-size: 28px; font-weight: 800; letter-spacing: -0.01em; }
.page-subtitle { margin-top: 6px; color: var(--text-muted); font-size: 15px; }
.page-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.back-link { display: inline-flex; gap: 6px; align-items: center; color: var(--text-muted); font-size: 14px; margin-bottom: 10px; }
.back-link:hover { color: var(--text); }

.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-lg { display: flex; flex-direction: column; gap: 24px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.muted { color: var(--text-muted); }
.subtle { color: var(--text-subtle); }
.small { font-size: 13px; }
.text-right { text-align: right; }
.mb-0 { margin-bottom: 0 !important; }
.mb-sm { margin-bottom: 10px; }
.mb { margin-bottom: 20px; }
.mt-sm { margin-top: 8px; }

/* ---------- Przyciski ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    padding: 8px 16px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    color: var(--text);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.05s;
}
.btn:hover { background: var(--surface-3); border-color: #4a525e; color: var(--text); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn.is-disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }

.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 700; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--on-accent); }
.btn-primary:active { background: var(--accent-press); }

.btn-ghost { background: transparent; border-color: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--surface-2); border-color: transparent; color: var(--text); }

.btn-danger { background: transparent; border-color: rgba(242, 85, 90, 0.45); color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }

.btn-sm { min-height: 32px; padding: 5px 12px; font-size: 13px; }
.btn-lg { min-height: 48px; padding: 12px 22px; font-size: 16px; }
.btn-block { width: 100%; }
.btn-icon { width: 40px; padding: 0; }
.btn-icon.btn-sm { width: 32px; }

.segmented { display: inline-flex; padding: 3px; gap: 3px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.segmented button {
    min-height: 30px;
    padding: 4px 12px;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: var(--text-muted);
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}
.segmented button:hover { color: var(--text); }
.segmented button.is-active { background: var(--accent); color: var(--on-accent); }

/* ---------- Karty ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
}
.card-sm { padding: 16px 18px; }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card-title { font-size: 17px; font-weight: 700; }
.card-subtitle { margin-top: 4px; font-size: 14px; color: var(--text-muted); }
.section-label {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-subtle);
    margin-bottom: 10px;
}

/* ---------- Formularze ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .field-label { font-size: 14px; font-weight: 600; color: var(--text); }
.field-help { font-size: 13px; color: var(--text-subtle); }
.field-error, .errorlist { color: var(--danger); font-size: 13px; margin: 0; padding: 0; list-style: none; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 20px; }
.form-grid .span-2 { grid-column: 1 / -1; }

.form-control,
input[type="text"], input[type="email"], input[type="password"], input[type="url"],
input[type="number"], input[type="search"], select, textarea {
    width: 100%;
    min-height: 42px;
    padding: 9px 12px;
    background: var(--bg);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    color: var(--text);
    font: inherit;
    font-size: 15px;
    transition: border-color 0.15s, box-shadow 0.15s;
}
textarea { min-height: 90px; resize: vertical; }
.form-control:focus, input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus); }
input[readonly] { color: var(--text-muted); }
input:disabled { opacity: 0.6; cursor: not-allowed; }
select { cursor: pointer; }

input[type="color"] {
    width: 56px; height: 42px; padding: 3px;
    background: var(--bg);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    cursor: pointer;
}
input[type="file"] { color: var(--text-muted); font: inherit; font-size: 14px; min-height: 0; padding: 0; border: 0; background: none; }
input[type="file"]::file-selector-button {
    margin-right: 12px;
    padding: 8px 14px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    color: var(--text);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}
input[type="file"]::file-selector-button:hover { background: var(--surface-3); }
input[type="range"] { width: 100%; accent-color: var(--accent); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); width: 18px; height: 18px; margin: 0; cursor: pointer; }

.check {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-2);
    cursor: pointer;
}
.check:hover { border-color: var(--border-strong); }
.check input { margin-top: 2px; flex-shrink: 0; }
.check strong { display: block; font-size: 14px; }
.check span { font-size: 13px; color: var(--text-muted); }
.check-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 20px;
    margin-top: 24px;
    border-top: 1px solid var(--border);
}

/* ---------- Odznaki i statusy ---------- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 9px;
    border-radius: 999px;
    border: 1px solid var(--border-strong);
    background: var(--surface-2);
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.02em;
    white-space: nowrap;
}
.badge-accent { background: var(--accent-soft); border-color: var(--accent-border); color: var(--accent); }
.badge-success { background: var(--success-soft); border-color: rgba(54, 199, 123, 0.4); color: var(--success); }
.badge-danger { background: var(--danger-soft); border-color: rgba(242, 85, 90, 0.4); color: var(--danger); }

.status { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--text-muted); white-space: nowrap; }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--text-subtle); flex-shrink: 0; }
.status--ok::before { background: var(--success); box-shadow: 0 0 0 3px var(--success-soft); }
.status--warn::before { background: var(--warning); box-shadow: 0 0 0 3px var(--warning-soft); animation: pulse 1.4s infinite; }
.status--off::before { background: var(--danger); }

@keyframes pulse { 50% { opacity: 0.35; } }

.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.25); flex-shrink: 0; }

/* ---------- Komunikaty ---------- */
.messages { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.alert {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 14px;
    border-radius: var(--radius);
    border: 1px solid var(--border-strong);
    background: var(--surface-2);
    font-size: 14px;
}
.alert-body { flex: 1; }
.alert-close { border: 0; background: none; color: inherit; opacity: 0.6; cursor: pointer; font-size: 18px; line-height: 1; padding: 0 2px; }
.alert-close:hover { opacity: 1; }
.alert-success { border-color: rgba(54, 199, 123, 0.4); background: var(--success-soft); }
.alert-error { border-color: rgba(242, 85, 90, 0.45); background: var(--danger-soft); }
.alert-warning { border-color: rgba(244, 183, 64, 0.45); background: var(--warning-soft); }
.alert-info { border-color: var(--accent-border); background: var(--accent-soft); }

.toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%);
    z-index: 500;
    max-width: calc(100vw - 32px);
    padding: 12px 18px;
    border-radius: var(--radius);
    background: var(--surface-3);
    border: 1px solid var(--border-strong);
    box-shadow: var(--shadow);
    font-size: 14px;
    font-weight: 600;
}

/* ---------- Zakładki ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 24px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tab {
    padding: 10px 16px;
    border: 0;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    background: none;
    color: var(--text-muted);
    font: inherit;
    font-size: 15px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
}
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--text); border-bottom-color: var(--accent); }

/* ---------- Tabele ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    color: var(--text-subtle);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    text-align: left;
    white-space: nowrap;
}
.table td { padding: 11px 12px; border-bottom: 1px solid var(--border); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: rgba(255, 255, 255, 0.02); }
.table .num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.table .pos { font-weight: 800; color: var(--accent); width: 48px; }
.table-empty { text-align: center; color: var(--text-subtle); padding: 32px 12px !important; }

/* ---------- Pole kopiowania linku ---------- */
.copy-field { display: flex; gap: 8px; }
.copy-field input { font-family: var(--font-mono); font-size: 13px; color: var(--text); }
.copy-field .btn { flex-shrink: 0; }

/* ---------- Pusty stan ---------- */
.empty-state { text-align: center; padding: 56px 24px; }
.empty-state img { width: 72px; opacity: 0.9; margin-bottom: 16px; }
.empty-state h2 { font-size: 22px; margin-bottom: 8px; }
.empty-state p { max-width: 460px; margin: 0 auto 24px; color: var(--text-muted); }
.steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; text-align: left; margin: 0 auto 28px; max-width: 720px; padding: 0; list-style: none; counter-reset: step; }
.steps li { counter-increment: step; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); font-size: 14px; color: var(--text-muted); }
.steps li::before { content: counter(step); display: grid; place-items: center; width: 24px; height: 24px; margin-bottom: 8px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 800; font-size: 13px; }
.steps li strong { color: var(--text); }

/* ---------- Lista nakładek ---------- */
.overlay-card { display: flex; flex-direction: column; gap: 18px; }
.overlay-card__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.overlay-card__title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 19px; font-weight: 700; }
.overlay-card__meta { margin-top: 6px; display: flex; gap: 14px; flex-wrap: wrap; font-size: 14px; color: var(--text-muted); }
.overlay-card__meta span { display: inline-flex; align-items: center; gap: 6px; }
.overlay-card.is-inactive { opacity: 0.7; }

.obs-help { font-size: 13px; color: var(--text-muted); }
.obs-help summary { cursor: pointer; color: var(--text-muted); font-weight: 600; width: fit-content; }
.obs-help summary:hover { color: var(--text); }
.obs-help ol { margin: 10px 0 0; padding-left: 20px; line-height: 1.8; }

.plan-note { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 16px; margin-bottom: 20px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); font-size: 14px; color: var(--text-muted); }

/* ---------- Ustawienia nakładki: podgląd na żywo ---------- */
/* Nakładka ma przezroczyste tło — podgląd pokazuje ją na tle przypominającym obraz z kamery */
.preview-frame {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    background:
        radial-gradient(60% 50% at 70% 75%, rgba(92, 120, 84, 0.55), transparent 70%),
        radial-gradient(120% 90% at 30% 30%, #5b646c 0%, #2c3338 55%, #14181b 100%);
}
.preview-frame > iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 1920px;
    height: 1080px;
    border: 0;
    transform-origin: 0 0;
    pointer-events: none;
}
.preview-note { display: block; margin-top: 8px; }

/* ---------- Ustawienia nakładki: motyw ---------- */
.theme-grid { --theme-color: var(--accent); display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.theme-option { position: relative; display: block; cursor: pointer; }
.theme-option input { position: absolute; opacity: 0; pointer-events: none; }
.theme-option__card {
    display: flex;
    flex-direction: column;
    gap: 4px;
    height: 100%;
    padding: 10px 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-2);
    transition: border-color 0.15s, background 0.15s;
}
.theme-option__card strong { margin-top: 6px; font-size: 14px; }
.theme-option__card > span:last-child { font-size: 13px; color: var(--text-muted); line-height: 1.4; }
.theme-option:hover .theme-option__card { border-color: var(--border-strong); }
.theme-option input:checked + .theme-option__card { border-color: var(--accent); background: var(--accent-soft); }
.theme-option input:focus-visible + .theme-option__card { box-shadow: var(--focus); }

/* Źródło danych nakładki (MyRCM / Demo race) — karty bez miniatury */
.source-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.source-option .theme-option__card { padding: 12px 14px; }
.source-option .theme-option__card strong { margin-top: 0; }

/* Miniatura motywu: baner w lewym górnym rogu i wieża wyników po prawej */
.theme-thumb {
    --thumb-clock: #050505;
    --thumb-row: rgba(15, 20, 26, 0.85);
    --thumb-row-line: rgba(255, 255, 255, 0.35);
    position: relative;
    display: block;
    aspect-ratio: 16 / 9;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: radial-gradient(120% 90% at 30% 30%, #5b646c 0%, #2c3338 60%, #171b1e 100%);
}
.theme-thumb--light { --thumb-clock: #ffffff; --thumb-row: rgba(255, 255, 255, 0.9); --thumb-row-line: rgba(20, 23, 28, 0.35); }
.theme-thumb--accent { --thumb-clock: var(--theme-color); --thumb-row: rgba(10, 12, 16, 0.88); }
.theme-thumb__banner {
    position: absolute;
    top: 9%;
    left: 6%;
    width: 42%;
    height: 11%;
    background: var(--theme-color);
    clip-path: polygon(6% 0, 100% 0, 94% 100%, 0 100%);
}
.theme-thumb__tower {
    position: absolute;
    top: 9%;
    right: 6%;
    width: 30%;
    height: 60%;
    display: flex;
    flex-direction: column;
}
.theme-thumb--accent .theme-thumb__tower { border-left: 2px solid var(--theme-color); }
.theme-thumb__tower i { display: flex; align-items: center; flex: 1 1 0; background: var(--thumb-row); }
.theme-thumb__tower i::before { content: ""; width: 55%; height: 2px; margin-left: 18%; background: var(--thumb-row-line); }
.theme-thumb__tower i:first-child { background: var(--thumb-clock); border-bottom: 1px solid var(--theme-color); }
.theme-thumb__tower i:first-child::before { display: none; }

/* ---------- Ustawienia nakładki: kolor ---------- */
.color-picker { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.color-picker__current { display: inline-flex; align-items: center; gap: 10px; }
.color-picker__current code { min-width: 64px; font-size: 14px; color: var(--text-muted); }
.color-presets { display: inline-flex; gap: 8px; flex-wrap: wrap; }
.color-preset {
    width: 28px;
    height: 28px;
    padding: 0;
    border: 2px solid var(--surface);
    border-radius: 50%;
    background: var(--swatch);
    box-shadow: 0 0 0 1px var(--border-strong);
    cursor: pointer;
    transition: transform 0.12s, box-shadow 0.12s;
}
.color-preset:hover { transform: scale(1.1); }
.color-preset[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--text); }

.range-row { display: flex; align-items: center; gap: 14px; }
.range-row output { min-width: 48px; text-align: right; font-family: var(--font-mono); font-size: 14px; color: var(--text-muted); }
.logo-preview { margin-top: 10px; max-height: 56px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--bg); padding: 4px; }

/* ---------- Ustawienia nakładki: układ ---------- */
.layout-card { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 18px; align-items: center; }
.layout-card__side { display: flex; flex-direction: column; gap: 14px; font-size: 14px; color: var(--text-muted); }
.layout-card__side p { margin: 0; line-height: 1.5; }
.layout-card__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.layout-card__status { padding: 8px 12px; border: 1px solid var(--accent-border); border-radius: var(--radius-sm); background: var(--accent-soft); color: var(--text); }

/* ---------- Edytor rozstawu (pełny ekran) ---------- */
.studio {
    width: 100vw;
    height: 100vh;
    max-width: none;
    max-height: none;
    margin: 0;
    padding: 0;
    border: 0;
    background: var(--bg);
    color: var(--text);
}
.studio[open] { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
.studio::backdrop { background: rgba(0, 0, 0, 0.6); }
.studio__bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}
.studio__title { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 360px; }
.studio__title strong { font-size: 16px; }
.studio__title span { font-size: 13px; color: var(--text-muted); }
.studio__actions { display: flex; gap: 8px; }
.studio__stage { display: grid; place-items: center; padding: 20px; overflow: hidden; }
.studio__screen { width: 100%; aspect-ratio: auto; box-shadow: var(--shadow); user-select: none; touch-action: none; }
.studio__boxes { position: absolute; inset: 0; }
.studio-box {
    position: absolute;
    border: 1px dashed rgba(255, 255, 255, 0.55);
    border-radius: 2px;
    cursor: move;
    transition: border-color 0.12s, background 0.12s;
}
.studio-box:hover { border-color: #fff; background: rgba(255, 255, 255, 0.06); }
.studio-box.is-selected { border: 2px solid var(--accent); background: rgba(255, 102, 0, 0.08); z-index: 2; }
.studio-box__label {
    position: absolute;
    left: -2px;
    bottom: 100%;
    margin-bottom: 4px;
    padding: 2px 8px;
    border-radius: 4px;
    background: rgba(13, 15, 18, 0.88);
    color: var(--text);
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.12s;
}
.studio-box.is-at-top .studio-box__label { top: 100%; bottom: auto; margin: 4px 0 0; }
.studio-box:hover .studio-box__label,
.studio-box.is-selected .studio-box__label { opacity: 1; }
.studio-box.is-selected .studio-box__label { background: var(--accent); color: var(--on-accent); }
.studio-box__handle {
    position: absolute;
    display: none;
    width: 14px;
    height: 14px;
    border: 2px solid var(--bg);
    border-radius: 3px;
    background: var(--accent);
}
.studio-box__handle::after { content: ""; position: absolute; inset: -7px; }
.studio-box.is-selected .studio-box__handle { display: block; }
.studio-box__handle--se { right: -8px; bottom: -8px; cursor: nwse-resize; }
.studio-box__handle--e { right: -8px; top: calc(50% - 7px); cursor: ew-resize; }
.studio__guide { position: absolute; z-index: 3; background: #2ee6a8; pointer-events: none; }
.studio__guide--v { top: 0; bottom: 0; width: 1px; }
.studio__guide--h { left: 0; right: 0; height: 1px; }
.studio__inspector {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px 24px;
    flex-wrap: wrap;
    padding: 12px 20px;
    border-top: 1px solid var(--border);
    background: var(--surface);
}
.studio__chips { display: flex; flex-wrap: wrap; gap: 6px; }
.studio-chip {
    padding: 5px 12px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--text-muted);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}
.studio-chip:hover:not(:disabled) { color: var(--text); border-color: var(--border-strong); }
.studio-chip.is-active { border-color: var(--accent); color: var(--text); background: var(--accent-soft); }
.studio-chip:disabled { opacity: 0.45; cursor: not-allowed; }
.studio__fields { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.studio__field { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--text-muted); }
.studio__field[hidden] { display: none; }
.studio__field input[type="number"] { width: 84px; min-height: 34px; padding: 5px 8px; font-size: 14px; }
.studio__field--scale input { width: 140px; }
.studio__field--scale output { min-width: 42px; font-family: var(--font-mono); color: var(--text); }

/* ---------- Reżyserka ---------- */
.director-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.director-top__title { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.director-top__status { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.director-top select { width: auto; min-width: 220px; }

.director-layout { display: grid; grid-template-columns: 400px minmax(0, 1fr); gap: 20px; align-items: start; }

.scene-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.scene-btn {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    min-height: 92px;
    padding: 14px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    background: var(--surface-2);
    color: var(--text);
    font: inherit;
    font-size: 16px;
    font-weight: 700;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}
.scene-btn:hover { border-color: #4a525e; background: var(--surface-3); }
.scene-btn kbd {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 1px 7px;
    border: 1px solid var(--border-strong);
    border-radius: 4px;
    font-size: 12px;
    color: var(--text-subtle);
}
.scene-btn small { font-size: 12px; font-weight: 600; color: var(--text-subtle); }
.scene-btn.is-active { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }
.scene-btn.is-active small, .scene-btn.is-active kbd { color: rgba(22, 11, 2, 0.75); border-color: rgba(22, 11, 2, 0.35); }

.event-form { display: flex; gap: 8px; }
.event-form input { font-family: var(--font-mono); font-size: 16px; }

.live-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.live-title { font-size: 18px; font-weight: 700; }
.timers { display: flex; gap: 10px; }
.timer { padding: 8px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); text-align: right; }
.timer span { display: block; font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-subtle); }
.timer strong { font-family: var(--font-mono); font-size: 20px; font-variant-numeric: tabular-nums; }
.timer--accent strong { color: var(--accent); }

.row-flash-ob td { background: rgba(176, 102, 255, 0.22) !important; }
.row-flash-pb td { background: rgba(54, 199, 123, 0.18) !important; }

/* ---------- Wyniki ---------- */
.event-card__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.heat-list { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.heat-list a { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px; color: var(--text); border-bottom: 1px solid var(--border); }
.heat-list a:last-child { border-bottom: 0; }
.heat-list a:hover { background: var(--surface-2); text-decoration: none; }

.stat-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat-tile { padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.stat-tile span { display: block; font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-subtle); }
.stat-tile strong { display: block; margin-top: 4px; font-size: 20px; }
.stat-tile small { color: var(--text-muted); font-size: 13px; }
.chart-box { position: relative; height: 360px; }
.delta-up { color: var(--success); font-weight: 700; }
.delta-down { color: var(--danger); font-weight: 700; }

/* ---------- Logowanie / rejestracja ---------- */
.auth-card { padding: 32px; }
.auth-head { text-align: center; margin-bottom: 24px; }
.auth-head img { height: 96px; margin: -16px 0 4px; }
.auth-head h1 { font-size: 24px; }
.auth-head p { margin-top: 6px; color: var(--text-muted); }
.auth-foot { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border); text-align: center; font-size: 14px; color: var(--text-muted); }

/* ---------- Stopka ---------- */
.app-footer { border-top: 1px solid var(--border); }
.app-footer__inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 18px 20px;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    font-size: 13px;
    color: var(--text-subtle);
}
.app-footer a { color: var(--text-muted); }

/* ---------- Responsywność ---------- */
@media (max-width: 1080px) {
    .director-layout { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
    .app-header__inner { height: auto; flex-wrap: wrap; gap: 10px; padding: 10px 16px; }
    .main-nav { order: 3; flex-basis: 100%; overflow-x: auto; }
    .user-chip__name { display: none; }
    .app-main { padding: 24px 16px 40px; }
    .page-title { font-size: 24px; }
    .card { padding: 18px; }
    .form-grid, .check-grid, .theme-grid, .source-grid, .steps, .layout-card { grid-template-columns: 1fr; }
    .theme-option__card { display: grid; grid-template-columns: 104px minmax(0, 1fr); gap: 2px 12px; align-items: center; }
    .theme-thumb { grid-row: 1 / span 2; }
    .theme-option__card strong { margin-top: 0; align-self: end; }
    .theme-option__card > span:last-child { align-self: start; }
    .studio__stage { padding: 10px; }
    .copy-field { flex-direction: column; }
    .event-form { flex-direction: column; }
}
