/* Demo ERP styled after TranZact's public brand: warm off-white, near-black, terracotta accent, Inter.
   Not the real product UI (that is behind a login); a demo harness for the PDF service. */
:root {
  --bg: #f6f5f1; --panel: #ffffff; --ink: #1a1b18; --muted: #6b6c66; --line: #e6e4dc; --line-strong: #d3d1c7;
  --side: #0e0f0c; --side-ink: #d9dbd3; --side-muted: #8b8d86;
  --accent: #db613f; --accent-ink: #ffffff; --accent-soft: #fbece6; --accent-strong: #c24f2f;
  --ok: #2f7d4f; --ok-soft: #e6f3ea; --warn: #b9770e; --warn-soft: #fbf0dc; --bad: #c43d3d; --bad-soft: #fbe8e8;
  --info: #2f6fb4; --info-soft: #e6eef8;
  --radius: 10px; --shadow: 0 1px 2px rgba(20,20,10,.06), 0 4px 14px rgba(20,20,10,.05);
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font: 14px/1.45 var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
a { color: var(--accent-strong); text-decoration: none; } a:hover { text-decoration: underline; }
.mono { font-family: var(--mono); font-size: 12px; }
.muted { color: var(--muted); } .nowrap { white-space: nowrap; } .right { text-align: right; } .center { text-align: center; }

/* ---------- shell ---------- */
.app { display: grid; grid-template-columns: 232px 1fr; grid-template-rows: 56px 1fr; height: 100vh; }
.topbar { grid-column: 1 / 3; display: flex; align-items: center; gap: 16px; padding: 0 20px; background: var(--panel); border-bottom: 1px solid var(--line); z-index: 5; }
.brand { display: flex; align-items: center; gap: 10px; width: 200px; }
.brand img { width: 28px; height: 28px; }
.brand b { font-size: 19px; letter-spacing: -.02em; }
.demo-pill { font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--accent-strong); background: var(--accent-soft); border: 1px solid #f3cfc2; padding: 2px 8px; border-radius: 999px; }
.top-spacer { flex: 1; }
.company { color: var(--muted); font-size: 13px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; font-weight: 600; font-size: 12px; }
.net { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; background: #fff; }
.seg button { border: 0; background: transparent; padding: 5px 10px; cursor: pointer; font-size: 12px; color: var(--muted); }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--ink); color: #fff; }

.side { background: var(--side); color: var(--side-ink); padding: 14px 10px; overflow: auto; }
.side h6 { margin: 14px 10px 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--side-muted); font-weight: 600; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 12px; color: var(--side-ink); border-radius: 8px; cursor: pointer; text-decoration: none; }
.nav a:hover { background: #1a1b18; }
.nav a.on { background: var(--accent); color: #fff; }
.nav .ic { width: 16px; text-align: center; opacity: .9; }
.side .foot { margin: 18px 10px 0; font-size: 11px; color: var(--side-muted); line-height: 1.5; }

.main { display: grid; grid-template-columns: 1fr auto; min-height: 0; }
.page { padding: 22px 22px 40px; overflow: auto; min-width: 0; }
.page-head { display: flex; align-items: flex-end; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head .sub { max-width: 420px; }
.page-head h1 { margin: 0; font-size: 22px; letter-spacing: -.02em; }
.page-head .sub { color: var(--muted); }
.grow { flex: 1; }

/* ---------- controls ---------- */
.btn { border: 1px solid var(--line-strong); background: #fff; padding: 7px 13px; border-radius: 8px; cursor: pointer; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; }
.btn:hover { border-color: var(--ink); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn.danger { border-color: var(--bad); color: var(--bad); }
.btn.sm { padding: 4px 9px; font-size: 12px; border-radius: 7px; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
input[type=text], input[type=number], input[type=search] { border: 1px solid var(--line-strong); border-radius: 8px; padding: 7px 10px; background: #fff; min-width: 0; }
input:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.search { width: 210px; }
table.data td.num { white-space: nowrap; }
table.data td, table.data th { padding-left: 9px; padding-right: 9px; }
table.data { font-size: 13px; }
.chip { font-size: 10.5px; padding: 1px 7px; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card.pad { padding: 16px 18px; }
.card h3 { margin: 0 0 10px; font-size: 14px; }

/* ---------- tables ---------- */
.tablewrap { overflow: auto; max-height: calc(100vh - 200px); border-radius: var(--radius); }
table.data { width: 100%; border-collapse: collapse; background: var(--panel); }
table.data th { position: sticky; top: 0; background: #faf9f5; text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 9px 12px; border-bottom: 1px solid var(--line); text-transform: uppercase; letter-spacing: .04em; z-index: 1; }
table.data td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tr:hover td { background: #fcfbf8; }
table.data tr.sel td { background: var(--accent-soft); }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; border: 1px solid transparent; white-space: nowrap; }
.chip.ok { color: var(--ok); background: var(--ok-soft); } .chip.warn { color: var(--warn); background: var(--warn-soft); }
.chip.bad { color: var(--bad); background: var(--bad-soft); } .chip.info { color: var(--info); background: var(--info-soft); } .chip.neutral { color: var(--muted); background: #efeee8; }
.chip.accent { color: var(--accent-strong); background: var(--accent-soft); }

/* ---------- activity drawer ---------- */
.drawer { width: 400px; border-left: 1px solid var(--line); background: #fbfaf7; display: flex; flex-direction: column; min-height: 0; transition: width .2s; }
.drawer.closed { width: 0; overflow: hidden; border: 0; }
.drawer-head { display: flex; align-items: center; gap: 8px; padding: 14px 16px; border-bottom: 1px solid var(--line); background: #fff; }
.drawer-head h2 { margin: 0; font-size: 15px; } .drawer-body { overflow: auto; padding: 14px; display: grid; gap: 12px; align-content: start; flex: 1; }
.empty { color: var(--muted); text-align: center; padding: 40px 20px; }
.toggle-activity { position: relative; }
.badge-n { background: var(--accent); color: #fff; border-radius: 999px; font-size: 11px; font-weight: 700; padding: 0 6px; margin-left: 2px; }

.task { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); }
.task-head { display: flex; align-items: flex-start; gap: 10px; }
.task-title { font-weight: 600; } .task-sub { color: var(--muted); font-size: 12px; }
.task-timer { margin-left: auto; text-align: right; font-variant-numeric: tabular-nums; }
.task-timer .t { white-space: nowrap; font-size: 22px; font-weight: 700; letter-spacing: -.02em; line-height: 1; }
.task-timer .l { font-size: 11px; color: var(--muted); }
.task.done .task-timer .t { color: var(--ok); } .task.failed .task-timer .t { color: var(--bad); }

.steps { margin: 10px 0 4px; display: grid; gap: 6px; }
.step { display: grid; grid-template-columns: 18px 1fr auto; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); }
.step .dot { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line-strong); }
.step.active { color: var(--ink); } .step.active .dot { border-color: var(--accent); border-top-color: transparent; animation: spin .8s linear infinite; }
.step.done { color: var(--ink); } .step.done .dot { background: var(--ok); border-color: var(--ok); position: relative; }
.step.done .dot::after { content: ""; position: absolute; left: 3px; top: 0px; width: 3px; height: 7px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.step.fail { color: var(--bad); } .step.fail .dot { background: var(--bad); border-color: var(--bad); }
.step .time { font-variant-numeric: tabular-nums; font-size: 12px; color: var(--muted); }
@keyframes spin { to { transform: rotate(360deg); } }

.bar { height: 8px; background: #efeee8; border-radius: 999px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width .25s; }
.bar.ok > i { background: var(--ok); } .bar.info > i { background: var(--info); }
.bar.indet > i { width: 35% !important; animation: slide 1.1s ease-in-out infinite; }
@keyframes slide { 0% { margin-left: -35%; } 100% { margin-left: 100%; } }
.metric-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.metric { flex: 1 1 90px; background: #faf9f5; border: 1px solid var(--line); border-radius: 8px; padding: 6px 9px; }
.metric .v { font-weight: 700; font-variant-numeric: tabular-nums; } .metric .k { font-size: 11px; color: var(--muted); }
.nfr { margin-top: 8px; padding: 7px 10px; border-radius: 8px; font-size: 12.5px; font-weight: 500; }
.nfr.ok { background: var(--ok-soft); color: var(--ok); } .nfr.warn { background: var(--warn-soft); color: var(--warn); } .nfr.bad { background: var(--bad-soft); color: var(--bad); } .nfr.info { background: var(--info-soft); color: var(--info); }
.banner { margin-top: 8px; padding: 8px 10px; border-radius: 8px; font-size: 12.5px; }
.banner.warn { background: var(--warn-soft); color: var(--warn); } .banner.bad { background: var(--bad-soft); color: var(--bad); }
.task-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.docgrid { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 8px; }
.docgrid i { width: 11px; height: 11px; border-radius: 3px; background: #dcdad0; cursor: pointer; }
.docgrid i.running { background: var(--accent); animation: pulse 1s ease-in-out infinite; } .docgrid i.done { background: var(--ok); }
.docgrid i.failed { background: var(--bad); } .docgrid i.stale { outline: 2px solid var(--warn); outline-offset: 1px; }
@keyframes pulse { 50% { opacity: .35; } }
.parts { display: grid; gap: 8px; margin-top: 8px; }
.part { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: #fdfcfa; }
.part-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12.5px; }
.small { font-size: 12px; }
.sep { height: 1px; background: var(--line); margin: 10px 0; }
details > summary { cursor: pointer; color: var(--muted); font-size: 12px; margin-top: 8px; }
details table { width: 100%; font-size: 11.5px; border-collapse: collapse; margin-top: 4px; } details td, details th { padding: 2px 6px; border-bottom: 1px solid var(--line); text-align: left; }

/* ---------- stress ---------- */
.grid2 { display: grid; grid-template-columns: 340px 1fr; gap: 16px; align-items: start; }
.field { display: grid; gap: 4px; margin-bottom: 12px; } .field label { font-size: 12px; font-weight: 600; color: var(--muted); }
.field .row { display: flex; align-items: center; gap: 10px; } .field input[type=range] { flex: 1; accent-color: var(--accent); }
.field .val { min-width: 54px; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.presets { display: grid; gap: 6px; margin-bottom: 14px; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 14px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; }
.stat .k { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
.stat .v { font-size: 22px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; } .stat .s { font-size: 12px; color: var(--muted); }
.stat.ok .v { color: var(--ok); } .stat.bad .v { color: var(--bad); } .stat.warn .v { color: var(--warn); }
canvas.chart { width: 100%; height: 260px; display: block; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); margin-top: 6px; } .legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; }
.explain { margin-top: 12px; padding: 10px 12px; border-radius: 8px; background: var(--info-soft); color: #234a78; font-size: 13px; }

/* ---------- dialogs / dropzone ---------- */
dialog { border: 1px solid var(--line); border-radius: 12px; padding: 0; box-shadow: 0 20px 60px rgba(0,0,0,.25); width: 460px; max-width: 94vw; }
dialog::backdrop { background: rgba(14,15,12,.45); }
.dlg-head { padding: 14px 18px; border-bottom: 1px solid var(--line); font-weight: 700; } .dlg-body { padding: 16px 18px; } .dlg-foot { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }
.dropzone { border: 2px dashed var(--line-strong); border-radius: var(--radius); padding: 28px; text-align: center; color: var(--muted); background: #fff; cursor: pointer; }
.dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.verdict { margin-top: 14px; padding: 14px 16px; border-radius: var(--radius); border: 1px solid; }
.verdict h4 { margin: 0 0 4px; font-size: 16px; }
.verdict.good { background: var(--ok-soft); border-color: #b9dcc5; color: #1f5a37; } .verdict.badv { background: var(--bad-soft); border-color: #efbcbc; color: #8a2b2b; } .verdict.mid { background: var(--warn-soft); border-color: #ecd49e; color: #7a4f0a; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 4px 12px; font-size: 12.5px; margin-top: 8px; } .kv dt { color: var(--muted); } .kv dd { margin: 0; word-break: break-all; }
.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 9px 16px; border-radius: 10px; z-index: 50; box-shadow: var(--shadow); }
@media (max-width: 1100px) { .app { grid-template-columns: 64px 1fr; } .side h6, .side .foot, .nav a span { display: none; } .grid2 { grid-template-columns: 1fr; } .drawer { position: fixed; right: 0; top: 56px; bottom: 0; z-index: 8; box-shadow: -8px 0 30px rgba(0,0,0,.15); } }
