:root {
    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --ink: #10141c;
    --ink-soft: #1c2230;
    --paper: #f1f2f5;
    --card: #ffffff;
    --line: #e4e5ea;
    --muted: #6b7280;
    --text: #14161c;

    --green: #00c853;
    --green-dark: #009e42;
    --amber: #ffab00;
    --amber-dark: #d98e00;
    --red: #ff3b30;
    --red-dark: #d6301f;
    --blue: #2979ff;
    --purple: #7c3aed;
    --cyan: #00c2e0;

    --gradient: linear-gradient(120deg, var(--purple) 0%, var(--blue) 55%, var(--green) 100%);
}

* { box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif; font-family: var(--font);
    margin: 0;
    color: #14161c; color: var(--text);
    background-color: #f1f2f5; background-color: var(--paper);
    background-image:
        radial-gradient(650px 550px at 8% -5%, rgba(124,58,237,0.28), transparent 60%),
        radial-gradient(700px 600px at 95% 0%, rgba(0,200,83,0.26), transparent 60%),
        radial-gradient(750px 650px at 50% 105%, rgba(41,121,255,0.22), transparent 60%),
        radial-gradient(550px 500px at 100% 60%, rgba(0,194,224,0.2), transparent 60%);
    background-repeat: no-repeat;
    animation: bg-drift 30s ease-in-out infinite alternate;
    -webkit-font-smoothing: antialiased;
    position: relative;
    min-height: 100vh; /* so the background covers short pages instead of stopping mid-screen */
}
body::before {
    content: '';
    position: fixed;
    top: 0; right: 0; bottom: 0; left: 0;
    inset: 0;
    z-index: -1;
    background-image: repeating-linear-gradient(
        135deg,
        rgba(0,200,83,0.045) 0px, rgba(0,200,83,0.045) 2px,
        transparent 2px, transparent 26px
    );
    background-size: 300px 300px;
    animation: court-drift 45s linear infinite;
}
@keyframes bg-drift {
    from { background-position: 0% 0%, 0% 0%, 0% 0%, 0% 0%; }
    to   { background-position: 3% 4%, -3% 3%, 2% -4%, -3% -3%; }
}
@keyframes court-drift {
    from { background-position: 0 0; }
    to { background-position: 300px 300px; }
}
@media (prefers-reduced-motion: reduce) {
    body, body::before { animation: none; }
}

main { max-width: 1100px; margin: 0 auto; padding: 1.75rem 2rem 3rem; }

