
@import url('tokens.css');

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    background-color: var(--background);
    color: var(--on-surface);
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    line-height: 1.5;
    min-height: 100vh;
    /* clip, not hidden: hidden turns body into a scroll container and breaks sticky. */
    overflow-x: clip;
    -webkit-font-smoothing: antialiased;
}

body, button, input, select, textarea, optgroup {
    font-family: 'JetBrains Mono', monospace;
}

/* Form controls default to a 13.33px system size. Inherit so buttons follow the type scale. */
button, input, select, textarea, optgroup {
    font-size: inherit;
}

/* Native controls and browser chrome stay on-palette: accent-color inherits
   from :root, so every checkbox, radio, range and progress renders Forest. */
:root {
    accent-color: var(--primary);
}

:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

::selection {
    background: var(--inverse-surface);
    color: var(--inverse-on-surface);
}

/* Chrome paints autofilled inputs pale blue; force the card surface instead.
   The inset shadow is the sanctioned way to repaint the autofill background. */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
    -webkit-box-shadow: inset 0 0 0 1000px var(--surface-container-lowest);
    -webkit-text-fill-color: var(--on-surface);
    caret-color: var(--on-surface);
    transition: background-color 9999s ease-in-out 0s;
}

.shift-card {
    background: var(--surface-container-lowest);
    border: 1px solid var(--outline-variant);
    border-left: 4px solid var(--shift-color, var(--primary));
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: relative;
}

.spots-chip {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 700;
    padding: 0 8px;
    min-height: 20px;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.spots-chip.spots-open {
    background: var(--success-container);
    color: var(--on-success-container);
}

.spots-chip.spots-low {
    background: var(--warning-container);
    color: var(--on-warning-container);
}

.spots-chip.spots-none {
    background: var(--surface-container-high);
    color: var(--on-surface-variant);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: var(--radius);
    font-family: var(--font-ui);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
    cursor: pointer;
    border: 1px solid var(--outline);
    background: transparent;
    color: var(--on-surface);
    transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
    text-decoration: none;
    min-height: 36px;
    box-shadow: none;
}

.btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--on-primary);
    font-weight: 600;
    border-radius: var(--radius);
    height: 36px;
    min-height: 36px;
    padding: 0 16px;
    box-shadow: none;
    box-sizing: border-box;
}

/* Hover keeps the tenant colour and draws an inner ring (U118). --primary-container is fixed Herb,
   so the cafe tenant turned green on hover. */
.btn-primary:hover:not(:disabled) {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--on-primary);
    box-shadow: inset 0 0 0 2px var(--inverse-on-surface);
}

.btn-secondary {
    background: transparent;
    border-color: var(--outline);
    color: var(--on-surface);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--surface-container-high);
    border-color: var(--outline);
    color: var(--on-surface);
}

.btn-danger {
    background: var(--error);
    border-color: var(--error);
    color: var(--on-error);
}

.btn-danger:hover:not(:disabled) {
    background: var(--error-container);
    border-color: var(--error);
    color: var(--on-error-container);
}

.btn-block {
    width: 100%;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.form-group {
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-label {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--on-surface-variant);
    letter-spacing: 0.05em;
    line-height: 1;
    display: block;
    margin-bottom: 8px;
}

.form-input {
    background: var(--surface-container-lowest);
    border: 1px solid var(--outline);
    border-radius: var(--radius);
    font-family: var(--font-ui);
    font-size: 14px;
    color: var(--on-surface);
    outline: none;
    min-height: 36px;
    padding: 0 12px;
    transition: border-color 120ms ease, box-shadow 120ms ease;
}

textarea.form-input {
    padding: 8px 12px;
}

.form-input:focus {
    border-color: var(--primary);
    box-shadow: inset 0 0 0 1px var(--primary);
}

/* Codes, times and figures in admin forms: monospace digits, same size and alignment as the
   fields around them. */
.form-input.input-mono {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--scrim);
    backdrop-filter: blur(8px);
    z-index: 100;
    display: flex;
    

    align-items: center;
    justify-content: center;
    padding: 16px;
    overflow-y: auto;
}

@media (max-width: 640px) {
    .modal-overlay {
        align-items: flex-end;
        padding: 0;
    }
}

@media (min-width: 480px) {
    .modal-overlay {
        align-items: center;
        padding: 24px;
    }
}

.modal-dialog {
    background: var(--surface-container-lowest);
    border: 1px solid var(--on-surface);
    border-radius: var(--radius);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    animation: slideUp 0.2s ease-out;
}

@media (max-width: 640px) {
    .modal-dialog {
        border-radius: var(--radius) var(--radius) 0 0;
        max-height: 92vh;
    }
}

@media (min-width: 480px) {
    .modal-dialog {
        border-radius: var(--radius);
    }
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--outline-variant);
    padding-bottom: 16px;
    margin-bottom: 16px;
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--on-surface);
}

.modal-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    color: var(--on-surface-variant);
}

.modal-close:hover {
    background: var(--surface-container-high);
    color: var(--on-surface);
}

.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    left: auto;
    max-width: 360px;
    width: calc(100% - 48px);
    margin: 0;
    z-index: 110;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    background: var(--inverse-surface);
    color: var(--inverse-on-surface);
    padding: 12px 16px;
    border-radius: var(--radius);
    border: none;
    font-family: var(--font-ui);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: none;
    pointer-events: auto;
    animation: fadeIn 0.15s ease;
}

.toast.toast-error {
    background: var(--error);
    color: var(--on-error);
}

.toast.toast-success {
    background: var(--success);
    color: var(--on-success);
}

