:root {
    color-scheme: light;
    --page: #f5f9ff;
    --panel: #ffffff;
    --ink: #0f172a;
    --muted: #475569;
    --soft: #64748b;
    --line: #dbeafe;
    --teal: #0891b2;
    --teal-ink: #155dfc;
    --teal-soft: #ecfeff;
    --blue: #155dfc;
    --blue-soft: #eff6ff;
    --amber: #d97706;
    --amber-soft: #fffbeb;
    --rose: #be123c;
    --rose-soft: #ffe4e6;
    --shadow: 0 18px 45px -32px rgba(15, 23, 42, 0.45);
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
    margin: 0;
}

body {
    overflow: auto;
    background:
        radial-gradient(circle at 5% 25%, rgba(96, 165, 250, 0.2), transparent 24rem),
        radial-gradient(circle at 95% 80%, rgba(34, 211, 238, 0.2), transparent 28rem),
        linear-gradient(135deg, #f8fafc 0%, #eff6ff 52%, #ecfeff 100%);
    color: var(--ink);
    font-family: Arial, Helvetica, sans-serif;
}

.tv-shell {
    display: grid;
    min-height: 100vh;
    grid-template-rows: auto 1fr auto;
}

.tv-header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 28px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.18);
    background:
        radial-gradient(circle at 12% 0%, rgba(255, 255, 255, 0.22), transparent 30%),
        linear-gradient(100deg, #0b2f6b 0%, #155dfc 54%, #0789b8 100%);
    padding: 20px 30px;
    color: #ffffff;
    box-shadow: 0 16px 34px -24px rgba(15, 23, 42, 0.85);
}

.brand-lockup {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 18px;
}

.brand-mark {
    width: 74px;
    height: 74px;
    flex: 0 0 auto;
    border: 2px solid rgba(255, 255, 255, 0.52);
    border-radius: 50%;
    background: #ffffff;
    object-fit: contain;
    padding: 4px;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.22);
}

.brand-eyebrow {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 0 0 6px;
    color: #cffafe;
    font-size: 14px;
    font-weight: 900;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.brand-eyebrow span {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #5eead4;
    box-shadow: 0 0 0 6px rgba(94, 234, 212, 0.16);
    animation: live-pulse 1.8s ease-out infinite;
}

.branch-name {
    margin: 0 0 5px;
    color: #dbeafe;
    font-size: 14px;
    font-weight: 800;
}

.brand-lockup h1 {
    margin: 0;
    color: #ffffff;
    font-size: 38px;
    font-weight: 900;
    line-height: 1.08;
}

.brand-lockup h1 em {
    color: #a5f3fc;
    font-style: normal;
    font-weight: 400;
}

.header-controls {
    display: flex;
    flex: 0 0 auto;
    align-items: stretch;
    justify-content: flex-end;
    gap: 12px;
}

.location-control {
    display: flex;
    min-width: 280px;
    flex-direction: column;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.1);
    padding: 12px 14px;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.16);
    backdrop-filter: blur(12px);
}

.location-control > span {
    margin-bottom: 6px;
    color: #cffafe;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.location-control select {
    width: 100%;
    min-height: 42px;
    border: 1px solid rgba(255, 255, 255, 0.42);
    border-radius: 9px;
    background: #ffffff;
    color: var(--ink);
    padding: 8px 34px 8px 11px;
    font: inherit;
    font-size: 14px;
    font-weight: 900;
    outline: none;
}

.location-control select:focus {
    border-color: #67e8f9;
    box-shadow: 0 0 0 3px rgba(165, 243, 252, 0.4);
}

.clock-panel {
    flex: 0 0 auto;
    min-width: 260px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.1);
    padding: 13px 18px;
    text-align: right;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.16);
    backdrop-filter: blur(12px);
}

.clock-panel strong {
    display: block;
    color: #ffffff;
    font-size: 48px;
    font-weight: 900;
    line-height: 1;
}

.clock-panel span {
    display: block;
    margin-top: 8px;
    color: #dbeafe;
    font-size: 18px;
    font-weight: 800;
}

.tv-main {
    display: grid;
    min-height: 0;
    gap: 16px;
    width: 100%;
    max-width: 2400px;
    margin: 0 auto;
    padding: 20px;
}

