/* Real Supermarket admin — Teal & Haldi */
:root {
  --teal: #0e6b66; --teal-d: #0a4f4b; --teal-l: #e3f0ee;
  --haldi: #e9a93b; --haldi-l: #fbf0d9;
  --bg: #f5f3ee; --card: #fff; --ink: #1d2a29; --ink-2: #51605e; --line: #e4e0d6;
  --red: #c0392b; --red-l: #fbe9e7; --green: #2e7d4f; --green-l: #e5f3ea; --blue: #2d5f9a; --blue-l: #e6eef8;
  --r: 10px; --sh: 0 1px 2px rgba(20,30,30,.06), 0 4px 14px rgba(20,30,30,.04);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 14px/1.5 "Segoe UI", system-ui, -apple-system, Roboto, "Noto Nastaliq Urdu", sans-serif; background: var(--bg); color: var(--ink); }
a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 16px; margin: 0 0 12px; }
h3 { font-size: 14px; margin: 0 0 8px; }
.muted { color: var(--ink-2); }
.small { font-size: 12px; }
.rtl { direction: rtl; text-align: right; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }

/* layout */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.side { background: var(--teal-d); color: #d9ebe8; padding: 18px 12px 40px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; gap: 10px; align-items: center; padding: 0 8px 18px; border-bottom: 1px solid rgba(255,255,255,.08); margin-bottom: 10px; }
.brand img { width: 36px; height: 36px; }
.brand b { display: block; color: #fff; font-size: 14px; line-height: 1.2; }
.brand span { font-size: 11px; color: var(--haldi); }
.side .grp { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: #8fb8b2; margin: 16px 10px 4px; }
.side a { display: flex; align-items: center; gap: 9px; padding: 7px 10px; border-radius: 7px; color: #d9ebe8; font-size: 13.5px; }
.side a:hover { background: rgba(255,255,255,.07); text-decoration: none; }
.side a.on { background: var(--haldi); color: #2b1f05; font-weight: 600; }
.side svg { width: 16px; height: 16px; flex: none; opacity: .9; }
.main { min-width: 0; }
.top { display: flex; justify-content: space-between; align-items: center; padding: 12px 28px; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.top .who { display: flex; gap: 14px; align-items: center; font-size: 13px; }
.menu-btn { display: none; background: none; border: 0; font-size: 22px; cursor: pointer; }
.content { padding: 24px 28px 60px; max-width: 1400px; }
.head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.head .sub { color: var(--ink-2); margin-top: 3px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--sh); padding: 18px; margin-bottom: 18px; }
.card.flush { padding: 0; overflow: hidden; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-side { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; box-shadow: var(--sh); }
.kpi .l { color: var(--ink-2); font-size: 12px; }
.kpi .v { font-size: 24px; font-weight: 700; margin-top: 4px; letter-spacing: -.02em; }
.kpi.accent { border-top: 3px solid var(--haldi); }

/* tables */
table.t { width: 100%; border-collapse: collapse; }
.t th, .t td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.t th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-2); background: #faf9f6; font-weight: 600; }
.t tr:last-child td { border-bottom: 0; }
.t tbody tr:hover { background: #fcfbf8; }
.t td.num, .t th.num { text-align: right; font-variant-numeric: tabular-nums; }
.t .thumb { width: 40px; height: 40px; object-fit: cover; border-radius: 6px; background: #eee; display: block; }
.table-wrap { overflow-x: auto; }
.empty { padding: 36px; text-align: center; color: var(--ink-2); }

/* forms */
label { display: block; font-weight: 600; font-size: 12.5px; margin-bottom: 12px; color: var(--ink); }
label .hint { font-weight: 400; color: var(--ink-2); display: block; font-size: 12px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=datetime-local], input[type=time], input[type=search], input[type=file], select, textarea {
  display: block; width: 100%; margin-top: 5px; padding: 8px 10px; border: 1px solid #cfcabd; border-radius: 7px; font: inherit; font-weight: 400; background: #fff; color: var(--ink);
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(14,107,102,.25); border-color: var(--teal); }
.check { display: flex; gap: 8px; align-items: center; font-weight: 500; }
.check input { width: 16px; height: 16px; accent-color: var(--teal); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; }
.form-grid .full { grid-column: 1 / -1; }
.inline-form { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.inline-form label { margin: 0; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 14px; }
.filters input, .filters select { margin-top: 0; width: auto; min-width: 150px; }
.err-text { color: var(--red); font-size: 12px; font-weight: 500; }

/* buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 7px; border: 1px solid #cfcabd; background: #fff; color: var(--ink); font: inherit; font-weight: 600; font-size: 13px; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: #f7f5f0; text-decoration: none; }
.btn.primary { background: var(--teal); color: #fff; border-color: var(--teal); }
.btn.primary:hover { background: var(--teal-d); }
.btn.haldi { background: var(--haldi); border-color: var(--haldi); color: #2b1f05; }
.btn.danger { color: var(--red); border-color: #e6b8b2; }
.btn.danger:hover { background: var(--red-l); }
.btn.sm { padding: 4px 9px; font-size: 12px; }
.btn.block { width: 100%; justify-content: center; }
.link-btn { background: none; border: 0; color: var(--teal); cursor: pointer; font: inherit; padding: 0; }
.link-btn.danger { color: var(--red); }

/* badges */
.badge { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 600; background: #eee; color: #444; white-space: nowrap; }
.b-active, .b-delivered, .b-paid, .b-ok { background: var(--green-l); color: var(--green); }
.b-inactive, .b-blocked, .b-cancelled, .b-rejected, .b-failed, .b-expired { background: var(--red-l); color: var(--red); }
.b-placed, .b-pending, .b-draft { background: var(--haldi-l); color: #8a5a00; }
.b-confirmed, .b-packing { background: var(--blue-l); color: var(--blue); }
.b-out_for_delivery { background: var(--teal-l); color: var(--teal-d); }
.b-depleted { background: #eee; color: #666; }
.b-sample { background: #f3e8ff; color: #6b21a8; }

/* alerts */
.alert { padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; font-weight: 500; }
.alert.ok { background: var(--green-l); color: var(--green); }
.alert.err { background: var(--red-l); color: var(--red); }
.alert.info { background: var(--haldi-l); color: #6d4700; }

/* misc */
.pager { display: flex; gap: 4px; justify-content: flex-end; padding: 12px; flex-wrap: wrap; }
.pager a, .pager span { padding: 5px 10px; border: 1px solid var(--line); border-radius: 6px; background: #fff; font-size: 13px; }
.pager .cur { background: var(--teal); color: #fff; border-color: var(--teal); }
.pager .dis { color: #aaa; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; flex-wrap: wrap; }
.tabs a { padding: 8px 14px; color: var(--ink-2); border-bottom: 2px solid transparent; font-weight: 600; }
.tabs a.on { color: var(--teal); border-color: var(--teal); }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; }
.kv dt { color: var(--ink-2); }
.kv dd { margin: 0; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: 0 0 12px 18px; border-left: 2px solid var(--line); position: relative; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--teal); }
.chart { width: 100%; height: 190px; }
.chart rect { fill: var(--teal); }
.chart rect:hover { fill: var(--haldi); }
.chart text { font-size: 10px; fill: var(--ink-2); }
.img-grid { display: flex; gap: 10px; flex-wrap: wrap; }
.img-grid figure { margin: 0; width: 120px; text-align: center; font-size: 12px; }
.img-grid img { width: 120px; height: 120px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.preview-img { max-width: 160px; max-height: 120px; border-radius: 8px; border: 1px solid var(--line); display: block; margin-top: 6px; }
.perm-group { border: 1px solid var(--line); border-radius: 8px; padding: 12px; }
.tree ul { list-style: none; padding-left: 20px; margin: 0; }
.tree > ul { padding-left: 0; }
.tree li { padding: 3px 0; }
.tree .row { display: flex; gap: 10px; align-items: center; padding: 5px 8px; border-radius: 6px; }
.tree .row:hover { background: #faf8f3; }
.tree img { width: 28px; height: 28px; border-radius: 5px; object-fit: cover; }
.tree details > summary { cursor: pointer; list-style: none; }
.tree details > summary::-webkit-details-marker { display: none; }

/* auth */
.auth-page { display: grid; place-items: center; min-height: 100vh; background: linear-gradient(160deg, var(--teal-d), var(--teal)); padding: 20px; }
.auth-card { background: #fff; border-radius: 14px; padding: 32px; width: 100%; max-width: 380px; box-shadow: 0 20px 60px rgba(0,0,0,.2); }
.auth-card h1 { margin-bottom: 4px; }
.auth-logo { width: 56px; height: 56px; display: block; margin-bottom: 14px; }

/* print (invoice) */
@media print {
  .side, .top, .no-print { display: none !important; }
  .shell { display: block; }
  .content { padding: 0; }
  .card { box-shadow: none; border: 0; }
  body { background: #fff; }
}

@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, 1fr); } .g-side { grid-template-columns: 1fr; } }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; left: -260px; width: 248px; z-index: 20; transition: left .2s; }
  body.menu-open .side { left: 0; }
  .menu-btn { display: block; }
  .content { padding: 16px; }
  .top { padding: 10px 16px; }
  .g2, .g3, .form-grid { grid-template-columns: 1fr; }
}
