/* =========================================================
   نظام حسابات الكافيه — ستايل "بريوش المتميز"
   كروت كريمي · حواف مدورة · شارة سعر داكنة · شريط تصنيفات عائم
   ========================================================= */

/* ============ Theme tokens ============ */
:root {
  --bg: #f2eee6;
  --bg-2: #eae2d5;
  --card: #fffdf8;
  --card-2: #f7f2e9;
  --tile: #efe6d8;
  --field: #fffdf8;
  --hover: rgba(122, 90, 63, 0.07);
  --ink: #33291f;
  --ink-2: #5d4c3c;
  --muted: #a2907a;
  --brand: #7a5a3f;
  --accent: #c08a4a;
  --accent-2: #a3702f;
  --pill: #2e2823;
  --pill-ink: #fffaf1;
  --dock: #3f4a50;
  --line: #e7dccb;
  --line-2: #f0e8db;
  --ok: #2f7d46;
  --warn: #c8791c;
  --bad: #c14b4b;
  --shadow: rgba(90, 64, 34, 0.18);
  --shadow-soft: 0 18px 40px -28px rgba(90, 64, 34, 0.45);
  --glow: rgba(192, 138, 74, 0.30);
  --sidebar-bg: #fbf8f2;
  --r-xl: 26px;
  --r-lg: 20px;
  --r-md: 14px;
}

[data-theme="dark"] {
  --bg: #16120e;
  --bg-2: #1d1712;
  --card: #211a14;
  --card-2: #292119;
  --tile: #33291f;
  --field: #2a2119;
  --hover: rgba(226, 179, 111, 0.10);
  --ink: #f3eade;
  --ink-2: #d8c8b4;
  --muted: #a08e79;
  --brand: #d9ab74;
  --accent: #e3b36f;
  --accent-2: #d29f57;
  --pill: #3b3128;
  --pill-ink: #fdf6ea;
  --dock: #3b3128;
  --line: #362a1f;
  --line-2: #2e241b;
  --ok: #6fbf85;
  --warn: #e8a355;
  --bad: #e08585;
  --shadow: rgba(0, 0, 0, 0.6);
  --shadow-soft: 0 18px 40px -26px rgba(0, 0, 0, 0.8);
  --glow: rgba(227, 179, 111, 0.22);
  --sidebar-bg: #1c1611;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: "Baloo Bhaijaan 2", "Cairo", "Segoe UI", Tahoma, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 90% -10%, rgba(192, 138, 74, 0.10), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(192, 138, 74, 0.08), transparent 60%),
    var(--bg);
  min-height: 100dvh;
  transition: background-color .25s ease, color .25s ease;
}

h1, h2, h3, h4 { font-weight: 800; letter-spacing: -.2px; }
a { color: var(--brand); }
button, input, select, textarea { font-family: inherit; }
.hidden { display: none !important; }

/* ============ Sidebar ============ */
.sidebar {
  position: fixed;
  inset-block: 0;
  right: 0;
  width: 262px;
  z-index: 70;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 13px;
  overflow-y: auto;
  background: var(--sidebar-bg);
  border-left: 1px solid var(--line);
  box-shadow: -18px 0 46px -34px var(--shadow);
  transition: transform .28s ease, background .25s ease;
}

.side-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
  padding: 8px;
  margin-bottom: 4px;
}
.side-brand .logo {
  width: 46px; height: 46px;
  flex: 0 0 46px;
  display: grid; place-items: center;
  border-radius: 16px;
  color: #fff;
  background: linear-gradient(140deg, var(--brand), var(--accent));
  box-shadow: 0 10px 22px -12px var(--glow);
}
.side-brand .logo svg {
  width: 25px; height: 25px;
  fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}
.side-brand-txt b { display: block; font-size: 15.5px; line-height: 1.35; }
.side-brand-txt small { color: var(--muted); font-size: 12px; }

.side-nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.side-sec {
  font-size: 11.5px;
  font-weight: 800;
  color: var(--muted);
  letter-spacing: .3px;
  margin: 14px 10px 5px;
}
.side-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  font-size: 15px;
  font-weight: 700;
  color: var(--ink-2);
  text-decoration: none;
  transition: background .18s ease, color .18s ease, transform .18s ease;
}
.side-link svg {
  width: 19px; height: 19px;
  flex: 0 0 19px;
  fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
  opacity: .8;
}
.side-link:hover { background: var(--hover); color: var(--ink); }
.side-link.on {
  color: var(--pill-ink);
  background: var(--pill);
  box-shadow: 0 14px 26px -16px var(--shadow);
}
.side-link.on svg { opacity: 1; }

