/* index.css — Side Street Meal Billing workbook UI */

:root {
    --bg-main: #0b0f19;
    --bg-surface: rgba(20, 28, 45, 0.75);
    --bg-surface-solid: #131b2e;
    --bg-input: #0f1626;
    --primary: #10b981;
    --primary-hover: #34d399;
    --primary-bg: rgba(16, 185, 129, 0.1);
    --accent: #3b82f6;
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.15);
    --danger: #f43f5e;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-dim: #64748b;
    --border: rgba(255, 255, 255, 0.08);
    --font-header: 'Outfit', system-ui, sans-serif;
    --font-body: 'Plus Jakarta Sans', system-ui, sans-serif;
    --grid-header: #1a2332;
    --grid-row-alt: rgba(255, 255, 255, 0.02);
    --cell-highlight: rgba(245, 158, 11, 0.2);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    background: var(--bg-main);
    color: var(--text-main);
    font-family: var(--font-body);
    min-height: 100vh;
    background-image:
        radial-gradient(at 0% 0%, rgba(16, 185, 129, 0.05) 0, transparent 50%),
        radial-gradient(at 100% 0%, rgba(59, 130, 246, 0.05) 0, transparent 50%);
}

.glass-panel {
    background: var(--bg-surface);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 20px 24px;
    margin-bottom: 20px;
}

.app-header {
    max-width: 1600px;
    margin: 0 auto;
    padding: 32px 24px 0;
}

.header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.admin-user-label {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 600;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand h1 {
    font-family: var(--font-header);
    font-size: 1.75rem;
    font-weight: 700;
}

.env-badge {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    padding: 4px 8px;
    border-radius: 6px;
    background: var(--primary-bg);
    color: var(--primary);
    border: 1px solid rgba(16, 185, 129, 0.25);
}

.subtitle {
    color: var(--text-muted);
    margin-top: 6px;
    font-size: 0.95rem;
}

.app-main {
    max-width: 1600px;
    margin: 0 auto;
    padding: 24px;
}

.controls-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-end;
    justify-content: space-between;
}

.week-picker-row {
    display: flex;
    align-items: flex-end;
    gap: 12px;
}

.week-picker-row .btn {
    white-space: nowrap;
}

.control-group label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 6px;
    font-weight: 500;
}

.control-group select {
    min-width: 220px;
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.95rem;
}

.control-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn {
    padding: 10px 16px;
    border-radius: 10px;
    border: 1px solid var(--border);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.btn-primary {
    background: var(--primary);
    color: #052e1f;
    border-color: var(--primary);
}

.btn-primary:hover { background: var(--primary-hover); }

.btn-secondary {
    background: var(--bg-input);
    color: var(--text-main);
}

.btn-secondary:hover { border-color: rgba(255, 255, 255, 0.2); }

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

.btn-primary:disabled:hover {
    background: var(--primary);
    border-color: var(--primary);
}

.btn-secondary:disabled:hover {
    border-color: var(--border);
}

.btn-sm {
    padding: 8px 12px;
    font-size: 0.85rem;
}

.btn-block {
    width: 100%;
}

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-control {
    width: 100%;
    background-color: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 14px 16px;
    border-radius: 12px;
    font-size: 1rem;
    font-family: var(--font-body);
    outline: none;
    min-height: 48px;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.form-control::placeholder {
    color: var(--text-dim);
}

.login-body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.login-card {
    width: 100%;
    max-width: 420px;
}

.login-brand {
    text-align: center;
    margin-bottom: 24px;
}

.login-brand h1 {
    font-family: var(--font-header);
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.login-subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 12px;
}

.login-role-toggle {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 20px;
    padding: 4px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
}

.login-role-btn {
    border: none;
    border-radius: 8px;
    padding: 10px 12px;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    color: var(--text-muted);
    background: transparent;
    transition: background 0.15s ease, color 0.15s ease;
}

.login-role-btn.is-active {
    color: var(--text);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: inset 0 0 0 1px var(--border);
}

.comment-cell {
    vertical-align: top;
    padding: 8px;
}

.comment-input {
    width: 100%;
    min-height: 52px;
    resize: vertical;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.2);
    color: var(--text);
    font: inherit;
    font-size: 0.85rem;
    padding: 8px;
}

.comment-input:disabled {
    opacity: 0.5;
}

.day-comment-row td.location-col {
    font-weight: 600;
    color: var(--text-muted);
}

.location-col-wrap {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}

.location-notes-btn {
    font-family: inherit;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 2px 8px;
    cursor: pointer;
    line-height: 1.4;
}

.location-notes-btn.has-notes {
    color: var(--primary);
    border-color: rgba(134, 239, 172, 0.35);
    background: rgba(134, 239, 172, 0.08);
}

.location-notes-btn:hover,
.location-notes-btn:focus {
    filter: brightness(1.08);
    outline: none;
}

.location-notes-btn:focus-visible {
    box-shadow: 0 0 0 2px rgba(134, 239, 172, 0.25);
}

.location-notes-input {
    width: 100%;
    min-height: 140px;
    resize: vertical;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.2);
    color: var(--text);
    font: inherit;
    font-size: 0.9rem;
    padding: 10px 12px;
}

