/* ============================================================
   style.css — poore CRM ka design (rang, font, layout)
   Rang badalne ho to sirf :root ke variables badaliye
   ============================================================ */
:root {
  --bg: #f5f3ef;
  --surface: #ffffff;
  --ink: #1d1b18;
  --ink-2: #5b5750;
  --ink-3: #8c877e;
  --line: #e6e1d8;
  --brand: #b4471f;        /* Dana Choga — tandoori orange */
  --brand-ink: #ffffff;
  --brand-soft: #f6e4da;
  --bar: #c2603a;
  --good: #2f7d4f;
  --warn: #b7791f;
  --bad: #b3261e;
  --side: #1f1c19;
  --side-ink: #d9d3c9;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 16px rgba(0,0,0,.04);
  font-family: "Inter", "Segoe UI", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #151311; --surface: #1f1c19; --ink: #f1ece4; --ink-2: #b9b2a7; --ink-3: #8a847a;
    --line: #34302b; --brand: #e0784c; --brand-soft: #3a261d; --bar: #e0784c; --side: #0f0e0c;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-size: 14px; line-height: 1.45; }
a { color: var(--brand); text-decoration: none; }
h1 { font-size: 22px; margin: 0 0 4px; letter-spacing: -.01em; }
h2 { font-size: 15px; margin: 0 0 12px; }
.muted { color: var(--ink-2); }
.small { font-size: 12px; color: var(--ink-3); }

/* ---------- Layout: left menu + main ---------- */
.layout { display: grid; grid-template-columns: 230px 1fr; min-height: 100vh; }
.side { background: var(--side); color: var(--side-ink); padding: 20px 14px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; color: #fff; font-size: 16px; padding: 4px 8px 18px; }
.logo span.mark { width: 32px; height: 32px; border-radius: 9px; background: var(--brand); display: grid; place-items: center; font-size: 15px; }
.side a.nav { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; color: var(--side-ink); }
.side a.nav:hover { background: rgba(255,255,255,.06); }
.side a.nav.active { background: rgba(255,255,255,.1); color: #fff; }
.side .me { margin-top: auto; border-top: 1px solid rgba(255,255,255,.1); padding: 14px 8px 0; font-size: 13px; }
.side .me b { color: #fff; display: block; }
.side .me button { margin-top: 10px; width: 100%; }
main { padding: 26px 30px 60px; min-width: 0; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }

/* ---------- Cards / grids ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); min-width: 0; }
.grid { display: grid; gap: 16px; }
.g4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.g2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.stat .label { color: var(--ink-2); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.stat .value { font-size: 26px; font-weight: 700; margin-top: 6px; font-variant-numeric: tabular-nums; }
.stat .sub { font-size: 12px; color: var(--ink-3); margin-top: 2px; }

/* ---------- Bar list (outlet-wise chart) ---------- */
.bars { display: flex; flex-direction: column; gap: 7px; }
.bar-row { display: grid; grid-template-columns: 130px 1fr 90px; gap: 10px; align-items: center; font-size: 13px; }
.bar-row .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink-2); }
.bar-track { height: 14px; background: transparent; border-radius: 0 4px 4px 0; position: relative; }
.bar-fill { height: 100%; background: var(--bar); border-radius: 0 4px 4px 0; min-width: 2px; }
.bar-row .val { text-align: right; font-variant-numeric: tabular-nums; }
.bar-row:hover .bar-fill { filter: brightness(1.1); }

/* ---------- Day columns chart ---------- */
.cols { display: flex; align-items: flex-end; gap: 8px; height: 180px; padding-top: 10px; border-bottom: 1px solid var(--line); }
.col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; position: relative; }
.col .fill { width: 100%; max-width: 46px; background: var(--bar); border-radius: 4px 4px 0 0; min-height: 2px; }
.col:hover .fill { filter: brightness(1.1); }
.col .tip { position: absolute; bottom: calc(100% - 4px); background: var(--ink); color: var(--surface); font-size: 12px; padding: 4px 8px; border-radius: 6px; white-space: nowrap; display: none; pointer-events: none; z-index: 2; }
.col:last-child .tip { right: 0; }
.col:first-child .tip { left: 0; }
.col:hover .tip { display: block; }
.col-labels { display: flex; gap: 8px; }
.col-labels span { flex: 1; text-align: center; font-size: 11px; color: var(--ink-3); padding-top: 6px; }

/* ---------- Form ---------- */
label { display: block; font-size: 12px; color: var(--ink-2); margin-bottom: 4px; font-weight: 500; }
input, select { width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); font: inherit; }
input:focus, select:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
.field { margin-bottom: 14px; }
.filters { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.filters .field { margin: 0; min-width: 140px; }
button, .btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 16px; border-radius: 8px; border: 1px solid transparent; background: var(--brand); color: var(--brand-ink); font: inherit; font-weight: 600; cursor: pointer; }
button:hover, .btn:hover { filter: brightness(1.06); }
button.ghost, .btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.side button.ghost { color: var(--side-ink); border-color: rgba(255,255,255,.15); }
button:disabled { opacity: .5; cursor: wait; }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-weight: 600; color: var(--ink-2); font-size: 12px; padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface); position: sticky; top: 0; }
td { padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; font-variant-numeric: tabular-nums; }
tr:hover td { background: var(--bg); }
td.num, th.num { text-align: right; }

.pill { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--brand-soft); color: var(--brand); }
.pill.good { background: #e3f1e8; color: var(--good); }
.pill.warn { background: #f8ecd6; color: var(--warn); }
.pill.bad { background: #f8dedc; color: var(--bad); }
.pill.gray { background: var(--line); color: var(--ink-2); }

.alert { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 13px; }
.alert.err { background: #f8dedc; color: var(--bad); }
.alert.ok { background: #e3f1e8; color: var(--good); }
.hidden { display: none !important; }
.offline-banner { position: sticky; top: 0; z-index: 100; background: var(--bad); color: #fff; padding: 10px 16px; text-align: center; font-weight: 600; font-size: 13px; }

/* ---------- Drop zone (import) ---------- */
.drop { border: 2px dashed var(--line); border-radius: var(--radius); padding: 36px; text-align: center; background: var(--surface); cursor: pointer; transition: .15s; }
.drop.over { border-color: var(--brand); background: var(--brand-soft); }
.drop .big { font-size: 34px; }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: 100%; max-width: 380px; }

/* ---------- Modal ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: grid; place-items: center; padding: 16px; z-index: 50; }
.modal { width: 100%; max-width: 460px; max-height: 90vh; overflow: auto; }

/* ---------- Mobile ---------- */
@media (max-width: 900px) {
  .g4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .g2, .g3 { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .layout { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px 12px; gap: 2px; }
  .logo { padding: 0 8px 0 0; width: 100%; }
  .side a.nav { padding: 7px 9px; font-size: 13px; }
  .side .me { margin: 0; border: 0; padding: 0; width: 100%; display: flex; justify-content: space-between; align-items: center; }
  .side .me button { width: auto; margin: 0; }
  main { padding: 18px 16px 50px; }
  .filters .field { min-width: 0; flex: 1 1 40%; }
  .filters > button, .filters > .btn { flex: 1 1 40%; }
  .bar-row { grid-template-columns: 100px 1fr 76px; }
}