.side-foot { margin-top: auto; display: grid; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line); }

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--card);
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background .2s ease, color .2s ease;
}
.theme-toggle:hover { background: var(--hover); color: var(--ink); }
.theme-toggle svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.theme-toggle span { display: inline-flex; align-items: center; gap: 8px; }
.theme-toggle .when-dark { display: none; }
[data-theme="dark"] .theme-toggle .when-light { display: none; }
[data-theme="dark"] .theme-toggle .when-dark { display: inline-flex; }

.theme-float {
  position: fixed;
  top: 14px;
  left: 14px;
  width: auto;
  z-index: 60;
  box-shadow: var(--shadow-soft);
}

.side-user {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 9px 12px;
  font-size: 14px;
}
.su-name { font-weight: 800; }
.su-role {
  font-size: 12px;
  color: var(--pill-ink);
  background: var(--pill);
  border-radius: 999px;
  padding: 2px 11px;
  font-weight: 700;
}
.side-logout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: var(--r-md);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  color: var(--bad);
  background: var(--card);
  border: 1px solid var(--line);
  transition: background .18s ease;
}
.side-logout:hover { background: var(--hover); }
.side-logout svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.burger {
  position: fixed;
  top: 13px;
  right: 13px;
  z-index: 75;
  width: 46px; height: 46px;
  display: none;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
  box-shadow: var(--shadow-soft);
}
.burger svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; }

.overlay {
  position: fixed;
  inset: 0;
  z-index: 64;
  background: rgba(24, 16, 8, .45);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
}

/* ============ Main / topbar ============ */
.main { margin-right: 262px; transition: margin .25s ease; }
body.guest .main { margin-right: 0; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 45;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 22px 14px;
  background: linear-gradient(180deg, var(--bg) 62%, rgba(242, 238, 230, 0));
  backdrop-filter: blur(6px);
}
[data-theme="dark"] .topbar { background: linear-gradient(180deg, var(--bg) 62%, rgba(22, 18, 14, 0)); }
.tb-head { flex: 1; min-width: 0; }
.tb-title {
  margin: 0;
  font-size: 27px;
  line-height: 1.25;
  font-weight: 800;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tb-sub { margin: 2px 0 0; color: var(--muted); font-size: 14px; font-weight: 600; }
.tb-sub b { color: var(--ink-2); }
.tb-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }

.icon-btn {
  display: grid; place-items: center;
  width: 42px; height: 42px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink-2);
  text-decoration: none;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
  transition: transform .15s ease, color .2s ease, background .2s ease;
}
.icon-btn:hover { color: var(--ink); background: var(--card-2); }
.icon-btn:active { transform: scale(.95); }
.icon-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Segmented view switch (زي أزرار الشكل فوق في الصور) */
.seg {
  display: inline-flex;
  gap: 3px;
  padding: 4px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--card);
  box-shadow: var(--shadow-soft);
}
.seg-btn {
  display: grid; place-items: center;
  width: 34px; height: 32px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background .18s ease, color .18s ease;
}
.seg-btn:hover { color: var(--ink); }
.seg-btn.on { background: var(--pill); color: var(--pill-ink); }
.seg-btn svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

.container { max-width: 1240px; margin: 0 auto; padding: 4px 22px 110px; }

/* ============ Cards ============ */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-soft);
  transition: background .25s ease, border-color .25s ease;
}
.card h2, .card h3 { margin-top: 0; font-size: 19px; }
.card h3 { color: var(--ink); }

