/* Tennis PWA — design derived from the logo (logo-tenis.png).
   Warm cream background, charcoal ink, terracotta accent.
   Display: Fraunces (serif). UI: Inter (sans). */

:root {
    /* Palette — sampled directly from the logo. */
    --cream:        #F2EBDA;   /* canvas */
    --cream-lift:   #FAF5E7;   /* lifted surface (card) */
    --cream-sink:   #E9DFC5;   /* pressed/active surface */
    --line:         #D6CDB8;   /* hairlines */
    --line-strong:  #B9AF97;   /* stronger divider */
    --ink:          #272721;   /* primary text + "net" black */
    --ink-soft:     #5A564C;   /* secondary text */
    --ink-muted:    #8A8578;   /* tertiary / disabled text */
    --accent:       #B2684F;   /* terracotta ball, a touch richer than logo sample for readability */
    --accent-deep:  #8A4E3A;   /* hover/pressed */
    --accent-soft:  #F0DCCF;   /* tint for success/selected backgrounds */
    --danger:       #A8392B;
    --danger-soft:  #EFCEC7;

    --shadow-sm:    0 1px 2px rgba(39, 39, 33, 0.06);
    --shadow-md:    0 4px 14px rgba(39, 39, 33, 0.08), 0 1px 2px rgba(39, 39, 33, 0.05);
    --shadow-lg:    0 12px 32px rgba(39, 39, 33, 0.12);

    --radius:       14px;
    --radius-sm:    10px;
    --radius-pill:  999px;

    --tap:          48px;
    --header-h:     60px;
    --nav-h:        68px;

    --font-display: "Fraunces", Georgia, "Times New Roman", serif;
    --font-ui:      "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

    --bg:           var(--cream);
    --surface:      var(--cream-lift);
    --text:         var(--ink);
    --muted:        var(--ink-soft);
    --border:       var(--line);
    --primary:      var(--accent);
    --primary-ink:  var(--cream);
    --primary-soft: var(--accent-soft);
}

@media (prefers-color-scheme: dark) {
    :root {
        --cream:        #16140F;
        --cream-lift:   #1F1D17;
        --cream-sink:   #2A271F;
        --line:         #33302A;
        --line-strong:  #4A463C;
        --ink:          #F2EBDA;
        --ink-soft:     #C5BEAC;
        --ink-muted:    #8B8575;
        --accent:       #D5886C;
        --accent-deep:  #B2684F;
        --accent-soft:  #3A2A22;
        --danger:       #E57B6A;
        --danger-soft:  #3A201C;
        --shadow-sm:    0 1px 2px rgba(0, 0, 0, 0.4);
        --shadow-md:    0 4px 14px rgba(0, 0, 0, 0.5);
        --shadow-lg:    0 12px 32px rgba(0, 0, 0, 0.6);
    }
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font: 400 16px/1.45 var(--font-ui);
    font-feature-settings: "ss01", "cv11";
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100dvh;
    overscroll-behavior-y: none;
}

body {
    background-image:
        radial-gradient(1200px 600px at 50% -100px, rgba(178, 104, 79, 0.05), transparent 60%);
    background-attachment: fixed;
}

button { font: inherit; cursor: pointer; }
input, textarea { font: inherit; color: inherit; }

a { color: var(--accent-deep); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

h1, h2, h3, h4 {
    font-family: var(--font-display);
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--ink);
    margin: 0;
}

.app { min-height: 100dvh; display: flex; flex-direction: column; }

/* --- SPLASH --- */

.splash {
    position: fixed; inset: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 28px;
    background: var(--bg);
    padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}
.splash-logo {
    width: 160px; height: 160px; object-fit: cover;
    border-radius: 22.5%;
    animation: logo-fade 0.4s ease-out both;
}
.splash-spinner {
    width: 28px; height: 28px; border-radius: 50%;
    border: 2.5px solid var(--line);
    border-top-color: var(--accent);
    animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes logo-fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

/* --- AUTH SCREENS --- */

.auth {
    min-height: 100dvh;
    display: flex; flex-direction: column;
    padding: env(safe-area-inset-top) 22px env(safe-area-inset-bottom);
    max-width: 440px; margin: 0 auto; width: 100%;
}
.auth-header {
    padding: 32px 0 20px;
    text-align: center;
}
.auth-logo-img {
    width: 160px; height: 160px; object-fit: cover; display: block; margin: 0 auto 18px;
    border-radius: 22.5%;
}
.auth-logo-link {
    display: block;
    text-decoration: none;
}
.auth-logo-link:hover { text-decoration: none; }
.auth-subfooter {
    margin-top: 4px;
    text-align: center;
    font-size: 14px;
    color: var(--ink-soft);
}
.auth-subfooter a { font-weight: 500; }
.auth-header h1 {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(24px, 7vw, 30px);
    letter-spacing: -0.015em;
    line-height: 1.1;
    color: var(--ink);
}
.auth-header .auth-subtitle {
    margin-top: 6px;
    font-family: var(--font-ui);
    font-size: 14px;
    color: var(--ink-soft);
}
.auth-main { flex: 1; }
.auth-footer {
    padding: 22px 0 18px;
    text-align: center;
    color: var(--ink-soft);
    font-size: 14px;
}
.auth-footer a { color: var(--accent-deep); font-weight: 500; }

/* --- FORMS --- */

.stack { display: flex; flex-direction: column; gap: 14px; }

.stack label, .sheet label {
    display: flex; flex-direction: column; gap: 6px;
    font-size: 12px;
    color: var(--ink-soft);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-weight: 500;
}
.stack label > span, .sheet label > span { line-height: 1; }

.stack input, .sheet input {
    width: 100%;
    height: var(--tap);
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--cream-lift);
    color: var(--ink);
    font-size: 16px;
    text-transform: none;
    letter-spacing: 0;
    transition: border-color .15s, box-shadow .15s, background .15s;
}
.stack input::placeholder, .sheet input::placeholder { color: var(--ink-muted); }
.stack input:focus, .sheet input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

/* Altcha runs as an invisible background challenge — no widget UI. The
   element stays in the DOM so its web-worker can solve the PoW while the
   user fills out the form; by the time they submit the token is ready. */
.captcha {
    position: absolute;
    left: -9999px;
    width: 1px; height: 1px;
    overflow: hidden;
}

.separator {
    display: flex; align-items: center; gap: 12px;
    margin: 18px 0 8px;
    color: var(--ink-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.14em;
}
.separator::before, .separator::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--line);
}

/* Google sign-in button — our custom styling; Google's rendered iframe
   overlays the same rectangle invisibly to intercept the click. */
.google-btn-wrap {
    position: relative;
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    min-height: var(--tap);
}
.btn-google {
    width: 100%;
    min-height: var(--tap);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    pointer-events: none;   /* clicks pass through to the overlay below */
    font-weight: 600;
}
.btn-google .btn-icon {
    width: 18px;
    height: 18px;
    display: inline-flex;
}
.btn-google svg { width: 18px; height: 18px; display: block; }

.gsi-hidden {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    z-index: 2;
    pointer-events: auto;
    /* Normalise whatever Google injects so the clickable area matches ours. */
}
.gsi-hidden > div,
.gsi-hidden iframe {
    width: 100% !important;
    height: 100% !important;
    min-height: var(--tap) !important;
}

.link-row { display: flex; justify-content: center; margin-top: 6px; font-size: 14px; }
.link-row-end { justify-content: flex-end; margin-top: -4px; }

.form-error { color: var(--danger); font-size: 14px; min-height: 1em; }
.form-success { color: var(--accent-deep); font-size: 14px; min-height: 1em; }
.muted { color: var(--ink-soft); font-size: 14px; }
.hint { color: var(--ink-muted); font-size: 12px; margin: -2px 0 0; }

/* --- BUTTONS --- */

.btn {
    min-height: var(--tap);
    padding: 0 20px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: var(--cream-lift);
    color: var(--ink);
    font-family: var(--font-ui);
    font-weight: 600;
    font-size: 15px;
    letter-spacing: 0.005em;
    transition: transform .05s ease, background .15s, border-color .15s, box-shadow .15s, opacity .15s;
    box-shadow: var(--shadow-sm);
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
    background: var(--ink);
    color: var(--cream);
    border-color: var(--ink);
}
.btn-primary:hover { background: #000; }

.btn-accent {
    background: var(--accent);
    color: var(--cream);
    border-color: var(--accent);
}
.btn-accent:hover { background: var(--accent-deep); border-color: var(--accent-deep); }

.btn-danger {
    background: var(--danger);
    color: #fff;
    border-color: var(--danger);
}

.btn-ghost {
    background: transparent;
    color: var(--ink);
    border-color: var(--line-strong);
    box-shadow: none;
}
.btn-ghost:hover { background: var(--cream-sink); }

.btn-link {
    min-height: 36px; padding: 8px 12px; border: 0;
    background: transparent; color: var(--accent-deep); font-weight: 600;
    border-radius: 8px; font-size: 14px;
}
.btn-link.btn-danger { color: var(--danger); background: transparent; border: 0; box-shadow: none; }
.btn-link:hover { background: var(--accent-soft); }
.btn-link.btn-danger:hover { background: var(--danger-soft); }

/* --- APP SHELL --- */

.app-shell { display: flex; flex-direction: column; min-height: 100dvh; }

.app-header {
    position: sticky; top: 0; z-index: 10;
    height: calc(var(--header-h) + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) 12px 0 16px;
    background: var(--cream);
    border-bottom: 1px solid var(--line);
    display: flex; align-items: center; gap: 12px;
}
.app-header-brand {
    display: flex; align-items: center; gap: 10px;
    color: var(--ink);
    text-decoration: none;
    flex: 0 0 auto;
    min-width: 0;
}
.app-header-brand:hover { text-decoration: none; }
.app-header-logo {
    width: 36px; height: 36px; object-fit: contain; display: block;
}
.app-title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 18px;
    letter-spacing: -0.005em;
    color: var(--ink);
    white-space: nowrap;
}
.app-title em {
    font-style: normal;
    font-weight: 700;
}

/* Top nav — hidden on mobile (bottom-nav takes over); visible ≥ 640px. */
.top-nav {
    display: none;
    flex: 1;
    justify-content: center;
    align-items: stretch;
    gap: 4px;
    align-self: stretch;
}
.nav-item.top-nav-item {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 14px;
    height: 100%;
    color: var(--ink-soft);
    font-family: var(--font-ui);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.01em;
    text-transform: none;
    position: relative;
    border-radius: 0;
    transition: color .15s;
}
.nav-item.top-nav-item svg { width: 20px; height: 20px; stroke-width: 1.75; transform: none; }
.nav-item.top-nav-item:hover { color: var(--ink); text-decoration: none; }
.nav-item.top-nav-item.is-active { color: var(--ink); }
.nav-item.top-nav-item.is-active svg { transform: none; }
.nav-item.top-nav-item.is-active::before { content: none; }
.nav-item.top-nav-item.is-active::after {
    content: '';
    position: absolute; left: 14px; right: 14px; bottom: -1px;
    height: 2px;
    background: var(--accent);
    border-radius: 2px 2px 0 0;
}
.nav-item.top-nav-item .nav-label { font-size: 14px; letter-spacing: 0.01em; text-transform: none; }

/* User chip + dropdown */
.user-menu-wrap {
    position: relative;
    margin-left: auto;
    flex: 0 0 auto;
}
.user-chip {
    display: inline-flex; align-items: center; gap: 8px;
    min-height: 40px;
    padding: 4px 10px 4px 4px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-pill);
    color: var(--ink);
    font-family: var(--font-ui);
    font-weight: 600;
    font-size: 14px;
    letter-spacing: 0.005em;
    transition: background .15s, border-color .15s;
    max-width: 220px;
}
.user-chip:hover, .user-chip[aria-expanded="true"] {
    background: var(--cream-sink);
    border-color: var(--line);
}
.user-avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--accent);
    color: var(--cream);
    display: inline-grid;
    place-items: center;
    font-family: var(--font-ui);
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 0.02em;
    flex: 0 0 auto;
}
.user-chip-name {
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: none;
}
.user-chip-caret {
    width: 16px !important; height: 16px !important;
    color: var(--ink-muted);
    display: none;
}

.user-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 240px;
    background: var(--cream-lift);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 6px;
    z-index: 20;
    display: flex;
    flex-direction: column;
}
.user-menu[hidden] { display: none; }
.user-menu-info {
    padding: 10px 12px 12px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 6px;
}
.user-menu-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--ink);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.user-menu-email {
    font-size: 12px;
    color: var(--ink-soft);
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.user-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: transparent;
    border: 0;
    border-radius: var(--radius-sm);
    color: var(--ink);
    font-family: var(--font-ui);
    font-size: 14px;
    font-weight: 500;
    text-align: left;
    transition: background .15s;
}
.user-menu-item:hover { background: var(--cream-sink); }
.user-menu-item svg { width: 18px; height: 18px; color: var(--ink-soft); }

.app-main {
    flex: 1;
    width: 100%;
    padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 8px);
}

