/* ZAIN COFFEE & RESTAURANT — POS stylesheet
   Palette: deep green primary, lime accents, cream/white backgrounds, dark text. */
:root {
  --green-900: #063D22;
  --green-800: #0B5D33;
  --green-700: #0F7A43;
  --green-600: #158F50;
  --green-100: #E3F2E8;
  --green-50: #F1F8F3;
  --lime-500: #9ACD32;
  --lime-400: #B5E048;
  --lime-200: #DFF5A6;
  --lime-100: #EEF9D2;
  --cream: #F6F3E7;
  --cream-2: #FBF9F2;
  --white: #FFFFFF;
  --ink: #1B2A1F;
  --ink-2: #3D4A40;
  --muted: #6B7A6E;
  --line: #DCE3DD;
  --danger: #C62828;
  --danger-bg: #FDECEC;
  --warn: #B26A00;
  --warn-bg: #FFF4DF;
  --info: #0B5D33;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(6, 61, 34, .06), 0 4px 14px rgba(6, 61, 34, .06);
  --shadow-lg: 0 10px 30px rgba(6, 61, 34, .18);
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --sidebar-w: 236px;
  --touch: 48px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.45; color: var(--ink); background: var(--cream); min-height: 100vh; }
a { color: var(--green-800); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { margin: 0 0 .5rem; line-height: 1.2; color: var(--green-900); }
h1 { font-size: 1.5rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1.05rem; }
p { margin: 0 0 .75rem; }
small, .muted { color: var(--muted); }
.mono { font-variant-numeric: tabular-nums; font-family: ui-monospace, Menlo, Consolas, monospace; }
.right { text-align: right; } .center { text-align: center; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.flex { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.flex-between { display: flex; justify-content: space-between; align-items: center; gap: .75rem; flex-wrap: wrap; }
.grow { flex: 1; }
.stack > * + * { margin-top: .75rem; }
.mt { margin-top: 1rem; } .mb { margin-bottom: 1rem; } .mt-2 { margin-top: 2rem; }

/* ---------- app shell ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar { background: var(--green-900); color: #DCEBDF; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: .6rem; padding: 1rem 1rem .8rem; color: #fff; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand img { width: 40px; height: 40px; border-radius: 10px; object-fit: cover; background: #fff; }
.brand .logo-fallback { width: 40px; height: 40px; border-radius: 10px; background: var(--lime-500); color: var(--green-900); font-weight: 800; display: grid; place-items: center; font-size: 1.1rem; }
.brand b { display: block; font-size: .95rem; line-height: 1.1; }
.brand small { color: var(--lime-200); font-size: .72rem; letter-spacing: .04em; }
.nav { padding: .5rem 0; flex: 1; }
.nav a { display: flex; align-items: center; gap: .65rem; padding: .62rem 1rem; color: #DCEBDF; font-weight: 500; border-left: 3px solid transparent; min-height: 44px; }
.nav a:hover { background: rgba(255,255,255,.06); text-decoration: none; }
.nav a.active { background: rgba(154,205,50,.16); border-left-color: var(--lime-500); color: #fff; }
.nav .ico { width: 22px; height: 22px; flex: none; opacity: .95; }
.nav .sec { padding: .8rem 1rem .25rem; font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; color: rgba(255,255,255,.45); }
.user-box { padding: .8rem 1rem; border-top: 1px solid rgba(255,255,255,.08); font-size: .85rem; }
.user-box b { color: #fff; display: block; }
.user-box form { margin-top: .4rem; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: .75rem; padding: .7rem 1.25rem; background: var(--white); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.topbar h1 { font-size: 1.15rem; margin: 0; flex: 1; }
.burger { display: none; }
.scrim { display: none; }
.content { padding: 1.25rem; flex: 1; }
@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 280px; transform: translateX(-100%); transition: transform .2s; z-index: 40; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .scrim { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 39; }
  .scrim.show { display: block; }
  .burger { display: inline-grid; }
  .content { padding: .9rem; }
}

/* ---------- status pill (online / offline) ---------- */
.conn { display: inline-flex; align-items: center; gap: .4rem; font-size: .78rem; padding: .25rem .6rem; border-radius: 99px; background: var(--green-100); color: var(--green-800); font-weight: 600; }
.conn::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--green-600); }
.conn.offline { background: var(--danger-bg); color: var(--danger); }
.conn.offline::before { background: var(--danger); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .3; } }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; min-height: var(--touch); padding: .6rem 1.1rem; border-radius: var(--radius-sm); border: 1px solid transparent; font: inherit; font-weight: 600; cursor: pointer; background: var(--green-800); color: #fff; line-height: 1.2; text-decoration: none; user-select: none; -webkit-tap-highlight-color: transparent; transition: filter .12s, transform .05s; }
.btn:hover { filter: brightness(1.08); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; filter: none; }
.btn.lime { background: var(--lime-500); color: var(--green-900); }
.btn.ghost { background: #fff; color: var(--green-800); border-color: var(--line); }
.btn.ghost:hover { background: var(--green-50); }
.btn.danger { background: var(--danger); }
.btn.warn { background: var(--warn); }
.btn.sm { min-height: 38px; padding: .4rem .8rem; font-size: .9rem; }
.btn.lg { min-height: 56px; font-size: 1.1rem; padding: .8rem 1.4rem; }
.btn.block { width: 100%; }
.btn.icon { padding: .5rem; width: var(--touch); }
.btn svg { width: 20px; height: 20px; }

/* ---------- forms ---------- */
label { display: block; font-size: .85rem; font-weight: 600; color: var(--ink-2); margin-bottom: .3rem; }
.field { margin-bottom: .9rem; }
input:not([type]), input[type="text"], input[type="number"], input[type="password"], input[type="email"], input[type="tel"], input[type="date"], input[type="datetime-local"], input[type="search"], input[type="url"], select, textarea {
  width: 100%; min-height: 46px; padding: .55rem .8rem; border: 1px solid var(--line); border-radius: var(--radius-sm); font: inherit; background: #fff; color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--lime-500); outline-offset: 1px; border-color: var(--green-600); }
textarea { min-height: 90px; resize: vertical; }
.check { display: flex; align-items: center; gap: .55rem; font-weight: 500; min-height: 40px; }
.check input { width: 22px; height: 22px; accent-color: var(--green-700); }
.help { font-size: .8rem; color: var(--muted); margin-top: .25rem; }
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 780px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } .grid-2.keep { grid-template-columns: 1fr 1fr; } }
.input-row { display: flex; gap: .5rem; }
.input-row > * { flex: 1; }

