/* Noorigen ERP — enterprise UI.
   Brand tokens sampled from the Noorigen Pharmaceuticals SE sun-and-DNA logo:
   helix navy #0A2240 · royal #14456F · teal #009688 · aqua #26C6DA · sun #FFE01B · amber #F6B817 · wordmark #0D2542
   · tagline #1E293B · divider #94A3B8 · background #F4F6F9. Text-on-white uses darker shades where needed (WCAG AA). */
/* Brand typeface (Montserrat, SIL OFL — see /static/brand/fonts/Montserrat-OFL.txt), used only for brand elements */
@font-face { font-family: "Noorigen Montserrat"; src: url(/static/brand/fonts/Montserrat-Regular.woff) format("woff"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Noorigen Montserrat"; src: url(/static/brand/fonts/Montserrat-Medium.woff) format("woff"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "Noorigen Montserrat"; src: url(/static/brand/fonts/Montserrat-Bold.woff) format("woff"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Noorigen Montserrat"; src: url(/static/brand/fonts/Montserrat-MediumItalic.woff) format("woff"); font-weight: 500; font-style: italic; font-display: swap; }
:root {
  --brand: #0A2240; --brand-2: #14456F; --accent: #009688; --accent-ink: #00796B; --aqua: #26C6DA;
  --wm-noori: #0D2542; --wm-gen: #13375E;
  --brand-font: "Noorigen Montserrat", "Montserrat", var(--font);
  --sun: #FFE01B; --amber: #F6B817; --sun-soft: #FFF6C7; --heading: #0D2542; --divider: #94A3B8;
  --bg: #F4F6F9; --panel: #FFFFFF; --ink: #1E293B; --muted: #52627A; --line: #DCE3EA; --line-2: #EEF2F6;
  --ok: #1E8E3E; --warn: #A16207; --bad: #C53030; --info: #14456F;
  --radius: 8px; --shadow: 0 1px 2px rgba(16,34,54,.06), 0 4px 14px rgba(16,34,54,.06);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.45 var(--font); color: var(--ink); background: var(--bg); }
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 20px; margin: 0; letter-spacing: -.01em; color: var(--heading); }
h2 { color: var(--heading); }
h2 { font-size: 15px; margin: 0 0 10px; }
h3 { font-size: 13px; margin: 18px 0 8px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: 12.5px; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.grow { flex: 1; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.stack > * + * { margin-top: 14px; }

/* ---------- login ---------- */
#login { min-height: 100%; display: grid; place-items: center; padding: 24px; background:
  radial-gradient(520px 420px at 50% 8%, rgba(255,224,27,.30), rgba(246,184,23,.10) 45%, transparent 70%),
  radial-gradient(900px 500px at 90% 110%, rgba(0,150,136,.30), transparent 60%),
  linear-gradient(165deg, var(--brand) 0%, var(--brand-2) 100%); }
.login-card { width: 400px; max-width: 100%; background: var(--panel); border-radius: 16px; padding: 30px 32px 26px; box-shadow: 0 24px 70px rgba(4,14,30,.45); border-top: 4px solid var(--amber); }
.lockup { text-align: center; margin-bottom: 18px; }
.lockup img { width: 92px; height: auto; display: block; margin: 0 auto 6px; }
/* Wordmark exactly as on the logo: NOORI = deep navy bold, GEN = lighter royal navy, medium weight */
.wordmark { font-family: var(--brand-font); letter-spacing: .06em; font-size: 28px; line-height: 1.05; white-space: nowrap; }
.wordmark .wm-a { font-weight: 700; color: var(--wm-noori); }
.wordmark .wm-b { font-weight: 500; color: var(--wm-gen); }
.wordmark-sub { font-family: var(--brand-font); font-weight: 500; letter-spacing: .24em; color: var(--wm-noori); font-size: 10.5px; margin-top: 5px; white-space: nowrap; }
/* Tagline: italic, as on the logo */
.tagline { font-family: var(--brand-font); font-style: italic; font-weight: 500; color: #1E293B; font-size: 13px; margin-top: 10px; }
.heritage { font-family: var(--brand-font); font-weight: 400; text-transform: uppercase; letter-spacing: .14em; color: #1E293B; font-size: 9.5px; margin-top: 4px; }
.lockup hr { width: 70px; border: 0; border-top: 1px solid var(--divider); margin: 10px auto 0; }
.login-card h1 { margin-bottom: 4px; font-size: 17px; }
.login-card p { margin: 0 0 18px; color: var(--muted); }
.login-card .btn { width: 100%; justify-content: center; margin-top: 8px; }
.login-foot { margin-top: 18px; font-size: 12px; color: var(--muted); }

/* ---------- shell ---------- */
#app { display: grid; grid-template-columns: 232px 1fr; min-height: 100%; }
.sidebar { background: var(--brand); color: #C9D6E3; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { display: block; text-align: center; padding: 14px 12px 12px; background:
  radial-gradient(140px 90px at 50% 18%, var(--sun-soft), transparent 75%), var(--bg); border-bottom: 3px solid var(--amber); }
.brand img { width: 54px; height: auto; display: block; margin: 0 auto 4px; }
.brand .wordmark { font-size: 21px; }
.brand .wordmark-sub { font-size: 8.2px; letter-spacing: .2em; margin-top: 3px; }
.brand .tagline { font-size: 11px; margin-top: 6px; }
.brand .heritage { font-size: 7.6px; letter-spacing: .08em; }
.brand .app-name { margin-top: 8px; font-size: 10.5px; font-weight: 600; color: var(--accent-ink); letter-spacing: .06em; text-transform: uppercase; }
.nav { padding: 10px 8px; overflow-y: auto; flex: 1; }
.nav .sec { font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em; color: #7FA3C4; margin: 14px 10px 6px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 6px; color: #C9D6E3; font-weight: 500; }
.nav a:hover { background: rgba(255,255,255,.06); text-decoration: none; color: #fff; }
.nav a.active { background: rgba(38,198,218,.14); color: #fff; box-shadow: inset 3px 0 0 var(--sun); }
.nav .count { margin-left: auto; background: var(--amber); color: var(--brand); font-weight: 700; border-radius: 10px; font-size: 11px; padding: 0 7px; }
.sidebar .me { padding: 12px 16px; border-top: 1px solid rgba(255,255,255,.08); font-size: 12px; }
.sidebar .me b { color: #fff; display: block; font-size: 13px; }
.sidebar .me .roles { color: #8FA6BC; }
.sidebar .me .row { margin-top: 8px; gap: 6px; }
.sidebar .me button { background: transparent; border: 1px solid rgba(255,255,255,.18); color: #C9D6E3; border-radius: 6px; padding: 4px 8px; cursor: pointer; font-size: 12px; }
.sidebar .me button:hover { color: #fff; border-color: rgba(255,255,255,.4); }

.main { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 5; background: rgba(244,246,249,.92); backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line); padding: 14px 24px; display: flex; align-items: center; gap: 12px; }
.topbar .crumbs { color: var(--muted); font-size: 12px; }
.content { padding: 20px 24px 60px; max-width: 1480px; }

/* ---------- panels, cards ---------- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel > .hd { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line-2); }
.panel > .hd h2 { margin: 0; }
.panel > .bd { padding: 14px 16px; }
.panel > .bd.flush { padding: 0; }
.grid { display: grid; gap: 14px; }
.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)); }
@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, 1fr); } .g3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 820px) { #app { grid-template-columns: 1fr; } .sidebar { position: relative; height: auto; } .g2,.g3,.g4 { grid-template-columns: 1fr; } }
.kpi { padding: 14px 16px; }
.kpi .lbl { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
.kpi .val { font-size: 24px; font-weight: 650; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .sub { font-size: 12px; color: var(--muted); }
.kpi.alert .val { color: var(--bad); }
.kpi a.val { display: block; color: var(--ink); }

/* ---------- key/value ---------- */
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 6px 14px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }
.kv2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 28px; }

/* ---------- tables ---------- */
.tbl-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
table.t th { text-align: left; font-weight: 600; color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em;
  padding: 9px 12px; border-bottom: 1px solid var(--line); background: #FAFBFC; position: sticky; top: 0; white-space: nowrap; }
table.t td { padding: 9px 12px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
table.t tr.click { cursor: pointer; }
table.t tr.click:hover td { background: #EEF8F7; }
table.t tfoot td { font-weight: 650; border-top: 2px solid var(--line); }
table.t .empty { text-align: center; color: var(--muted); padding: 28px; }
.pager { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--line-2); font-size: 12.5px; color: var(--muted); }

/* ---------- badges ---------- */
.b { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; letter-spacing: .02em; white-space: nowrap;
  background: #EDF2F7; color: #4A5568; }
.b.ok { background: #E6F4EA; color: var(--ok); } .b.warn { background: #FEF6D8; color: var(--warn); }
.b.bad { background: #FDECEC; color: var(--bad); } .b.info { background: #E6EEF6; color: var(--info); }
.b.accent { background: #E0F2F1; color: var(--accent-ink); }

/* ---------- forms ---------- */
.toolbar { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; padding: 12px 16px; border-bottom: 1px solid var(--line-2); }
label.f { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); font-weight: 600; }
label.f.wide { grid-column: 1 / -1; }
input, select, textarea { font: inherit; color: var(--ink); border: 1px solid var(--line); border-radius: 6px; padding: 7px 9px; background: #fff; min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(0,150,136,.35); border-color: var(--accent); }
textarea { min-height: 70px; resize: vertical; }
.form { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px 16px; }
.form.g3f { grid-template-columns: repeat(3, minmax(0,1fr)); }
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: #fff; color: var(--ink);
  padding: 7px 12px; border-radius: 6px; font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: #b9c6d3; text-decoration: none; }
.btn.primary { background: var(--accent-ink); border-color: var(--accent-ink); color: #fff; }
.btn.primary:hover { background: #00665B; border-color: #00665B; }
.btn.dark { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.danger { color: var(--bad); border-color: #f1c4c4; }
.btn.danger:hover { background: #FDECEC; }
.btn.sm { padding: 4px 9px; font-size: 12.5px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; margin-left: -1px; }
.btn-group .btn:first-child { border-radius: 6px 0 0 6px; margin-left: 0; }
.btn-group .btn:last-child { border-radius: 0 6px 6px 0; }

.lines input { width: 100%; padding: 5px 7px; }
.lines td { padding: 5px 6px; }

/* ---------- modal & toast ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(10,34,64,.45); display: grid; place-items: center; z-index: 50; padding: 20px; }
.modal { background: #fff; border-radius: 12px; width: min(720px, 100%); max-height: 92vh; display: flex; flex-direction: column; box-shadow: 0 30px 80px rgba(0,0,0,.35); }
.modal.wide { width: min(1080px, 100%); }
.modal .hd { padding: 14px 18px; border-bottom: 1px solid var(--line-2); display: flex; align-items: center; }
.modal .hd h2 { margin: 0; }
.modal .bd { padding: 16px 18px; overflow-y: auto; }
.modal .ft { padding: 12px 18px; border-top: 1px solid var(--line-2); display: flex; justify-content: flex-end; gap: 8px; }
.x { margin-left: auto; border: 0; background: none; font-size: 22px; line-height: 1; cursor: pointer; color: var(--muted); }
#toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { background: var(--brand); color: #fff; padding: 10px 14px; border-radius: 8px; box-shadow: var(--shadow); max-width: 420px; font-size: 13px; }
.toast.err { background: var(--bad); } .toast.ok { background: var(--ok); }
.notice { padding: 10px 12px; border-radius: 6px; background: #E6EEF6; color: var(--brand-2); font-size: 13px; border-left: 3px solid var(--brand-2); }
.notice.warn { background: #FEF6D8; color: #7a4f05; border-left-color: var(--amber); } .notice.bad { background: #FDECEC; color: #8b1f1f; border-left-color: var(--bad); }

/* ---------- charts (CSS bars) ---------- */
.bars { display: flex; flex-direction: column; gap: 8px; }
.bar { display: grid; grid-template-columns: 130px minmax(40px,1fr) auto; gap: 10px; align-items: center; font-size: 12.5px; }
.bar .num { white-space: nowrap; text-align: right; }
.bar .track { background: var(--line-2); border-radius: 4px; height: 10px; overflow: hidden; }
.bar .fill { background: var(--accent); height: 100%; border-radius: 4px; }
.bar.warn .fill { background: var(--amber); } .bar.bad .fill { background: var(--bad); }
.cols { display: flex; align-items: flex-end; gap: 10px; height: 140px; padding-top: 10px; }
.cols .c { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 11px; color: var(--muted); height: 100%; justify-content: flex-end; }
.cols .c i { display: block; width: 100%; max-width: 46px; background: linear-gradient(180deg, var(--accent), var(--brand-2)); border-radius: 4px 4px 0 0; min-height: 2px; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 12px 18px; border-left: 2px solid var(--line); margin-left: 6px; font-size: 13px; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 3px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.timeline li:last-child { border-left-color: transparent; }
pre.json { background: var(--brand); color: #d6e2ee; padding: 12px; border-radius: 6px; overflow: auto; font-size: 12px; max-height: 420px; }
.md h1 { font-size: 18px; } .md h2 { font-size: 15px; margin-top: 18px; } .md table { border-collapse: collapse; font-size: 12.5px; }
.md td, .md th { border: 1px solid var(--line); padding: 4px 8px; } .md code { font-family: var(--mono); font-size: 12px; background: var(--line-2); padding: 0 4px; border-radius: 3px; }
/* v1.1 — scope selector in the top bar */
#scope-box select { min-width: 300px; max-width: 420px; font-weight: 600; }
#scope-box .f { color: var(--muted); }
optgroup { font-weight: 700; color: var(--muted); }

/* ---------- brand banner (dashboard) ---------- */
.brand-banner { display: flex; align-items: center; gap: 16px; padding: 12px 20px; border-radius: var(--radius); margin-bottom: 14px;
  background: radial-gradient(240px 150px at 7% 50%, rgba(255,224,27,.30), rgba(255,246,199,.35) 45%, transparent 75%), linear-gradient(100deg, #FFFFFF 0%, var(--bg) 100%);
  box-shadow: var(--shadow); border: 1px solid var(--line); border-bottom: 3px solid var(--amber); }
.brand-banner img { width: 62px; height: auto; }
.brand-banner .wordmark { font-size: 24px; }
.brand-banner .tagline { margin-top: 6px; }
.brand-banner .hi { margin-left: auto; text-align: right; font-size: 12.5px; color: var(--muted); }
.brand-banner .hi b { color: var(--heading); font-size: 14px; display: block; }
@media (max-width: 820px) { .brand-banner .hi { display: none; } }

/* ---------- v1.3 site plans, org chart, corrections ---------- */
.plan-wrap { display: flex; flex-direction: column; gap: 8px; }
.plan-svg { width: 100%; max-height: 640px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.plan-svg .bld:hover rect:first-child { filter: brightness(.93); }
.plan-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12px; color: var(--muted); }
.plan-legend span { display: inline-flex; align-items: center; gap: 6px; }
.plan-legend i { width: 18px; height: 11px; border-radius: 2px; display: inline-block; }
ol.chain { margin: 0 0 8px; padding-left: 20px; }
ol.chain li { margin: 3px 0; }
ul.org, ul.org ul { list-style: none; padding-left: 18px; margin: 4px 0; border-left: 2px solid var(--line); }
ul.org { border-left: 0; padding-left: 0; }
ul.org li { margin: 5px 0; }
.diff-old { background: #FDECEC; color: #8b1f1f; padding: 1px 5px; border-radius: 4px; text-decoration: line-through; text-decoration-color: rgba(139,31,31,.4); }
.diff-new { background: #E6F4EA; color: #1E6B35; padding: 1px 5px; border-radius: 4px; font-weight: 600; }
table.t tr.sel td { background: #EEF8F7; }
.small{font-size:11px;line-height:1.3}
/* v1.4 — income statement */
table.pnl tr.sub td{font-weight:600;border-top:1px solid var(--line,#dfe5ee);background:rgba(20,69,111,.035)}
table.pnl tr.total td{font-weight:700;border-top:2px solid var(--navy,#0A2240);background:rgba(0,150,136,.06)}
table.pnl tr.acct td{font-size:12px;padding-top:2px;padding-bottom:2px}
.pos{color:#00796B}.neg{color:#b42318}
