/* ---------------------------------------------------------------
   Design tokens
   A distinct, warm, modern civic look - deliberately not the
   default blue/gray admin-template style most gov systems use.
----------------------------------------------------------------*/
:root {
    --ink-950: #14231f;
    --brand: #0f766e;      /* teal - primary accent */
    --brand-ink: #0b5952;
    --surface: #fbfaf8;    /* warm off-white page background */
    --available: #059669;  /* green */
    --occupied: #e11d48;   /* red */
    --winner: #d97706;     /* amber/gold */
    --radius-lg: 20px;
    --radius-md: 14px;
}

* { -webkit-tap-highlight-color: transparent; }

html, body { background: var(--surface); font-family: 'Plus Jakarta Sans', ui-sans-serif, system-ui, sans-serif; }

::selection { background: #ccfbf1; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #d6d3d1; border-radius: 999px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------------------------------------------------------------
   Shell layout + mobile drawer nav
----------------------------------------------------------------*/
.app-shell { display: flex; min-height: 100vh; min-height: 100dvh; }

.app-sidebar {
    width: 260px;
    flex-shrink: 0;
    background: #ffffff;
    border-right: 1px solid #ece9e4;
}

@media (max-width: 1023px) {
    .app-sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        z-index: 50;
        transform: translateX(-100%);
        transition: transform .25s ease;
        border-right: 1px solid #ece9e4;
    }
    .app-sidebar.is-open { transform: translateX(0); }
}

.app-scrim {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(20, 35, 31, .35);
    z-index: 40;
}
.app-scrim.is-open { display: block; }

.app-topbar { display: none; }
@media (max-width: 1023px) {
    .app-topbar {
        display: flex;
        align-items: center;
        gap: .75rem;
        padding: .9rem 1.1rem;
        background: #fff;
        border-bottom: 1px solid #ece9e4;
        position: sticky;
        top: 0;
        z-index: 30;
    }
}

.app-main { flex: 1; min-width: 0; padding: 1.5rem; }
@media (min-width: 1024px) { .app-main { padding: 2.25rem 2.5rem; } }

/* ---------------------------------------------------------------
   Reusable components
----------------------------------------------------------------*/
.card {
    background: #fff;
    border: 1px solid #ece9e4;
    border-radius: var(--radius-lg);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    font-weight: 600;
    font-size: .875rem;
    border-radius: 12px;
    padding: .6rem 1.1rem;
    transition: background-color .15s ease, transform .1s ease;
    white-space: nowrap;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-ink); }
.btn-primary:disabled { background: #a8a29e; cursor: not-allowed; transform: none; }
.btn-dark { background: var(--ink-950); color: #fff; }
.btn-dark:hover { background: #0b1a16; }
.btn-ghost { background: #f5f4f2; color: #44403c; }
.btn-ghost:hover { background: #ece9e4; }
.btn-danger-ghost { background: #fef2f3; color: var(--occupied); }
.btn-danger-ghost:hover { background: #fde3e5; }

.input-field {
    width: 100%;
    border: 1px solid #e7e5e1;
    border-radius: 12px;
    padding: .6rem .8rem;
    font-size: .875rem;
    background: #fff;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.input-field:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(15,118,110,.15);
}

.badge-dot { display: inline-block; width: 7px; height: 7px; border-radius: 999px; }

/* ---------------------------------------------------------------
   Ticket grid blocks (clusters + color coding)
----------------------------------------------------------------*/
.tix-block {
    text-align: center;
    font-variant-numeric: tabular-nums;
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    font-size: .78rem;
    font-weight: 600;
    border-radius: 9px;
    padding: .5rem 0;
    border: 1px solid transparent;
}
.tix-block--available {
    background: #ecfdf5;
    color: #047857;
    border-color: #d1fae5;
}
button.tix-block--available:hover { background: #d1fae5; cursor: pointer; }

.tix-block--occupied {
    background: #fef2f3;
    color: #be123c;
    border-color: #fecdd3;
}
button.tix-block--occupied { cursor: not-allowed; }

.tix-block--winner {
    background: #fffbeb;
    color: #b45309;
    border-color: #fde68a;
}

/* Booklet blocks (10 tickets each, labelled with their ticket range) */
.tix-block--booklet {
    font-size: .74rem;
    padding: .65rem 0;
    letter-spacing: -.01em;
    white-space: nowrap;
}
.tix-block--partial {
    background: #f5f5f4;
    color: #78716c;
    border-color: #e7e5e4;
}
button.tix-block--partial { cursor: not-allowed; }
.tix-block--selected {
    background: var(--brand);
    color: #fff;
    border-color: var(--brand);
    box-shadow: 0 0 0 2px rgba(15,118,110,.18);
}
button.tix-block--selected:hover { background: var(--brand-ink); cursor: pointer; }
.no-select { -webkit-user-select: none; user-select: none; }

.cluster-card {
    border: 1px solid #ece9e4;
    border-radius: var(--radius-md);
    padding: .85rem;
    text-align: left;
    background: #fff;
    transition: border-color .15s ease;
}
.cluster-card:hover { border-color: #99d6cf; }

/* ---------------------------------------------------------------
   Modal
----------------------------------------------------------------*/
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(20, 35, 31, .45);
    z-index: 60;
    display: none;
    align-items: flex-end;
    justify-content: center;
    padding: 0;
}
.modal-overlay.is-open { display: flex; }
@media (min-width: 640px) {
    .modal-overlay { align-items: center; padding: 1rem; }
}
.modal-panel {
    background: #fff;
    width: 100%;
    max-width: 560px;
    max-height: 88vh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    border: 1px solid #ece9e4;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
@media (min-width: 640px) {
    .modal-panel { border-radius: var(--radius-lg); }
}
.modal-panel.modal-panel--wide { max-width: 720px; }

.skeleton {
    background: linear-gradient(90deg, #f0efec 25%, #e7e5e1 37%, #f0efec 63%);
    background-size: 400% 100%;
    animation: skeleton-shine 1.4s ease infinite;
    border-radius: 9px;
}
@keyframes skeleton-shine {
    0% { background-position: 100% 50%; }
    100% { background-position: 0 50%; }
}

.fade-in { animation: fade-in .15s ease; }
@keyframes fade-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }