:root {
  color-scheme: light;
  --ink: #5c3a21;
  --crust: #5c3a21;
  --muted: #786354;
  --paper: #f5ebe1;
  --surface: #fffaf5;
  --line: #e5d2c4;
  --tomato: #6e1a14;
  --tomato-dark: #53120e;
  --olive: #4a5d4e;
  --olive-dark: #37483c;
  --gold: #c88a3b;
  --sage: #e7ebe3;
  --warning: #f5e8d1;
  --danger: #6e1a14;
  --radius: 16px;
  --font-display: "Cormorant Garamond", "Bodoni MT", Georgia, serif;
  --font-sans: "Montserrat", "Avenir Next", Arial, sans-serif;
  --shadow: 0 14px 36px rgba(92, 58, 33, 0.09);
  font-family: var(--font-sans);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 320px; background: var(--paper); color: var(--ink); }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid rgba(200, 138, 59, 0.48);
  outline-offset: 2px;
}

.boot-screen, .fatal-screen { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 16px; color: var(--muted); }
.brand-emblem { position: relative; display: inline-block; flex: 0 0 48px; width: 48px; height: 48px; overflow: hidden; border: 1px solid var(--line); border-radius: 50%; background: var(--paper); }
.brand-emblem img { position: absolute; top: -7px; left: -29px; width: 106px; max-width: none; height: 106px; }
.boot-screen .brand-emblem { width: 66px; height: 66px; flex-basis: 66px; }
.boot-screen .brand-emblem img { top: -10px; left: -40px; width: 146px; height: 146px; }
.login-layout { min-height: 100vh; display: grid; grid-template-columns: minmax(320px, 480px) minmax(320px, 1fr); align-items: stretch; padding: 32px; gap: 32px; background: radial-gradient(ellipse at 8% 6%, rgba(200, 138, 59, .12), transparent 34%), var(--paper); }
.login-card { align-self: center; width: 100%; max-width: 430px; margin: auto; padding: 38px 40px; border: 1px solid var(--line); border-radius: 24px; background: var(--surface); box-shadow: var(--shadow); }
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); }
.brand strong, .brand small { display: block; }
.brand strong { font-family: var(--font-display); font-size: 22px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.brand small { margin-top: 1px; color: var(--tomato); font-size: 10px; font-weight: 600; letter-spacing: 0.28em; text-transform: uppercase; }
.brand--login { display: flex; justify-content: center; width: 100%; margin-bottom: 26px; }
.login-brand-image { display: block; width: 142px; height: 142px; border-radius: 50%; object-fit: cover; mix-blend-mode: multiply; }
.eyebrow, .sidebar-caption { margin: 0; color: var(--olive); font-size: 10px; font-weight: 700; letter-spacing: 0.13em; }
.login-card h1 { margin: 10px 0 8px; color: var(--tomato); font-family: var(--font-display); font-size: clamp(34px, 4vw, 48px); font-weight: 600; letter-spacing: -0.025em; }
.muted { color: var(--muted); line-height: 1.6; }
.login-aside { position: relative; display: grid; align-content: center; justify-items: center; min-height: 500px; overflow: hidden; border: 1px solid rgba(245, 235, 225, .2); border-radius: 28px; background: linear-gradient(145deg, #6e1a14, #53120e 72%, #3d241b); color: var(--paper); text-align: center; }
.login-aside::before, .login-aside::after { position: absolute; width: 400px; height: 400px; border: 1px solid rgba(245, 235, 225, .16); border-radius: 50%; content: ""; }
.login-aside::before { top: -230px; right: -170px; }
.login-aside::after { bottom: -270px; left: -150px; width: 500px; height: 500px; }
.login-aside-content { position: relative; display: grid; justify-items: center; gap: 15px; }
.login-aside-logo { display: block; width: min(290px, 70vw); border: 8px solid rgba(245, 235, 225, .9); border-radius: 12px; background: var(--paper); box-shadow: 0 18px 40px rgba(34, 14, 10, .25); }
.login-aside p { margin: 8px 0 0; font-family: var(--font-display); font-size: clamp(32px, 4vw, 52px); font-weight: 500; line-height: .96; }
.login-aside-content > span { color: #f2d5b2; font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; }
.login-footnote { margin: 26px 0 0; color: var(--muted); font-size: 12px; text-align: center; }

.form-stack { display: grid; gap: 10px; margin-top: 28px; }
.form-stack label, .field label { color: var(--ink); font-size: 13px; font-weight: 600; }
input, select, textarea { width: 100%; min-height: 42px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; background: #fffdfa; color: var(--ink); }
textarea { min-height: 100px; resize: vertical; }
input::placeholder, textarea::placeholder { color: #9a8472; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 9px 15px; border: 1px solid transparent; border-radius: 9px; cursor: pointer; font-weight: 700; text-decoration: none; transition: background .15s ease, transform .15s ease; }
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:disabled { cursor: wait; opacity: .6; }
.button--primary { background: var(--tomato); color: #fffaf5; }
.button--primary:hover:not(:disabled) { background: var(--tomato-dark); }
.button--secondary { border-color: #d7bdab; background: #fffaf5; color: var(--crust, #5c3a21); }
.button--danger { background: #f3e2dc; color: var(--danger); }
.button--quiet { min-height: 34px; border-color: var(--line); background: transparent; color: var(--muted); }
.button--wide { width: 100%; margin-top: 12px; }
.button--small { min-height: 32px; padding: 6px 10px; font-size: 12px; }
.link-button { padding: 0; border: 0; background: none; color: var(--tomato); cursor: pointer; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }

.app-shell { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 20; display: flex; flex-direction: column; width: 244px; padding: 28px 18px 22px; border-right: 1px solid var(--line); background: #f8f1e9; }
.sidebar .brand { padding: 0 8px; }
.sidebar-caption { margin: 36px 8px 14px; color: #80551f; }
.nav-menu { display: grid; gap: 5px; }
.nav-link { display: flex; align-items: center; gap: 11px; min-height: 42px; padding: 9px 11px; border-radius: 9px; color: #6a5242; font-size: 13px; text-decoration: none; }
.nav-link:hover { background: #efe1d5; }
.nav-link.is-active { background: var(--sage); color: var(--olive-dark); font-weight: 800; }
.nav-dot { width: 7px; height: 7px; border: 1px solid #879486; border-radius: 50%; }
.nav-link.is-active .nav-dot { border-color: var(--olive); background: var(--olive); }
.sidebar-bottom { margin-top: auto; padding: 18px 10px 4px; border-top: 1px solid #ddc9b8; }
.sidebar-note { color: var(--olive); font-family: var(--font-display); font-size: 20px; font-style: italic; line-height: 1.1; }
.workspace { min-height: 100vh; margin-left: 244px; }
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; min-height: 88px; padding: 16px clamp(20px, 4vw, 54px); border-bottom: 1px solid rgba(229, 210, 196, .86); background: rgba(245, 235, 225, .94); backdrop-filter: blur(12px); }
.topbar-title h1 { margin: 4px 0 0; color: var(--tomato); font-family: var(--font-display); font-size: 29px; font-weight: 600; letter-spacing: -0.02em; }
.user-menu { display: flex; align-items: center; gap: 10px; }
.user-avatar { display: grid; place-items: center; width: 38px; height: 38px; border: 1px solid #d6c3b3; border-radius: 50%; background: var(--surface); color: var(--tomato); font-family: var(--font-display); font-size: 20px; font-weight: 700; }
.user-copy strong, .user-copy small { display: block; }
.user-copy strong { max-width: 160px; overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.user-copy small { margin-top: 3px; color: var(--muted); font-size: 11px; text-transform: capitalize; }
.menu-toggle { display: none; border: 0; background: transparent; color: var(--ink); cursor: pointer; font-size: 23px; }
.page-content { width: min(1420px, 100%); margin: 0 auto; padding: 30px clamp(20px, 4vw, 54px) 56px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.page-heading h2, .panel h2 { margin: 0; color: var(--tomato); font-family: var(--font-display); font-size: clamp(27px, 3vw, 36px); font-weight: 600; letter-spacing: -0.02em; }
.page-heading p { margin: 7px 0 0; color: var(--muted); }
.panel, .stat-card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.panel { padding: 22px; }
.panel + .panel { margin-top: 20px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.panel-heading h3 { margin: 0; color: var(--crust); font-size: 21px; letter-spacing: -0.015em; }
.panel-heading p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-card { padding: 18px; }
.stat-label { color: var(--muted); font-size: 12px; font-weight: 700; }
.stat-value { display: block; margin-top: 11px; color: var(--tomato); font-family: var(--font-display); font-size: 34px; font-weight: 600; letter-spacing: -0.02em; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(280px, .7fr); gap: 18px; }
.stack { display: grid; gap: 18px; }
.empty-state { padding: 24px; border: 1px dashed var(--line); border-radius: 12px; color: var(--muted); text-align: center; }
.empty-state p { margin: 0; }
.data-table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th { padding: 11px 10px; color: #806858; font-size: 10px; letter-spacing: .09em; text-align: left; text-transform: uppercase; white-space: nowrap; }
.data-table td { padding: 13px 10px; border-top: 1px solid #efe2d7; vertical-align: middle; }
.data-table tbody tr:hover { background: #fcf5ee; }
.table-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.badge { display: inline-flex; align-items: center; min-height: 24px; padding: 4px 9px; border-radius: 999px; background: #efeee8; color: #687064; font-size: 11px; font-weight: 800; white-space: nowrap; }
.badge--pending, .badge--low { background: var(--warning); color: #6c4b22; }
.badge--confirmed, .badge--ok { background: #e6ece5; color: #37483c; }
.badge--production { background: #f1e3d8; color: #6e1a14; }
.badge--ready { background: #f4e5cb; color: #70491d; }
.badge--delivered { background: #e2e9df; color: #37483c; }
.badge--cancelled, .badge--critical { background: #f3e0dc; color: var(--danger); }
.filter-bar { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; margin-bottom: 18px; }
.filter-bar .field { min-width: 180px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.field { display: grid; align-content: start; gap: 7px; }
.field--wide { grid-column: 1 / -1; }
.field small, .help-text { color: var(--muted); font-size: 12px; line-height: 1.5; }
.form-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 18px; }
.inline-form { display: grid; grid-template-columns: minmax(180px, 1.4fr) minmax(100px, .4fr) auto; align-items: end; gap: 10px; margin-bottom: 16px; }
.ingredient-row { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(110px, .45fr) auto; gap: 10px; align-items: end; margin-bottom: 10px; }
.notice { margin: 0 0 16px; padding: 12px 14px; border: 1px solid transparent; border-radius: 10px; font-size: 13px; line-height: 1.5; }
.notice--error { border-color: #d9aaa0; background: #fbede9; color: #6e1a14; }
.notice--success { border-color: #c3d0c2; background: #edf1e9; color: #37483c; }
.notice--info { border-color: #e5c899; background: #fbf3e5; color: #5c3a21; }
.loading-state { padding: 36px; color: var(--muted); text-align: center; }
.pill-list { display: flex; flex-wrap: wrap; gap: 8px; }
.ingredient-pill { padding: 8px 11px; border: 1px solid var(--line); border-radius: 999px; background: #fcf5ee; color: var(--olive-dark); font-size: 12px; }
.list-cards { display: grid; gap: 10px; }
.list-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px; border: 1px solid #efe2d7; border-radius: 12px; }
.list-row strong, .list-row small { display: block; }
.list-row small { margin-top: 5px; color: var(--muted); }
.item-list { display: grid; gap: 8px; margin: 14px 0 0; }
.item-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border-radius: 9px; background: #f8f0e8; }
.total-line { display: flex; justify-content: space-between; margin-top: 15px; padding-top: 13px; border-top: 1px solid var(--line); font-weight: 800; }
.detail-row td { padding-top: 0; background: #fcf5ee; }
.detail-content { padding: 6px 4px 14px; color: var(--muted); line-height: 1.6; }
.table-secondary { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }
.compact-select { width: auto; min-width: 135px; min-height: 32px; padding: 5px 8px; font-size: 11px; }
.recipe-details { overflow: hidden; border: 1px solid #efe2d7; border-radius: 12px; background: var(--surface); }
.recipe-details summary { cursor: pointer; list-style: none; }
.recipe-details summary::-webkit-details-marker { display: none; }
.recipe-details[open] summary { border-bottom: 1px solid #efe2d7; border-radius: 0; }
.recipe-details .list-row { border: 0; }
.recipe-instructions { white-space: pre-wrap; }
.notice-list { display: grid; gap: 9px; }
.notice-item { padding: 12px 14px; border-left: 3px solid var(--gold); border-radius: 8px; background: #fbf3e5; }
.notice-item strong { display: block; margin-bottom: 5px; }
.notice-item--critical { border-left-color: var(--tomato); background: #fbede9; }
.fatal-screen .panel { width: min(500px, calc(100vw - 32px)); }

@media (max-width: 1100px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .login-layout { grid-template-columns: 1fr; padding: 16px; }
  .login-card { padding: 28px 22px; }
  .brand--login { margin-bottom: 36px; }
  .login-aside { display: none; }
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow); }
  .sidebar.is-open { transform: translateX(0); }
  .workspace { margin-left: 0; }
  .topbar { min-height: 74px; padding: 12px 16px; }
  .menu-toggle { display: inline-flex; }
  .topbar-title { flex: 1; margin-left: 12px; }
  .topbar-title h1 { font-size: 20px; }
  .user-copy { display: none; }
  .page-content { padding: 22px 16px 42px; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .form-grid { grid-template-columns: 1fr; }
  .field--wide { grid-column: auto; }
  .inline-form, .ingredient-row { grid-template-columns: 1fr; }
  .panel { padding: 17px; }
}

@media (max-width: 430px) {
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
  .stat-card { padding: 14px; }
  .stat-value { font-size: 24px; }
  .user-avatar { display: none; }
  .topbar { gap: 8px; }
  .topbar-title { margin-left: 0; }
}