.error-banner {
    display: flex;
    align-items: center;
    gap: 14px;
    border: 1px solid #fecdd3;
    border-radius: 12px;
    background: var(--rose-soft);
    color: #881337;
    padding: 14px 18px;
}

.error-banner strong,
.error-banner span {
    font-size: 18px;
    font-weight: 900;
}

.loading-panel {
    display: grid;
    min-height: 58vh;
    place-items: center;
    align-content: center;
    gap: 18px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: var(--shadow);
}

.loading-panel p {
    margin: 0;
    color: var(--muted);
    font-size: 28px;
    font-weight: 900;
}

.loading-pulse {
    width: 68px;
    height: 68px;
    border: 8px solid var(--teal-soft);
    border-top-color: var(--teal);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.status-grid {
    display: grid;
    min-height: 0;
    grid-template-columns: minmax(360px, 0.72fr) minmax(520px, 1.28fr);
    gap: 18px;
}

.side-stack {
    display: grid;
    min-height: 0;
    grid-template-rows: minmax(220px, 1fr) minmax(220px, 1fr);
    gap: 18px;
}

.status-column {
    display: grid;
    min-height: 0;
    grid-template-rows: auto 1fr;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.88);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.primary-column {
    border-color: #bfdbfe;
    background: rgba(239, 246, 255, 0.82);
    color: var(--ink);
}

.payment-column {
    border-color: #fde68a;
    background: rgba(255, 251, 235, 0.86);
}

.waiting-column {
    border-color: #a5f3fc;
    background: rgba(236, 254, 255, 0.84);
}

.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    border-bottom: 1px solid rgba(216, 227, 223, 0.82);
    padding: 20px 22px 18px;
}

.section-kicker {
    display: block;
    color: var(--soft);
    font-size: 14px;
    font-weight: 900;
    letter-spacing: 0;
    text-transform: uppercase;
}

.primary-column .section-kicker {
    color: var(--blue);
}

.payment-column .section-kicker {
    color: var(--amber);
}

.waiting-column .section-kicker {
    color: var(--blue);
}

.section-heading h2 {
    margin: 5px 0 0;
    color: inherit;
    font-size: 30px;
    font-weight: 900;
    line-height: 1.05;
}

.primary-column .section-heading h2 {
    font-size: 30px;
}

.section-heading strong {
    display: grid;
    min-width: 58px;
    height: 50px;
    place-items: center;
    border-radius: 9px;
    background: var(--blue);
    color: #ffffff;
    font-size: 24px;
    font-weight: 900;
}

.primary-column .section-heading strong {
    background: var(--blue);
    color: #ffffff;
}

.payment-column .section-heading strong {
    background: #f59e0b;
}

.waiting-column .section-heading strong {
    background: #0891b2;
}

.status-list {
    display: grid;
    min-height: 0;
    align-content: start;
    gap: 12px;
    overflow: auto;
    padding: 16px;
}

.status-list::-webkit-scrollbar {
    width: 10px;
}

.status-list::-webkit-scrollbar-track {
    background: transparent;
}

.status-list::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: rgba(100, 112, 107, 0.28);
}

.status-card {
    display: grid;
    min-height: 112px;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 18px;
    border: 1px solid var(--line);
    border-left: 7px solid var(--blue);
    border-radius: 12px;
    background: var(--panel);
    padding: 18px;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05);
    transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.status-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.1);
}

.primary-column .status-card {
    min-height: 112px;
    border-color: #dbeafe;
    border-left-color: var(--blue);
    background: #ffffff;
}

.status-card.stage-service {
    border-left-color: var(--teal);
}

.primary-column .status-card.stage-service {
    border-left-color: var(--blue);
}

.status-card.stage-payment {
    border-left-color: var(--amber);
}

.status-card.stage-done {
    border-left-color: #0f766e;
}

.status-card.compact-card {
    min-height: 70px;
    border-color: #cffafe;
    border-left-color: #06b6d4;
    padding: 13px 15px;
}

.pet-name {
    margin: 0;
    color: var(--ink);
    font-size: 34px;
    font-weight: 900;
    line-height: 1.08;
    overflow-wrap: anywhere;
}