.toast.toast-warning {
    background: var(--warning);
    color: var(--on-warning);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.empty-state {
    text-align: center;
    padding: 48px 16px;
    color: var(--on-surface-variant);
}

.empty-state-text {
    font-size: 14px;
    margin-bottom: 16px;
}

.noscript-banner {
    margin: 16px;
    padding: 16px;
    background: var(--warning-container);
    color: var(--on-warning-container);
    border: 1px solid var(--warning);
    border-radius: var(--radius);
    font-size: 14px;
    line-height: 1.5;
}

.next-shift-card {
    background: var(--surface-container-low, #F4EAD5);
    border: 1px solid var(--outline-variant, #D3BE9A);
    border-radius: var(--radius, 4px);
    padding: 16px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.next-shift-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.next-shift-badge {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--primary, #294733);
}

.next-shift-countdown {
    font-family: var(--font-mono, 'JetBrains Mono', monospace);
    font-size: 11px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--on-surface-variant, #4F654A);
    background: var(--surface-container-high, #E9D7C7);
    padding: 0 8px;
    line-height: 20px;
    border-radius: 2px;
    display: inline-block;
}

.next-shift-body {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 12px;
}

.next-shift-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--on-surface, #141D17);
}

.next-shift-time {
    font-family: var(--font-mono, 'JetBrains Mono', monospace);
    font-size: 14px;
    font-variant-numeric: tabular-nums;
    color: var(--on-surface-variant, #4F654A);
}

.next-shift-location {
    font-size: 14px;
    color: var(--on-surface-variant, #4F654A);
}

@media (max-width: 640px) {
    #staff-tabs {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 90;
        background: var(--surface-container-lowest, #ffffff);
        border-top: 1px solid var(--outline-variant, #D3BE9A);
        border-bottom: none;
        display: flex;
        justify-content: space-around;
        padding: 0;
        margin: 0;
        height: 52px;
    }

    #staff-tabs .nav-item {
        flex: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        height: 100%;
        min-height: 48px;
        padding: 8px 4px;
        font-size: 14px;
        font-weight: 600;
        border-bottom: none;
        border-top: 3px solid transparent;
        border-radius: 0;
        color: var(--on-surface-variant, #4F654A);
        background: transparent;
        text-align: center;
    }

    #staff-tabs .nav-item.active {
        color: var(--primary, #294733);
        border-top-color: var(--primary, #294733);
        background: var(--surface-container-low, #F4EAD5);
    }

    .app-shell {
        padding-bottom: 68px;
    }
}


/* Notification bell, staff portal. The admin console gets these from admin.css. */
.icon-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1px solid var(--outline-variant, #D3BE9A);
    border-radius: var(--radius, 4px);
    background: var(--surface-container-lowest, #FFFFFF);
    color: var(--on-surface-variant, #4F654A);
    cursor: pointer;
    box-sizing: border-box;
}

.icon-btn:hover {
    color: var(--on-surface, #141D17);
    border-color: var(--outline, #899065);
}

.icon-btn:focus-visible {
    outline: 2px solid var(--primary, #294733);
    outline-offset: 1px;
}

.topbar-actions {
    position: relative;
}

.bell-count {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: var(--radius-sm);
    background: var(--error, #913136);
    color: var(--on-error, #FFFFFF);
    font-family: var(--font-mono, 'JetBrains Mono', monospace);
    font-size: 11px;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
    box-sizing: border-box;
}

.bell-panel {
    position: absolute;
    top: 40px;
    right: 0;
    z-index: 40;
    width: 300px;
    max-width: calc(100vw - 32px);
    max-height: 400px;
    overflow-y: auto;
    background: var(--surface-container-lowest, #FFFFFF);
    border: 1px solid var(--outline-variant, #D3BE9A);
    border-radius: var(--radius, 4px);
}

.search-empty {
    padding: 12px;
    font-family: var(--font-ui, 'JetBrains Mono', monospace);
    font-size: 11px;
    color: var(--on-surface-variant, #4F654A);
}

/* Notification bell */
.bell-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px;
    border-bottom: 1px solid var(--outline-variant, #D3BE9A);
}

.btn-linkish {
    border: none;
    background: transparent;
    padding: 0;
    font-family: var(--font-ui, 'JetBrains Mono', monospace);
    font-size: 11px;
    font-weight: 600;
    color: var(--primary, #294733);
    cursor: pointer;
    text-decoration: underline;
}

.bell-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    padding: 12px;
    border: none;
    border-bottom: 1px solid var(--outline-variant, #D3BE9A);
    background: transparent;
    font-family: var(--font-ui, 'JetBrains Mono', monospace);
    font-size: 11px;
    color: var(--on-surface, #141D17);
    text-align: left;
    cursor: pointer;
}

.bell-item:last-child {
    border-bottom: none;
}

.bell-item:hover {
    background: var(--surface-container-low, #F4EAD5);
}

.bell-item.is-unread {
    background: var(--secondary-container, #DFE2CD);
    font-weight: 600;
}

.bell-item-text {
    flex: 1;
    line-height: 1.4;
}

.bell-item-time {
    flex: 0 0 auto;
    font-size: 11px;
    color: var(--on-surface-variant, #4F654A);
    white-space: nowrap;
}

/* The icon buttons measure 32 by 32, which reads well but is a small thing to hit with a
   thumb. This grows the tappable area to 44 by 44 without moving a single pixel on screen. */
.icon-btn::after {
    content: "";
    position: absolute;
    inset: -6px;
    border-radius: inherit;
}

/* The view area holds a screen of height from first paint, so the footer starts below the fold
   and never moves into view while the data arrives (U76, U27). */
#app-content,
#admin-view-content {
    min-height: 100vh;
}

/* A person who asks the system for less motion gets none: modals, toasts, the row flash and
   every hover transition stop (P64). The drawer rule in admin.css stays as it was. */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* iOS Safari zooms the page on focus of a field under 16px. The rule in components.css lost to
   .form-input above, and admin modal fields are 12px, so this one wins on phones (P111). */
@media (max-width: 640px) {
    .form-input,
    .modal-form-card .form-input {
        font-size: 18px !important;
    }
}

/* The staff Schedule store filter was under the 44 px touch floor on a phone (U136). Select all
   stayed 36px because .btn above loads after the .btn-compact phone rule in components.css and
   ties it, so the id outranks both. The labels are inline-flex and centred already, so min-height
   is all they need. Ids keep admin screens, which load this file too, unchanged. */
@media (max-width: 640px) {
    #btn-toggle-all-locations {
        min-height: 44px;
    }

    #sched-location-filter-bar .filter-check-item {
        min-height: 44px;
    }
}

/* W4 staff portal */
.month-store-picker {
    margin-top: 0;
}

.month-store-apply {
    display: block;
    width: calc(100% - 16px);
    margin: 8px;
}

.my-earnings-line {
    font-size: 14px;
    font-weight: 600;
}