/* Bottom nav */
.bottom-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
    height: calc(var(--nav-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--cream-lift);
    border-top: 1px solid var(--line);
    display: grid; grid-template-columns: 1fr 1fr;
    box-shadow: 0 -4px 16px rgba(39, 39, 33, 0.04);
}
.nav-item {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    color: var(--ink-muted);
    font-family: var(--font-ui);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    position: relative;
    transition: color .15s;
}
.nav-item svg { width: 22px; height: 22px; stroke-width: 1.75; transition: transform .15s; }
.nav-item.is-active { color: var(--ink); }
.nav-item.is-active svg { transform: translateY(-1px); }
.nav-item.is-active::before {
    content: '';
    position: absolute; top: 0; left: 50%; transform: translateX(-50%);
    width: 24px; height: 2px;
    background: var(--accent);
    border-radius: 0 0 2px 2px;
}

/* --- CALENDAR (month grid) --- */

.calendar {
    padding: 14px 16px 6px;
}
.cal-head {
    display: flex; align-items: center; gap: 8px;
    margin-bottom: 10px;
}
.cal-month {
    flex: 1;
    text-align: center;
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--ink);
    text-transform: capitalize;
}
.cal-nav {
    width: 36px; height: 36px;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: var(--cream-lift);
    color: var(--ink);
    font-size: 20px;
    line-height: 1;
    display: inline-flex; align-items: center; justify-content: center;
    transition: background .15s, border-color .15s;
}
.cal-nav:hover { border-color: var(--line-strong); background: var(--cream-sink); }
.cal-dow {
    display: grid; grid-template-columns: repeat(7, 1fr);
    padding: 0 2px 4px;
    font-size: 11px;
    color: var(--ink-muted);
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.cal-grid {
    display: grid; grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}
.cal-cell {
    aspect-ratio: 1;
    display: inline-flex; align-items: center; justify-content: center;
    font-family: var(--font-ui);
    font-size: 15px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    color: var(--ink);
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    transition: background .15s, color .15s, border-color .15s;
}
.cal-cell.is-out { color: var(--ink-muted); opacity: 0.45; }
.cal-cell.is-past { color: var(--ink-muted); }
.cal-cell.is-today {
    border-color: var(--accent);
    color: var(--accent-deep);
    font-weight: 600;
}
.cal-cell.is-selected {
    background: var(--ink);
    color: var(--cream);
    border-color: var(--ink);
}
.cal-cell.is-selected.is-today { color: var(--cream); border-color: var(--ink); }
.cal-cell:hover:not(.is-selected) { background: var(--cream-sink); }

/* --- TIMETABLE --- */

.timetable {
    padding: 6px 20px 100px;
    position: relative;
}
.tt-col {
    position: relative;
    margin-left: 54px;
    height: calc(var(--tt-hours, 14) * 56px);
    border-left: 1px solid var(--line);
}
.tt-tick {
    position: absolute;
    left: 0; right: 0;
    height: 0;
    border-top: 1px dashed var(--line);
    transform: translateY(-0.5px);
}
.tt-tick-last { border-top-style: solid; }
.tt-tick-first { border-top-color: transparent; }
.tt-tick-label {
    position: absolute;
    left: -54px;
    top: -7px;
    width: 46px;
    text-align: right;
    font-family: var(--font-ui);
    font-size: 11px;
    font-variant-numeric: tabular-nums;
    color: var(--ink-muted);
}
.tt-weather {
    position: absolute;
    right: 4px;
    /* shift the icon+temp stack up so the icon sits above the hour line */
    transform: translateY(calc(-50% - 8px));
    width: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    opacity: 0.9;
    pointer-events: none;
    color: var(--ink-muted);
    line-height: 1;
}
.tt-weather > svg {
    width: 28px;
    height: 28px;
    display: block;
}
.tt-weather .tt-temp {
    font-family: var(--font-ui);
    font-size: 10px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--ink-soft);
}
.tt-past {
    position: absolute;
    left: 0; right: 0; top: 0;
    background: repeating-linear-gradient(
        135deg,
        transparent, transparent 6px,
        var(--line) 6px, var(--line) 7px
    );
    opacity: 0.5;
    pointer-events: none;
    border-radius: 2px;
}
.tt-res {
    position: absolute;
    left: 6px; right: 42px;
    padding: 6px 10px;
    background: var(--cream);
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: var(--shadow-sm);
    display: flex; flex-direction: column; justify-content: center; gap: 2px;
    text-align: left;
    overflow: hidden;
    font-family: var(--font-ui);
    color: var(--ink);
    cursor: default;
    transition: transform .08s;
}
.tt-res.is-taken {
    background: var(--cream-sink);
    color: var(--ink-soft);
    border-color: var(--line);
}
.tt-res.is-mine {
    background: var(--accent-soft);
    border-color: var(--accent);
    color: var(--accent-deep);
    cursor: pointer;
}
.tt-res.is-mine:active { transform: scale(0.985); }
.tt-res-time {
    font-size: 11px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
    opacity: 0.85;
}
.tt-res-naziv {
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

/* --- FAB (new reservation) ---
   Extended pill by default; collapses to a round "+" on mobile after scroll
   (the .is-compact class is toggled from JS). */

.fab {
    position: fixed;
    right: 18px;
    bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 18px);
    height: 56px;
    min-width: 56px;
    padding: 0 22px;
    border-radius: 28px;
    background: var(--accent);
    color: var(--cream);
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-ui);
    font-size: 15px;
    font-weight: 600;
    line-height: 1;
    letter-spacing: 0.005em;
    box-shadow: var(--shadow-lg);
    z-index: 50;
    transition: background .15s, transform .1s, padding .2s ease, width .2s ease;
}
.fab-label { white-space: nowrap; }
.fab-icon {
    font-size: 26px;
    font-weight: 400;
    line-height: 1;
    transform: translateY(-1px);
}
.fab:hover { background: var(--accent-deep); }
.fab:active { transform: scale(0.96); }