/* ============ Buttons ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: var(--r-md);
  padding: 12px 20px;
  font-size: 15.5px;
  font-weight: 800;
  cursor: pointer;
  background: var(--pill);
  color: var(--pill-ink);
  text-decoration: none;
  box-shadow: 0 14px 28px -18px var(--shadow);
  transition: transform .15s ease, filter .2s ease, background .2s ease;
}
.btn:hover { filter: brightness(1.12); transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.98); }
.btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.btn.ok { background: linear-gradient(135deg, #2f7d46, #55b06d); color: #fff; }
.btn.warn { background: linear-gradient(135deg, #c8791c, #e6a54a); color: #fff; }
.btn.bad { background: linear-gradient(135deg, #b34444, #d76f6f); color: #fff; }
.btn.ghost {
  background: var(--card);
  color: var(--ink-2);
  border: 1px solid var(--line);
  box-shadow: none;
}
.btn.ghost:hover { background: var(--hover); color: var(--ink); }
.btn.sm { padding: 7px 13px; font-size: 13.5px; border-radius: 11px; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

/* ============ Forms ============ */
input, select, textarea {
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  font-size: 15px;
  background: var(--field);
  color: var(--ink);
  transition: border-color .2s ease, box-shadow .2s ease, background .25s ease;
}
input::placeholder, textarea::placeholder { color: var(--muted); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--glow);
}
input[type="file"] {
  padding: 10px 12px;
  border-radius: var(--r-md);
  border-style: dashed;
  background: var(--card-2);
  font-size: 14px;
}
input[type="file"]::file-selector-button {
  border: 0;
  border-radius: 10px;
  margin-inline-end: 10px;
  padding: 7px 14px;
  background: var(--pill);
  color: var(--pill-ink);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 800;
  cursor: pointer;
}
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--brand); }

label { color: var(--ink-2); font-weight: 700; }
.form-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 10px; }
.form-row label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 5px; font-weight: 700; }

/* ============ Tables ============ */
table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 10px; border-bottom: 1px solid var(--line-2); text-align: right; }
th {
  color: var(--muted);
  font-weight: 800;
  font-size: 13px;
  background: var(--card-2);
  border-bottom: 1px solid var(--line);
}
th:first-child { border-top-right-radius: var(--r-md); }
th:last-child { border-top-left-radius: var(--r-md); }
tbody tr:hover td, tr:hover td { background: var(--hover); }
tr.row-total td { background: var(--card-2); font-weight: 800; font-size: 16px; }

/* ============ Badges / flash / misc ============ */
.flash {
  padding: 13px 16px;
  border-radius: var(--r-lg);
  margin-bottom: 14px;
  font-weight: 800;
  border: 1px solid transparent;
  box-shadow: var(--shadow-soft);
}
.flash.ok { background: rgba(47, 125, 70, .12); color: var(--ok); border-color: rgba(47, 125, 70, .35); }
.flash.error { background: rgba(193, 75, 75, .12); color: var(--bad); border-color: rgba(193, 75, 75, .35); }

.badge {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 800;
  vertical-align: middle;
}
.badge.open { background: rgba(200, 121, 28, .16); color: var(--warn); }
.badge.paid { background: rgba(47, 125, 70, .16); color: var(--ok); }
.badge.cancelled { background: var(--hover); color: var(--muted); }
.badge.off { background: rgba(193, 75, 75, .16); color: var(--bad); }
.badge.on { background: rgba(47, 125, 70, .16); color: var(--ok); }

.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.muted { color: var(--muted); }
.center { text-align: center; }

/* ============ Stats ============ */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 16px; }
.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  padding: 18px 18px 16px;
  box-shadow: var(--shadow-soft);
  position: relative;
  overflow: hidden;
}
.stat::after {
  content: "";
  position: absolute;
  inset-inline-start: -46px;
  top: -46px;
  width: 120px; height: 120px;
  border-radius: 50%;
  background: var(--glow);
  opacity: .18;
  pointer-events: none;
}
.stat .t { color: var(--muted); font-size: 13.5px; font-weight: 800; position: relative; }
.stat .n { font-size: 30px; font-weight: 800; margin-top: 4px; color: var(--ink); position: relative; }
.stat .n::after { content: " ج.م"; font-size: 13px; color: var(--muted); font-weight: 700; }
.stat.green .n { color: var(--ok); }
.stat.red .n { color: var(--bad); }

/* ============ Tables: scroll + filters ============ */
.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); gap: 16px; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-scroll table { min-width: 620px; }

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  margin-bottom: 16px;
}
.filter-bar .f { display: grid; gap: 5px; }
.filter-bar .f > span { font-size: 12.5px; font-weight: 800; color: var(--muted); }

/* ============ Admin quick links ============ */
.quick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(178px, 1fr));
  gap: 13px;
  margin-bottom: 18px;
}
.quick {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 16px 16px 15px;
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  background: var(--card);
  box-shadow: var(--shadow-soft);
  text-decoration: none;
  color: var(--ink);
  transition: transform .16s ease, border-color .2s ease;
}
.quick:hover { transform: translateY(-4px); border-color: var(--accent); }
.quick:active { transform: scale(.98); }
.quick svg {
  width: 26px; height: 26px;
  margin-bottom: 8px;
  fill: none; stroke: var(--brand); stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}