h1, h2 { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif; font-family: var(--font); font-weight: 900; letter-spacing: -0.01em; margin: 0 0 1rem; text-transform: uppercase; }
h1 { font-size: 1.9rem; }
h2 { font-size: 1.1rem; color: #1c2230; color: var(--ink-soft); letter-spacing: 0.01em; }

.auth-shell {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #075b30;
    overflow: hidden;
    padding: 1.5rem;
}
.table-bg {
    position: absolute;
    top: 0; right: 0; bottom: 0; left: 0;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}
.auth-shine {
    position: absolute;
    top: -10%; right: -10%; bottom: -10%; left: -10%;
    inset: -10%;
    z-index: 1;
    pointer-events: none;
    background: radial-gradient(500px 260px at 30% 25%, rgba(255,255,255,0.14), transparent 65%);
    mix-blend-mode: screen;
    animation: shine-drift 9s ease-in-out infinite alternate;
}
@keyframes shine-drift {
    from { transform: translate(-2%, -1%); }
    to { transform: translate(4%, 3%); }
}
.cue-stick { animation: cue-poke 1.9s ease-in-out infinite alternate; }
@keyframes cue-poke {
    from { transform: translate(0, 0); }
    to { transform: translate(6px, -6px); }
}
@media (prefers-reduced-motion: reduce) {
    .auth-shine, .cue-stick { animation: none; }
}

.auth-overlay {
    position: absolute;
    top: 0; right: 0; bottom: 0; left: 0;
    inset: 0;
    z-index: 2;
    background: radial-gradient(ellipse at center, rgba(8,12,18,0.15) 0%, rgba(8,12,18,0.72) 100%);
}

.auth-page {
    position: relative;
    z-index: 3;
    max-width: 380px;
    width: 100%;
    margin: 0;
    padding: 2.25rem;
    background: #ffffff; background: var(--card);
    border-radius: 10px;
    border-top: 5px solid;
    border-image: var(--gradient) 1;
    box-shadow: 0 24px 60px -16px rgba(0,0,0,0.55);
}
.auth-page h1 { font-size: 2.1rem; }

form { display: flex; flex-direction: column; gap: 0.6rem; max-width: 320px; margin-bottom: 1.5rem; }
form.inline-form, form.logout-form { display: inline-flex; flex-direction: row; align-items: center; max-width: none; margin-bottom: 0; vertical-align: middle; }
form.inline-form + form.inline-form { margin-left: 0.4rem; }
.auth-page form { margin-bottom: 0; }
label { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: #6b7280; color: var(--muted); }
input, select {
    margin: 0;
    padding: 0.6rem 0.7rem;
    border: 1.5px solid #e4e5ea; border: 1.5px solid var(--line);
    border-radius: 6px;
    font: inherit;
    background: #ffffff; background: var(--card);
    color: #14161c; color: var(--text);
    vertical-align: middle;
}
input:focus, select:focus { outline: none; border-color: #00c853; border-color: var(--green); box-shadow: 0 0 0 3px rgba(0,200,83,0.15); }

button {
    margin: 0;
    padding: 0.65rem 1.1rem;
    border: none;
    border-radius: 6px;
    background: #2979ff; background: var(--gradient);
    color: #fff;
    cursor: pointer;
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    vertical-align: middle;
    transition: transform 0.06s ease, filter 0.15s ease;
}
/* Firefox pads button contents with an extra invisible focus ring inset
   that Chrome doesn't have, throwing off height even with identical CSS. */
button::-moz-focus-inner { border: 0; padding: 0; }
button:hover { filter: brightness(1.15); }
button:active { transform: translateY(1px); }
.btn-danger { background: #ff3b30; background: var(--red); }
.btn-void { background: transparent; border: 1.5px solid #ff3b30; border: 1.5px solid var(--red); color: #ff3b30; color: var(--red); }
.btn-void:hover { background: #ff3b30; background: var(--red); color: #fff; }
.btn-small { padding: 0.2rem 0.5rem; font-size: 0.7rem; line-height: 1; }
/* Square icon button (e.g. × remove) big enough to tap on a phone. */
.btn-icon { width: 1.9rem; height: 1.9rem; padding: 0; font-size: 1.05rem; line-height: 1; flex: 0 0 auto; }
/* Keep the destructive Void button a thumb's width away from the Receipt link. */
.void-form { margin-left: 0.75rem; }

/* Status pills (staff, tables, shops, shifts) */
.pill {
    display: inline-block; padding: 0.15rem 0.55rem; border-radius: 100px;
    font-size: 0.7rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em;
    background: #eceef1; color: #6b7280; color: var(--muted);
}
.pill-live { background: rgba(0,200,83,0.15); color: #009e42; color: var(--green-dark); }
.pill-danger { background: rgba(255,59,48,0.13); color: #d6301f; color: var(--red-dark); }
.pill-muted { background: #eceef1; color: #6b7280; color: var(--muted); }

/* Expenses: this month's totals per category */
.category-totals { list-style: none; margin: 0 0 1.75rem; padding: 0; display: flex; flex-wrap: wrap; gap: 0.6rem; }
.category-totals li {
    background: #ffffff; background: var(--card); border-radius: 8px; padding: 0.6rem 0.9rem;
    box-shadow: 0 4px 12px -8px rgba(16,20,28,0.3); font-size: 0.85rem; font-weight: 700;
}
.category-totals li span { display: block; font-size: 0.68rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; color: #6b7280; color: var(--muted); }

/* Package pricing */
.package-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; margin-bottom: 1.75rem; }
.package-card { background: #ffffff; background: var(--card); border-radius: 10px; padding: 1rem 1.1rem; box-shadow: 0 6px 18px -10px rgba(16,20,28,0.2); }
.package-card h3 { margin: 0 0 0.5rem; font-size: 0.95rem; font-weight: 800; }
.package-list { list-style: none; margin: 0 0 0.75rem; padding: 0; display: flex; flex-direction: column; gap: 0.35rem; }
.package-list li { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; font-size: 0.85rem; }
.package-add-form { flex-direction: row; flex-wrap: wrap; max-width: none; gap: 0.4rem; }
.package-add-form input { width: auto; flex: 1 1 4.2rem; min-width: 0; }
.package-add-form button { flex: 0 0 auto; }

/* Superadmin: owner reset-password rows in the shops table */
.owner-row { display: flex; align-items: center; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.35rem; }
.owner-row:last-child { margin-bottom: 0; }
.owner-email { font-weight: 700; font-size: 0.85rem; white-space: nowrap; }
.owner-row input[type="password"] { width: 9rem; padding: 0.3rem 0.5rem; font-size: 0.78rem; }

.error {
    color: #fff;
    background: #ff3b30; background: var(--red);
    font-weight: 600;
    padding: 0.6rem 0.9rem;
    border-radius: 6px;
    margin: 0 0 1rem;
}
.success {
    color: #fff;
    background: #00c853; background: var(--green);
    font-weight: 600;
    padding: 0.6rem 0.9rem;
    border-radius: 6px;
    margin: 0 0 1rem;
}

/* Nav */
.shop-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 1.5rem;
    padding: 1.1rem 2rem;
    background: #2979ff; background: var(--gradient);
    margin: 0 0 1.75rem;
}
.nav-links { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1.5rem; }
.nav-actions { display: flex; align-items: center; gap: 0.6rem; margin-left: auto; }
@media (max-width: 1100px) {
    /* Not enough room for one row: name + buttons on top, links underneath. */
    .nav-links { order: 3; width: 100%; }
}
@media (max-width: 700px) {
    /* Phones: shop name, then the buttons, then the links as a single swipeable
       row — instead of the header wrapping to ~4 lines. */
    .shop-nav { padding: 0.8rem 1rem 0.4rem; gap: 0.5rem 0.75rem; margin-bottom: 1.25rem; }
    /* Full-width name line so long names wrap between words, never truncate —
       owners with several shops need to see which one they're in. */
    .shop-nav .shop-name { flex: 1 1 100%; min-width: 0; font-size: 1rem; line-height: 1.2; margin-right: 0; }
    .shop-name-text { min-width: 0; overflow-wrap: break-word; }
    .nav-actions { gap: 0.35rem; }
    .nav-actions button { padding: 0.6rem 0.55rem; font-size: 0.68rem; letter-spacing: 0.01em; }
    .nav-links {
        order: 3; width: 100%; flex-wrap: nowrap; gap: 1.25rem;
        overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
    }
    .nav-links::-webkit-scrollbar { display: none; }
    .shop-nav .nav-links a { white-space: nowrap; padding: 0.45rem 0; }
}
.shop-nav .shop-name {
    display: flex;
    align-items: center;
    font-weight: 900;
    font-size: 1.1rem;
    letter-spacing: 0.01em;
    text-transform: uppercase;
    color: #fff;
    margin-right: 0.5rem;
    border-left: 4px solid #00c853; border-left: 4px solid var(--green);
    padding-left: 0.6rem;
}

.nav-ball {
    position: relative;
    display: inline-block;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, #4d4d4d 0%, #1a1a1a 45%, #000 100%);
    margin-right: 0.55rem;
    flex-shrink: 0;
    animation: nav-ball-roll 5s linear infinite;
}
.nav-ball::after {
    content: '';
    position: absolute;
    top: 0; right: 0; bottom: 0; left: 0;
    inset: 0;
    margin: auto;
    width: 8px;
    height: 8px;
    background: #fff;
    border-radius: 50%;
    z-index: 1;
}
.nav-ball::before {
    content: '8';
    position: absolute;
    top: 0; right: 0; bottom: 0; left: 0;
    inset: 0;
    margin: auto;
    width: 8px;
    height: 8px;
    text-align: center;
    line-height: 8px;
    font-size: 6px;
    font-weight: 900;
    color: #111;
    z-index: 2;
}
@keyframes nav-ball-roll {
    to { transform: rotate(360deg); }
}
@media (prefers-reduced-motion: reduce) {
    .nav-ball { animation: none; }
}
.shop-nav a {
    color: #cbd0dc;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 0.3rem 0;
    border-bottom: 2px solid transparent;
}
.shop-nav a:hover { color: #fff; border-bottom-color: #00c853; border-bottom-color: var(--green); }
.shop-nav a[aria-current="page"] { color: #fff; border-bottom-color: #fff; }
/* Navs without a .nav-actions wrapper (e.g. the billing page) still push Log out right. */
.shop-nav > .logout-form { margin-left: auto; }
/* Clock in/out: solid white so it doesn't disappear into the gradient header. */
.shop-nav .inline-form button { background: #fff; color: #10141c; color: var(--ink); }
.shop-nav .inline-form button:hover { filter: none; background: #eafbf1; }
.shop-nav .logout-form button { background: rgba(0,0,0,0.18); border: 1.5px solid rgba(255,255,255,0.4); color: #fff; }
.shop-nav .logout-form button:hover { border-color: #ff3b30; border-color: var(--red); color: #fff; filter: none; }

/* Shop picker */
.shop-pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1.1rem; }
.shop-pick-card {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: #ffffff; background: var(--card);
    border-radius: 10px;
    padding: 1.25rem 1.4rem;
    box-shadow: 0 6px 18px -10px rgba(16,20,28,0.25);
    border-top: 5px solid;
    border-image: var(--gradient) 1;
    font-weight: 800;
    font-size: 1.05rem;
    color: #14161c; color: var(--text);
    text-decoration: none;
}
.shop-pick-card:hover { box-shadow: 0 10px 24px -10px rgba(0,200,83,0.4); }
.shop-pick-card .nav-ball { margin-right: 0; }

/* Tabulated table list — compact rows instead of tall cards, so a full floor of tables fits without scrolling */
.table-list { display: flex; flex-direction: column; gap: 0.4rem; }
.table-list-header,
.table-row {
    display: grid;
    grid-template-columns: 1.1fr 0.7fr 0.85fr 0.8fr 1.75fr 2fr;
    align-items: center;
    gap: 0.85rem;
}
.table-list-header {
    padding: 0 1rem 0.4rem;
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280; color: var(--muted);
}
.table-row {
    position: relative;
    background: #ffffff; background: var(--card);
    border-radius: 8px;
    padding: 0.55rem 1rem;
    box-shadow: 0 4px 12px -8px rgba(16,20,28,0.3);
    border-left: 5px solid #b9bcc4;
    transition: box-shadow 0.15s ease;
}
.table-row:hover { box-shadow: 0 6px 18px -8px rgba(16,20,28,0.4); }
.table-row.status-idle { border-left-color: #b9bcc4; background: #fafcfb; }
.table-row.status-active { border-left-color: #00c853; border-left-color: var(--green); background: rgba(0,200,83,0.07); }
.table-row.status-paused { border-left-color: #ffab00; border-left-color: var(--amber); background: rgba(255,171,0,0.09); }
.tl-name { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif; font-family: var(--font); font-weight: 800; font-size: 0.95rem; color: #14161c; color: var(--text); }
.tl-name .badge {
    font-size: 0.6rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em;
    background: #10141c; background: var(--ink); color: #fff; padding: 0.1rem 0.35rem; border-radius: 4px; vertical-align: middle;
}
.tl-rate { color: #6b7280; color: var(--muted); font-size: 0.82rem; font-weight: 600; }

.status-label {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.18rem 0.5rem;
    border-radius: 100px;
    background: #eceef1;
    color: #6b7280; color: var(--muted);
}
.status-active .status-label { background: rgba(0,200,83,0.15); color: #009e42; color: var(--green-dark); }
.status-paused .status-label { background: rgba(255,171,0,0.18); color: #d98e00; color: var(--amber-dark); }

.paid-badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.18rem 0.5rem;
    border-radius: 100px;
    background: rgba(41,121,255,0.15);
    color: #2979ff; color: var(--blue);
    margin-left: 0.35rem;
}
.paid-badge:empty { display: none; }
.items-badge {
    display: inline-block; font-size: 0.65rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em;
    padding: 0.18rem 0.5rem; border-radius: 100px; margin-left: 0.35rem;
    background: rgba(124,58,237,0.13); color: #7c3aed; color: var(--purple);
}

.status-active .status-label::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #00c853; background: var(--green);
    margin-right: 0.35rem;
    vertical-align: middle;
    animation: live-pulse 1.4s ease-in-out infinite;
}
@keyframes live-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(1.6); }
}
@media (prefers-reduced-motion: reduce) {
    .status-active .status-label::before { animation: none; }
}

.tl-timer {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif; font-family: var(--font);
    font-weight: 800;
    font-size: 1.15rem;
    letter-spacing: 0.01em;
    font-variant-numeric: tabular-nums;
    color: #10141c; color: var(--ink);
}
.tl-plan { font-size: 0.76rem; font-weight: 600; color: #6b7280; color: var(--muted); line-height: 1.2; }
.due-amount { color: #10141c; color: var(--ink); font-weight: 800; }

.table-row.time-up { border-left-color: #ff3b30; border-left-color: var(--red); background: rgba(255,59,48,0.08); animation: time-up-pulse 1.4s ease-in-out infinite; }
.table-row.time-up .status-label { background: rgba(255,59,48,0.15); color: #d6301f; color: var(--red-dark); }
.table-row.time-up .tl-plan { color: #ff3b30; color: var(--red); font-weight: 800; }
@keyframes time-up-pulse {
    0%, 100% { box-shadow: 0 4px 12px -8px rgba(16,20,28,0.3); }
    50% { box-shadow: 0 0 0 3px rgba(255,59,48,0.3); }
}

.tl-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
.tl-actions form { max-width: none; flex-direction: row; align-items: center; gap: 0.4rem; margin-bottom: 0; }
.tl-actions button, .tl-actions select, .tl-actions input {
    height: 2.1rem;
    padding: 0 0.6rem;
    font-size: 0.75rem;
    border: 1px solid transparent;
    line-height: 2rem;
    box-sizing: border-box;
}
.tl-actions select, .tl-actions input { border-color: #e4e5ea; border-color: var(--line); }
.tl-actions .prepay-input { width: 8rem; }
.tl-actions .extend-form select { max-width: 11rem; }
.tl-actions .extend-form button { background: #1c2230; background: var(--ink-soft); }

/* Action-intent button colors */
.tl-actions form[action*="/session/start"] button,
.tl-actions form[action*="/resume"] button { background: #00c853; background: var(--green); }
.tl-actions form[action*="/pause"] button { background: #ffab00; background: var(--amber); color: #10141c; color: var(--ink); }
.tl-actions form[action*="/stop"] button { background: #ff3b30; background: var(--red); }
.tl-actions .btn-void { background: transparent; border-color: #ff3b30; border-color: var(--red); color: #ff3b30; color: var(--red); }
.tl-actions .btn-void:hover { background: #ff3b30; background: var(--red); color: #fff; }

/* "More" dropdown — keeps the row itself to one line; less-frequent actions
   (add time, cancel) live in a small panel that floats over the row instead
   of pushing its height, opened on click. */
.tl-more { position: relative; display: inline-flex; align-items: center; }
.tl-more-toggle { background: #1c2230; background: var(--ink-soft); }
.tl-more-panel {
    display: none;
    position: absolute;
    top: calc(100% + 0.4rem);
    right: 0;
    z-index: 20;
    min-width: 17.5rem;
    background: #ffffff; background: var(--card);
    border: 1px solid #e4e5ea; border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 12px 28px -10px rgba(16,20,28,0.35);
    padding: 0.75rem;
    flex-direction: column;
    gap: 0.5rem;
}
.tl-more-panel.is-open { display: block; display: flex; }
.tl-more-panel form { max-width: none; flex-direction: row; align-items: center; gap: 0.4rem; margin-bottom: 0; }
.tl-more-panel select, .tl-more-panel button {
    height: 2.1rem;
    padding: 0 0.6rem;
    font-size: 0.75rem;
    border: 1px solid transparent;
    line-height: 2rem;
    box-sizing: border-box;
}
/* min-width: 0 lets the select shrink so the Add time button stays inside the panel. */
.tl-more-panel select { border-color: #e4e5ea; border-color: var(--line); flex: 1 1 auto; min-width: 0; }
.tl-more-panel .extend-form button { background: #1c2230; background: var(--ink-soft); flex: 0 0 auto; }
.tl-more-panel .btn-void { width: 100%; background: transparent; border-color: #ff3b30; border-color: var(--red); color: #ff3b30; color: var(--red); }
.tl-more-panel .btn-void:hover { background: #ff3b30; background: var(--red); color: #fff; }
/* Snacks & drinks on a running table: add form, then one line per item with a × remove. */
.tl-more-panel .item-form { border-top: 1px solid #e4e5ea; border-top: 1px solid var(--line); padding-top: 0.5rem; }
.tl-more-panel .item-form button { background: #7c3aed; background: var(--purple); flex: 0 0 auto; }
.tl-more-panel .qty-input { width: 3.4rem; height: 2.1rem; padding: 0 0.4rem; flex: 0 0 auto; }
.tl-more-panel .item-line { justify-content: space-between; font-size: 0.8rem; }
.tl-more-panel .item-line .btn-void { width: 1.9rem; height: 1.9rem; padding: 0; line-height: 1; }

/* Waiting list: banner when a table frees up, then the list under the tables. */
.waitlist-alert {
    margin: 0 0 1rem; padding: 0.8rem 1rem; border-radius: 8px;
    background: rgba(0,200,83,0.14); border-left: 4px solid #00c853; border-left: 4px solid var(--green);
    color: #10141c; color: var(--ink);
}
.waitlist { margin-top: 2rem; }
.waitlist-form { flex-direction: row; flex-wrap: wrap; align-items: center; max-width: none; margin-bottom: 0.75rem; }
.waitlist-form input[name=customer_name] { flex: 1 1 10rem; min-width: 0; }
.waitlist-form input[name=phone] { flex: 1 1 9rem; min-width: 0; }
.waitlist-form .qty-input { width: 4.5rem; }
.waitlist-entries { margin: 0; padding: 0; list-style: none; counter-reset: waitlist; }
.waitlist-entries li {
    display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem 0.9rem;
    padding: 0.6rem 0.9rem; margin-bottom: 0.4rem; border-radius: 8px;
    background: #ffffff; background: var(--card); box-shadow: 0 4px 12px -8px rgba(16,20,28,0.3);
    counter-increment: waitlist;
}
.waitlist-entries li::before { content: counter(waitlist) "."; font-weight: 800; color: #6b7280; color: var(--muted); }
.wl-name { font-weight: 800; }
.wl-meta { color: #6b7280; color: var(--muted); font-size: 0.85rem; flex: 1 1 auto; }
.wl-actions { display: inline-flex; }
.wl-actions form + form { margin-left: 0.4rem; }
/* Clock-out cash count */
.cash-summary { max-width: 420px; margin-bottom: 1.25rem; }
.cash-preview { font-weight: 800; margin: 0.25rem 0; }
.cash-ok { color: #009e42; color: var(--green-dark); }
.cash-short { color: #d6301f; color: var(--red-dark); }
.cash-over { color: #d98e00; color: var(--amber-dark); }
/* A table left running far too long (forgot to stop?). */
.long-warning {
    display: inline-block; margin-right: 0.35rem; padding: 0.1rem 0.45rem; border-radius: 4px;
    background: #ff3b30; background: var(--red); color: #fff; font-weight: 800; font-size: 0.72rem;
}

@media (max-width: 900px) {
    .table-list-header { display: none; }
    /* minmax(0, …) so wide row content (e.g. the Start form) can't stretch the column past the card. */
    .table-row { grid-template-columns: minmax(0, 1fr); gap: 0.3rem; }
    /* Anchor the panel to the whole row (already position: relative) instead of
       the More button, so it spans the row and can't run off the screen edge. */
    .tl-more { position: static; }
    .tl-more-panel { left: 0.75rem; right: 0.75rem; min-width: 0; }
    /* Start form: package select and cash input share the row's width so the
       Start button can't be pushed past the card edge. */
    .tl-actions form[action*="/session/start"] { width: 100%; }
    .tl-actions form[action*="/session/start"] select,
    .tl-actions form[action*="/session/start"] .prepay-input { flex: 1 1 0; min-width: 0; width: auto; }
    .tl-actions form[action*="/session/start"] button { flex: 0 0 auto; }
}

/* Tables */
.data-table { width: 100%; border-collapse: collapse; background: #ffffff; background: var(--card); margin-bottom: 1.75rem; border-radius: 10px; overflow: hidden; box-shadow: 0 6px 18px -10px rgba(16,20,28,0.2); }
.data-table th, .data-table td { text-align: left; padding: 0.7rem 0.9rem; border-bottom: 1px solid #e4e5ea; border-bottom: 1px solid var(--line); }
.data-table th { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; color: #6b7280; color: var(--muted); background: #f7f8fa; font-weight: 800; }
.data-table tr:last-child td { border-bottom: none; }
.data-table button { white-space: nowrap; }
@media (max-width: 640px) {
    /* Phones: each row becomes a small card (label on the left, value on the
       right) so action buttons aren't hidden off the right edge. Labels come
       from data-label, set by assets/js/app.js from the table's <th>s. */
    .data-table, .data-table tbody, .data-table tr, .data-table td { display: block; width: 100%; }
    .data-table thead { display: none; }
    .data-table tr { padding: 0.55rem 0.9rem; border-bottom: 1px solid #e4e5ea; border-bottom: 1px solid var(--line); }
    .data-table tr:last-child { border-bottom: none; }
    .data-table td {
        display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
        gap: 0.25rem 1rem; padding: 0.25rem 0; border-bottom: none; text-align: right; overflow-wrap: anywhere;
    }
    .data-table td[data-label]::before {
        content: attr(data-label); text-align: left; flex: 0 0 auto;
        font-size: 0.68rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; color: #6b7280; color: var(--muted);
    }
    /* Action cells (no heading) and empty-state rows: just lay the content out left to right. */
    .data-table td:not([data-label]) { justify-content: flex-start; text-align: left; }
    .data-table td:empty { display: none; }
    /* Inline forms with an input (e.g. rate + Update) take the full card width,
       with the input shrinking so the button stays inside the card. */
    .data-table td form.inline-form:has(input:not([type=hidden])) { flex: 1 1 100%; min-width: 0; gap: 0.4rem; }
    .data-table td form.inline-form input:not([type=hidden]) { flex: 1 1 auto; min-width: 0; width: auto; }
}

/* Stat cards */
.stat-cards { display: flex; flex-wrap: wrap; gap: 1rem; margin-bottom: 1.75rem; }
.stat-card { flex: 1 1 220px; background: #ffffff; background: var(--card); border-radius: 10px; padding: 1.1rem 1.6rem; box-shadow: 0 6px 18px -10px rgba(16,20,28,0.2); border-top: 5px solid; border-image: var(--gradient) 1; }
.stat-card h2 { margin: 0; font-size: 0.72rem; color: #6b7280; color: var(--muted); letter-spacing: 0.05em; font-weight: 800; }
.stat-value { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif; font-family: var(--font); font-weight: 900; font-size: 2.2rem; letter-spacing: -0.01em; margin: 0.1rem 0; color: #10141c; color: var(--ink); }
.stat-value.negative { color: #ff3b30; color: var(--red); }

.change-badge {
    display: inline-block;
    margin-top: 0.4rem;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.15rem 0.55rem;
    border-radius: 100px;
    background: rgba(107,114,128,0.12);
    color: #6b7280; color: var(--muted);
}
.change-badge.positive { background: rgba(0,200,83,0.15); color: #009e42; color: var(--green-dark); }
.change-badge.negative { background: rgba(255,59,48,0.12); color: #d6301f; color: var(--red-dark); }

/* Page header row: title + export actions */
.page-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 0.2rem; }
.page-header h1 { margin-bottom: 0; }
.page-actions { display: flex; gap: 0.6rem; }
.page-action-btn {
    display: inline-block;
    font-size: 0.78rem;
    font-weight: 700;
    text-decoration: none;
    color: #14161c; color: var(--text);
    background: #ffffff; background: var(--card);
    border: 1.5px solid #e4e5ea; border: 1.5px solid var(--line);
    border-radius: 100px;
    padding: 0.4rem 0.9rem;
}
.page-action-btn:hover { border-color: #00c853; border-color: var(--green); color: #009e42; color: var(--green-dark); }
.page-actions-hint { margin: 0 0 1.5rem; font-size: 0.78rem; color: #6b7280; color: var(--muted); }

/* Section scaffolding — every block of the page (Overview / Insights /
   Custom range / Trends) gets a consistent label + spacing rhythm so the
   page reads as distinct sections instead of one long stack of cards. */
.report-section { margin-bottom: 2rem; }
.section-label { font-size: 0.8rem; margin-bottom: 0.6rem; }
.section-caption { margin: -0.3rem 0 0.75rem; font-size: 0.8rem; color: #6b7280; color: var(--muted); }

/* Quick insights: one strip instead of several near-identical cards */
.insight-strip {
    display: flex;
    flex-wrap: wrap;
    background: #ffffff; background: var(--card);
    border-radius: 10px;
    box-shadow: 0 6px 18px -10px rgba(16,20,28,0.2);
    overflow: hidden;
}
.insight-col {
    flex: 1 1 180px;
    padding: 0.9rem 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    border-right: 1px solid #e4e5ea; border-right: 1px solid var(--line);
}
.insight-col:last-child { border-right: none; }
.insight-label { font-size: 0.68rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; color: #6b7280; color: var(--muted); }
.insight-value { font-size: 1.3rem; font-weight: 900; color: #10141c; color: var(--ink); }
.insight-sub { font-size: 0.72rem; color: #6b7280; color: var(--muted); }

/* Custom range: picker + summary + sessions all live in one card, so
   selecting a range reads as "this card updated" rather than "new boxes
   appeared on the page." */
.range-card {
    background: #ffffff; background: var(--card);
    border-radius: 10px;
    box-shadow: 0 6px 18px -10px rgba(16,20,28,0.2);
    padding: 1.1rem 1.25rem;
}
.range-summary { border-top: 1px solid #e4e5ea; border-top: 1px solid var(--line); margin-top: 1rem; padding-top: 1rem; }
.range-summary-net { display: flex; align-items: baseline; gap: 0.75rem; flex-wrap: wrap; }
.range-summary-net .stat-value { font-size: 1.7rem; margin: 0; }
.range-summary-net .change-badge { margin-top: 0; }
.range-sessions-table { margin: 1rem 0 0; box-shadow: none; }

.utilization-heading { margin: 1.75rem 0 0.5rem; font-size: 1rem; text-transform: uppercase; font-weight: 900; letter-spacing: -0.01em; }
.utilization-form {
    flex-direction: row;
    align-items: center;
    max-width: none;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    font-size: 0.82rem;
    color: #6b7280; color: var(--muted);
}
.utilization-form input[type="number"] { width: 4.5rem; padding: 0.35rem 0.5rem; }
.utilization-form button { font-size: 0.78rem; padding: 0.4rem 0.9rem; }

/* Bar reports (hourly / daily / weekly / per-table) */
.section-hint { text-transform: none; font-size: 0.7rem; font-weight: 600; letter-spacing: normal; color: #6b7280; color: var(--muted); margin-left: 0.4rem; }
.bar-report {
    display: flex; flex-direction: column; gap: 0.4rem;
    background: #ffffff; background: var(--card); border-radius: 10px; padding: 1rem 1.25rem;
    box-shadow: 0 6px 18px -10px rgba(16,20,28,0.2);
    margin-bottom: 1.75rem;
}
.bar-row {
    display: grid; grid-template-columns: 108px minmax(0, 1fr) auto; align-items: center; gap: 0.75rem;
    text-decoration: none; color: inherit; border-radius: 6px; padding: 0.15rem 0.3rem; margin: 0 -0.3rem;
}
.bar-label { font-size: 0.78rem; font-weight: 700; color: #6b7280; color: var(--muted); white-space: nowrap; }
.bar-track { background: #eceef1; border-radius: 4px; height: 10px; overflow: hidden; }
.bar-fill { background: #2979ff; background: linear-gradient(90deg, var(--purple), var(--blue), var(--green)); height: 100%; border-radius: 4px; }
.bar-value { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; font-size: 0.85rem; }
.bar-value small { color: #6b7280; color: var(--muted); font-weight: 600; margin-left: 0.2rem; }
.bar-value.negative { color: #ff3b30; color: var(--red); }
.muted { color: #6b7280; color: var(--muted); }

.bar-row-link { cursor: pointer; }
.bar-row-link:hover { background: #eef9f1; }
.bar-row-link:hover .bar-label { color: #10141c; color: var(--ink); }
.bar-row-link:hover .bar-fill { background: #009e42; background: var(--green-dark); }

.drilldown { border: 2px solid #00c853; border: 2px solid var(--green); border-radius: 10px; padding: 0.25rem 1rem 1rem; margin-bottom: 1.75rem; background: #f3fbf6; }
.drilldown h2 { display: flex; align-items: center; gap: 0.75rem; }
.clear-filter {
    text-transform: none; font-weight: 700; font-size: 0.75rem; letter-spacing: normal;
    color: #fff; background: #10141c; background: var(--ink); padding: 0.2rem 0.6rem; border-radius: 100px; text-decoration: none;
}
.clear-filter:hover { background: #ff3b30; background: var(--red); }

.range-presets { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.75rem; }
.range-preset {
    font-size: 0.75rem;
    font-weight: 700;
    text-decoration: none;
    color: #6b7280; color: var(--muted);
    background: #f1f2f5; background: var(--paper);
    border-radius: 100px;
    padding: 0.35rem 0.8rem;
    white-space: nowrap;
}
.range-preset:hover { color: #10141c; color: var(--ink); }
.range-preset.active { color: #fff; background: #00c853; background: var(--green); }
.range-form {
    display: flex;
    flex-direction: row;
    max-width: none;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    font-size: 0.8rem;
    color: #6b7280; color: var(--muted);
    margin-bottom: 0;
}
.range-form input[type="date"] { padding: 0.35rem 0.5rem; }
.range-form button { font-size: 0.78rem; padding: 0.4rem 0.9rem; }

/* Report tabs */
.report-tabs {
    display: flex;
    gap: 0.25rem;
    border-bottom: 2px solid #e4e5ea; border-bottom: 2px solid var(--line);
    margin-bottom: 1.25rem;
    overflow-x: auto;
}
.report-tab {
    background: transparent;
    color: #6b7280; color: var(--muted);
    border: none;
    border-radius: 0;
    padding: 0.65rem 1rem;
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 3px solid transparent;
    white-space: nowrap;
}
.report-tab:hover { color: #14161c; color: var(--text); background: transparent; }
.report-tab.active { color: #10141c; color: var(--ink); border-bottom-color: #00c853; border-bottom-color: var(--green); }
.panel-hint { margin: 0 0 0.75rem; }

@media (max-width: 640px) {
    .bar-row { grid-template-columns: 1fr; gap: 0.15rem; }
    .bar-value { text-align: left; white-space: normal; }
    main { padding: 1.5rem 1.1rem 2.5rem; }
    h1 { font-size: 1.45rem; }
    .stat-value { font-size: 1.8rem; }
    /* Comfortable tap targets for the small buttons (Void, View range) on phones. */
    .btn-small { padding: 0.5rem 0.8rem; font-size: 0.72rem; }
    .range-form button { padding: 0.6rem 1rem; }
}

.site-footer {
    text-align: center;
    font-size: 0.72rem;
    color: #6b7280; color: var(--muted);
    padding: 1.5rem 1rem 2rem;
}

.blank-body {
    background: #f2f2f2;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    padding: 2rem 1rem;
}
.receipt-page { width: 100%; max-width: 380px; }
.receipt-page.report-print-page { max-width: 460px; }
.report-print-heading { margin: 1rem 0 0.3rem; font-size: 0.72rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; color: #6b7280; color: var(--muted); text-align: left; }
.receipt-slip {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.12);
    padding: 1.75rem 1.5rem;
    text-align: center;
}
.receipt-slip h1 {
    font-size: 1.1rem;
    margin: 0 0 0.2rem;
}
.receipt-subtitle {
    margin: 0 0 1.25rem;
    color: #6b7280; color: var(--muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.receipt-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.88rem;
    margin-bottom: 1rem;
}
.receipt-table td {
    padding: 0.4rem 0;
    border-bottom: 1px dashed #ddd;
}
.receipt-table td:first-child { color: #6b7280; color: var(--muted); }
.receipt-table td:last-child { text-align: right; font-weight: 600; }
.receipt-total {
    font-size: 1.4rem;
    font-weight: 800;
    margin: 0.5rem 0 0.25rem;
}
.receipt-meta {
    color: #6b7280; color: var(--muted);
    font-size: 0.72rem;
    margin: 0 0 1.25rem;
}
.receipt-actions {
    display: flex;
    gap: 0.6rem;
    justify-content: center;
}
.receipt-actions button,
.receipt-actions a {
    font-size: 0.82rem;
    padding: 0.5rem 1rem;
}
.payment-form {
    text-align: left;
    border-top: 1px dashed #ddd;
    margin-top: 1rem;
    padding-top: 1rem;
}
.payment-form label {
    display: block;
    font-size: 0.78rem;
    color: #6b7280; color: var(--muted);
    margin-bottom: 0.3rem;
}
.payment-form input {
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 0.5rem;
}
.payment-form button {
    width: 100%;
}
.change-preview {
    font-weight: 700;
    min-height: 1.2em;
    margin: 0 0 0.5rem;
}

@media print {
    .no-print { display: none !important; }
    .blank-body { background: #fff; padding: 0; }
    .receipt-slip { box-shadow: none; padding: 0; }
}
