/* Refibe Operations. Light, enterprise UI. Brand: blue #1B89FF, green #21E7AB, yellow #F5F10F, ink #0B0B0C */
@font-face { font-family: 'Jakarta'; font-weight: 400; font-display: swap; src: url(../fonts/plus-jakarta-sans-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: 'Jakarta'; font-weight: 500; font-display: swap; src: url(../fonts/plus-jakarta-sans-latin-500-normal.woff2) format('woff2'); }
@font-face { font-family: 'Jakarta'; font-weight: 600; font-display: swap; src: url(../fonts/plus-jakarta-sans-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: 'Jakarta'; font-weight: 700; font-display: swap; src: url(../fonts/plus-jakarta-sans-latin-700-normal.woff2) format('woff2'); }
@font-face { font-family: 'Jakarta'; font-weight: 800; font-display: swap; src: url(../fonts/plus-jakarta-sans-latin-800-normal.woff2) format('woff2'); }

:root {
  --brand-blue: #1B89FF; --brand-green: #21E7AB; --brand-yellow: #F5F10F; --ink: #0B0B0C;
  --primary: #0B6FDB; --primary-hover: #095BB5; --primary-soft: #EAF3FF;
  --bg: #F5F6F8; --surface: #FFFFFF; --surface-2: #FAFBFC; --line: #E3E6EB; --line-strong: #CDD2DA;
  --text: #15171A; --text-2: #4A5160; --muted: #6E7686;
  --ok: #0B7A55; --ok-soft: #E3F8EF; --warn: #8A6100; --warn-soft: #FFF6D6; --bad: #B42318; --bad-soft: #FDECEA; --info-soft: #EEF4FF;
  --s1: #1B89FF; --s2: #0E9F75; --s3: #C48A00;
  --radius: 10px; --shadow: 0 1px 2px rgba(16, 24, 40, .05); --shadow-lg: 0 12px 32px rgba(16, 24, 40, .16);
  --side: 252px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: 'Jakarta', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; font-size: 14px; line-height: 1.45; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -0.01em; color: var(--ink); }
h1 { font-size: 22px; } h2 { font-size: 17px; } h3 { font-size: 15px; } h4 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
.num, td.n, th.n { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.muted { color: var(--muted); } .small { font-size: 12px; } .nowrap { white-space: nowrap; } .mono { font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; font-size: 12.5px; }
.hidden { display: none !important; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--side) 1fr; min-height: 100vh; }
.side { background: var(--surface); border-right: 1px solid var(--line); position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; }
.stripe { display: grid; grid-template-columns: 2fr 1.4fr 1fr; height: 4px; flex: none; }
.stripe i:nth-child(1) { background: var(--brand-blue); } .stripe i:nth-child(2) { background: var(--brand-green); } .stripe i:nth-child(3) { background: var(--brand-yellow); }
.brand { padding: 18px 18px 14px; border-bottom: 1px solid var(--line); }
.brand img { display: block; width: 100%; max-width: 196px; height: auto; }
.brand .sys { margin-top: 10px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.nav { padding: 10px 10px 24px; flex: 1; }
.nav .grp { margin: 14px 10px 6px; font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--text-2); font-weight: 500; position: relative; }
.nav a:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.nav a.on { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.nav a.on::before { content: ''; position: absolute; left: -10px; top: 6px; bottom: 6px; width: 3px; border-radius: 0 3px 3px 0; background: var(--brand-blue); }
.nav svg { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav .badge { margin-left: auto; }
.side-foot { padding: 12px 18px; border-top: 1px solid var(--line); font-size: 11.5px; color: var(--muted); }

.main { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 20; background: rgba(255,255,255,.94); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); height: 60px; display: flex; align-items: center; gap: 14px; padding: 0 24px; }
.top .title { font-size: 17px; font-weight: 700; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .crumb { color: var(--muted); font-weight: 500; }
.top .sp { flex: 1; }
.menu-btn { display: none; }
.user { display: flex; align-items: center; gap: 10px; padding: 4px 6px 4px 4px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; position: relative; }
.user .av { width: 30px; height: 30px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 12px; }
.user .nm { font-weight: 600; font-size: 13px; line-height: 1.1; } .user .rl { font-size: 11px; color: var(--muted); }
.user .dd { position: absolute; right: 0; top: calc(100% + 6px); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-lg); min-width: 200px; padding: 6px; display: none; }
.user.open .dd { display: block; }
.user .dd a { display: block; padding: 8px 10px; border-radius: 6px; color: var(--text); }
.user .dd a:hover { background: var(--surface-2); text-decoration: none; }
.content { padding: 22px 24px 48px; max-width: 1480px; width: 100%; }

/* ---------- building blocks ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card > .hd { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.card > .hd h3 { flex: 1; }
.card > .bd { padding: 16px; }
.card > .bd.flush { padding: 0; }
.grid { display: grid; gap: 16px; }
.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)); }
.g-2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.stack > * + * { margin-top: 16px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.toolbar { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .sp { flex: 1; }

.kpi { padding: 14px 16px; }
.kpi .lb { font-size: 12px; font-weight: 600; color: var(--muted); }
.kpi .v { font-size: 24px; font-weight: 700; color: var(--ink); margin-top: 4px; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.kpi .v small { font-size: 13px; font-weight: 600; color: var(--muted); margin-left: 3px; }
.kpi .sub { font-size: 12px; color: var(--text-2); margin-top: 4px; }
.kpi.accent { border-top: 3px solid var(--brand-blue); }
.kpi.accent.g { border-top-color: var(--brand-green); } .kpi.accent.y { border-top-color: var(--brand-yellow); } .kpi.accent.k { border-top-color: var(--ink); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; font-size: 13.5px; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-hover); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.danger { color: var(--bad); border-color: #F1B8B2; }
.btn.danger:hover { background: var(--bad-soft); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn { width: 30px; padding: 0; }

.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700; letter-spacing: .02em; white-space: nowrap; background: #EEF0F3; color: var(--text-2); }
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.ok { background: var(--ok-soft); color: var(--ok); } .pill.warn { background: var(--warn-soft); color: var(--warn); } .pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.info { background: var(--info-soft); color: var(--primary); } .pill.ink { background: #E9EAEC; color: var(--ink); }
.badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--brand-yellow); color: var(--ink); font-size: 11px; font-weight: 800; }
.tag { display: inline-block; padding: 1px 7px; border-radius: 5px; font-size: 11px; font-weight: 700; background: #EEF0F3; color: var(--text-2); }
.tag.hz { background: var(--bad-soft); color: var(--bad); }

/* tables */
.tbl-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
table.t th { text-align: left; font-size: 11.5px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; color: var(--muted); background: var(--surface-2); padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; }
table.t td { padding: 9px 12px; border-bottom: 1px solid #EEF0F3; vertical-align: top; }
table.t tr:last-child td { border-bottom: 0; }
table.t tbody tr.click { cursor: pointer; }
table.t tbody tr.click:hover td { background: #F7FAFF; }
table.t tfoot td { font-weight: 700; background: var(--surface-2); border-top: 1px solid var(--line); }
table.t.compact td, table.t.compact th { padding: 6px 10px; }
.empty { padding: 34px 16px; text-align: center; color: var(--muted); }

/* forms */
.f { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.f > label, .lbl { font-size: 12px; font-weight: 600; color: var(--text-2); }
.f > label .req { color: var(--bad); }
input, select, textarea { font: inherit; font-size: 13.5px; color: var(--text); background: #fff; border: 1px solid var(--line-strong); border-radius: 8px; height: 36px; padding: 0 10px; width: 100%; min-width: 0; }
textarea { height: auto; min-height: 70px; padding: 8px 10px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(27, 137, 255, .35); outline-offset: 0; border-color: var(--brand-blue); }
input[readonly] { background: var(--surface-2); color: var(--text-2); }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--primary); }
.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; cursor: pointer; }
.fgrid { display: grid; gap: 14px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.fgrid .s2 { grid-column: span 2; } .fgrid .s3 { grid-column: span 3; } .fgrid .s4 { grid-column: 1 / -1; }
.hint { font-size: 12px; color: var(--muted); }
.lines td { padding: 6px 6px; } .lines td input, .lines td select { height: 34px; }
.lines th { padding: 8px 6px; }
.sumbar { display: flex; gap: 22px; justify-content: flex-end; flex-wrap: wrap; padding: 12px 16px; background: var(--surface-2); border-top: 1px solid var(--line); }
.sumbar div { text-align: right; } .sumbar .lb { font-size: 11.5px; color: var(--muted); font-weight: 600; } .sumbar .v { font-weight: 700; font-size: 15px; font-variant-numeric: tabular-nums; }

.alert { display: flex; gap: 10px; padding: 11px 14px; border-radius: 8px; border: 1px solid; font-size: 13px; }
.alert.warn { background: var(--warn-soft); border-color: #F0D78A; color: #5C4300; }
.alert.bad { background: var(--bad-soft); border-color: #F3C1BC; color: #7A1A12; }
.alert.info { background: var(--info-soft); border-color: #C9DCFF; color: #0B3F80; }
.alert.ok { background: var(--ok-soft); border-color: #A8E5CC; color: #08553C; }
.alert ul { margin: 4px 0 0; padding-left: 18px; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs a { padding: 10px 14px; font-weight: 600; color: var(--text-2); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.on { color: var(--primary); border-bottom-color: var(--brand-blue); }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; font-size: 13px; }
.kv dt { color: var(--muted); font-weight: 500; } .kv dd { margin: 0; font-weight: 600; }
.kv.cols { grid-template-columns: repeat(4, max-content 1fr); }

/* modal & toast */
.modal-bg { position: fixed; inset: 0; background: rgba(15, 18, 24, .45); z-index: 100; display: grid; place-items: start center; padding: 6vh 16px; overflow-y: auto; }
.modal { background: var(--surface); border-radius: 12px; box-shadow: var(--shadow-lg); width: 100%; max-width: 560px; }
.modal.wide { max-width: 980px; }
.modal .hd { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.modal .hd h2 { flex: 1; }
.modal .bd { padding: 18px 20px; }
.modal .ft { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; background: var(--surface-2); border-radius: 0 0 12px 12px; }
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--ink); color: #fff; padding: 11px 16px; border-radius: 8px; box-shadow: var(--shadow-lg); max-width: 420px; font-weight: 500; border-left: 4px solid var(--brand-green); }
.toast.err { border-left-color: #FF6B5E; }

/* charts */
.chart { width: 100%; display: block; overflow: visible; }
.chart text { font-family: inherit; font-size: 11px; fill: var(--muted); }
.chart .grid line { stroke: #ECEEF2; stroke-width: 1; }
.chart .axis line { stroke: #D5D9E0; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); margin-bottom: 8px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 12px; height: 4px; border-radius: 2px; display: inline-block; }
.tip { position: fixed; z-index: 300; pointer-events: none; background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow-lg); border-radius: 8px; padding: 8px 10px; font-size: 12px; line-height: 1.5; max-width: 280px; }
.tip b { color: var(--ink); }
.tip .sw { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; }
.hbar { display: grid; grid-template-columns: minmax(120px, 38%) 1fr max-content; gap: 8px 10px; align-items: center; font-size: 12.5px; }
.hbar .bar { height: 12px; background: #F0F2F5; border-radius: 0 4px 4px 0; position: relative; }
.hbar .bar i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 0 4px 4px 0; background: var(--s1); }
.hbar .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.meter { height: 8px; background: #EEF0F3; border-radius: 4px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--s2); }

/* trace tree */
.tree { list-style: none; padding-left: 18px; margin: 4px 0; border-left: 1px dashed var(--line-strong); }
.tree li { margin: 6px 0; }
.node { display: inline-flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); font-size: 12.5px; }

/* login */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; background: #fff; }
.login .art { background: #fff; border-right: 1px solid var(--line); display: flex; flex-direction: column; justify-content: space-between; padding: 48px 56px; position: relative; overflow: hidden; }
.login .art img.lock { width: 300px; max-width: 80%; }
.login .art .hero { font-size: 44px; font-weight: 800; line-height: 1.08; letter-spacing: -0.03em; color: var(--ink); max-width: 520px; }
.login .art .hero em { font-style: normal; color: var(--primary); }
.login .art p.lead { font-size: 16px; color: var(--text-2); max-width: 460px; margin: 18px 0 0; }
.login .art .mark { position: absolute; right: -90px; bottom: -70px; width: 380px; opacity: .1; }
.login .art .foot { font-size: 12px; color: var(--muted); }
.login .panel { background: var(--surface-2); display: grid; place-items: center; padding: 40px 24px; }
.login form { width: 100%; max-width: 360px; }
.login form h2 { font-size: 24px; margin-bottom: 6px; }
.login form .f { margin-top: 14px; }
.login form .btn { width: 100%; height: 42px; margin-top: 20px; font-size: 14.5px; }

/* print */
.print-page { background: #fff; max-width: 800px; margin: 0 auto; padding: 28px 32px; color: #000; }
.print-page .ph { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; border-bottom: 2px solid var(--ink); padding-bottom: 12px; }
.print-page .ph img { height: 56px; }
.print-page .doc-title { font-size: 20px; font-weight: 800; text-align: right; }
.print-page .doc-no { font-size: 15px; font-weight: 700; text-align: right; }
.print-page table.t th { position: static; }
.print-page .sig { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; margin-top: 48px; }
.print-page .sig div { border-top: 1px solid #000; padding-top: 6px; font-size: 12px; text-align: center; }
.print-bar { max-width: 800px; margin: 16px auto 0; display: flex; gap: 10px; justify-content: flex-end; }
@media print {
  @page { size: A4; margin: 12mm; }
  body { background: #fff; }
  .print-bar, .side, .top, .toasts { display: none !important; }
  .print-page { padding: 0; max-width: none; }
}

/* responsive */
@media (max-width: 1180px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g-2-1 { grid-template-columns: 1fr; } }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 50; left: 0; width: 280px; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow-lg); }
  .side.open { transform: none; }
  .menu-btn { display: inline-flex; }
  .top { padding: 0 16px; }
  .content { padding: 16px 16px 40px; }
  .g2, .g3 { grid-template-columns: 1fr; }
  .fgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .user .nm, .user .rl { display: none; }
  .login { grid-template-columns: 1fr; }
  .login .art { padding: 28px 24px; } .login .art .hero { font-size: 30px; } .login .art .mark { display: none; }
  .kv.cols { grid-template-columns: max-content 1fr; }
}
@media (max-width: 560px) { .g4 { grid-template-columns: 1fr 1fr; } .fgrid { grid-template-columns: 1fr; } .fgrid .s2, .fgrid .s3 { grid-column: auto; } .kpi .v { font-size: 20px; } }

/* company identity */
.brand .co { display: flex; align-items: center; gap: 12px; }
.brand .co img { width: 54px; height: 54px; flex: none; }
.brand .co b { font-size: 16px; line-height: 1.15; font-weight: 800; color: var(--ink); letter-spacing: -0.01em; }
.brand a:hover { text-decoration: none; }
.login .art .co.big { display: flex; align-items: center; gap: 18px; }
.login .art .co.big img { width: 112px; height: 112px; }
.login .art .co.big b { font-size: 26px; font-weight: 800; color: var(--ink); line-height: 1.1; max-width: 260px; }
.copick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.copick label { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 10px; background: #fff; cursor: pointer; font-weight: 600; font-size: 13px; line-height: 1.25; color: var(--text); }
.copick label:hover { border-color: var(--brand-blue); }
.copick label.on { border-color: var(--brand-blue); box-shadow: 0 0 0 3px rgba(27, 137, 255, .18); }
.copick input { position: absolute; opacity: 0; pointer-events: none; }
.copick img { width: 36px; height: 36px; object-fit: contain; flex: none; }
.print-page .ph img { height: 56px; }