.quick b { font-size: 15.5px; font-weight: 800; }
.quick small { font-size: 12.5px; color: var(--muted); font-weight: 700; }

/* ============ Cashier: tables grid ============ */
.legend { display: flex; gap: 18px; margin-bottom: 14px; color: var(--muted); font-size: 13.5px; font-weight: 800; }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend .dot { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }
.legend .dot.free { background: var(--ok); }
.legend .dot.open { background: var(--warn); }

.tables-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
}
.tcard {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 9px;
  text-align: center;
  min-height: 148px;
  padding: 18px 12px;
  border-radius: var(--r-xl);
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
  text-decoration: none;
  color: var(--ink);
  font-weight: 800;
  transition: transform .18s ease, box-shadow .22s ease;
}
.tcard:hover { transform: translateY(-4px); box-shadow: 0 26px 46px -26px var(--shadow); }
.tcard:active { transform: scale(.98); }
.tcard .tn {
  display: grid; place-items: center;
  width: 54px; height: 54px;
  border-radius: 18px;
  font-size: 22px;
  background: var(--card-2);
  color: var(--ink-2);
  border: 1px solid var(--line);
}
.tcard small { font-size: 13px; font-weight: 700; color: var(--muted); }
.tcard.open { border-color: rgba(200, 121, 28, .45); }
.tcard.open .tn { background: rgba(200, 121, 28, .14); color: var(--warn); border-color: transparent; }
.tcard.open small { color: var(--warn); }
.tcard.free .tn { background: rgba(47, 125, 70, .12); color: var(--ok); border-color: transparent; }
.tcard.free small { color: var(--ok); }

/* ============ Cashier: order screen ============ */
.pos-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1.62fr) minmax(320px, 1fr);
  gap: 18px;
  align-items: start;
}
.pos-menu { min-width: 0; }

.prod-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); }

.pcard {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 10px 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  background: var(--card);
  box-shadow: var(--shadow-soft);
  color: var(--ink);
  cursor: pointer;
  text-align: right;
  font: inherit;
  transition: transform .16s ease, box-shadow .22s ease, border-color .2s ease;
}
.pcard:hover { transform: translateY(-4px); border-color: var(--accent); }
.pcard:active { transform: scale(.97); }
.pcard:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.pc-media {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: var(--r-lg);
  overflow: hidden;
  background: linear-gradient(150deg, var(--tile), var(--card-2));
}
.pc-media img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.pc-ph {
  position: absolute; inset: 0;
  display: none;
  place-items: center;
  font-size: 40px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(140deg, var(--brand), var(--accent));
}
.pcard.no-img .pc-ph { display: grid; }
.pcard.no-img .pc-media img { display: none; }

.pc-flag {
  position: absolute;
  top: 8px;
  inset-inline-end: 8px;
  min-width: 28px; height: 28px;
  padding: 0 8px;
  display: grid; place-items: center;
  border-radius: 999px;
  background: var(--pill);
  color: var(--pill-ink);
  font-size: 14px;
  font-weight: 800;
  box-shadow: 0 8px 18px -8px var(--shadow);
}

