:root {
    --white: #ffffff;
    --ink: #1c1b19;
    --muted: #5c5852;
    --soft: #6a655e;
    --ocean: #3c6d76;
    --ocean-soft: #e7f0f1;
    --line: rgba(28, 27, 25, 0.12);
    --navy: #102a43;
    --navy-2: #18364f;
    --sand: #efe8e0;
    --paper: #f7f6f4;
    --rose: #e4c8c2;
    --ok: #2f6b4f;
    --ok-bg: #e5f2ea;
    --wait: #8a5a12;
    --wait-bg: #f8efd8;
    --danger: #8d3b32;
    --danger-bg: #f8e8e6;
    --side: 188px;
    --top: 52px;
    --radius: 18px;
    --shadow: 0 12px 28px rgba(16, 42, 67, 0.08);
    --ease: 0.4s cubic-bezier(0.2, 0.9, 0.2, 1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    color: var(--ink);
    background:
        radial-gradient(900px 420px at -10% -20%, rgba(60, 109, 118, 0.16), transparent 60%),
        radial-gradient(700px 380px at 110% 0%, rgba(228, 200, 194, 0.45), transparent 55%),
        var(--paper);
    font-family: Inter, "Segoe UI", sans-serif;
    font-size: 13.5px;
    line-height: 1.45;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
h1, h2, h3 {
    margin: 0;
    font-family: "Playfair Display", Georgia, serif;
    font-weight: 500;
    letter-spacing: -0.03em;
    line-height: 1.15;
}
p { margin: 0; }
img { max-width: 100%; display: block; }
::selection { background: #d5e4e7; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--ocean); outline-offset: 3px; }
.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); border: 0;
}

.app { min-height: 100vh; }
.side {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 30;
    width: var(--side);
    display: flex;
    flex-direction: column;
    background:
        radial-gradient(240px 180px at 20% 0%, rgba(60, 109, 118, 0.45), transparent 70%),
        linear-gradient(180deg, #17344d 0%, var(--navy) 42%, #0c2236 100%);
    color: #fff;
    box-shadow: 12px 0 40px rgba(16, 42, 67, 0.18);
    transition: transform var(--ease);
}
.side__brand {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0.55rem 0.7rem 0.35rem;
    color: #fff;
}
.side__brand span {
    font-family: "Playfair Display", Georgia, serif;
    font-size: 1.05rem;
    letter-spacing: -0.03em;
    line-height: 1;
}
.side__brand small {
    color: rgba(255, 255, 255, 0.55);
    font-size: 0.62rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}
.side__nav {
    overflow: auto;
    padding: 0.05rem 0.35rem 0.35rem;
}
.side__block {
    margin: 0.18rem 0.1rem 0;
    padding: 0.22rem 0.22rem 0.12rem;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.045);
}
.side__label {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin: 0 0.3rem 0.18rem;
    color: rgba(255, 255, 255, 0.48);
    font-size: 0.58rem;
    font-weight: 600;
    letter-spacing: 0.13em;
    text-transform: uppercase;
}
.side__label::after {
    content: "";
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.14);
}
.side__group { display: grid; gap: 1px; }
.side__link {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    min-height: 24px;
    padding: 0.08rem 0.35rem;
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.82);
    font-size: 12px;
    line-height: 1.15;
}
.side__link span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.side__link:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.side__link.is-active {
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    box-shadow: inset 2px 0 0 #d7ebe8;
}
.icon { width: 14px; height: 14px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.workspace { min-height: 100vh; margin-left: var(--side); }
.workspace.is-fit, .workspace.is-stage {
    height: 100vh;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.top {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: var(--top);
    padding: 0 1.25rem;
    background: rgba(247, 246, 244, 0.92);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(14px);
}
.top__title { margin-right: auto; font-weight: 600; }
.top__user { display: flex; align-items: center; gap: 0.75rem; }
.who { display: flex; flex-direction: column; line-height: 1.2; text-align: right; }
.who small { color: var(--muted); font-size: 0.75rem; }
.icon-btn {
    display: none;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--white);
}
.icon-btn span {
    display: block;
    width: 16px;
    height: 1.5px;
    margin: 4px auto;
    background: var(--navy);
}
.side-backdrop {
    position: fixed;
    inset: 0;
    z-index: 25;
    background: rgba(16, 42, 67, 0.42);
}
.canvas {
    width: min(1180px, calc(100% - 1.6rem));
    margin: 0 auto;
    padding: 0.7rem 0 1rem;
}
.workspace.is-fit .canvas, .workspace.is-stage .canvas {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding-bottom: 0.7rem;
}
.hero-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.7rem;
    margin-bottom: 0.55rem;
    flex: none;
}
.kicker {
    margin-bottom: 0.25rem;
    color: var(--ocean);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}
