/* =========================================================
   Local Dabba - design system
   Tokens first, then layout, then components.
   ========================================================= */
:root {
  --masala:      #2a1d16;
  --masala-soft: #4a3a30;
  --cream:       #fdf7ee;
  --paper:       #ffffff;
  --line:        #e9ddcc;
  --saffron:     #e2680f;
  --saffron-dk:  #b8500a;
  --turmeric:    #f2b134;
  --leaf:        #2f7d4f;
  --chilli:      #c62828;
  --ink:         #2a1d16;
  --ink-soft:    #7a6a5d;

  --radius:      14px;
  --radius-sm:   9px;
  --shadow:      0 2px 4px rgba(42,29,22,.06), 0 12px 28px rgba(42,29,22,.08);
  --shadow-sm:   0 1px 2px rgba(42,29,22,.08);
  --sans:        "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --max:         1180px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--cream);
}
img { max-width: 100%; display: block; }
a { color: var(--saffron-dk); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .5rem; line-height: 1.2; font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; }
p  { margin: 0 0 .75rem; }
small, .muted { color: var(--ink-soft); }
.small { font-size: .85rem; }

/* ---------- layout ---------- */
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 16px; }
.row { display: flex; gap: 16px; flex-wrap: wrap; }
.row > * { min-width: 0; }
.col { flex: 1 1 240px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.stack > * + * { margin-top: 12px; }
.mt { margin-top: 18px; } .mb { margin-bottom: 18px; }
.center { text-align: center; }
.hide { display: none !important; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: var(--masala); color: #f6ece0;
  box-shadow: var(--shadow-sm);
}
.topbar .wrap { display: flex; align-items: center; gap: 14px; height: 60px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 1.12rem; color: #fff; }
.brand:hover { text-decoration: none; }
.brand .dot { width: 11px; height: 11px; border-radius: 50%; background: var(--turmeric); }
.topnav { display: flex; gap: 4px; margin-left: auto; align-items: center; }
.topnav a, .topnav button {
  color: #f0e2d2; padding: 8px 11px; border-radius: var(--radius-sm);
  font-size: .9rem; background: none; border: 0; cursor: pointer; font-family: inherit;
}
.topnav a:hover, .topnav button:hover { background: rgba(255,255,255,.1); text-decoration: none; }
.topnav .active { background: var(--saffron); color: #fff; }
.badge-dot { background: var(--chilli); color: #fff; border-radius: 999px; padding: 0 6px; font-size: .7rem; margin-left: 4px; }

/* ---------- panel shell ---------- */
.shell { display: flex; min-height: calc(100vh - 60px); }
.sidebar {
  width: 232px; flex: 0 0 232px; background: var(--paper);
  border-right: 1px solid var(--line); padding: 16px 12px;
}
.sidebar h4 { font-size: .72rem; text-transform: uppercase; letter-spacing: .09em; color: var(--ink-soft); margin: 16px 8px 6px; }
.sidebar a {
  display: block; padding: 9px 12px; border-radius: var(--radius-sm);
  color: var(--ink); font-size: .92rem;
}
.sidebar a:hover { background: var(--cream); text-decoration: none; }
.sidebar a.active { background: var(--saffron); color: #fff; font-weight: 600; }
.content { flex: 1; padding: 22px 20px 60px; min-width: 0; }

/* ---------- cards ---------- */
.card {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow-sm);
}
.card + .card { margin-top: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.stat { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat .label { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); }
.stat .value { font-size: 1.6rem; font-weight: 800; margin-top: 2px; }
.stat.accent { background: linear-gradient(135deg, var(--saffron), var(--turmeric)); color: #fff; border-color: transparent; }
.stat.accent .label { color: rgba(255,255,255,.85); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 16px; border-radius: var(--radius-sm); border: 1px solid transparent;
  background: var(--saffron); color: #fff; font-weight: 600; font-size: .92rem;
  cursor: pointer; font-family: inherit; line-height: 1.2;
}
.btn:hover { background: var(--saffron-dk); text-decoration: none; color: #fff; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--cream); color: var(--ink); }
.btn-dark { background: var(--masala); }
.btn-dark:hover { background: #12100e; }
.btn-danger { background: var(--chilli); }
.btn-danger:hover { background: #9e1f1f; }
.btn-success { background: var(--leaf); }
.btn-success:hover { background: #23603c; }
.btn-sm { padding: 6px 11px; font-size: .82rem; }
.btn-block { width: 100%; }

/* ---------- forms ---------- */
label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: 5px; }
input, select, textarea {
  width: 100%; padding: 10px 12px; font-family: inherit; font-size: .94rem;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--paper); color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(226,104,15,.35); border-color: var(--saffron); }
textarea { min-height: 96px; resize: vertical; }
.field { margin-bottom: 14px; }
.field-row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.check input { width: auto; }
.form-note { font-size: .82rem; color: var(--ink-soft); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .76rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); background: var(--cream); }
tbody tr:hover { background: #fffaf2; }

/* ---------- pills & tags ---------- */
.pill {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: .75rem; font-weight: 700; background: var(--cream); border: 1px solid var(--line);
}
.pill-green  { background: #e6f4ec; color: var(--leaf); border-color: #c7e6d5; }
.pill-red    { background: #fdeaea; color: var(--chilli); border-color: #f3cfcf; }
.pill-amber  { background: #fdf1da; color: #a86c07; border-color: #f2ddb3; }
.pill-blue   { background: #e8eefb; color: #2a4f9e; border-color: #ccd9f4; }
.veg, .nonveg { display: inline-block; width: 12px; height: 12px; border: 2px solid var(--leaf); position: relative; }
.nonveg { border-color: var(--chilli); }
.veg::after, .nonveg::after { content: ''; position: absolute; inset: 2px; border-radius: 50%; background: var(--leaf); }
.nonveg::after { background: var(--chilli); }

/* ---------- food & restaurant cards ---------- */
.tile { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
.tile:hover { box-shadow: var(--shadow); }
.tile .thumb { aspect-ratio: 16/10; background: linear-gradient(135deg, #f6e3c8, #f1cf9c); display: grid; place-items: center; color: var(--masala-soft); }
.tile .thumb img { width: 100%; height: 100%; object-fit: cover; }
.tile .thumb span { font-size: 2rem; }
.tile .body { padding: 12px 14px 14px; }
.tile h3 { margin-bottom: 2px; font-size: 1rem; }
.price { font-weight: 800; color: var(--masala); }
.strike { text-decoration: line-through; color: var(--ink-soft); font-weight: 500; margin-left: 6px; font-size: .85rem; }

/* ---------- hero ---------- */
.hero {
  background: radial-gradient(120% 120% at 10% 0%, #3a2a20 0%, var(--masala) 60%);
  color: #fdf0df; padding: 46px 0 54px;
}
.hero h1 { font-size: clamp(1.7rem, 4vw, 2.6rem); color: #fff; }
.hero p { color: #e3cfb8; max-width: 540px; }
.searchbar { display: flex; gap: 8px; margin-top: 18px; max-width: 560px; }
.searchbar input { border: 0; }

/* ---------- order timeline ---------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 16px 24px; border-left: 2px solid var(--line); }
.timeline li:last-child { border-color: transparent; padding-bottom: 0; }
.timeline li::before {
  content: ''; position: absolute; left: -7px; top: 3px; width: 12px; height: 12px;
  border-radius: 50%; background: var(--saffron); box-shadow: 0 0 0 3px #fff;
}

/* ---------- cart bar ---------- */
.cartbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  background: var(--masala); color: #fff; padding: 12px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}

/* ---------- toast ---------- */
#toasts { position: fixed; right: 16px; top: 74px; z-index: 90; display: grid; gap: 8px; max-width: 330px; }
.toast {
  background: var(--masala); color: #fff; padding: 11px 14px; border-radius: var(--radius-sm);
  box-shadow: var(--shadow); font-size: .9rem; animation: pop .18s ease-out;
}
.toast.err { background: var(--chilli); }
.toast.ok  { background: var(--leaf); }
@keyframes pop { from { transform: translateY(-6px); opacity: 0; } }

/* ---------- misc ---------- */
.empty { padding: 34px 16px; text-align: center; color: var(--ink-soft); }
.auth-page { display: grid; place-items: center; min-height: calc(100vh - 60px); padding: 30px 16px; }
.auth-card { width: 100%; max-width: 420px; }
.footer { background: var(--masala); color: #cdb9a6; padding: 26px 0; margin-top: 40px; font-size: .88rem; }
.footer a { color: var(--turmeric); }
.pager { display: flex; gap: 8px; justify-content: center; margin-top: 16px; }

@media (max-width: 860px) {
  .sidebar {
    position: fixed; inset: 60px auto 0 0; z-index: 45; transform: translateX(-100%);
    transition: transform .2s ease; height: calc(100vh - 60px); overflow-y: auto;
  }
  .sidebar.open { transform: none; box-shadow: var(--shadow); }
  .content { padding: 16px 14px 80px; }
  .topbar .wrap { gap: 8px; }
  .topnav a span.label { display: none; }
}
/* ---------- admin: modal ---------- */
.modal-back {
  position: fixed; inset: 0; z-index: 100; background: rgba(42,29,22,.45);
  display: flex; align-items: flex-start; justify-content: center; padding: 24px 14px; overflow-y: auto;
}
.modal { background: var(--paper); border-radius: var(--radius); width: 100%; max-width: 560px; padding: 16px; box-shadow: var(--shadow); margin: auto 0; }
.modal .modal-body { max-height: 76vh; overflow-y: auto; padding-top: 4px; }
.modal-wide { max-width: 820px; }

/* ---------- admin: tabs ---------- */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tabs button { background: none; border: 0; padding: 10px 14px; font-weight: 600; font-size: .9rem; color: var(--ink-soft); cursor: pointer; border-bottom: 2px solid transparent; font-family: inherit; }
.tabs button.active { color: var(--saffron-dk); border-color: var(--saffron); }

/* ---------- admin: charts ---------- */
.chart-wrap { overflow-x: auto; }
.chart-wrap svg { display: block; }
.bar-chart rect { fill: var(--saffron); }
.bar-chart rect:hover { fill: var(--saffron-dk); }
.line-chart path.line { fill: none; stroke: var(--saffron); stroke-width: 2; }
.line-chart path.area { fill: rgba(226,104,15,.12); stroke: none; }
.chart-axis text { font-size: 10px; fill: var(--ink-soft); }

/* ---------- admin: misc ---------- */
.notice { background: #fdf1da; border: 1px solid #f2ddb3; color: #7a4f04; padding: 12px 14px; border-radius: var(--radius-sm); font-size: .88rem; }
.notice.danger { background: #fdeaea; border-color: #f3cfcf; color: #7a1414; }
.notice.ok { background: #e6f4ec; border-color: #c7e6d5; color: #1d4d31; }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 6px 12px; font-size: .9rem; }
.kv dt { color: var(--ink-soft); }
.kv dd { margin: 0; }
.feed-item { padding: 10px 0; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.feed-item:last-child { border-bottom: 0; }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px,1fr)); gap: 8px; }
.perm-grid label.check { background: var(--cream); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 10px; }

/* ---------- delivery panel: switch + mobile-first big actions ---------- */
.switch { display: flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 700; }
.switch input { appearance: none; width: 46px; height: 26px; border-radius: 999px; background: var(--line); position: relative; cursor: pointer; transition: background .15s; flex: none; }
.switch input:checked { background: var(--leaf); }
.switch input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: left .15s; box-shadow: var(--shadow-sm); }
.switch input:checked::after { left: 23px; }
.btn-lg { padding: 14px 20px; font-size: 1rem; border-radius: var(--radius); }
.job-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; background: var(--paper); }
.job-card + .job-card { margin-top: 12px; }
.bar-chart { display: flex; align-items: flex-end; gap: 6px; height: 140px; padding-top: 10px; }
.bar-chart .bar { flex: 1; background: linear-gradient(180deg, var(--saffron), var(--turmeric)); border-radius: 4px 4px 0 0; min-height: 3px; position: relative; }
.bar-chart .bar span { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); font-size: .68rem; color: var(--ink-soft); white-space: nowrap; }
.empty { padding: 24px; text-align: center; color: var(--ink-soft); background: var(--cream); border-radius: var(--radius-sm); }
@media (max-width: 640px) {
  .btn { padding: 12px 16px; font-size: .95rem; }
  .job-card .row { flex-direction: column; }
}