.status-bar {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    font-size: 0.875rem;
    color: var(--text-muted);
}

#import-meta.has-import { color: var(--primary); }

.eli-import-panel {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.eli-import-label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 8px;
    font-weight: 500;
}

.eli-import-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.eli-import-row input[type="file"] {
    flex: 1;
    min-width: 220px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.eli-import-help {
    margin-top: 8px;
    font-size: 0.8rem;
    color: var(--text-dim);
}

.alert {
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 16px;
    font-size: 0.9rem;
}

.alert.error {
    background: rgba(244, 63, 94, 0.12);
    border: 1px solid rgba(244, 63, 94, 0.3);
    color: #fda4af;
}

.alert.success {
    background: var(--primary-bg);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: var(--primary-hover);
}

.hidden { display: none !important; }

.empty-state {
    text-align: center;
    padding: 48px 24px;
}

.empty-state h2 {
    font-family: var(--font-header);
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--text-muted);
    margin-bottom: 20px;
}

.section-block {
    margin-bottom: 28px;
}

.section-title {
    font-family: var(--font-header);
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-main);
    padding-left: 4px;
}

.grid-wrap {
    overflow: auto;
    max-height: calc(100vh - 320px);
    max-height: calc(100dvh - 320px);
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-surface-solid);
}

.meal-grid {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.85rem;
    min-width: 900px;
}

.meal-grid th,
.meal-grid td {
    padding: 8px 10px;
    text-align: center;
    white-space: nowrap;
}

.meal-grid thead th {
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 0 var(--border);
}

.meal-grid th {
    background: var(--grid-header);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    position: sticky;
    top: 0;
    z-index: 2;
}

.meal-grid td.location-col,
.meal-grid th.location-col {
    text-align: left;
    min-width: 200px;
    max-width: 280px;
    position: sticky;
    left: 0;
    background: var(--bg-surface-solid);
    z-index: 2;
    box-shadow: 2px 0 6px rgba(0, 0, 0, 0.15);
}

.meal-grid th.location-col {
    z-index: 4;
    background: var(--grid-header);
}

.meal-grid thead tr.header-legend-row th {
    top: 33px;
    font-size: 0.68rem;
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
    color: var(--text-dim);
    padding-top: 4px;
    padding-bottom: 8px;
}

/* Location groups — alternating tint + divider between locations */
.meal-grid tbody tr[data-group="0"] td {
    background: rgba(255, 255, 255, 0.018);
}

.meal-grid tbody tr[data-group="1"] td {
    background: transparent;
}

.meal-grid tbody tr[data-group="0"] td.location-col {
    background: #141c2e;
}

.meal-grid tbody tr[data-group="1"] td.location-col {
    background: var(--bg-surface-solid);
}