h1 { font-size: 1.45rem; }
.lede { max-width: 46rem; color: var(--muted); font-size: 0.82rem; }

.metrics {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.55rem;
    margin: 0 0 0.55rem;
    flex: none;
    perspective: 900px;
}
.metric, .panel, .admin-card {
    background:
        linear-gradient(180deg, rgba(255,255,255,.98), rgba(247,246,244,.94));
    border: 1px solid rgba(255,255,255,.8);
    border-radius: var(--radius);
    box-shadow: var(--shadow), inset 0 1px 0 #fff;
}
.metric {
    position: relative;
    overflow: hidden;
    padding: 0.65rem 0.75rem 0.6rem;
    transform-style: preserve-3d;
    transition: transform var(--ease), box-shadow var(--ease);
}
.metric::after, .btn--play::after, button[type="submit"]::after {
    content: "";
    position: absolute;
    inset: 0 auto 0 -40%;
    width: 38%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.72), transparent);
    transform: translateX(-30%);
    pointer-events: none;
}
.metric:hover {
    transform: translateY(-4px) rotateX(6deg);
    box-shadow: 0 18px 30px rgba(16, 42, 67, 0.14), inset 0 1px 0 #fff;
}
.metric:hover::after { transform: translateX(320%); transition: transform .7s ease; }
.metric span { display: block; color: var(--muted); font-size: 0.75rem; }
.metric strong {
    display: block;
    margin-top: 0.1rem;
    font-family: "Playfair Display", Georgia, serif;
    font-size: 1.55rem;
    font-weight: 500;
    letter-spacing: -0.03em;
}
.metric small { color: var(--soft); font-size: 0.78rem; }
.layout {
    display: grid;
    grid-template-columns: 1.35fr 0.8fr;
    gap: 0.55rem;
    min-height: 0;
    flex: 1;
}
.stack { display: grid; gap: 0.55rem; min-height: 0; }
.workspace.is-fit .stack { grid-auto-rows: minmax(0, 1fr); overflow: hidden; }
.workspace.is-fit .panel { min-height: 0; overflow: auto; }
.workspace.is-fit .canvas > .panel { flex: 1; min-height: 0; }
.workspace.is-fit .canvas > .btn, .workspace.is-fit .canvas > .lede { flex: none; align-self: flex-start; }
.panel { padding: 0.7rem 0.8rem 0.75rem; }
.panel h2 { margin-bottom: 0.45rem; font-size: 1.15rem; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 0.85rem; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td {
    padding: 0.42rem 0.3rem;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
}
th {
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
tr:last-child td { border-bottom: 0; }
tbody tr { transition: background var(--ease); }
tbody tr:hover { background: rgba(60, 109, 118, 0.04); }

.pill {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 0.55rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}
.pill--ok { background: var(--ok-bg); color: var(--ok); }
.pill--wait { background: var(--wait-bg); color: var(--wait); }
.pill--work { background: var(--ocean-soft); color: var(--ocean); }
.pill--muted { background: var(--sand); color: var(--muted); }

.btn, button[type="submit"], .tabs__bar button, .pip {
    position: relative;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 0 0.9rem;
    border: 0;
    border-radius: 999px;
    background: linear-gradient(180deg, #1c4468, var(--navy));
    color: #fff;
    font-weight: 600;
    box-shadow: 0 8px 16px rgba(16, 42, 67, 0.22), inset 0 1px 0 rgba(255,255,255,.28);
    transition: transform var(--ease), box-shadow var(--ease);
}
.btn:hover, button[type="submit"]:hover { transform: translateY(-2px); }
.btn:active, button[type="submit"]:active { transform: translateY(1px) scale(.98); box-shadow: 0 3px 8px rgba(16, 42, 67, 0.18); }
.btn--ghost, .top .btn--ghost {
    background: transparent;
    color: var(--ink);
    border: 1px solid var(--line);
}
.btn--ghost:hover { background: var(--white); }
.btn.is-busy { opacity: 0.65; }
.link {
    color: var(--ocean);
    font-weight: 600;
}
.actions { display: flex; flex-wrap: wrap; gap: 0.45rem; }

.note, .alert {
    margin-bottom: 0.8rem;
    padding: 0.75rem 0.9rem;
    border-radius: 12px;
}
.note { background: var(--ok-bg); color: var(--ok); }
.alert { background: var(--danger-bg); color: var(--danger); }
.empty {
    padding: 1.2rem 0.2rem 0.4rem;
    color: var(--muted);
}
.empty strong { display: block; margin-bottom: 0.2rem; color: var(--ink); font-weight: 600; }
.quick { display: grid; gap: 0.45rem; }
.quick a, .feed a {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.7rem 0;
    border-bottom: 1px solid var(--line);
}
.quick a:last-child, .feed li:last-child { border-bottom: 0; }
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { padding: 0.7rem 0; border-bottom: 1px solid var(--line); }
.feed small, .quick small { color: var(--muted); }

.form-grid, .tabs__panel .form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.8rem 0.9rem;
}
.field { display: grid; gap: 0.35rem; }
.field span, .check span { color: var(--muted); font-size: 0.82rem; font-weight: 600; }
.field--full { grid-column: 1 / -1; }
input, textarea, select {
    width: 100%;
    min-height: 44px;
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    transition: border-color var(--ease), box-shadow var(--ease);
}
textarea { min-height: 110px; resize: vertical; }
input:focus, textarea:focus, select:focus {
    border-color: var(--ocean);
    box-shadow: 0 0 0 4px rgba(60, 109, 118, 0.12);
}
.check {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    min-height: 44px;
}
.check input { width: 18px; height: 18px; min-height: 0; }
.form-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 0.4rem; }

.tabs__bar {
    display: flex;
    gap: 0.35rem;
    overflow-x: auto;
    margin-bottom: 1rem;
}
.tabs__bar button {
    background: rgba(16, 42, 67, 0.06);
    color: var(--ink);
    box-shadow: none;
    min-height: 34px;
    white-space: nowrap;
}
.tabs__bar button.is-on {
    background: linear-gradient(180deg, #1c4468, var(--navy));
    color: #fff;
    box-shadow: 0 8px 16px rgba(16, 42, 67, 0.2);
}
.tabs__panel { display: none; }
.tabs__panel.is-on { display: block; }
.callout {
    margin-bottom: 0.9rem;
    padding: 0.85rem 0.95rem;
    border-radius: 12px;
    background: var(--sand);
    color: var(--ink);
}
.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.75rem;
}
.media-card {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
}
.media-card img { aspect-ratio: 4 / 3; object-fit: cover; width: 100%; }
.media-card p { padding: 0.55rem 0.7rem 0.75rem; color: var(--muted); font-size: 0.82rem; }

.admin-login {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 1.5rem;
    background:
        radial-gradient(circle at top, rgba(60, 109, 118, 0.18), transparent 32%),
        var(--paper);
}
.admin-login .admin-card {
    width: min(420px, 100%);
    padding: 1.5rem;
}
.admin-login h1 { margin: 0.2rem 0 1rem; }
.admin-login label { display: block; margin: 0.75rem 0 0.35rem; color: var(--muted); font-size: 0.82rem; font-weight: 600; }
.admin-login .admin-error, .admin-login .admin-note { margin-bottom: 0.6rem; }
.admin-error { color: var(--danger); }
.admin-note { color: var(--ok); }
.admin-login button { width: 100%; margin-top: 1rem; }

@media (max-width: 1024px) {
    .metrics { grid-template-columns: 1fr 1fr; }
    .layout, .split { grid-template-columns: 1fr; }
    .workspace.is-fit, .workspace.is-stage { height: auto; overflow: visible; }
    .workspace.is-fit .canvas, .workspace.is-stage .canvas { overflow: visible; display: block; }
}
.tickets { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 0.4rem; }
.ticket {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 0.45rem;
    min-height: 0;
    padding: 0.5rem 0.6rem;
    border-radius: 18px;
    background: linear-gradient(180deg, #fff, #f7f6f4);
    border: 1px solid rgba(255,255,255,.85);
    box-shadow: 0 10px 22px rgba(16, 42, 67, 0.07), inset 0 1px 0 #fff;
    transition: transform var(--ease);
}
.ticket:hover { transform: translateY(-4px) rotateX(4deg); }
.ticket strong { display: block; }
.ticket small { color: var(--muted); }
.ticket--row { flex-direction: row; align-items: center; min-height: 0; }

body.play-open { overflow: hidden; }
.play { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 1rem; perspective: 1200px; }
.play[hidden] { display: none !important; }
.play__veil { position: absolute; inset: 0; background: rgba(16, 42, 67, 0.5); backdrop-filter: blur(8px); opacity: 0; transition: opacity .35s; }
.play.is-open .play__veil { opacity: 1; }
.play__card {
    position: relative;
    z-index: 1;
    width: min(680px, 100%);
    max-height: min(80vh, 740px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 26px;
    background: linear-gradient(180deg, #fff 0%, #f6f4f1 100%);
    border: 1px solid rgba(255,255,255,.8);
    box-shadow: 0 30px 70px rgba(16, 42, 67, 0.32), inset 0 1px 0 #fff;
    transform: rotateX(12deg) translateY(28px) scale(.92);
    opacity: 0;
    transition: transform .48s cubic-bezier(.16, 1.2, .32, 1), opacity .28s;
}
.play.is-open .play__card { transform: rotateX(0) translateY(0) scale(1); opacity: 1; }
.play__shine {
    position: absolute; inset: 0 auto 0 -20%; width: 35%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.75), transparent);
    transform: translateX(-40%);
    pointer-events: none;
}
.play.is-open .play__shine { animation: sheen 1.1s ease .05s 1; }
.play__head { display: flex; align-items: flex-start; gap: 0.6rem; padding: 0.85rem 0.95rem 0.35rem; }
.play__head h2 { font-size: 1.35rem; }
.play__x {
    margin-left: auto; width: 36px; height: 36px; border: 0; border-radius: 50%;
    background: var(--sand); color: var(--navy); font-size: 1.3rem; box-shadow: inset 0 1px 0 #fff;
}
.play__body { overflow: auto; padding: 0.2rem 0.85rem 0.8rem; }
.play__body .form-grid { gap: 0.4rem 0.55rem; }
.play__body input, .play__body textarea, .play__body select { min-height: 34px; padding: 0.35rem 0.6rem; border-radius: 10px; }
.play__body textarea { min-height: 68px; }
@keyframes sheen { to { transform: translateX(380%); } }

.steps { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.steps__pips { display: flex; gap: 0.35rem; overflow-x: auto; margin-bottom: 0.55rem; flex: none; }
.pip {
    gap: 0.4rem;
    background: rgba(16, 42, 67, 0.06);
    color: var(--ink);
    box-shadow: none;
    min-height: 36px;
}
.pip b {
    display: grid; place-items: center; width: 1.25rem; height: 1.25rem; border-radius: 50%;
    background: var(--sand); color: var(--navy); font-size: 0.72rem;
}
.pip.is-on { background: linear-gradient(180deg, #1c4468, var(--navy)); color: #fff; box-shadow: 0 8px 16px rgba(16, 42, 67, 0.2); }
.pip.is-on b { background: rgba(255,255,255,.2); color: #fff; }
.step { display: none; min-height: 0; }
.step.is-on { display: block; overflow: auto; flex: 1; }
.steps__nav { display: flex; gap: 0.45rem; margin-top: 0.55rem; flex: none; }
.workspace.is-stage .panel { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.workspace.is-stage form { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.workspace.is-fit [data-tabs] { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.workspace.is-fit .tabs__panel.is-on { overflow: auto; min-height: 0; flex: 1; }

@media (max-width: 800px) {
    .icon-btn { display: inline-block; }
    .workspace.is-fit, .workspace.is-stage { height: auto; overflow: visible; }
    .workspace.is-fit .canvas, .workspace.is-stage .canvas { overflow: visible; display: block; }
    .play { align-items: end; padding: 0; }
    .play__card { width: 100%; max-height: 88vh; border-radius: 22px 22px 0 0; }
    .side { transform: translateX(-105%); }
    body.side-open .side { transform: none; }
    body.side-open { overflow: hidden; }
    .workspace { margin-left: 0; }
    .canvas { width: min(100% - 1.5rem, 1180px); }
    .who { display: none; }
    .top { padding-inline: 0.75rem; }
    .form-grid { grid-template-columns: 1fr; }
    .hero-row { align-items: stretch; flex-direction: column; }
    table.cards thead { display: none; }
    table.cards, table.cards tbody, table.cards tr, table.cards td { display: block; width: 100%; }
    table.cards tr {
        margin-bottom: 0.75rem;
        padding: 0.35rem 0.15rem;
        border: 1px solid var(--line);
        border-radius: 14px;
        background: #fff;
    }
    table.cards td {
        display: flex;
        justify-content: space-between;
        gap: 1rem;
        border-bottom: 0;
        padding: 0.45rem 0.7rem;
    }
    table.cards td::before {
        content: attr(data-label);
        color: var(--muted);
        font-size: 0.75rem;
        font-weight: 600;
    }
    .table-wrap { overflow: visible; }
}
@media (max-width: 390px) {
    .metrics { grid-template-columns: 1fr; }
    h1 { font-size: 1.55rem; }
    .metric strong { font-size: 1.65rem; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
