/* ==========================================================================
   METRO RESTAURANT & BAKERY — DESIGN SYSTEM
   Identity: kitchen order-ticket / bakery chit motif — perforated dividers,
   stamped totals, warm crust-gold + basil-green against a flour-white base.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@500;600;700;800&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@500;700&display=swap');

:root {
    --ink:        #1E2328;
    --ink-soft:   #2B323A;
    --crust:      #C68A2E;
    --crust-dark: #A66F1E;
    --basil:      #4C7A5E;
    --basil-soft: #E7F0EA;
    --rust:       #B3432B;
    --rust-soft:  #FBE9E5;
    --flour:      #F7F5F1;
    --flour-dim:  #EFEBE3;
    --paper:      #FFFFFF;
    --line:       #E3DDD1;
    --text:       #262320;
    --text-dim:   #6B655A;

    --font-display: 'Sora', sans-serif;
    --font-body: 'Inter', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    --radius: 10px;
    --shadow: 0 1px 3px rgba(30,35,40,0.08), 0 1px 2px rgba(30,35,40,0.05);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--font-body);
    background: var(--flour);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

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

.mono { font-family: var(--font-mono); }

a { color: var(--crust-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

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

/* ---------- Layout ---------- */
.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 232px;
    background: var(--ink);
    color: #D9D5CB;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; bottom: 0; left: 0;
    transition: transform 0.25s ease;
    z-index: 40;
}

