/* Chaudhury International ERP — screens. Maroon and gold from the company logo; system fonts (nothing loaded from outside). */
:root {
  --bg: #F4F1EC; --panel: #FFFFFF; --ink: #24191A; --muted: #6E625C; --line: #E2DAD0; --soft: #FAF7F2;
  --maroon: #4A0E17; --maroon-2: #2A060B; --gold: #B08A34; --gold-soft: #E6C77A; --accent: #7A1F2B;
  --ok: #2F6B3A; --ok-bg: #E3F0E1; --warn: #8A5A00; --warn-bg: #F7EBCD; --bad: #9B2C1F; --bad-bg: #F6DEDA; --info: #3B5470; --info-bg: #E2E9F1;
  --serif: "Marcellus", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Roboto Mono", monospace;
  --r: 8px; --s1: #A8803A; --s2: #9A3B4C;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #171112; --panel: #221A1B; --ink: #F1E9DF; --muted: #B5A79C; --line: #3A2E2F; --soft: #1C1516; --accent: #E6C77A;
  --ok: #9ED3A2; --ok-bg: #213425; --warn: #F0C977; --warn-bg: #3A2F17; --bad: #F2A497; --bad-bg: #3D2220; --info: #A9C2DE; --info-bg: #1F2A37; --s1: #B38C45; --s2: #C0596A; color-scheme: dark } }
:root[data-theme="dark"] { --s1: #B38C45; --s2: #C0596A; --bg: #171112; --panel: #221A1B; --ink: #F1E9DF; --muted: #B5A79C; --line: #3A2E2F; --soft: #1C1516; --accent: #E6C77A;
  --ok: #9ED3A2; --ok-bg: #213425; --warn: #F0C977; --warn-bg: #3A2F17; --bad: #F2A497; --bad-bg: #3D2220; --info: #A9C2DE; --info-bg: #1F2A37; color-scheme: dark }
* { box-sizing: border-box }
[hidden] { display: none !important }
html, body { margin: 0; height: 100% }
body { background: var(--bg); color: var(--ink); font: 14px/1.5 var(--sans) }
a { color: var(--accent) }
button, input, select, textarea { font: inherit; color: inherit }
h1, h2, h3 { font-family: var(--serif); font-weight: 400; margin: 0 }
.num, td.num { font-family: var(--mono); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap }

/* ---------- sign-in ---------- */
.signin { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; background: linear-gradient(160deg, var(--maroon), var(--maroon-2)) }
.signin .box { width: min(400px, 100%); background: var(--panel); border-radius: 12px; padding: 28px 24px; display: grid; gap: 14px; box-shadow: 0 10px 40px rgba(0,0,0,.35) }
.signin .brand { display: flex; gap: 12px; align-items: center }
.signin .brand img { width: 52px; height: 52px; border-radius: 50% }
.signin .brand h1 { font-size: 21px; color: var(--accent) }
.signin .brand p { margin: 0; color: var(--muted); font-size: 12.5px }
.codes { font-family: var(--mono); display: grid; grid-template-columns: 1fr 1fr; gap: 4px 16px; background: var(--soft); border: 1px solid var(--line); border-radius: 6px; padding: 10px 14px }
.qr { display: grid; place-items: center; background: #fff; border-radius: 6px; padding: 8px }
.qr svg { width: 200px; height: 200px }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100% }
.side { background: linear-gradient(180deg, var(--maroon), var(--maroon-2)); color: #F3E6D3; padding: 14px 10px 30px; position: sticky; top: 0; height: 100vh; overflow-y: auto }
.side .brand { display: flex; gap: 10px; align-items: center; padding: 4px 8px 14px; border-bottom: 1px solid rgba(230,199,122,.25); margin-bottom: 8px }
.side .brand img { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--gold-soft) }
.side .brand b { font-family: var(--serif); font-weight: 400; font-size: 16px; color: var(--gold-soft); line-height: 1.2 }
.side .grp { font: 600 10.5px var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--gold-soft); opacity: .8; padding: 12px 10px 4px }
.side a { display: flex; justify-content: space-between; color: #F3E6D3; text-decoration: none; padding: 6px 10px; border-radius: 6px; font-size: 13.5px }
.side a:hover { background: rgba(255,255,255,.07) }
.side a.on { background: rgba(230,199,122,.18); color: #fff }
.side .badge { background: var(--gold); color: var(--maroon-2); border-radius: 999px; padding: 0 7px; font-size: 11px; font-weight: 700 }
.main { min-width: 0; display: flex; flex-direction: column }
.top { display: flex; gap: 10px; align-items: center; padding: 10px 20px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5 }
.top .menu { display: none }
.top h1 { font-size: 20px; flex: 1; color: var(--accent); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
.top .who { color: var(--muted); font-size: 12.5px; text-align: right }
.content { padding: 18px 20px 60px; display: grid; gap: 16px; align-content: start }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr }
  .side { position: fixed; inset: 0 auto 0 0; width: 270px; z-index: 20; transform: translateX(-100%); transition: transform .2s }
  .side.open { transform: none }
  .top .menu { display: inline-flex }
  .content { padding: 14px 12px 60px }
}

/* ---------- building blocks ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; display: grid; gap: 10px; min-width: 0 }
.card > h2 { font-size: 17px; color: var(--accent) }
.card > h2 small { font: 500 11px var(--sans); color: var(--muted); letter-spacing: .06em; text-transform: uppercase; margin-left: 8px }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; align-items: start }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; min-width: 0 }
.tile span { display: block; font: 600 10.5px var(--sans); letter-spacing: .07em; text-transform: uppercase; color: var(--muted) }
.tile b { display: block; font: 500 21px/1.3 var(--mono); margin-top: 4px; overflow-wrap: anywhere }
.tile small { color: var(--muted) }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center }
.grow { flex: 1 }
.muted { color: var(--muted) }
.note { color: var(--muted); font-size: 12.5px; margin: 0 }
.btn { border: 1px solid var(--line); background: var(--panel); border-radius: 6px; padding: 7px 13px; cursor: pointer; font-weight: 500; white-space: nowrap }
.btn:hover { border-color: var(--gold) }
.btn.primary { background: var(--maroon); border-color: var(--maroon); color: #fff }
.btn.primary:hover { background: var(--accent) }
.btn.small { padding: 3px 9px; font-size: 12.5px }
.btn.danger { color: var(--bad); border-color: var(--bad) }
.btn:disabled { opacity: .5; cursor: wait }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .side a:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px }
.chip { display: inline-block; font: 600 10.5px var(--sans); letter-spacing: .05em; text-transform: uppercase; border-radius: 999px; padding: 2px 8px; white-space: nowrap; background: var(--soft); color: var(--muted); border: 1px solid var(--line) }
.chip.ok { color: var(--ok); background: var(--ok-bg); border-color: transparent } .chip.warn { color: var(--warn); background: var(--warn-bg); border-color: transparent }
.chip.bad { color: var(--bad); background: var(--bad-bg); border-color: transparent } .chip.info { color: var(--info); background: var(--info-bg); border-color: transparent }
.alert { display: flex; gap: 10px; align-items: baseline; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 8px 12px }

/* ---------- forms ---------- */
.form { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px 14px; align-items: start }
.form .wide { grid-column: 1 / -1 }
.field { display: grid; gap: 3px; min-width: 0 }
.field > span { font-size: 12px; color: var(--muted); font-weight: 500 }
.field > span i { color: var(--bad); font-style: normal }
.field input, .field select, .field textarea { width: 100%; border: 1px solid var(--line); background: var(--panel); border-radius: 6px; padding: 7px 9px; min-width: 0 }
.field textarea { min-height: 80px; font-family: var(--mono); font-size: 12.5px }
.field .hint { font-size: 11.5px; color: var(--muted) }
.field.check { display: flex; gap: 8px; align-items: center; padding-top: 18px }
.field.check input { width: auto }
.pick { position: relative }
.pick .opts { position: absolute; left: 0; right: 0; top: 100%; z-index: 30; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 8px 24px rgba(0,0,0,.15); max-height: 260px; overflow-y: auto }
.pick .opt { padding: 6px 9px; cursor: pointer; display: grid; font-size: 13px }
.pick .opt small { color: var(--muted) }
.pick .opt:hover, .pick .opt.on { background: var(--soft) }
.lines { display: grid; gap: 6px }
.lines table td { padding: 3px 4px }
.lines input, .lines select { width: 100%; border: 1px solid var(--line); background: var(--panel); border-radius: 5px; padding: 5px 6px; min-width: 80px }
.cosign { border: 1px dashed var(--gold); border-radius: 6px; padding: 7px 10px; background: var(--soft); display: flex; gap: 8px; align-items: center; justify-content: space-between }
.cosign.done { border-style: solid; border-color: var(--ok) }

/* ---------- tables & results ---------- */
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 6px; background: var(--panel) }
table.t { border-collapse: collapse; width: 100%; font-size: 13px }
table.t th { position: sticky; top: 0; background: var(--soft); text-align: left; font: 600 10.5px var(--sans); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 7px 9px; border-bottom: 1px solid var(--line); white-space: nowrap; cursor: pointer; user-select: none }
table.t td { padding: 6px 9px; border-bottom: 1px solid var(--line); vertical-align: top }
table.t tr.click { cursor: pointer }
table.t tr.click:hover td { background: var(--soft) }
table.t td.wrap { max-width: 380px; overflow-wrap: anywhere }
dl.kv { display: grid; grid-template-columns: minmax(140px, max-content) 1fr; gap: 4px 16px; margin: 0; font-size: 13px }
dl.kv dt { color: var(--muted) } dl.kv dd { margin: 0; overflow-wrap: break-word; min-width: 0 }
dl.kv dd .nw { white-space: nowrap }
.result { display: grid; gap: 10px }
.result h3 { font-size: 15px; color: var(--accent); margin-top: 6px }

/* ---------- modal & toast ---------- */
.modal { position: fixed; inset: 0; background: rgba(20,10,12,.55); display: grid; place-items: center; z-index: 50; padding: 16px }
.modal .box { background: var(--panel); border-radius: 10px; width: min(560px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; padding: 18px 20px; display: grid; gap: 12px }
.modal .box.wide { width: min(980px, 100%) }
.modal h2 { font-size: 18px; color: var(--accent) }
.toast { position: fixed; right: 16px; bottom: 16px; z-index: 60; display: grid; gap: 8px; max-width: min(420px, calc(100vw - 32px)) }
.toast div { background: var(--ink); color: var(--bg); border-radius: 8px; padding: 10px 14px; box-shadow: 0 6px 20px rgba(0,0,0,.25) }
.toast div.bad { background: var(--bad); color: #fff }
.loading { color: var(--muted); font-style: italic }

/* ---------- dashboard bars ---------- */
.bars { display: grid; gap: 6px }
.bar { display: grid; grid-template-columns: minmax(100px, 1fr) 2fr auto; gap: 8px; align-items: center; font-size: 12.5px }
.bar .track { height: 10px; background: var(--soft); border: 1px solid var(--line); border-radius: 0 4px 4px 0; position: relative; overflow: hidden }
.bar .fill { position: absolute; inset: 0 auto 0 0; background: var(--gold); border-radius: 0 4px 4px 0 }
.bar .tick { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--accent) }

/* ---------- printable documents ---------- */
.doc { background: #fff; color: #1d1414; max-width: 820px; margin: 0 auto; padding: 26px 30px; border: 1px solid var(--line); border-radius: 6px; font-size: 12.5px }
.doc h1 { font-size: 22px; color: #4A0E17 }
.doc .dhead { display: flex; justify-content: space-between; gap: 16px; border-bottom: 2px solid #B08A34; padding-bottom: 10px; margin-bottom: 10px }
.doc .dhead img { width: 60px; height: 60px; border-radius: 50% }
.doc table { width: 100%; border-collapse: collapse; margin: 8px 0 }
.doc th, .doc td { border: 1px solid #d8cfc4; padding: 4px 6px; text-align: left; vertical-align: top }
.doc th { background: #f5efe6; font-size: 11px }
.doc .r { text-align: right; font-family: var(--mono) }
.doc .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 20px }
.doc .wm { color: #c9a9a9; font: 700 14px var(--sans); letter-spacing: .3em }
.doc .qrbox svg { width: 120px; height: 120px }
.doc .sign { display: flex; justify-content: space-between; margin-top: 36px }
/* screens */
.stack { display: grid; gap: 10px }
.actions { display: flex; flex-wrap: wrap; gap: 8px }
a.btn { text-decoration: none; display: inline-flex; align-items: center }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--line) }
.tabs a { padding: 6px 12px; border-radius: 6px 6px 0 0; text-decoration: none; color: var(--muted); border: 1px solid transparent; border-bottom: 0; margin-bottom: -1px }
.tabs a.on { background: var(--panel); color: var(--accent); border-color: var(--line) }
.row input[type=search] { flex: 1; min-width: 180px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel) }
.row select { padding: 7px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel) }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted) }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px }
.legend i.s1 { background: var(--s1) } .legend i.s2 { background: var(--s2) } .legend i.tk { width: 3px; height: 12px; border-radius: 1px }
svg.chart { display: block; overflow: visible } svg.chart text { fill: var(--muted); font: 10.5px var(--sans) }
svg.chart .grid { stroke: var(--line); stroke-width: 1 } svg.chart .axis { stroke: var(--muted); stroke-width: 1 }
svg.chart .s1 { fill: var(--s1) } svg.chart .s2 { fill: var(--s2) }
.bar .fill { background: var(--s1) } .bar .tick { background: var(--s2) }
.tip { position: fixed; z-index: 50; pointer-events: none; background: var(--ink); color: var(--panel); font-size: 12px; padding: 6px 9px; border-radius: 6px; white-space: pre-line; max-width: 280px }
dl.kv dd b { font-weight: 700 }
.result { display: grid; gap: 8px; min-width: 0 }
video { border-radius: 8px; background: #000 }
.doc .wm { text-align: center; margin-bottom: 6px }
/* keep everything inside the screen width on phones: wide tables scroll inside their own box */
.content, .modal .box, .result, .card { grid-template-columns: minmax(0, 1fr) }
fieldset { min-width: 0; margin: 0 }
.row input[type=search] { min-width: 0; flex-basis: 160px }
@media (max-width: 560px) {
  .modal { padding: 6px; place-items: start center }
  .modal .box { padding: 14px 12px; max-height: calc(100vh - 12px) }
  .form { grid-template-columns: minmax(0, 1fr) }
  .top { padding: 8px 10px } .top .who div { display: none }
  .doc { padding: 12px; font-size: 11px } .doc .grid2 { grid-template-columns: 1fr }
}
@media print {
  body { background: #fff }
  .side, .top, .noprint, .toast { display: none !important }
  .shell { display: block } .content { padding: 0 }
  .doc { border: 0; max-width: none; padding: 0 }
  .card { border: 0; padding: 0 }
}
