/* Soup Ghar Hisaab: phone-first, modern, in the restaurant's colours (red and warm browns). */

:root {
  --bg: #f6f1ea;
  --bg-2: #efe6da;
  --surface: #ffffff;
  --surface-2: #faf6f1;
  --ink: #1f1714;
  --ink-2: #3a2f2a;
  --muted: #7a6a5f;
  --line: #ece2d6;
  --line-2: #dccdbd;
  --soft: #f3ebe1;
  --red: #b3161b;
  --red-2: #d42a2f;
  --red-dark: #8a0e13;
  --red-tint: #fdecec;
  --gold: #c9781c;
  --good: #16794a;
  --good-tint: #e6f5ec;
  --warn: #a35a08;
  --warn-tint: #fdf1e1;
  --bad: #c0161c;
  --bad-tint: #fdecec;
  --fp: #d70f64;
  --fp-dark: #a10b4b;
  --fp-tint: #fde8f1;
  --radius: 20px;
  --radius-sm: 14px;
  --shadow: 0 1px 2px rgb(60 35 20 / 0.06), 0 8px 24px -6px rgb(60 35 20 / 0.10);
  --shadow-lg: 0 18px 40px -12px rgb(60 35 20 / 0.28);
  --shadow-red: 0 10px 24px -8px rgb(179 22 27 / 0.55);
  --font: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-ur: "Noto Nastaliq Urdu", "Jameel Noori Nastaleeq", serif;
  --header-h: 64px;
  --nav-h: 70px;
  --side-w: 236px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(1200px 500px at 50% -200px, #fbe9e4 0%, transparent 70%), var(--bg);
  background-attachment: fixed;
  color: var(--ink);
  font: 500 16px/1.45 var(--font);
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 24px);
}
html[dir="rtl"] body { font-family: var(--font-ur); line-height: 2; font-size: 15px; font-weight: 400; }
html[dir="rtl"] input, html[dir="rtl"] select, html[dir="rtl"] button, html[dir="rtl"] textarea { font-family: var(--font-ur); }
body.sheet-open { overflow: hidden; }
a { color: var(--red); text-decoration: none; }
a:hover { text-decoration: underline; }
.btn:hover, .menu-item:hover, .list a:hover, .nav a:hover, .brand:hover, .back:hover, .banner:hover { text-decoration: none; }
h1, h2, h3 { line-height: 1.25; letter-spacing: -0.01em; }
html[dir="rtl"] h1, html[dir="rtl"] h2, html[dir="rtl"] h3 { line-height: 1.9; letter-spacing: 0; }
small { font-size: 0.82em; }
b, strong { font-weight: 800; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.bad { color: var(--bad); }
.warn { color: var(--warn); }
.good { color: var(--good); }
button { font-family: inherit; }

/* ---- Top bar ---- */

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: var(--header-h);
  padding: 10px 16px; padding-top: calc(10px + env(safe-area-inset-top));
  background: linear-gradient(120deg, var(--red-2) 0%, var(--red) 45%, var(--red-dark) 100%);
  color: #fff;
  box-shadow: 0 6px 20px -10px rgb(138 14 19 / 0.7);
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-size: 1.08rem; letter-spacing: -0.01em; }
.brand img { border-radius: 50%; background: #fff; box-shadow: 0 0 0 2px rgb(255 255 255 / 0.35); }
.brand b { font-weight: 800; }
.user-chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 4px 12px 4px 4px;
  border-radius: 999px; background: rgb(255 255 255 / 0.14); border: 1px solid rgb(255 255 255 / 0.22);
}
.avatar {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
  background: #fff; color: var(--red); font-weight: 800; font-size: 0.9rem; text-transform: uppercase;
}
.avatar:empty { display: none; }
.who { font-size: 0.88rem; font-weight: 700; }
body.logged-out .user-chip { display: none; }

/* ---- Navigation: a floating bar on phones, a side menu on computers ---- */

.nav {
  position: fixed; z-index: 25; left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom));
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 2px;
  height: var(--nav-h); padding: 8px;
  background: rgb(255 255 255 / 0.92); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow-lg);
}
.nav a {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  min-width: 0; border-radius: 16px; color: var(--muted); text-decoration: none; font-size: 0.72rem; font-weight: 700;
  transition: color 0.15s, background 0.15s;
}
html[dir="rtl"] .nav a { font-size: 0.66rem; line-height: 1.5; }
.nav svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav svg .fill { fill: currentColor; stroke: none; }
.nav a.active { color: var(--red); background: var(--red-tint); }
.nav a:active { transform: scale(0.96); }
body.logged-out .nav { display: none; }
body.logged-out { padding-bottom: 24px; }