.primary-column .pet-name {
    font-size: 34px;
}

.compact-card .pet-name {
    font-size: 26px;
}

.meta-line,
.ref-line,
.vet-line {
    margin: 7px 0 0;
    color: var(--muted);
    font-weight: 800;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.meta-line {
    font-size: 19px;
}

.primary-column .meta-line {
    font-size: 19px;
}

.vet-line {
    color: var(--blue);
    font-size: 17px;
}

.ref-line {
    color: var(--soft);
    font-size: 13px;
    font-weight: 900;
    text-transform: uppercase;
}

.status-side {
    display: grid;
    min-width: 126px;
    justify-items: end;
    gap: 9px;
}

.stage-pill,
.source-pill {
    max-width: 170px;
    border-radius: 8px;
    padding: 9px 11px;
    font-size: 13px;
    font-weight: 900;
    line-height: 1;
    text-align: center;
    text-transform: uppercase;
}

.stage-pill {
    background: var(--blue-soft);
    color: var(--blue);
}

.stage-service .stage-pill {
    background: var(--teal-soft);
    color: var(--teal);
}

.stage-payment .stage-pill {
    background: var(--amber-soft);
    color: var(--amber);
}

.stage-done .stage-pill {
    background: #ccfbf1;
    color: #0f766e;
}

.source-pill {
    background: #eef2f7;
    color: #475569;
}

.time-text {
    color: var(--muted);
    font-size: 14px;
    font-weight: 900;
    text-transform: uppercase;
}

.empty-state {
    display: grid;
    min-height: 180px;
    place-items: center;
    border: 2px dashed rgba(100, 112, 107, 0.24);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.7);
    color: var(--soft);
    font-size: 24px;
    font-weight: 900;
    text-align: center;
}

.primary-column .empty-state {
    border-color: #bfdbfe;
    background: rgba(255, 255, 255, 0.78);
    color: #60a5fa;
}

.tv-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    border-top: 1px solid #dbeafe;
    background: rgba(255, 255, 255, 0.88);
    padding: 12px 30px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 900;
    text-transform: uppercase;
}

.live-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
}

.live-indicator span {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: #16a34a;
    box-shadow: 0 0 0 7px rgba(22, 163, 74, 0.14);
    animation: live-pulse 1.8s ease-out infinite;
}

.tv-footer p {
    margin: 0;
}

[hidden] {
    display: none !important;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes live-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.55);
    }
    70% {
        box-shadow: 0 0 0 9px rgba(52, 211, 153, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(52, 211, 153, 0);
    }
}

@media (max-width: 1320px) {
    .tv-header {
        align-items: flex-start;
    }

    .header-controls {
        width: 100%;
    }

    .location-control {
        flex: 1 1 320px;
    }

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

    .side-stack {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: none;
    }

    .primary-column .status-card {
        min-height: 128px;
    }
}

@media (max-width: 920px) {
    .tv-header,
    .tv-footer {
        align-items: flex-start;
        flex-direction: column;
    }

    .clock-panel {
        min-width: 0;
        border-left: 0;
        padding-left: 0;
        text-align: left;
    }

    .header-controls {
        flex-direction: column;
    }

    .location-control {
        width: 100%;
        min-width: 0;
    }

    .side-stack {
        grid-template-columns: 1fr;
    }

    .status-card,
    .primary-column .status-card {
        min-height: auto;
        grid-template-columns: 1fr;
    }

    .status-side {
        min-width: 0;
        justify-items: start;
    }
}

@media (max-width: 640px) {
    .tv-header,
    .tv-main,
    .tv-footer {
        padding-left: 14px;
        padding-right: 14px;
    }

    .brand-mark {
        width: 58px;
        height: 58px;
    }

    .brand-lockup h1 {
        font-size: 30px;
    }

    .clock-panel strong {
        font-size: 38px;
    }

    .section-heading,
    .status-card {
        padding-left: 14px;
        padding-right: 14px;
    }

    .primary-column .section-heading h2,
    .section-heading h2 {
        font-size: 30px;
    }

    .primary-column .pet-name,
    .pet-name {
        font-size: 30px;
    }
}