.pc-body {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: 11px 3px 0;
}
.pc-txt { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.pc-name {
  font-size: 16px;
  font-weight: 800;
  line-height: 1.3;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.pc-avail { font-size: 12.5px; font-weight: 700; color: var(--muted); }
.pc-price {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--pill);
  color: var(--pill-ink);
  font-size: 15px;
  font-weight: 800;
  white-space: nowrap;
}
.pc-price i { font-style: normal; font-size: 11px; opacity: .8; }

.pcard.in-order { border-color: var(--accent); box-shadow: 0 0 0 2px var(--glow), var(--shadow-soft); }

/* compact view */
.pos-wrap[data-view="compact"] .prod-grid { grid-template-columns: repeat(auto-fill, minmax(146px, 1fr)); gap: 11px; }
.pos-wrap[data-view="compact"] .pcard { padding: 8px 8px 10px; border-radius: var(--r-lg); }
.pos-wrap[data-view="compact"] .pc-media { aspect-ratio: 1 / 1; border-radius: var(--r-md); }
.pos-wrap[data-view="compact"] .pc-name { font-size: 14px; }
.pos-wrap[data-view="compact"] .pc-avail { display: none; }
.pos-wrap[data-view="compact"] .pc-price { font-size: 13px; padding: 5px 9px; }
.pos-wrap[data-view="compact"] .pc-ph { font-size: 30px; }

/* list view */
.pos-wrap[data-view="list"] .prod-grid { grid-template-columns: 1fr; gap: 9px; }
.pos-wrap[data-view="list"] .pcard {
  flex-direction: row;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: var(--r-lg);
}
.pos-wrap[data-view="list"] .pc-media { width: 62px; flex: 0 0 62px; aspect-ratio: 1 / 1; border-radius: var(--r-md); }
.pos-wrap[data-view="list"] .pc-body { flex: 1; padding: 0; align-items: center; }
.pos-wrap[data-view="list"] .pc-name { font-size: 16px; -webkit-line-clamp: 1; }
.pos-wrap[data-view="list"] .pc-avail { display: none; }
.pos-wrap[data-view="list"] .pc-ph { font-size: 22px; }
.pos-wrap[data-view="list"] .pc-flag { top: -4px; inset-inline-end: -4px; }

/* category dock (شريط التصنيفات العائم) */
.cat-dock {
  position: sticky;
  bottom: 12px;
  z-index: 40;
  display: flex;
  gap: 6px;
  margin-top: 18px;
  padding: 8px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--card);
  box-shadow: 0 22px 44px -22px var(--shadow);
  scrollbar-width: thin;
}
.cat-chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 16px;
  border: 0;
  border-radius: 16px;
  background: transparent;
  color: var(--muted);
  font-size: 14.5px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  transition: background .18s ease, color .18s ease;
}
.cat-chip:hover { background: var(--hover); color: var(--ink); }
.cat-chip.on { background: var(--dock); color: #fff; box-shadow: 0 14px 26px -16px var(--shadow); }
.cat-chip svg {
  width: 19px; height: 19px;
  fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}

/* bill */
.bill {
  position: sticky;
  top: 86px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  background: var(--card);
  box-shadow: var(--shadow-soft);
  max-height: calc(100dvh - 110px);
  overflow-y: auto;
}
.bill-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.bill-head h3 { margin: 0; font-size: 19px; }
.count-pill {
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--card-2);
  border: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 800;
}
.bill-empty { text-align: center; padding: 26px 10px; color: var(--muted); }
.bill-empty svg {
  width: 46px; height: 46px;
  fill: none; stroke: currentColor; stroke-width: 1.5;
  stroke-linecap: round; stroke-linejoin: round;
  opacity: .5;
}
.bill-empty p { margin: 8px 0 0; font-weight: 700; }
.bill-empty small { font-size: 13px; opacity: .85; }