/* ---------- cards & tables ---------- */
.card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.1rem 1.25rem; }
.card + .card { margin-top: 1rem; }
.card-title { display: flex; justify-content: space-between; align-items: center; gap: .75rem; margin-bottom: .8rem; flex-wrap: wrap; }
.card-title h2 { margin: 0; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.tbl { width: 100%; border-collapse: collapse; font-size: .93rem; }
.tbl th, .tbl td { padding: .55rem .6rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.tbl th { font-size: .75rem; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); background: var(--cream-2); position: sticky; top: 0; }
.tbl tr:hover td { background: var(--green-50); }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl tfoot td { font-weight: 700; background: var(--cream-2); }
.tbl .thumb { width: 44px; min-width: 44px; max-width: none; height: 44px; border-radius: 8px; object-fit: cover; }
.badge { display: inline-block; padding: .15rem .55rem; border-radius: 99px; font-size: .75rem; font-weight: 700; background: var(--green-100); color: var(--green-800); white-space: nowrap; }
.badge.lime { background: var(--lime-200); color: var(--green-900); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.danger { background: var(--danger-bg); color: var(--danger); }
.badge.grey { background: #EDEFEA; color: var(--ink-2); }
.badge.blue { background: #E3ECFB; color: #1A4FA3; }

/* ---------- alerts ---------- */
.alert { padding: .75rem 1rem; border-radius: var(--radius-sm); margin-bottom: 1rem; border-left: 4px solid var(--green-700); background: var(--green-100); color: var(--green-900); }
.alert.error { background: var(--danger-bg); border-color: var(--danger); color: #7a1414; }
.alert.warn { background: var(--warn-bg); border-color: var(--warn); color: #5c3600; }
.alert.info { background: #EEF3FB; border-color: #3B6FC4; color: #1A3E7A; }

/* ---------- KPI tiles ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .8rem; }
.kpi { background: #fff; border-radius: var(--radius); padding: .9rem 1rem; box-shadow: var(--shadow); border-top: 4px solid var(--green-800); }
.kpi.lime { border-top-color: var(--lime-500); } .kpi.warn { border-top-color: var(--warn); } .kpi.danger { border-top-color: var(--danger); } .kpi.grey { border-top-color: #B9C2BB; }
.kpi .lbl { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; }
.kpi .val { font-size: 1.45rem; font-weight: 800; color: var(--green-900); margin-top: .15rem; font-variant-numeric: tabular-nums; }
.kpi .sub { font-size: .78rem; color: var(--muted); margin-top: .15rem; }

/* ---------- tabs / filters ---------- */
.tabs { display: flex; gap: .35rem; flex-wrap: wrap; margin-bottom: 1rem; }
.tabs a, .tabs button { padding: .45rem .9rem; border-radius: 99px; background: #fff; border: 1px solid var(--line); color: var(--ink-2); font: inherit; font-weight: 600; cursor: pointer; min-height: 40px; }
.tabs a.active, .tabs button.active { background: var(--green-800); color: #fff; border-color: var(--green-800); }
.filters { display: flex; gap: .5rem; flex-wrap: wrap; align-items: flex-end; margin-bottom: 1rem; }
.filters .field { margin: 0; min-width: 150px; }

/* ---------- modal ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(6,61,34,.45); z-index: 100; display: none; align-items: center; justify-content: center; padding: 1rem; }
.modal-bg.show { display: flex; }
.modal { background: #fff; border-radius: var(--radius); width: 100%; max-width: 560px; max-height: 92vh; overflow: auto; box-shadow: var(--shadow-lg); }
.modal.wide { max-width: 860px; }
.modal-h { display: flex; justify-content: space-between; align-items: center; padding: .9rem 1.1rem; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: #fff; z-index: 1; }
.modal-h h3 { margin: 0; }
.modal-b { padding: 1.1rem; }
.modal-f { padding: .9rem 1.1rem; border-top: 1px solid var(--line); display: flex; gap: .5rem; justify-content: flex-end; flex-wrap: wrap; position: sticky; bottom: 0; background: #fff; }
@media (max-width: 600px) { .modal-bg { padding: 0; align-items: flex-end; } .modal { max-height: 96vh; border-radius: var(--radius) var(--radius) 0 0; } }

/* ---------- toast ---------- */
.toasts { position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: .5rem; width: min(92vw, 420px); }
.toast { background: var(--green-900); color: #fff; padding: .75rem 1rem; border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); font-weight: 600; animation: pop .15s ease-out; }
.toast.error { background: var(--danger); } .toast.warn { background: var(--warn); }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } }

/* ---------- login ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1rem; background: radial-gradient(1200px 600px at 20% -10%, #0F7A43 0%, var(--green-900) 60%); }
.auth-card { background: #fff; border-radius: 18px; padding: 2rem; width: 100%; max-width: 400px; box-shadow: var(--shadow-lg); }
.auth-card .brand { padding: 0 0 1rem; color: var(--green-900); border: 0; }
.auth-card .brand b { font-size: 1.1rem; } .auth-card .brand small { color: var(--green-700); }

/* ---------- permission matrix ---------- */
.matrix { font-size: .85rem; }
.matrix th, .matrix td { text-align: center; padding: .35rem .3rem; }
.matrix td:first-child, .matrix th:first-child { text-align: left; }
.matrix input { width: 20px; height: 20px; accent-color: var(--green-700); }
.matrix tr.sensitive td:first-child::after { content: " 🔒"; font-size: .75rem; }

/* ---------- product image tiles in menu admin ---------- */
.img-drop { border: 2px dashed var(--line); border-radius: var(--radius); padding: 1rem; text-align: center; background: var(--cream-2); }
.img-drop img { width: 180px; height: 180px; object-fit: cover; border-radius: var(--radius-sm); margin: 0 auto .5rem; }

/* ---------- print helpers ---------- */
@media print {
  .sidebar, .topbar, .no-print, .toasts { display: none !important; }
  .shell { display: block; }
  .content { padding: 0; }
  body { background: #fff; }
  .card { box-shadow: none; }
}
.empty { text-align: center; color: var(--muted); padding: 2rem 1rem; }
.empty svg { width: 42px; height: 42px; opacity: .5; margin-bottom: .5rem; }
.pager { display: flex; gap: .4rem; justify-content: center; margin-top: 1rem; flex-wrap: wrap; }
.pager a, .pager span { padding: .4rem .7rem; border-radius: 8px; border: 1px solid var(--line); background: #fff; min-width: 40px; text-align: center; }
.pager span.cur { background: var(--green-800); color: #fff; border-color: var(--green-800); }
.chart-box { position: relative; height: 260px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: .3rem; }
kbd { background: #eee; border-radius: 4px; padding: 0 .35rem; font-family: inherit; font-size: .85em; border: 1px solid #ccc; }
.progress { height: 8px; background: var(--green-100); border-radius: 99px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--green-700); }
details summary { cursor: pointer; font-weight: 600; color: var(--green-800); }
.chip { display: inline-flex; align-items: center; gap: .3rem; padding: .3rem .7rem; border-radius: 99px; background: var(--green-50); border: 1px solid var(--line); font-size: .85rem; }
.kpi.small .val { font-size: 1rem; }