.fab.is-compact {
    padding: 0;
    width: 56px;
    min-width: 56px;
    gap: 0;
    justify-content: center;
}
.fab.is-compact .fab-label {
    width: 0;
    overflow: hidden;
    opacity: 0;
}
.fab.is-compact .fab-icon { transform: none; }

/* --- INSTALL BANNER (mobile, non-installed) --- */

.install-banner {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 12px);
    max-width: 560px;
    margin: 0 auto;
    background: var(--cream-lift);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    z-index: 55;
    animation: install-banner-in .22s ease-out;
}
@keyframes install-banner-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}
.install-banner-icon {
    width: 40px;
    height: 40px;
    border-radius: 9px;
    flex: 0 0 auto;
}
.install-banner-text {
    flex: 1;
    min-width: 0;
}
.install-banner-title {
    font-weight: 600;
    font-size: 14px;
    color: var(--ink);
}
.install-banner-msg {
    color: var(--ink-soft);
    font-size: 12px;
    margin-top: 2px;
    line-height: 1.35;
}
.install-banner-action {
    min-height: 34px;
    padding: 0 12px;
    flex: 0 0 auto;
}
.install-banner-close {
    width: 32px; height: 32px;
    border-radius: 50%;
    border: 0;
    background: transparent;
    color: var(--ink-muted);
    font-size: 22px;
    line-height: 1;
    flex: 0 0 auto;
}
.install-banner-close:hover { background: var(--cream-sink); color: var(--ink); }


/* --- DAY HEADER --- */

.day-header { padding: 6px 20px 10px; }
.day-header h2 {
    font-family: var(--font-display);
    font-size: clamp(22px, 5.5vw, 26px);
    font-weight: 600;
    letter-spacing: -0.015em;
    color: var(--ink);
}
.day-header .day-sub {
    color: var(--ink-soft);
    font-size: 13px;
    margin-top: 2px;
    letter-spacing: 0.02em;
}

/* Day header with prev/next arrows around a clickable date button. */
.day-header-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 10px 16px 12px;
}
.day-nav {
    flex: 0 0 auto;
    width: 40px; height: 40px;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: var(--cream-lift);
    color: var(--ink);
    font-size: 22px;
    line-height: 1;
    display: inline-flex; align-items: center; justify-content: center;
    transition: background .15s, border-color .15s;
}
.day-nav:hover { border-color: var(--line-strong); background: var(--cream-sink); }
.day-nav:active { transform: scale(0.96); }

.day-title {
    flex: 1 1 auto;
    min-height: 40px;
    padding: 6px 14px;
    background: var(--cream-lift);
    border: 1px solid var(--line);
    border-radius: var(--radius-pill);
    display: inline-flex; align-items: center; justify-content: center;
    gap: 8px;
    font-family: var(--font-display);
    font-size: clamp(17px, 4.2vw, 20px);
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--ink);
    transition: background .15s, border-color .15s;
}
.day-title:hover { border-color: var(--line-strong); background: var(--cream-sink); }
.day-title.is-today { border-color: var(--accent); color: var(--accent-deep); }
.day-title-text { text-transform: capitalize; }