.meal-grid tbody tr.grid-section-header td {
    background: rgba(134, 239, 172, 0.08);
    color: var(--primary);
    font-family: var(--font-header);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    padding: 10px 12px;
    border-top: 2px solid rgba(134, 239, 172, 0.25);
    border-bottom: 1px solid var(--border);
}

.meal-grid tbody tr.grid-section-header:first-child td {
    border-top: none;
}

.meal-grid tbody tr.location-group-divider td {
    border-top: 2px solid rgba(255, 255, 255, 0.1);
    padding-top: 12px;
}

.meal-grid tbody tr:hover td {
    background: rgba(59, 130, 246, 0.08);
}

.meal-grid tbody tr:hover td.location-col {
    background: #172035;
}

.cell-nonzero {
    background: var(--cell-highlight) !important;
    font-weight: 600;
    color: #fcd34d;
}

.cell-zero {
    color: var(--text-dim);
}

.cell-weekly-na {
    color: var(--text-dim);
}

.cell-weekly-total {
    font-weight: 700;
    color: #fcd34d;
}

.row-total {
    font-weight: 700;
    color: var(--text-main);
}

.meta-col {
    text-align: left !important;
    font-size: 0.8rem;
    color: var(--text-muted);
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.save-status {
    margin-left: auto;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.save-status.saving {
    color: #93c5fd;
}

.save-status.saved {
    color: #86efac;
}

.save-status.error {
    color: #fda4af;
}

.count-cell-stack {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.count-cell-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.day-status-btn {
    font-family: inherit;
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    border-radius: 4px;
    padding: 2px 6px;
    border: 1px solid transparent;
    cursor: pointer;
    line-height: 1.2;
}

.day-status-btn.is-open {
    color: #86efac;
    background: rgba(134, 239, 172, 0.12);
    border-color: rgba(134, 239, 172, 0.25);
}

.day-status-btn.is-closed {
    color: #fda4af;
    background: rgba(244, 63, 94, 0.12);
    border-color: rgba(244, 63, 94, 0.25);
}

.day-status-btn:hover {
    filter: brightness(1.1);
}

.day-status-btn.saving {
    opacity: 0.7;
}

.count-cell.day-closed {
    background: rgba(244, 63, 94, 0.06) !important;
}

.count-cell.day-closed .cell-input:disabled {
    opacity: 0.45;
}

.cell-weekly-dash {
    color: var(--text-dim);
    font-size: 0.85rem;
}

.header-legend-sub {
    display: block;
    font-size: 0.58rem;
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
    color: var(--text-dim);
    margin-top: 2px;
}

.row-total-stack {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.count-rate {
    font-family: inherit;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--primary);
    background: transparent;
    border: none;
    border-bottom: 1px dashed rgba(134, 239, 172, 0.35);
    padding: 0 2px;
    cursor: pointer;
    line-height: 1.3;
}

.count-rate.is-unset {
    color: var(--text-muted);
    border-bottom-color: rgba(148, 163, 184, 0.35);
}

.count-rate:hover,
.count-rate:focus {
    color: var(--primary-hover, #86efac);
    outline: none;
}

.count-rate:focus-visible {
    box-shadow: 0 0 0 2px rgba(134, 239, 172, 0.25);
}

.row-amount-total {
    font-size: 0.68rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.count-minimum {
    font-family: inherit;
    font-size: 0.72rem;
    color: var(--text-dim);
    font-weight: 500;
    border: none;
    background: transparent;
    padding: 0 2px;
    cursor: pointer;
    border-radius: 4px;
}

.count-minimum-total {
    font-family: inherit;
    font-size: 0.72rem;
    color: var(--text-dim);
    font-weight: 500;
}

.row-total-static .count-minimum-total {
    font-size: 0.78rem;
}

.count-minimum:hover,
.count-minimum:focus {
    color: var(--text-muted);
    outline: none;
    background: rgba(255, 255, 255, 0.06);
}

.count-minimum:focus-visible {
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.45);
}

.minimum-edit-field {
    margin-top: 16px;
}

.minimum-edit-field label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.minimum-edit-input {
    width: 100%;
    max-width: 200px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-input);
    color: var(--text-main);
    font: inherit;
    font-size: 1.1rem;
    -moz-appearance: textfield;
}

.minimum-edit-input:focus {
    outline: none;
    border-color: rgba(59, 130, 246, 0.6);
}

.minimum-edit-input::-webkit-outer-spin-button,
.minimum-edit-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.cell-input {
    width: 3.25rem;
    padding: 4px 6px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-main);
    font: inherit;
    text-align: center;
    -moz-appearance: textfield;
}

.cell-input::-webkit-outer-spin-button,
.cell-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.cell-input:focus {
    outline: none;
    border-color: rgba(59, 130, 246, 0.6);
    background: var(--bg-input);
}

.cell-input.saving {
    border-color: rgba(147, 197, 253, 0.5);
}

.cell-input.saved {
    border-color: rgba(134, 239, 172, 0.45);
}

.cell-input.error {
    border-color: rgba(253, 164, 175, 0.6);
}

.meta-input {
    width: 100%;
    min-width: 80px;
    max-width: 160px;
    padding: 4px 8px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-main);
    font: inherit;
    text-align: left;
}

.meta-input:focus {
    outline: none;
    border-color: rgba(59, 130, 246, 0.6);
    background: var(--bg-input);
}

.workflow-check {
    width: 1rem;
    height: 1rem;
    accent-color: #3b82f6;
    cursor: pointer;
}

.row-total-static {
    font-weight: 700;
    color: var(--text-main);
}

.badge-no-order {
    display: inline-block;
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(244, 63, 94, 0.15);
    color: #fda4af;
    margin-left: 6px;
    vertical-align: middle;
}

/* New locations modal */
.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.modal.hidden {
    display: none;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
}

.modal-panel {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 520px;
    max-height: min(80vh, 640px);
    display: flex;
    flex-direction: column;
    margin: 0;
}

.modal-title {
    font-family: var(--font-header);
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.pending-import-week {
    color: var(--primary-hover);
    font-family: var(--font-header);
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.modal-intro,
.modal-note {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.5;
}

.modal-note {
    font-size: 0.82rem;
    margin-top: 12px;
}

.location-sync-list {
    list-style: none;
    margin: 16px 0 0;
    overflow-y: auto;
    flex: 1;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-input);
}

.location-sync-list li {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
}

.location-sync-list li:last-child {
    border-bottom: none;
}

.location-sync-list .loc-name {
    font-weight: 600;
    color: var(--text-main);
}

.location-sync-list .loc-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.modal-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 16px;
    font-size: 0.9rem;
    color: var(--text-muted);
    cursor: pointer;
    user-select: none;
}

.modal-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: var(--primary);
    cursor: pointer;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.import-confirm-list {
    list-style: none;
    margin: 12px 0 0;
    padding: 0;
}

.import-confirm-list li {
    position: relative;
    padding: 6px 0 6px 18px;
    color: var(--text-main);
    font-size: 0.9rem;
    line-height: 1.45;
}

.import-confirm-list li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: var(--primary);
    font-weight: 700;
}

.eli-preview-panel {
    max-width: min(920px, 96vw);
}

.eli-preview-table-wrap {
    margin-top: 12px;
    max-height: min(52vh, 420px);
    overflow: auto;
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
    border-radius: 8px;
}

.eli-preview-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

.eli-preview-table th,
.eli-preview-table td {
    padding: 8px 10px;
    text-align: left;
    border-bottom: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
    vertical-align: top;
}

.eli-preview-table th {
    position: sticky;
    top: 0;
    background: var(--panel-bg, rgba(20, 24, 32, 0.98));
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}

.eli-preview-table td.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.eli-preview-table tr.is-unmatched td {
    color: var(--text-muted);
}

.eli-preview-table .eli-preview-status {
    display: block;
    margin-top: 2px;
    font-size: 0.75rem;
    color: var(--danger, #e57373);
}

@media (max-width: 768px) {
    .controls-row { flex-direction: column; align-items: stretch; }
    .control-actions { justify-content: stretch; }
    .control-actions .btn { flex: 1; }
}