.main { max-width: 680px; margin: 0 auto; padding: 14px 16px 24px; }

/* ---- Cards, tiles, banners ---- */

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px; margin: 14px 0;
}
.card h2 { font-size: 1.05rem; font-weight: 800; margin: 0 0 12px; display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.page-title { font-size: 1.5rem; font-weight: 800; margin: 10px 0 6px; letter-spacing: -0.02em; }
.back {
  display: inline-flex; align-items: center; gap: 4px; margin: 6px 0 2px; padding: 6px 12px 6px 8px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line); color: var(--ink-2); text-decoration: none; font-weight: 700; font-size: 0.9rem;
}
.banner {
  display: block; padding: 12px 14px; border-radius: var(--radius-sm); margin: 10px 0;
  background: var(--soft); color: var(--ink); text-decoration: none; border: 1px solid var(--line); font-weight: 600;
}
.banner.warn { background: var(--warn-tint); color: var(--warn); border-color: #f5dcb8; }
.banner.ok { background: var(--good-tint); color: var(--good); border-color: #c7e8d4; }
.banner.fp { background: var(--fp-tint); color: var(--fp-dark); border-color: #f8c9dd; }
.banner b { white-space: nowrap; }
.empty { color: var(--muted); text-align: center; padding: 18px 6px; margin: 0; }
.loading { min-height: 140px; display: grid; place-items: center; }
.loading::after {
  content: ""; width: 30px; height: 30px; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--red); animation: spin 0.8s linear infinite;
}
.loading.small { min-height: 48px; }
@keyframes spin { to { transform: rotate(360deg); } }
.error-card { text-align: center; }

.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 12px 0; }
.tiles.one { grid-template-columns: 1fr; }
.tile {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; gap: 2px; min-width: 0; padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.tile.wide { grid-column: 1 / -1; }
.tile-label { font-size: 0.8rem; font-weight: 700; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-value { font-size: 1.45rem; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.tile-value .muted { font-size: 0.9rem; font-weight: 600; letter-spacing: 0; }
.tile small { color: var(--muted); font-weight: 600; }
.tile.good .tile-value { color: var(--good); }
.tile.warn .tile-value { color: var(--warn); }
.tile.bad .tile-value { color: var(--bad); }
/* The two sale tiles: a coloured wash and a stripe on the side. */
.tile.rest, .tile.fp { padding-inline-start: 20px; }
.tile.rest::before, .tile.fp::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 5px; }
html[dir="rtl"] .tile.rest::before, html[dir="rtl"] .tile.fp::before { inset: 0 0 0 auto; }
.tile.rest { background: linear-gradient(135deg, #fff 55%, var(--red-tint)); }
.tile.rest::before { background: linear-gradient(var(--red-2), var(--red-dark)); }
.tile.fp { background: linear-gradient(135deg, #fff 55%, var(--fp-tint)); }
.tile.fp::before { background: linear-gradient(#f0388a, var(--fp-dark)); }
.tile.fp .tile-value { color: var(--fp-dark); }

.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; background: var(--soft); font-size: 0.78rem; font-weight: 700; margin: 2px; }
.badge.ok { background: var(--good-tint); color: var(--good); }
.badge.warn { background: var(--warn-tint); color: var(--warn); }
.badge.bad { background: var(--bad-tint); color: var(--bad); }

/* ---- Day page ---- */

.date-nav { display: grid; grid-template-columns: 46px 1fr 46px; align-items: center; gap: 8px; margin: 4px 0 10px; }
.icon-btn {
  display: grid; place-items: center; width: 46px; height: 46px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); color: var(--ink);
  font-size: 1.5rem; text-decoration: none; cursor: pointer;
}
.icon-btn.disabled { visibility: hidden; }
.sheet-head .icon-btn { box-shadow: none; background: var(--soft); border: 0; font-size: 1.05rem; width: 40px; height: 40px; border-radius: 12px; }
.date-pick { position: relative; text-align: center; display: flex; flex-direction: column; align-items: center; }
.date-pick > span { font-size: 1.3rem; font-weight: 800; letter-spacing: -0.02em; }
.date-pick small { color: var(--muted); font-weight: 600; }
.date-pick input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }

.actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 12px 0; }
.action {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  min-height: 98px; padding: 12px 6px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow); color: var(--ink);
  font: 700 0.86rem/1.2 var(--font); text-align: center; cursor: pointer; transition: transform 0.12s, box-shadow 0.12s;
}
html[dir="rtl"] .action { font-family: var(--font-ur); line-height: 1.7; font-size: 0.78rem; font-weight: 400; }
.action span {
  display: grid; place-items: center; width: 46px; height: 46px; border-radius: 15px;
  font-size: 1.45rem; line-height: 1; background: var(--soft);
}
.action[data-do="purchase"] span { background: #fff1da; }
.action[data-do="roti"] span { background: #ffe6dc; }
.action[data-do="dihari"] span { background: #e5efff; }
.action[data-do="expense"] span { background: #eee8ff; }
.action[data-do="supplier_payment"] span { background: #e1f5e9; }
.action[data-do="meal"] span { background: #ffe3ee; }
.action:hover { box-shadow: var(--shadow-lg); }
.action:active { transform: scale(0.97); }
.action.wide { grid-column: 1 / -1; flex-direction: row; min-height: 54px; gap: 10px; }
.action.wide span { width: 32px; height: 32px; border-radius: 10px; font-size: 1.1rem; }

/* ---- Buttons ---- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 10px 18px; border-radius: 14px; border: 1px solid var(--line-2);
  background: var(--surface); color: var(--ink); font: 700 1rem/1.2 var(--font); text-decoration: none; cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s, background 0.12s;
}
html[dir="rtl"] .btn { font-family: var(--font-ur); line-height: 1.8; font-weight: 400; }
.btn:active { transform: scale(0.98); }
.btn.primary {
  background: linear-gradient(135deg, var(--red-2), var(--red) 55%, var(--red-dark)); border-color: transparent; color: #fff;
  box-shadow: var(--shadow-red);
}
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.ghost { background: transparent; border-color: var(--line-2); }
.btn.danger-text { color: var(--bad); border-color: transparent; background: transparent; }
.btn.big { min-height: 54px; font-size: 1.05rem; flex: 1; }
.btn.whatsapp { background: linear-gradient(135deg, #25b260, #168a47); border-color: transparent; color: #fff; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; box-shadow: none; }
.btn.busy::after { content: ""; width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-top-color: transparent; animation: spin 0.8s linear infinite; }
.small-btn { min-height: 40px; padding: 6px 14px; font-size: 0.9rem; }
.wide-btn { width: 100%; margin: 12px 0; }
.new-order { display: flex; width: 100%; min-height: 62px; font-size: 1.15rem; border-radius: 18px; margin: 4px 0 12px; }
/* "Din band karo" is dark so it is never mistaken for "Naya order". */
.close-day {
  display: flex; width: 100%; min-height: 58px; font-size: 1.08rem; margin: 8px 0 4px; border-radius: 18px;
  background: linear-gradient(135deg, #3a302b, var(--ink)); border-color: transparent; color: #fff;
  box-shadow: 0 10px 22px -10px rgb(31 23 20 / 0.6);
}
.close-day.done { background: var(--good-tint); border: 1px solid #c7e8d4; color: var(--good); box-shadow: none; }
.row-buttons { display: flex; gap: 10px; margin: 12px 0; }
.row-buttons.wrap { flex-wrap: wrap; }
.row-buttons .btn { flex: 1 1 auto; }

/* ---- Entry and order lists ---- */

.entries { list-style: none; margin: 0; padding: 0; }
.entry {
  display: grid; grid-template-columns: 40px 1fr auto; gap: 12px; align-items: center;
  padding: 10px 8px; margin: 0 -8px; border-radius: 14px; cursor: pointer; transition: background 0.12s;
}
.entry + .entry { border-top: 1px solid var(--line); }
.entry:hover { background: var(--surface-2); }
.entries.compact .entry { grid-template-columns: 1fr auto; cursor: default; }
.entry-icon {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 13px;
  background: var(--soft); font-size: 1.2rem;
}
.entry-main { display: flex; flex-direction: column; min-width: 0; }
.entry-main b { font-weight: 700; }
.entry-main small { color: var(--muted); overflow-wrap: anywhere; font-weight: 600; }
.entry-amt { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.order-no { font-weight: 800; font-size: 0.82rem; color: var(--red); background: var(--red-tint); }
.orders-card.foodpanda .order-no { color: var(--fp-dark); background: var(--fp-tint); }
.entries.collapsed .extra-row, .ledger.collapsed .extra-row { display: none; }
.orders-card { position: relative; overflow: hidden; }
.orders-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; }
.orders-card.restaurant::before { background: linear-gradient(90deg, var(--red-2), var(--red-dark)); }
.orders-card.foodpanda::before { background: linear-gradient(90deg, #f0388a, var(--fp-dark)); }

.list { list-style: none; margin: 12px 0; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card .list { box-shadow: none; border: 0; margin: 0; padding: 0; }
.list li + li { border-top: 1px solid var(--line); }
.list a, .list .list-btn {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%;
  padding: 12px 12px; border-radius: 14px; color: var(--ink); text-decoration: none; background: none; border: 0; text-align: start; font: inherit; cursor: pointer;
}
.list a:hover, .list .list-btn:hover { background: var(--surface-2); }
.list a > span:first-child, .list-btn > span:first-child { display: flex; flex-direction: column; min-width: 0; }
.list b { font-weight: 700; }
.list small { color: var(--muted); font-weight: 600; }
.list .amt { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.list .inactive { opacity: 0.55; }
.list li.empty { padding: 16px; }
.list .row-buttons { margin: 0; flex: none; }
.log li { display: flex; justify-content: space-between; gap: 10px; padding: 10px 12px; }
.log li > span:first-child { display: flex; flex-direction: column; }
.log li.deleted b { color: var(--bad); }
.log.only-deleted li:not(.deleted) { display: none; }

.menu-list { display: flex; flex-direction: column; gap: 10px; margin: 12px 0; }
.menu-item {
  display: flex; align-items: center; gap: 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow); color: var(--ink); text-decoration: none; text-align: start; font: inherit; cursor: pointer;
}
.menu-item:hover { box-shadow: var(--shadow-lg); }
.menu-item > span:last-child { display: flex; flex-direction: column; }
.menu-item b { font-weight: 700; }
.menu-item small { color: var(--muted); font-weight: 600; }
.mi-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px; background: var(--soft); font-size: 1.3rem; flex: none; }
.setup-list ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; counter-reset: step; }
.setup-list li { counter-increment: step; }
.setup-list a {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--ink); text-decoration: none; font-weight: 700;
}
.setup-list a:hover { border-color: var(--red); text-decoration: none; }
.setup-list a::before {
  content: counter(step); display: grid; place-items: center; width: 30px; height: 30px; flex: none; border-radius: 50%;
  background: var(--red-tint); color: var(--red); font-weight: 800;
}
.setup-list a::after { content: '›'; margin-inline-start: auto; color: var(--muted); font-size: 1.4rem; line-height: 1; }
.setup-list a small { color: var(--good); font-weight: 800; white-space: nowrap; }
.setup-list li.done a { background: var(--good-tint); border-color: #c7e8d4; }
.setup-list li.done a::before { content: '✓'; background: var(--good); color: #fff; }
.setup-list li.done a::after { margin-inline-start: 0; }
.setup-list li.done a span { flex: 1; }

/* ---- Tables ---- */

.calc { width: 100%; border-collapse: collapse; margin: 10px 0; font-variant-numeric: tabular-nums; }
.calc caption { text-align: start; font-weight: 800; padding: 4px 0 6px; }
.calc td { padding: 7px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.calc td:last-child { text-align: end; white-space: nowrap; padding-inline-start: 12px; font-weight: 700; }
.calc tr.sub td { color: var(--muted); font-size: 0.88rem; padding-inline-start: 12px; border-bottom-style: dashed; font-weight: 600; }
.calc tr.total td { font-weight: 800; border-bottom: 2px solid var(--ink); }
.calc tr.total.big td { font-size: 1.18rem; }
.calc tr.status td { font-weight: 800; border-bottom: 0; }
.calc tr.status.ok td { color: var(--good); }
.calc tr.status.warn td { color: var(--warn); }
.calc tr.status.bad td { color: var(--bad); }
[data-preview] .calc { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 4px 14px 8px; border-collapse: separate; border-spacing: 0; }
[data-preview] .calc td { padding: 7px 4px; }

.ledger { width: 100%; border-collapse: collapse; font-size: 0.92rem; font-variant-numeric: tabular-nums; }
.ledger th { text-align: start; color: var(--muted); font-weight: 700; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.03em; padding: 6px 4px; border-bottom: 1px solid var(--line); }
html[dir="rtl"] .ledger th { text-transform: none; letter-spacing: 0; }
.ledger td { padding: 9px 4px; border-bottom: 1px solid var(--line); vertical-align: top; }
.ledger td:last-child, .ledger th:last-child { text-align: end; white-space: nowrap; }
.ledger tr[data-entry], .ledger tr[data-day] { cursor: pointer; }
.ledger tr[data-entry]:hover td, .ledger tr[data-day]:hover td { background: var(--surface-2); }
.ledger.days td:not(:first-child), .ledger.days th:not(:first-child) { text-align: end; }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 0; }
.kv dt { color: var(--muted); font-weight: 600; }
.kv dd { margin: 0; text-align: end; font-variant-numeric: tabular-nums; font-weight: 700; }

.profit { text-align: center; padding: 22px 18px; }
.profit .profit-value { display: block; font-size: 2.4rem; font-weight: 800; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.profit.good { background: linear-gradient(135deg, #f2fbf5, #d9f1e3); border-color: #c7e8d4; }
.profit.good .profit-value { color: var(--good); }
.profit.bad { background: linear-gradient(135deg, #fff5f5, #fbdcdc); border-color: #f4c4c4; }
.profit.bad .profit-value { color: var(--bad); }
.profit small { display: block; color: var(--muted); font-weight: 600; }
.reminders ul { margin: 0; padding: 0; list-style: none; }
.reminders li { padding: 7px 0; font-weight: 600; }

.bars { list-style: none; margin: 0; padding: 0; }
.bars li { display: grid; grid-template-columns: minmax(90px, 38%) 1fr auto; gap: 10px; align-items: center; padding: 6px 0; font-size: 0.9rem; font-weight: 600; }
.bar-track { height: 12px; background: var(--soft); border-radius: 999px; overflow: hidden; }
.bar { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--red-2), var(--red-dark)); border-radius: 999px; transition: width 0.5s; }
.bar-amt { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 700; }
.month-status { display: flex; flex-wrap: wrap; gap: 4px; margin: 8px 0; }
.checks { margin: 12px 0 6px; }

/* ---- Forms ---- */

.form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-weight: 700; font-size: 0.92rem; color: var(--ink-2); }
.field-hint { color: var(--muted); font-size: 0.8rem; font-weight: 600; }
input, select, textarea {
  width: 100%; min-height: 50px; padding: 10px 14px; border-radius: 14px; border: 1px solid var(--line-2);
  background: var(--surface-2); color: var(--ink); font: 600 16px var(--font); transition: border-color 0.12s, box-shadow 0.12s, background 0.12s;
}
input:focus, select:focus, textarea:focus { outline: 0; background: #fff; border-color: var(--red); box-shadow: 0 0 0 4px rgb(179 22 27 / 0.12); }
input[type="checkbox"], input[type="radio"] { width: auto; min-height: 0; }
.amount-input { display: flex; align-items: center; border: 1px solid var(--line-2); border-radius: 14px; background: var(--surface-2); direction: ltr; transition: border-color 0.12s, box-shadow 0.12s; }
.amount-input:focus-within { background: #fff; border-color: var(--red); box-shadow: 0 0 0 4px rgb(179 22 27 / 0.12); }
.amount-input .prefix { padding-inline-start: 14px; color: var(--muted); font-weight: 800; font-family: var(--font); }
.amount-input input { border: 0; background: transparent; box-shadow: none; font-size: 1.35rem; font-weight: 800; font-variant-numeric: tabular-nums; direction: ltr; text-align: left; font-family: var(--font); }
.amount-input input:focus { box-shadow: none; }
.amount-input.small input { font-size: 1rem; min-height: 42px; padding: 6px 8px; }
.field-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.chips { border: 0; margin: 0; padding: 0; min-width: 0; }
.chips legend { padding: 0; margin-bottom: 8px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; inset: 0; }
.chip span {
  display: flex; flex-direction: column; justify-content: center; min-height: 46px; padding: 8px 14px; border-radius: 14px;
  border: 1px solid var(--line-2); background: var(--surface); cursor: pointer; font-weight: 700; line-height: 1.2; transition: all 0.12s;
}
html[dir="rtl"] .chip span { line-height: 1.8; font-weight: 400; }
.chip small { font-weight: 600; color: var(--muted); }
.chip input:checked + span {
  background: linear-gradient(135deg, var(--red-2), var(--red-dark)); border-color: transparent; color: #fff; box-shadow: var(--shadow-red);
}
.chip input:checked + span small { color: rgb(255 255 255 / 0.85); }
.chip input:focus-visible + span { outline: 3px solid rgb(179 22 27 / 0.35); }
.chips.small .chip span { min-height: 42px; padding: 6px 12px; font-size: 0.92rem; }

.link-btn { align-self: flex-start; background: none; border: 0; color: var(--red); font: 700 0.95rem var(--font); padding: 4px 0; cursor: pointer; }
html[dir="rtl"] .link-btn { font-family: var(--font-ur); font-weight: 400; }
.small-link { font-size: 0.8rem; padding: 2px 0; }
.quick-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: -6px; }
.pill {
  border: 1px solid var(--line-2); background: var(--surface); border-radius: 999px; padding: 7px 14px;
  font: 700 0.85rem var(--font); color: var(--ink-2); cursor: pointer; transition: all 0.12s;
}
.pill:hover { background: var(--soft); }
.pill.active { background: var(--ink); border-color: var(--ink); color: #fff; }
.live-line { margin: -4px 0 0; color: var(--warn); font-weight: 800; }
.live-line:empty { display: none; }
.info-line { margin: 0; color: var(--muted); font-size: 0.9rem; font-weight: 600; }
.info-line:empty { display: none; }
.big-line { margin: 0; font-size: 1.2rem; font-weight: 800; color: var(--good); }
.big-line:empty { display: none; }
.warn-line { color: var(--warn); }
.fixed-who { margin: 0; font-size: 1.1rem; font-weight: 800; }
.check-line { display: flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; }
.check-line input { width: 22px; height: 22px; accent-color: var(--red); }
.check-line.big { font-size: 1.05rem; font-weight: 800; }
.form-actions {
  display: flex; gap: 10px; position: sticky; bottom: -18px; z-index: 2;
  margin: 0 -18px -18px; padding: 12px 18px 18px; background: var(--surface);
  box-shadow: 0 -12px 16px -14px rgb(60 35 20 / 0.3);
}
.card .form-actions, .auth .form-actions { bottom: 0; margin: 0; padding: 8px 0 0; box-shadow: none; }
.form-error { margin: 0; padding: 12px 14px; border-radius: 14px; background: var(--bad-tint); color: var(--bad); font-weight: 700; border: 1px solid #f4c4c4; }
.confirm-text { font-size: 1.05rem; font-weight: 600; }

.dihari-row { display: flex; flex-direction: column; gap: 6px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.dihari-row.done { opacity: 0.75; }
.dihari-row .badge { font-size: 0.75rem; }
.cut-line { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 0.88rem; flex-wrap: wrap; font-weight: 600; }
.cut-line .amount-input { width: 140px; }

.dish-results { max-height: 280px; overflow: auto; border: 1px solid var(--line); border-radius: 14px; padding: 4px 12px; background: var(--surface-2); }
.dish { display: flex; flex-direction: column; gap: 4px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.dish:last-child { border-bottom: 0; }
.dish-name { font-weight: 700; }
.dish-opts { display: flex; flex-wrap: wrap; gap: 6px; }
.picked { list-style: none; margin: 8px 0 0; padding: 0; }
.picked li { display: grid; grid-template-columns: 1fr auto auto; gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px dashed var(--line-2); }
.picked-name { font-weight: 600; }
.picked-amt { font-variant-numeric: tabular-nums; font-weight: 800; }
.stepper { display: inline-flex; align-items: center; gap: 8px; }
.stepper b { min-width: 18px; text-align: center; }
.stepper button { width: 36px; height: 36px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--soft); font-size: 1.1rem; font-weight: 800; cursor: pointer; }
.portion { display: inline-block; padding: 0 8px; border-radius: 999px; background: var(--warn-tint); color: var(--warn); font-size: 0.72rem; }

.stock-head, .stock-row { display: grid; grid-template-columns: 1.6fr 0.8fr 0.6fr 1.3fr; gap: 6px; align-items: center; }
.stock-head { color: var(--muted); font-size: 0.78rem; font-weight: 700; }
.stock-row { padding: 4px 0; }
.stock-row input { min-height: 44px; padding: 6px 10px; }
.stock-row .unit { color: var(--muted); font-size: 0.85rem; font-weight: 600; }
.acc-row { border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; background: var(--surface-2); }

.auth { max-width: 420px; margin: 32px auto; text-align: center; padding: 26px 22px; }
.auth .form { text-align: start; margin-top: 14px; }
.auth-logo { border-radius: 50%; box-shadow: 0 8px 20px -8px rgb(138 14 19 / 0.6); }
.auth h1 { font-size: 1.4rem; font-weight: 800; }

/* ---- POS ---- */

.pos { padding-bottom: 90px; }
.pos-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 10px; }
.pos-head .back { flex-basis: auto; }
.pos-head .page-title { flex-basis: 100%; order: 2; margin: 4px 0 0; }
.pos-head [data-paste] { order: 1; }
.mode-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 12px 0 0; padding: 5px; background: var(--soft); border: 1px solid var(--line); border-radius: 16px; }
.mode-switch button { min-height: 46px; border: 0; border-radius: 12px; background: transparent; font: 800 0.95rem var(--font); color: var(--muted); cursor: pointer; transition: all 0.15s; }
html[dir="rtl"] .mode-switch button { font-family: var(--font-ur); font-weight: 400; }
.mode-switch button.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.mode-switch button[data-mode="restaurant"].active { background: linear-gradient(135deg, var(--red-2), var(--red-dark)); color: #fff; }
.mode-switch button[data-mode="foodpanda"].active { background: linear-gradient(135deg, #f0388a, var(--fp-dark)); color: #fff; }
.pos-search { margin: 12px 0 10px; }
.cat-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 4px; scrollbar-width: none; }
.cat-tabs::-webkit-scrollbar { display: none; }
.cat-tabs .pill { white-space: nowrap; min-height: 38px; }
.pos-dishes { display: grid; grid-template-columns: 1fr; gap: 10px; }
.pos-dish {
  display: grid; grid-template-columns: 60px 1fr auto; align-items: center; gap: 12px; padding: 10px 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); cursor: pointer; transition: box-shadow 0.12s, border-color 0.12s;
}
.pos-dish:hover { box-shadow: var(--shadow-lg); }
.pos-dish.in-cart { border-color: var(--red); box-shadow: 0 0 0 3px rgb(179 22 27 / 0.12), var(--shadow); }
.pos-dish.multi { grid-template-columns: 60px 1fr; }
.pos-dish.multi .pos-thumb { grid-row: span 2; align-self: start; }
/* Several sizes: the name keeps its own line, the price buttons sit at the card's end like a single price. */
.pos-dish.multi .pos-opts { grid-column: 2; justify-content: flex-end; }
.pos-thumb { width: 60px; height: 60px; border-radius: 14px; object-fit: cover; background: var(--soft); }
.pos-thumb.none { display: grid; place-items: center; font-size: 1.6rem; }
.pos-dish-name { font-weight: 700; min-width: 0; }
.pos-dish-name .count {
  display: inline-grid; place-items: center; min-width: 24px; height: 24px; padding: 0 7px; border-radius: 999px;
  background: var(--red); color: #fff; font-size: 0.78rem; margin-inline-start: 4px; vertical-align: 2px;
}
.pos-opts { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.opt {
  display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 68px; min-height: 50px; padding: 4px 12px;
  border: 1px solid var(--line-2); border-radius: 14px; background: var(--surface-2); font: 800 0.95rem var(--font); color: var(--ink); cursor: pointer;
  font-variant-numeric: tabular-nums; transition: all 0.12s;
}
.opt small { font-weight: 700; font-size: 0.68rem; color: var(--muted); }
.opt:hover { border-color: var(--red); }
.opt:active, .opt.pop { background: linear-gradient(135deg, var(--red-2), var(--red-dark)); border-color: transparent; color: #fff; }
.opt.pop small, .opt:active small { color: #fff; }
.bowl-btn { min-width: 88px; }
.bowl .field-label { display: block; margin: 4px 0 8px; }
.bowl-bases { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 16px; }
.bowl-group { margin-bottom: 14px; }
.bowl-group h3 { font-size: 1rem; font-weight: 800; margin: 6px 0 8px; }
.bowl-dishes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.bowl-dish, .bowl-base { flex-direction: row; justify-content: flex-start; gap: 10px; text-align: start; font-size: 0.86rem; font-weight: 700; line-height: 1.25; padding: 6px 8px; }
.bowl-dish img, .bowl-base img { width: 42px; height: 42px; border-radius: 10px; object-fit: cover; flex: none; background: var(--line); }
.bowl-base.active { background: var(--ink); border-color: var(--ink); color: #fff; }
.pos-bar {
  position: fixed; z-index: 20; left: 12px; right: 12px; bottom: calc(var(--nav-h) + 20px + env(safe-area-inset-bottom));
  padding: 0;
}
.pos-bar .btn { width: 100%; max-width: 656px; margin: 0 auto; display: flex; min-height: 58px; border-radius: 18px; }
/* Nothing picked yet: a calm solid bar, not a see-through red one over the dishes. */
.pos-bar .btn:disabled { opacity: 1; background: #ece3d8; color: var(--muted); border: 1px solid var(--line-2); box-shadow: var(--shadow); }
details.discount summary { cursor: pointer; font-weight: 800; color: var(--red); padding: 4px 0; }
details.discount[open] summary { margin-bottom: 8px; }
.paste-box { min-height: 190px; font: 600 14px/1.45 var(--font); resize: vertical; direction: ltr; }

/* ---- Sheets (pop-up forms) ---- */

.sheet-wrap { position: fixed; inset: 0; z-index: 50; }
.sheet-backdrop { position: absolute; inset: 0; background: rgb(25 12 8 / 0.5); backdrop-filter: blur(2px); opacity: 0; transition: opacity 0.2s; }
.sheet {
  position: absolute; inset: auto 0 0 0; max-height: 92vh; max-height: 92dvh; display: flex; flex-direction: column;
  background: var(--surface); border-radius: 26px 26px 0 0; transform: translateY(100%); transition: transform 0.24s cubic-bezier(0.2, 0.8, 0.2, 1);
  padding-bottom: env(safe-area-inset-bottom); box-shadow: 0 -20px 50px -20px rgb(0 0 0 / 0.4);
}
.sheet::before { content: ""; align-self: center; width: 44px; height: 5px; border-radius: 999px; background: var(--line-2); margin-top: 8px; }
.sheet-wrap.open .sheet-backdrop { opacity: 1; }
.sheet-wrap.open .sheet { transform: none; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 18px 10px; border-bottom: 1px solid var(--line); }
.sheet-head h2 { margin: 0; font-size: 1.2rem; font-weight: 800; }
.sheet-body { overflow: auto; padding: 16px 18px 18px; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + 28px + env(safe-area-inset-bottom)); z-index: 80;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none; transition: all 0.2s;
  max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 14px; background: var(--ink); color: #fff; font-weight: 700; box-shadow: var(--shadow-lg);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--bad); }

/* ---- Computers: side menu, wider page, the day in two columns ---- */

@media (min-width: 700px) {
  .sheet { inset: 6vh auto auto 50%; width: 560px; max-height: 88vh; border-radius: 24px; transform: translate(-50%, 24px); opacity: 0; transition: transform 0.2s, opacity 0.2s; }
  .sheet::before { display: none; }
  .sheet.wide { width: 680px; }
  .sheet-wrap.open .sheet { transform: translate(-50%, 0); opacity: 1; }
  .sheet-head { padding-top: 16px; }
  .pos-dishes { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 1000px) {
  body { padding-bottom: 32px; padding-inline-start: calc(var(--side-w) + 24px); }
  body.logged-out { padding-inline-start: 0; }
  .topbar { position: fixed; inset: 0 0 auto 0; padding-inline: 24px; }
  body:not(.logged-out) .main, body.logged-out .main { padding-top: calc(var(--header-h) + 22px); }
  .main { max-width: 1120px; padding-inline: 8px 24px; }
  .nav {
    top: calc(var(--header-h) + 18px); bottom: auto; left: 18px; right: auto; width: var(--side-w); height: auto;
    display: flex; flex-direction: column; gap: 4px; padding: 10px; border-radius: 22px;
  }
  html[dir="rtl"] .nav { left: auto; right: 18px; }
  .nav a { flex-direction: row; justify-content: flex-start; gap: 12px; padding: 12px 14px; font-size: 0.95rem; }
  html[dir="rtl"] .nav a { font-size: 0.9rem; }
  .toast { bottom: 28px; left: calc(50% + var(--side-w) / 2); }
  .pos-bar { left: calc(var(--side-w) + 42px); right: 24px; bottom: 20px; }
  .pos-dishes { grid-template-columns: repeat(3, 1fr); }
  .day-grid { display: grid; grid-template-columns: minmax(360px, 430px) 1fr; gap: 24px; align-items: start; }
  .day-side { position: sticky; top: calc(var(--header-h) + 18px); }
  .day-grid .card:first-child { margin-top: 12px; }
}

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