.sheet-body-cal {
    padding-bottom: 22px;
}

.cal-footer {
    display: flex;
    justify-content: center;
    padding: 10px 0 2px;
}
.cal-today-btn {
    font-family: var(--font-ui);
    font-size: 13px;
    font-weight: 600;
    color: var(--accent-deep);
    background: var(--accent-soft);
    border: 1px solid var(--accent);
    border-radius: var(--radius-pill);
    padding: 6px 16px;
    transition: background .15s, border-color .15s, transform .1s;
}
.cal-today-btn:hover { background: var(--cream-sink); }
.cal-today-btn:active { transform: scale(0.97); }

/* Desktop calendar popover — appears under the day-title button. */
.cal-popover {
    position: fixed;
    z-index: 120;
    background: var(--cream-lift);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 6px;
    width: min(340px, calc(100vw - 16px));
    animation: cal-pop-in .14s ease-out;
}
.cal-popover .calendar { padding: 8px 10px 4px; }
@keyframes cal-pop-in {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Generic page header — left-aligned, with a subtle underline. */
.page-header {
    padding: 18px 20px 10px;
    margin: 0 12px 10px;
    border-bottom: 1px solid var(--line);
    text-align: left;
}
.page-header h2 {
    font-family: var(--font-display);
    font-size: clamp(22px, 5.5vw, 26px);
    font-weight: 600;
    letter-spacing: -0.015em;
    color: var(--ink);
    text-align: left;
}
.page-empty {
    margin: 0;
    padding: 8px 32px 20px;
    color: var(--ink-soft);
    font-size: 14px;
    text-align: left;
}

/* --- MY RESERVATIONS --- */

.res-list {
    list-style: none; margin: 0;
    padding: 8px 12px 20px;
    display: flex; flex-direction: column; gap: 8px;
}
.res-item {
    display: grid;
    grid-template-columns: 52px 1fr auto;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    background: var(--cream-lift);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}
.res-item.is-past { opacity: 0.55; }
.res-date { text-align: center; }
.res-date-num {
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 600;
    line-height: 1;
    letter-spacing: -0.02em;
    color: var(--ink);
}
.res-date-mon {
    font-size: 11px;
    color: var(--ink-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-top: 2px;
}
.res-time { font-weight: 600; font-size: 15px; color: var(--ink); }
.res-naziv { color: var(--ink-soft); font-size: 13px; margin-top: 2px; }
.res-item.empty {
    justify-content: center;
    color: var(--ink-soft);
    grid-template-columns: 1fr;
    text-align: center;
    padding: 32px;
}

/* --- SHEET --- */

.sheet-backdrop {
    position: fixed; inset: 0; z-index: 100;
    background: rgba(22, 20, 15, 0.55);
    display: flex; align-items: flex-end;
    opacity: 0;
    transition: opacity .25s;
}
.sheet-backdrop.is-open { opacity: 1; }
.sheet {
    width: 100%; max-width: 540px; margin: 0 auto;
    background: var(--cream-lift);
    border-radius: 22px 22px 0 0;
    box-shadow: var(--shadow-lg);
    transform: translateY(100%);
    transition: transform .3s cubic-bezier(.2,.8,.2,1);
    padding-bottom: env(safe-area-inset-bottom);
}
.sheet-backdrop.is-open .sheet { transform: translateY(0); }
.sheet-body {
    padding: 6px 22px 26px;
    display: flex; flex-direction: column; gap: 14px;
}
.sheet-handle {
    width: 40px; height: 4px;
    background: var(--line-strong);
    border-radius: 2px;
    margin: 10px auto 10px;
}
.sheet h3 {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.015em;
    color: var(--ink);
}
.sheet-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 6px;
}

/* --- TIME SPINNERS (in booking sheet) --- */

.spin-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
/* Narrow viewports: stack so the two spinners don't overflow the sheet. */
@media (max-width: 560px) {
    .spin-grid { grid-template-columns: 1fr; }
}
.spinner {
    position: relative;
    background: var(--cream);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 10px 12px;
    text-align: center;
    min-width: 0;
}
.spin-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--ink-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 8px;
}
.spin-row {
    display: flex; align-items: center; justify-content: space-between;
    gap: 6px;
}
.spin-btn {
    flex: 0 0 auto;
    width: 38px; height: 38px;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: var(--cream-lift);
    color: var(--ink);
    font-size: 22px;
    line-height: 1;
    display: inline-flex; align-items: center; justify-content: center;
    transition: background .15s, border-color .15s, opacity .15s;
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
}
.spin-btn:hover:not(:disabled) { border-color: var(--accent); }
.spin-btn:active:not(:disabled) { background: var(--cream-sink); }
.spin-btn:disabled { opacity: 0.35; cursor: not-allowed; }
/* HH:MM display: a button that opens the custom 24-hour popover picker. */
button.spin-value {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
    padding: 4px 8px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: transparent;
    font-family: var(--font-display);
    font-size: 26px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
    color: var(--ink);
    text-align: center;
    cursor: pointer;
    transition: background .15s, border-color .15s;
}
button.spin-value:hover { border-color: var(--line-strong); background: var(--cream-lift); }
button.spin-value:focus-visible,
button.spin-value[aria-expanded="true"] {
    outline: none;
    border-color: var(--accent);
    background: var(--cream-lift);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

/* 24-hour popover: always HH and :MM grids, independent of locale. */
.spin-picker {
    position: absolute;
    top: calc(100% - 4px);
    left: 8px; right: 8px;
    z-index: 20;
    background: var(--cream-lift);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-align: center;
}
.spin-picker[hidden] { display: none; }
.spin-picker-row {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    justify-content: center;
}
.spin-picker-hours { max-width: 100%; }
.spin-picker-minutes {
    border-top: 1px solid var(--line);
    padding-top: 8px;
}
.spin-pick {
    min-width: 40px;
    height: 36px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--cream);
    color: var(--ink);
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 15px;
    font-variant-numeric: tabular-nums;
    display: inline-flex; align-items: center; justify-content: center;
    transition: background .15s, border-color .15s, color .15s, opacity .15s;
}
.spin-pick:hover:not(:disabled) { border-color: var(--accent); background: var(--cream-sink); }
.spin-pick.is-active {
    background: var(--ink);
    color: var(--cream);
    border-color: var(--ink);
}
.spin-pick:disabled { opacity: 0.3; cursor: not-allowed; }
.duration-row {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    font-size: 13px;
    color: var(--ink-soft);
}
.duration-pill {
    background: var(--accent-soft);
    color: var(--accent-deep);
    font-weight: 600;
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    font-variant-numeric: tabular-nums;
}