.sidebar-brand {
    padding: 22px 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-brand .name {
    font-family: var(--font-display);
    font-weight: 700;
    color: #fff;
    font-size: 17px;
    line-height: 1.2;
}
.sidebar-brand .tag {
    font-size: 11px;
    color: var(--crust);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-top: 2px;
    display: block;
}

.sidebar-nav { padding: 12px 10px; overflow-y: auto; flex: 1; }
.sidebar-nav .group-label {
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: #857F72;
    margin: 16px 10px 6px;
}
.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 8px;
    color: #C9C5BA;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    margin-bottom: 2px;
}
.sidebar-nav a:hover { background: rgba(255,255,255,0.06); color: #fff; }
.sidebar-nav a.active { background: var(--crust); color: #1E1508; font-weight: 600; }
.sidebar-nav svg { width: 17px; height: 17px; flex-shrink: 0; }

.sidebar-user {
    padding: 14px 18px;
    border-top: 1px solid rgba(255,255,255,0.08);
    font-size: 13px;
}
.sidebar-user .role-pill {
    display: inline-block;
    font-size: 10.5px;
    padding: 2px 8px;
    border-radius: 100px;
    background: var(--basil);
    color: #fff;
    margin-top: 4px;
    font-weight: 600;
}
.sidebar-user .logout-link { color: #E3A79A; font-size: 12.5px; }

.main {
    margin-left: 232px;
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.topbar {
    height: 60px;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    padding: 0 22px;
    gap: 14px;
    position: sticky;
    top: 0;
    z-index: 20;
}
.topbar .page-title { font-family: var(--font-display); font-weight: 700; font-size: 18px; color: var(--ink); }
.menu-toggle {
    display: none;
    background: none; border: none; cursor: pointer;
    color: var(--ink); padding: 6px;
}

.content { padding: 22px; max-width: 1400px; width: 100%; margin: 0 auto; }

/* ---------- Ticket-style cards (signature element) ---------- */
.ticket {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    position: relative;
    padding: 18px 18px 16px;
}
.ticket::before {
    content: "";
    position: absolute;
    top: 0; left: 18px; right: 18px;
    height: 3px;
    background: repeating-linear-gradient(90deg, var(--crust) 0 8px, transparent 8px 14px);
    border-radius: 0 0 3px 3px;
}
.ticket .k-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-dim);
    font-weight: 600;
}
.ticket .k-value {
    font-family: var(--font-mono);
    font-size: 26px;
    font-weight: 700;
    color: var(--ink);
    margin-top: 4px;
}
.ticket .k-delta { font-size: 12.5px; margin-top: 6px; }
.k-delta.up { color: var(--basil); }
.k-delta.down { color: var(--rust); }

.grid {
    display: grid;
    gap: 16px;
}
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }

.card {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px;
}
.card h3 { font-size: 15px; margin-bottom: 14px; }

/* ---------- Buttons / forms ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 14px;
    padding: 10px 16px;
    border-radius: 8px;
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s ease;
}
.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover { background: var(--ink-soft); text-decoration: none; }
.btn-accent { background: var(--crust); color: #1E1508; }
.btn-accent:hover { background: var(--crust-dark); text-decoration: none; }
.btn-outline { background: transparent; border-color: var(--line); color: var(--text); }
.btn-outline:hover { background: var(--flour-dim); text-decoration: none; }
.btn-danger { background: var(--rust); color: #fff; }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; color: var(--ink-soft); }
input, select, textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-family: var(--font-body);
    font-size: 14.5px;
    background: var(--paper);
    color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--crust); outline-offset: 0; border-color: var(--crust); }
.field { margin-bottom: 14px; }
.field-row { display: flex; gap: 12px; }
.field-row > * { flex: 1; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-dim); font-weight: 600; background: var(--flour-dim); }
tr:hover td { background: var(--flour); }
td.num, th.num { text-align: right; font-family: var(--font-mono); }

.badge { display: inline-block; padding: 3px 9px; border-radius: 100px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; }
.badge-green { background: var(--basil-soft); color: var(--basil); }
.badge-red { background: var(--rust-soft); color: var(--rust); }
.badge-gold { background: #FBF0DA; color: var(--crust-dark); }
.badge-gray { background: var(--flour-dim); color: var(--text-dim); }

.alert { padding: 12px 14px; border-radius: 8px; font-size: 13.5px; margin-bottom: 16px; border: 1px solid transparent; }
.alert-error { background: var(--rust-soft); color: var(--rust); border-color: #F0C6BC; }
.alert-success { background: var(--basil-soft); color: var(--basil); border-color: #C9DFCF; }
.alert-info { background: #EAF1FB; color: #2E5EA8; border-color: #CADCF3; }

.empty-state { text-align: center; padding: 50px 20px; color: var(--text-dim); }
.empty-state svg { width: 44px; height: 44px; margin-bottom: 12px; opacity: 0.5; }

/* ---------- Login page ---------- */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--ink);
    background-image: radial-gradient(circle at 15% 20%, rgba(198,138,46,0.18), transparent 45%),
                       radial-gradient(circle at 85% 80%, rgba(76,122,94,0.18), transparent 45%);
    padding: 20px;
}
.login-card {
    background: var(--paper);
    border-radius: 14px;
    padding: 34px 30px;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.35);
}
.login-card .brand-mark {
    width: 46px; height: 46px; border-radius: 10px;
    background: var(--crust);
    color: #1E1508;
    display: flex; align-items: center; justify-content: center;
    font-family: var(--font-display); font-weight: 800; font-size: 20px;
    margin-bottom: 16px;
}
.login-card h1 { font-size: 20px; margin-bottom: 2px; }
.login-card p.sub { color: var(--text-dim); font-size: 13.5px; margin-bottom: 22px; }
.demo-creds { margin-top: 18px; font-size: 12px; color: var(--text-dim); background: var(--flour); border-radius: 8px; padding: 10px 12px; }
.demo-creds strong { color: var(--ink); }

/* ---------- Camera capture ---------- */
.capture-box {
    border: 2px dashed var(--line);
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
    background: var(--flour-dim);
}
.capture-preview { max-width: 100%; border-radius: 8px; margin-top: 14px; border: 1px solid var(--line); }
.capture-actions { display: flex; gap: 10px; justify-content: center; margin-top: 14px; flex-wrap: wrap; }
.compress-meta { font-family: var(--font-mono); font-size: 12px; color: var(--text-dim); margin-top: 10px; }

/* ---------- Mobile ---------- */
@media (max-width: 900px) {
    .grid-4, .grid-3, .grid-2 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
    .sidebar { transform: translateX(-100%); width: 250px; }
    .sidebar.open { transform: translateX(0); }
    .main { margin-left: 0; }
    .menu-toggle { display: block; }
    .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr 1fr; }
    .content { padding: 14px; }
    .field-row { flex-direction: column; gap: 0; }
    table { font-size: 12.5px; }
    th, td { padding: 8px; }
}
@media (max-width: 420px) {
    .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
}

.sidebar-backdrop {
    display: none;
    position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 30;
}
.sidebar-backdrop.show { display: block; }

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
}
