/* ============================================================
   OPD LIFESTYLE Rx — visual system
   Identity: an Indian prescription pad, digitized.
   Ink blue = the pen. Haldi = the action. Plex Mono = the lab report.
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,400;12..96,600;12..96,700&family=IBM+Plex+Sans:wght@400;500;600&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root {
  --ink: #1b2a4a;          /* prescription pen ink */
  --ink-2: #24365c;
  --ink-soft: #47598050;
  --paper: #f4f6f9;        /* clinical paper */
  --card: #ffffff;
  --line: #dfe5ee;
  --haldi: #d98e04;        /* turmeric — primary action */
  --haldi-ink: #7a4f00;
  --sage: #2f7a52;         /* veg / on-target */
  --sage-bg: #e7f3ec;
  --brick: #b2402a;        /* non-veg / over / danger */
  --brick-bg: #f9ebe7;
  --muted: #64708a;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(27,42,74,.06), 0 4px 16px rgba(27,42,74,.07);
  --font-body: 'IBM Plex Sans', system-ui, sans-serif;
  --font-disp: 'Bricolage Grotesque', var(--font-body);
  --font-mono: 'IBM Plex Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font-body); font-size: 14.5px; line-height: 1.5;
  color: var(--ink); background: var(--paper);
}
a { color: var(--ink-2); }
:focus-visible { outline: 2px solid var(--haldi); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- shell: sidebar + main ---------- */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side {
  background: var(--ink); color: #dfe6f4; padding: 18px 14px;
  display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh;
}
.brand { display:flex; align-items:baseline; gap:8px; padding: 2px 10px 16px; }
.brand .rx {
  font-family: var(--font-disp); font-weight: 700; font-size: 30px; color: var(--haldi);
  line-height: 1;
}
.brand .nm { font-family: var(--font-disp); font-weight: 600; font-size: 15px; letter-spacing:.2px; }
.brand .nm small { display:block; font-family: var(--font-mono); font-size: 10px; color:#9fb0d2; font-weight:400; letter-spacing:1px; text-transform:uppercase; }
.nav a {
  display:flex; align-items:center; gap:10px; padding: 9px 10px; border-radius: 8px;
  color:#c9d4ea; text-decoration:none; font-weight:500; font-size:13.5px;
}
.nav a svg { width:17px; height:17px; opacity:.8; }
.nav a:hover { background: var(--ink-2); color:#fff; }
.nav a.on { background: var(--ink-2); color:#fff; box-shadow: inset 3px 0 0 var(--haldi); }
.nav .grp { font-family:var(--font-mono); font-size:10px; letter-spacing:1.5px; text-transform:uppercase; color:#7e90b6; padding: 14px 10px 4px; }
.side .foot { margin-top:auto; padding: 10px; font-size:12px; color:#9fb0d2; border-top:1px solid #33456e; }
.side .foot a { color:#c9d4ea; }

.main { padding: 22px 26px 60px; max-width: 1160px; width:100%; }
.topbar { display:flex; align-items:center; gap:14px; margin-bottom: 18px; flex-wrap:wrap; }
.topbar h1 { font-family: var(--font-disp); font-weight:600; font-size: 22px; margin: 0; letter-spacing:.2px; }
.topbar .sub { color: var(--muted); font-size: 13px; }
.spacer { flex:1; }

/* ---------- cards, tables, forms ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card .hd { padding: 13px 16px; border-bottom: 1px solid var(--line); display:flex; align-items:center; gap:10px; font-weight:600; }
.card .bd { padding: 16px; }
.grid { display:grid; gap:16px; }
.g2 { grid-template-columns: 1fr 1fr; } .g3 { grid-template-columns: repeat(3,1fr); } .g4 { grid-template-columns: repeat(4,1fr); }

.stat { padding: 14px 16px; }
.stat .n { font-family: var(--font-mono); font-size: 26px; font-weight:500; }
.stat .l { color: var(--muted); font-size: 12.5px; }

table.tbl { width:100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align:left; font-family: var(--font-mono); font-size: 11px; letter-spacing:.8px; text-transform:uppercase; color: var(--muted); padding: 9px 12px; border-bottom: 1px solid var(--line); font-weight:500;}
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr:hover td { background: #f8fafd; }
.tbl .num { font-family: var(--font-mono); }

label { display:block; font-weight:600; font-size: 12.5px; margin: 0 0 5px; }
label .req { color: var(--brick); }
input[type=text], input[type=number], input[type=email], input[type=password], input[type=time], input[type=date], input[type=search], select, textarea {
  width:100%; padding: 9px 11px; border:1px solid var(--line); border-radius: 8px;
  font: inherit; color: var(--ink); background:#fff;
}
input:focus, select:focus, textarea:focus { border-color: var(--haldi); outline: none; box-shadow: 0 0 0 3px #d98e0422; }
input:invalid:not(:placeholder-shown) { border-color: var(--brick); }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.field { margin-bottom: 14px; }
.frow { display:grid; gap: 14px; }
.frow.c2 { grid-template-columns: 1fr 1fr; } .frow.c3 { grid-template-columns: 1fr 1fr 1fr; } .frow.c4 { grid-template-columns: repeat(4,1fr); }

.btn {
  display:inline-flex; align-items:center; gap:7px; padding: 9px 16px; border-radius: 8px;
  border:1px solid transparent; font: inherit; font-weight:600; cursor:pointer; text-decoration:none;
  background: var(--haldi); color: #fff; transition: filter .12s;
}
.btn:hover { filter: brightness(.94); }
.btn.ghost { background:#fff; color: var(--ink); border-color: var(--line); }
.btn.ink { background: var(--ink); }
.btn.danger { background: var(--brick); }
.btn.sm { padding: 5px 10px; font-size: 12.5px; border-radius: 7px; }
.btn[disabled] { opacity:.5; cursor:not-allowed; }

.badge { display:inline-block; padding: 2px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 600; }
.badge.veg { background: var(--sage-bg); color: var(--sage); }
.badge.nonveg { background: var(--brick-bg); color: var(--brick); }
.badge.draft { background: #fff4dd; color: var(--haldi-ink); }
.badge.final { background: var(--sage-bg); color: var(--sage); }
.badge.cancelled { background:#eee; color:#777; }
.badge.ink { background:#e8edf6; color:var(--ink-2); }

.flash { padding: 11px 14px; border-radius: 8px; margin-bottom: 14px; font-weight: 500; border:1px solid; }
.flash.info { background:#eef3fb; border-color:#c9d8f0; color: var(--ink-2); }
.flash.ok { background: var(--sage-bg); border-color:#bfdccc; color: var(--sage); }
.flash.warn { background:#fff6e4; border-color:#eedbA6; color: var(--haldi-ink); }
.flash.err { background: var(--brick-bg); border-color:#e3c0b6; color: var(--brick); }

/* ---------- auth pages ---------- */
.auth { min-height:100vh; display:grid; place-items:center; padding: 24px;
  background: linear-gradient(160deg, var(--ink) 0 46%, var(--paper) 46.2%); }
.auth .pad { width: min(400px, 100%); background:#fff; border-radius: 14px; box-shadow: 0 20px 60px rgba(27,42,74,.35); overflow:hidden; }
.auth .pad .top { background: var(--ink); color:#fff; padding: 22px 26px 18px; }
.auth .pad .top .rx { font-family: var(--font-disp); font-size: 40px; font-weight:700; color: var(--haldi); line-height:1; }
.auth .pad .top h1 { margin: 6px 0 2px; font-family: var(--font-disp); font-size: 19px; font-weight:600; }
.auth .pad .top p { margin:0; color:#b9c6e0; font-size: 12.5px; }
.auth .pad .bd { padding: 22px 26px 26px; }

/* ---------- wizard ---------- */
.wiz { display:grid; grid-template-columns: 1fr 250px; gap: 18px; align-items:start; }
.steps { display:flex; gap:6px; flex-wrap:wrap; margin-bottom: 16px; }
.steps a { padding: 6px 12px; border-radius: 99px; border:1px solid var(--line); background:#fff; text-decoration:none;
  font-size: 12.5px; font-weight:600; color: var(--muted); }
.steps a.on { background: var(--ink); color:#fff; border-color: var(--ink); }
.steps a.done { color: var(--sage); border-color:#bfdccc; background: var(--sage-bg); }
.steps a.off { opacity:.55; }

.dayschips { display:flex; gap:5px; flex-wrap:wrap; }
.dayschips .d { padding: 4px 9px; border-radius: 7px; border: 1px solid var(--line); font-family: var(--font-mono);
  font-size: 11.5px; cursor:pointer; user-select:none; background:#fff; }
.dayschips .d.on { background: var(--ink); color:#fff; border-color: var(--ink); }
.dayschips .d.all { border-style: dashed; }

.item-row { display:flex; align-items:center; gap:10px; padding: 10px 12px; border:1px solid var(--line); border-radius: 9px; margin-bottom: 8px; background:#fff; flex-wrap:wrap; }
.item-row .nm { font-weight: 600; min-width: 150px; flex: 1; }
.item-row .nm small { display:block; font-weight:400; color:var(--muted); font-size:11.5px; }
.item-row .macros { font-family: var(--font-mono); font-size: 11.5px; color: var(--muted); white-space:nowrap; }
.item-row .del { color: var(--brick); background:none; border:none; cursor:pointer; font-size: 16px; padding:4px; }
.item-row.alt { border-left: 3px solid var(--haldi); }
.qty { width: 64px !important; font-family: var(--font-mono); text-align:center; }
.altsel { width: 74px !important; }
.timein { width: 96px !important; font-family: var(--font-mono); }

.ac-wrap { position: relative; }
.ac-list { position:absolute; z-index: 30; left:0; right:0; top: calc(100% + 4px); background:#fff; border:1px solid var(--line);
  border-radius: 9px; box-shadow: var(--shadow); max-height: 300px; overflow:auto; }
.ac-list .it { padding: 9px 12px; cursor:pointer; display:flex; justify-content:space-between; gap:10px; align-items:center; }
.ac-list .it:hover, .ac-list .it.sel { background: #f2f6fc; }
.ac-list .it .m { font-family: var(--font-mono); font-size: 11px; color: var(--muted); white-space:nowrap; }
.tabs { display:flex; gap:6px; flex-wrap:wrap; margin-bottom:10px; }
.tabs .t { padding:5px 11px; border-radius:99px; font-size:12px; font-weight:600; border:1px solid var(--line); cursor:pointer; background:#fff; color:var(--muted); }
.tabs .t.on { background:var(--haldi); border-color:var(--haldi); color:#fff; }

/* ---------- the signature: 7-day ledger rail ---------- */
.rail { position: sticky; top: 18px; }
.rail .card .bd { padding: 12px 14px; }
.rail h3 { margin: 0 0 2px; font-family: var(--font-disp); font-size: 14px; }
.rail .tgt { font-family: var(--font-mono); font-size: 11px; color: var(--muted); margin-bottom: 10px; }
.dayrow { display:grid; grid-template-columns: 34px 1fr 44px; gap: 8px; align-items:center; margin-bottom: 7px; }
.dayrow .dl { font-family: var(--font-mono); font-size: 11px; color: var(--muted); text-transform:uppercase; }
.meter { height: 9px; border-radius: 99px; background: #edf0f5; overflow: hidden; position:relative; }
.meter i { position:absolute; inset:0 auto 0 0; border-radius: 99px; background: var(--sage); transition: width .35s ease; }
.meter.low i { background: #d9a404; } .meter.over i { background: var(--brick); }
.dayrow .dv { font-family: var(--font-mono); font-size: 11px; text-align:right; color: var(--ink-2); }
.rail .legend { font-size: 11px; color: var(--muted); margin-top: 8px; }
.rail .warnbox { margin-top: 10px; }
.rail .warnbox .w { font-size: 12px; color: var(--brick); background: var(--brick-bg); border-radius: 7px; padding: 7px 9px; margin-bottom: 6px; }
.rail .sugg { font-size: 12.5px; margin-top: 10px; }
.rail .sugg .s { padding: 7px 9px; border: 1px dashed var(--line); border-radius: 7px; margin-bottom: 6px; display:flex; justify-content:space-between; gap:8px; align-items:center; cursor:pointer; }
.rail .sugg .s:hover { border-color: var(--haldi); background:#fffaf0; }
.rail .sugg .s .m { font-family: var(--font-mono); font-size: 10.5px; color: var(--muted); }

/* ---------- modal ---------- */
.overlay { position: fixed; inset: 0; background: rgba(27,42,74,.45); display:none; place-items:center; z-index: 60; padding: 20px; }
.overlay.open { display: grid; }
.modal { width: min(560px, 100%); background:#fff; border-radius: 12px; box-shadow: 0 24px 70px rgba(0,0,0,.3); max-height: 92vh; overflow:auto; }
.modal .hd { padding: 14px 18px; border-bottom:1px solid var(--line); font-weight: 700; font-family: var(--font-disp); display:flex; }
.modal .bd { padding: 18px; }
.modal .ft { padding: 12px 18px; border-top:1px solid var(--line); display:flex; gap:10px; justify-content:flex-end; }

/* ---------- responsive ---------- */
.burger { display:none; background:none; border:1px solid var(--line); border-radius:8px; padding:7px 10px; cursor:pointer; }
@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 50; left: -240px; width: 232px; transition: left .2s; }
  .side.open { left: 0; box-shadow: 0 0 60px rgba(0,0,0,.4); }
  .burger { display:inline-flex; }
  .main { padding: 14px 14px 60px; }
  .wiz { grid-template-columns: 1fr; }
  .rail { position: static; }
  .g4, .g3 { grid-template-columns: 1fr 1fr; }
  .frow.c3, .frow.c4 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .g4, .g3, .g2, .frow.c2, .frow.c3, .frow.c4 { grid-template-columns: 1fr; }
  .item-row .macros { width:100%; }
}

/* ---------- print: the Rx pad itself ---------- */
@media print {
  @page { size: A4; margin: 12mm; }
  body { background: #fff; font-size: 12px; }
  .no-print { display: none !important; }
  .rxpad { box-shadow:none !important; border:none !important; }
}
.rxpad { background:#fff; max-width: 800px; margin: 0 auto; padding: 26px 34px; border:1px solid var(--line); border-radius: 6px; box-shadow: var(--shadow); }
.rxpad .lh { display:flex; justify-content:space-between; align-items:flex-start; border-bottom: 2.5px solid var(--ink); padding-bottom: 12px; }
.rxpad .lh .doc { font-family: var(--font-disp); }
.rxpad .lh .doc b { font-size: 19px; }
.rxpad .lh .doc div { font-size: 12px; color: var(--muted); }
.rxpad .lh .rx { font-family: var(--font-disp); font-size: 46px; font-weight: 700; color: var(--ink); line-height: 1; }
.rxpad .pt { display:flex; gap: 18px 30px; flex-wrap:wrap; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.rxpad .pt b { font-weight: 600; }
.rxpad h4.sec { font-family: var(--font-disp); font-size: 13px; letter-spacing:.6px; text-transform: uppercase;
  border-bottom: 1px solid var(--line); padding-bottom: 4px; margin: 18px 0 8px; display:flex; justify-content:space-between; }
.rxpad table { width: 100%; border-collapse: collapse; font-size: 12px; }
.rxpad table th { font-family: var(--font-mono); font-size: 10px; text-transform: uppercase; letter-spacing: .6px;
  color: var(--muted); text-align: left; padding: 4px 6px; border-bottom: 1px solid var(--line); font-weight:500; }
.rxpad table td { padding: 5px 6px; border-bottom: 1px dotted #e7ebf2; vertical-align: top; }
.rxpad .tickrow td { font-family: var(--font-mono); font-size: 10.5px; text-align:center; }
.rxpad .targets { display:flex; gap: 10px; flex-wrap:wrap; margin: 12px 0 2px; }
.rxpad .targets .t { border: 1.5px solid var(--ink); border-radius: 8px; padding: 7px 13px; text-align:center; }
.rxpad .targets .t b { display:block; font-family: var(--font-mono); font-size: 16px; }
.rxpad .targets .t span { font-size: 10.5px; text-transform: uppercase; letter-spacing:.5px; color: var(--muted); }
.rxpad .sign { margin-top: 40px; display:flex; justify-content: flex-end; }
.rxpad .sign .box { text-align:center; font-size: 12px; }
.rxpad .sign .box .ln { border-top: 1px solid var(--ink); width: 210px; margin-bottom: 4px; }
.rxpad .altnote { color: var(--haldi-ink); font-size: 11px; }