/* --- TOAST --- */

.toast {
    position: fixed; left: 50%;
    bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 20px);
    transform: translateX(-50%);
    background: var(--ink);
    color: var(--cream);
    padding: 12px 18px;
    border-radius: var(--radius-pill);
    font-size: 14px;
    font-weight: 500;
    box-shadow: var(--shadow-md);
    z-index: 200;
    max-width: 90vw;
    animation: toast-in .22s ease-out;
}
.toast-error { background: var(--danger); color: #fff; }
@keyframes toast-in {
    from { opacity: 0; transform: translate(-50%, 10px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

/* Wider screens: center content, swap bottom nav for top nav. */
/* --- ADMIN USERS TABLE --- */

.users-table-wrap {
    padding: 0 12px 24px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.users-table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--font-ui);
    font-size: 14px;
    background: var(--cream-lift);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
}
.users-table thead th {
    text-align: left;
    padding: 10px 12px;
    background: var(--cream-sink);
    color: var(--ink-soft);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border-bottom: 1px solid var(--line);
}
.users-table tbody td {
    padding: 10px 12px;
    border-top: 1px solid var(--line);
    vertical-align: middle;
}
.users-table tbody tr:first-child td { border-top: 0; }
.users-table tbody tr.is-banned { opacity: 0.55; }
.users-table tbody tr.users-row { cursor: pointer; transition: background .15s; }
.users-table tbody tr.users-row:hover { background: var(--cream-sink); }
.users-table .col-centre { text-align: center; }
.users-table .col-right  { text-align: right; }
.u-name { font-weight: 600; color: var(--ink); }
.u-email { color: var(--ink); font-variant-numeric: tabular-nums; }
.u-phone.muted { color: var(--ink-muted); }
.u-tags { margin-top: 3px; display: flex; flex-wrap: wrap; gap: 4px; }

.tag {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: var(--radius-pill);
    letter-spacing: 0.03em;
    background: var(--cream-sink);
    color: var(--ink-soft);
    border: 1px solid var(--line);
}
.tag-admin   { background: var(--accent-soft); color: var(--accent-deep); border-color: var(--accent); }
.tag-self    { background: var(--cream-sink); color: var(--ink-soft); }
.tag-email   { background: var(--cream); color: var(--ink-soft); }
.tag-google  { background: var(--cream); color: var(--ink-soft); }
.tag-none    { background: transparent; color: var(--ink-muted); border-color: transparent; }
.tag-ok      { background: var(--accent-soft); color: var(--accent-deep); border-color: var(--accent); }
.tag-banned  { background: var(--danger-soft); color: var(--danger); border-color: var(--danger); }
.tag-pending { background: var(--cream-sink); color: var(--ink-soft); border-color: var(--line-strong); }

.u-login-tags {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 4px;
    justify-content: center;
}

.btn-small {
    min-height: 34px;
    padding: 0 12px;
    font-size: 13px;
}
.btn-danger-ghost {
    color: var(--danger);
    border-color: var(--danger);
    background: transparent;
}
.btn-danger-ghost:hover { background: var(--danger-soft); }

.small { font-size: 12px; }

/* --- ADMIN: EDIT USER PROFILE --- */

.edit-user-body {
    padding: 10px 20px 28px;
    max-width: 520px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 22px;
}
.page-header-with-back { padding-top: 10px; }
.back-link {
    display: inline-block;
    margin-bottom: 4px;
    color: var(--ink-soft);
    font-size: 13px;
    font-weight: 500;
}
.back-link:hover { color: var(--ink); }
.edit-status-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    background: var(--cream-lift);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}
.edit-status-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.stack label.checkbox-row {
    flex-direction: row;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    letter-spacing: 0;
    text-transform: none;
    color: var(--ink);
    font-weight: 500;
    padding: 4px 0;
}
.stack label.checkbox-row input[type="checkbox"] {
    width: 20px;
    height: 20px;
    flex: 0 0 auto;
    margin: 0;
    padding: 0;
    accent-color: var(--accent);
    cursor: pointer;
}
.stack label.checkbox-row input[type="checkbox"]:disabled { cursor: not-allowed; }

@media (max-width: 639px) {
    .users-table .u-phone,
    .users-table thead th:nth-child(3),
    .users-table .col-centre:nth-child(4),
    .users-table thead th:nth-child(4) {
        display: none;
    }
}

/* --- ADMIN: ALL RESERVATIONS BY MONTH --- */

.admin-res-groups {
    padding: 0 12px 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.admin-res-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.admin-res-day {
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding: 0 8px 2px;
    border-bottom: 1px solid var(--line);
}
.admin-res-daynum {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.015em;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
}
.admin-res-daylabel {
    font-size: 13px;
    color: var(--ink-soft);
    text-transform: capitalize;
}
.admin-res-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.admin-res-item {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 16px;
    width: 100%;
    padding: 14px 16px;
    background: var(--cream-lift);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}
.admin-res-item.is-past { opacity: 0.55; }
.admin-res-time {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 16px;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
    color: var(--ink);
    white-space: nowrap;
}
.admin-res-body { min-width: 0; }
.admin-res-user {
    font-weight: 600;
    font-size: 14px;
    color: var(--ink);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.admin-res-naziv {
    font-size: 13px;
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* --- MONTH PICKER (used inside popover / sheet) --- */

.month-picker { padding: 8px 10px 4px; }
.month-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    padding: 8px 2px 4px;
}
.month-cell {
    padding: 12px 8px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--ink);
    font-family: var(--font-ui);
    font-size: 14px;
    font-weight: 500;
    text-transform: capitalize;
    transition: background .15s, color .15s, border-color .15s;
}
.month-cell:hover:not(.is-selected) { background: var(--cream-sink); }
.month-cell.is-today {
    border-color: var(--accent);
    color: var(--accent-deep);
    font-weight: 600;
}
.month-cell.is-selected {
    background: var(--ink);
    color: var(--cream);
    border-color: var(--ink);
}

@media (min-width: 640px) {
    .app-main, .calendar, .timetable, .res-list, .day-header, .page-header, .page-empty,
    .admin-res-groups {
        max-width: 640px;
        margin-left: auto;
        margin-right: auto;
    }
    /* The user-management table needs more horizontal room than the rest of
       the app so name/email/phone can breathe. */
    .users-table-wrap {
        max-width: 960px;
        margin-left: auto;
        margin-right: auto;
    }
    .app-header {
        padding-left: 24px;
        padding-right: 18px;
    }
    .top-nav { display: flex; }
    .bottom-nav { display: none; }
    .app-main {
        padding-bottom: 24px;
    }
    .user-chip-name, .user-chip-caret { display: inline-flex; }
    .toast {
        bottom: 24px;
    }
}