.bill-item {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 11px 12px;
  margin-bottom: 8px;
  border-radius: var(--r-lg);
  background: var(--card-2);
  border: 1px solid var(--line-2);
}
.bi-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.bi-name { font-weight: 800; font-size: 15.5px; }
.bi-line { font-weight: 800; color: var(--accent-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.bi-ctrl { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.bi-unit { font-size: 12.5px; color: var(--muted); font-weight: 700; }
.bi-qty { display: inline-flex; align-items: center; gap: 8px; }
.bi-qty b { min-width: 24px; text-align: center; font-size: 16px; }
.qty-btn {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card);
  font-size: 19px;
  font-weight: 800;
  cursor: pointer;
  color: var(--ink);
  transition: background .15s ease, transform .12s ease;
}
.qty-btn:hover { background: var(--hover); }
.qty-btn:active { transform: scale(.92); }
.qty-btn:disabled { opacity: .4; cursor: not-allowed; }

.bill-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  border-radius: var(--r-lg);
  background: var(--pill);
  color: var(--pill-ink);
  font-size: 17px;
  font-weight: 800;
}
.bill-total b { font-size: 23px; font-variant-numeric: tabular-nums; }
.bill-total i { font-style: normal; font-size: 13px; opacity: .75; }

.bill-actions { display: grid; gap: 9px; }
.pay-cash { background: linear-gradient(135deg, #2f7d46, #55b06d); color: #fff; padding: 15px; font-size: 17px; }
.pay-card { background: linear-gradient(135deg, #3f4a50, #5c6d76); color: #fff; padding: 15px; font-size: 17px; }
.bill-sub-actions { display: flex; gap: 9px; }
.bill-sub-actions .btn { flex: 1; }
.sm-btn { padding: 10px 12px; font-size: 14px; }

/* ============ Login / single forms ============ */
.narrow { max-width: 580px; margin: 0 auto; }
.big-field { padding: 15px !important; font-size: 20px !important; font-weight: 800; }
.check-line {
  display: flex; gap: 9px; align-items: center;
  margin: 6px 0 16px;
  font-size: 14.5px;
  font-weight: 700;
  color: var(--ink-2);
}
.recap {
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 13px 15px;
  margin-top: 0;
  font-size: 14px;
}
.recap b { color: var(--ink); }
.recap .up { color: var(--ok); font-weight: 800; }
.recap .down { color: var(--bad); font-weight: 800; }

.login-box { max-width: 420px; margin: 9vh auto 0; }
.login-box h1 {
  text-align: center;
  margin-bottom: 4px;
  font-size: 30px;
  color: var(--ink);
}
.login-box .brand-mark {
  display: grid;
  place-items: center;
  width: 66px; height: 66px;
  margin: 0 auto 12px;
  border-radius: 22px;
  color: #fff;
  background: linear-gradient(140deg, var(--brand), var(--accent));
  box-shadow: 0 18px 34px -18px var(--glow);
}
.login-box .brand-mark svg {
  width: 34px; height: 34px;
  fill: none; stroke: currentColor; stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round;
}
.login-box p.sub { text-align: center; color: var(--muted); margin-top: 0; font-weight: 700; }
.login-box .card { padding: 22px; }
.login-box form { display: grid; gap: 12px; }
.login-box input { padding: 14px; font-size: 16px; border-radius: var(--r-md); }

/* ============ Admin thumbs ============ */
.thumb-sm {
  width: 48px; height: 48px;
  object-fit: cover;
  border-radius: 12px;
  background: var(--tile);
  vertical-align: middle;
}
.thumb-lg {
  width: 120px; height: 92px;
  object-fit: cover;
  border-radius: var(--r-md);
  background: var(--tile);
  display: block;
}

/* ============ Credit tag ============ */
.credit-tag {
  position: fixed;
  bottom: 14px;
  left: 14px;
  z-index: 80;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 15px;
  border-radius: 999px;
  background: var(--pill);
  color: var(--pill-ink);
  box-shadow: 0 20px 40px -22px var(--shadow);
}
.credit-tag .ct-star {
  display: grid; place-items: center;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: linear-gradient(140deg, var(--brand), var(--accent));
}
.credit-tag .ct-star svg { width: 17px; height: 17px; fill: #fff; stroke: none; }
.credit-tag b { display: block; font-size: 13px; line-height: 1.45; }
.credit-tag .ct-phone {
  display: block;
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: .5px;
  color: var(--accent);
  text-decoration: none;
}

/* ============ Print ============ */
@media print {
  .sidebar, .topbar, .burger, .overlay, .credit-tag, .theme-float { display: none !important; }
  .main { margin: 0; }
  body { background: #fff; }
  .card { box-shadow: none; border-color: #ddd; }
}

/* ============ Responsive ============ */
/* على شاشة الأوردر الشريط العائم بيغطي على توقيع الشركة — نرفعه فوقه */
body:has(.cat-dock) .credit-tag { bottom: 86px; }

@media (max-width: 1080px) {
  .pos-wrap { grid-template-columns: 1fr; }
  .bill { position: static; max-height: none; }
}
@media (max-width: 980px) {
  .sidebar { transform: translateX(105%); width: 280px; }
  body.side-open .sidebar { transform: none; }
  body.side-open .overlay { opacity: 1; pointer-events: auto; }
  .main { margin-right: 0; }
  .burger { display: grid; }
  .container { padding: 4px 14px 110px; }
  .topbar { padding: 62px 14px 10px; }
  .tb-title { font-size: 23px; white-space: normal; }
}
@media (max-width: 620px) {
  .prod-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 11px; }
  .pc-name { font-size: 14.5px; }
  .credit-tag { padding: 7px 12px; gap: 8px; }
  .credit-tag .ct-star { width: 26px; height: 26px; }
  .credit-tag b { font-size: 12px; }
  .credit-tag .ct-phone { font-size: 11.5px; }
  .tables-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
  .tcard { min-height: 128px; }
  .bill-sub-actions { flex-direction: column; }
}
