/* ITL Asset: Idea Tec Ltd brand (yellow→orange gradient, near-black). */
:root, [data-theme="light"] {
  --bg: #f4f3ef; --surface: #ffffff; --surface-2: #f9f8f5; --sunken: #eeece6;
  --text: #18181b; --muted: #62626b; --faint: #8d8d96;
  --line: #e3e1da; --line-strong: #cfccc3;
  --brand-1: #f5c518; --brand-2: #eb6e25; --accent: #d9631e; --accent-ink: #ffffff; --accent-soft: #fdeedd;
  --ok: #1f8a4c; --ok-soft: #e3f4ea; --warn: #b26b00; --warn-soft: #fff1d6;
  --bad: #c2321f; --bad-soft: #fde6e2; --info: #2b62c4; --info-soft: #e5eefc; --neutral-soft: #ecebe6;
  --side: #141416; --side-text: #d9d9de; --side-muted: #8b8b94; --side-active: #26262b;
  --shadow: 0 1px 2px rgba(20,20,22,.06), 0 4px 16px rgba(20,20,22,.05);
  --radius: 10px; --radius-sm: 7px;
  --logo: url("/static/logo-light.png");
}
[data-theme="dark"] {
  --bg: #0e0f11; --surface: #17181b; --surface-2: #1c1d21; --sunken: #121315;
  --text: #ececee; --muted: #a3a3ac; --faint: #75757e;
  --line: #2a2b30; --line-strong: #3a3b41;
  --accent: #f08a3a; --accent-ink: #141416; --accent-soft: #3a2616;
  --ok: #4cc782; --ok-soft: #14301f; --warn: #f0b44a; --warn-soft: #36290f;
  --bad: #f2735f; --bad-soft: #3a1a15; --info: #7aa7ff; --info-soft: #172540; --neutral-soft: #24252a;
  --side: #0a0a0c; --side-text: #d9d9de; --side-muted: #7d7d86; --side-active: #1d1e22;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 6px 20px rgba(0,0,0,.25);
  --logo: url("/static/logo-dark.png");
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font: 14px/1.5 "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 21px; } h2 { font-size: 16px; } h3 { font-size: 14px; }
.boot { display: grid; place-items: center; height: 100vh; color: var(--muted); }
.mono, code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12.5px; }
.tbl td .mono, .tbl td.mono { white-space: nowrap; }
.muted { color: var(--muted); } .faint { color: var(--faint); } .small { font-size: 12.5px; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }

/* ---------- layout */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.side {
  background: var(--side); color: var(--side-text); position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; overflow-y: auto; z-index: 30;
}
.side .brand { padding: 18px 18px 14px; border-bottom: 1px solid #222226; }
.side .brand .logo { height: 30px; background: url("/static/logo-dark.png") left center / contain no-repeat; }
.side .brand .sub { font-size: 11px; color: var(--side-muted); margin-top: 6px; letter-spacing: .02em; }
.nav { padding: 10px 10px 20px; flex: 1; }
.nav .grp { font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em; color: var(--side-muted); margin: 16px 10px 6px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 7px; color: var(--side-text);
  font-size: 13.5px; text-decoration: none; position: relative;
}
.nav a:hover { background: #1c1c20; }
.nav a.on { background: var(--side-active); color: #fff; }
.nav a.on::before {
  content: ""; position: absolute; left: -10px; top: 7px; bottom: 7px; width: 3px; border-radius: 0 3px 3px 0;
  background: linear-gradient(var(--brand-1), var(--brand-2));
}
.nav svg { width: 17px; height: 17px; flex: none; opacity: .85; }
.side .foot { padding: 12px 18px; font-size: 11px; color: var(--side-muted); border-top: 1px solid #222226; }

.main { min-width: 0; display: flex; flex-direction: column; }
.top {
  height: 58px; display: flex; align-items: center; gap: 12px; padding: 0 24px; background: var(--surface);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20;
}
.top .menu-btn { display: none; }
.top .search { flex: 1; max-width: 460px; position: relative; }
.top .search input { padding-left: 34px; background: var(--surface-2); }
.top .search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 16px; color: var(--faint); }
.top .spacer { flex: 1; }
.user-chip { display: flex; align-items: center; gap: 9px; cursor: pointer; padding: 4px 8px 4px 4px; border-radius: 99px; border: 1px solid transparent; background: none; color: var(--text); font: inherit; }
.user-chip:hover { border-color: var(--line); }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 12px;
  color: #1a1a1a; background: linear-gradient(135deg, var(--brand-1), var(--brand-2));
}
.user-chip .who { text-align: left; line-height: 1.2; }
.user-chip .who small { display: block; color: var(--muted); font-size: 11px; }
.content { padding: 22px 24px 48px; max-width: 1480px; width: 100%; }
.page-head { display: flex; align-items: flex-end; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head .t { flex: 1; min-width: 220px; }
.page-head .t p { margin: 4px 0 0; color: var(--muted); }
.crumb { font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }

/* ---------- controls */
input, select, textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); padding: 7px 10px; min-height: 36px; outline: none; transition: border-color .12s, box-shadow .12s;
}
textarea { min-height: 76px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
input[type=checkbox] { width: 16px; height: 16px; min-height: 0; accent-color: var(--accent); vertical-align: middle; }
input[type=file] { padding: 6px; }
label.f { display: block; }
label.f > span { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 5px; }
label.f > span .req { color: var(--bad); }
label.f .help { font-size: 12px; color: var(--faint); margin-top: 4px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13.5px; cursor: pointer; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; font: inherit; font-weight: 600; font-size: 13.5px;
  border-radius: var(--radius-sm); padding: 0 14px; height: 36px; cursor: pointer; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--text); white-space: nowrap; text-decoration: none !important;
}
.btn:hover { background: var(--surface-2); border-color: var(--faint); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; }
.btn.primary { background: linear-gradient(135deg, #f0a21d, var(--brand-2)); border-color: transparent; color: #17120c; }
.btn.primary:hover { filter: brightness(1.05); }
.btn.danger { color: var(--bad); }
.btn.danger.solid { background: var(--bad); color: #fff; border-color: transparent; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--sunken); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn.icon { width: 36px; padding: 0; }
.btn.sm.icon { width: 30px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- cards & grids */
.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: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.card > .hd h2 { flex: 1; font-size: 14.5px; }
.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)); }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { padding: 14px 16px; position: relative; overflow: hidden; }
.kpi .l { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.kpi .v { font-size: 24px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.kpi .s { font-size: 12px; color: var(--faint); margin-top: 2px; }
.kpi.brand::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: linear-gradient(var(--brand-1), var(--brand-2)); }
.kpi a { color: inherit; }

/* ---------- tables */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th {
  text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; background: var(--surface-2);
  padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0;
}
.tbl th.sort { cursor: pointer; user-select: none; }
.tbl th.sort:hover { color: var(--text); }
.tbl td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tbody tr:hover td { background: var(--surface-2); }
.tbl tr.click { cursor: pointer; }
.tbl td.act { width: 1%; white-space: nowrap; text-align: right; }
.tbl td.chk, .tbl th.chk { width: 34px; padding-right: 0; }
.empty { padding: 44px 20px; text-align: center; color: var(--muted); }
.empty b { display: block; color: var(--text); font-size: 15px; margin-bottom: 4px; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.toolbar input[type=search] { max-width: 280px; }
.toolbar select { width: auto; min-width: 140px; max-width: 220px; }
.toolbar .grow { flex: 1; }
.pager { display: flex; align-items: center; gap: 8px; justify-content: flex-end; padding: 10px 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12.5px; }
.bulkbar { display: flex; gap: 8px; align-items: center; padding: 10px 14px; background: var(--accent-soft); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.bulkbar select { width: auto; }

/* ---------- chips */
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 1px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--neutral-soft); color: var(--muted); }
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.info { background: var(--info-soft); color: var(--info); }
.chip.brand { background: var(--accent-soft); color: var(--accent); }
.chip.plain::before { display: none; }

/* ---------- details */
.dl { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px 20px; }
.dl div > span { display: block; font-size: 12px; color: var(--muted); font-weight: 600; margin-bottom: 2px; }
.dl div > b { font-weight: 500; word-break: break-word; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); padding: 0 12px; overflow-x: auto; }
.tabs button { background: none; border: none; font: inherit; font-weight: 600; color: var(--muted); padding: 11px 12px; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button.on { color: var(--text); border-bottom-color: var(--accent); }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 150px 1fr; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.timeline li:last-child { border-bottom: none; }

/* ---------- bars */
.bars { display: grid; gap: 9px; }
.bar-row { display: grid; grid-template-columns: minmax(90px, 160px) 1fr 70px; gap: 10px; align-items: center; font-size: 13px; }
.bar-row .track { height: 9px; background: var(--sunken); border-radius: 99px; overflow: hidden; }
.bar-row .fill { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--brand-1), var(--brand-2)); }
.stack { display: flex; height: 12px; border-radius: 99px; overflow: hidden; background: var(--sunken); margin: 6px 0 12px; }
.stack span { height: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: var(--muted); }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }

/* ---------- modal */
.overlay { position: fixed; inset: 0; background: rgba(10,10,12,.5); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px 16px; z-index: 100; overflow-y: auto; animation: fade .12s; }
.modal { width: 100%; max-width: 640px; background: var(--surface); border-radius: 12px; border: 1px solid var(--line); box-shadow: 0 20px 60px rgba(0,0,0,.3); animation: pop .14s; }
.modal.wide { max-width: 900px; }
.modal > .hd { display: flex; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal > .hd h2 { flex: 1; }
.modal > .bd { padding: 18px 20px; max-height: 70vh; overflow-y: auto; }
.modal > .ft { display: flex; gap: 8px; justify-content: flex-end; padding: 14px 20px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 12px 12px; }
.form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form .full { grid-column: 1 / -1; }
.form .sect { grid-column: 1 / -1; font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); font-weight: 700; margin-top: 4px; border-top: 1px solid var(--line); padding-top: 12px; }
.err-box { background: var(--bad-soft); color: var(--bad); border-radius: var(--radius-sm); padding: 9px 12px; font-size: 13px; margin-bottom: 12px; }
.note { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; font-size: 13px; color: var(--muted); }
.note.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } }

/* ---------- menu, toasts */
.menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 210px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 6px; z-index: 50; }
.menu button, .menu a { display: flex; width: 100%; align-items: center; gap: 9px; background: none; border: none; font: inherit; color: var(--text); padding: 8px 10px; border-radius: 6px; cursor: pointer; text-align: left; text-decoration: none; }
.menu button:hover, .menu a:hover { background: var(--surface-2); text-decoration: none; }
.menu hr { border: none; border-top: 1px solid var(--line); margin: 5px 0; }
.menu svg { width: 16px; height: 16px; color: var(--muted); }
#toasts { position: fixed; right: 18px; bottom: 18px; display: grid; gap: 8px; z-index: 200; }
.toast { background: var(--side); color: #f3f3f5; padding: 10px 14px; border-radius: 9px; box-shadow: 0 8px 24px rgba(0,0,0,.25); font-size: 13.5px; max-width: 380px; border-left: 3px solid var(--ok); animation: pop .15s; }
.toast.err { border-left-color: var(--bad); }

/* ---------- login */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-art { background: #121214; color: #e9e9ec; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.login-art .logo { height: 46px; background: url("/static/logo-dark.png") left center / contain no-repeat; max-width: 340px; }
.login-art h2 { font-size: 26px; max-width: 460px; line-height: 1.3; margin-top: 40px; }
.login-art p { color: #a2a2ab; max-width: 460px; }
.login-art .rings { position: absolute; right: -140px; bottom: -140px; width: 520px; height: 520px; border-radius: 50%; border: 26px solid transparent; border-top-color: #f2b31f; border-right-color: #eb6e25; opacity: .16; }
.login-art .rings.r2 { right: -60px; bottom: -60px; width: 360px; height: 360px; border-width: 20px; }
.login-form { display: grid; place-items: center; padding: 32px; background: var(--bg); }
.login-form .card { width: 100%; max-width: 380px; padding: 28px; }
.login-form .card .logo-m { display: none; height: 34px; background: var(--logo) left center / contain no-repeat; margin-bottom: 18px; }
.login-form form { display: grid; gap: 14px; margin-top: 18px; }

/* ---------- fiber */
.calc-out { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.calc-out div { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.calc-out span { display: block; font-size: 12px; color: var(--muted); font-weight: 600; }
.calc-out b { font-size: 19px; font-variant-numeric: tabular-nums; }
.verdict { padding: 12px 14px; border-radius: 8px; font-weight: 600; margin-top: 12px; }
.verdict.ok { background: var(--ok-soft); color: var(--ok); }
.verdict.warn { background: var(--warn-soft); color: var(--warn); }
.verdict.bad { background: var(--bad-soft); color: var(--bad); }
.colors { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.colors div { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 7px; }
.colors i { width: 18px; height: 18px; border-radius: 50%; border: 1px solid rgba(0,0,0,.2); flex: none; }
.splitter-list { display: grid; gap: 6px; }
.splitter-list .row { display: flex; gap: 6px; }

/* ---------- print / label */
.label-sheet { display: flex; flex-wrap: wrap; gap: 10px; }
.asset-label { width: 300px; border: 1px solid #000; border-radius: 6px; padding: 8px 10px; background: #fff; color: #000; font-family: Arial, sans-serif; }
.asset-label .top-l { display: flex; justify-content: space-between; align-items: center; font-size: 10px; }
.asset-label .top-l img { height: 16px; }
.asset-label svg { width: 100%; height: 46px; display: block; margin: 4px 0 2px; }
.asset-label .tag { font: 700 13px/1.2 ui-monospace, Consolas, monospace; text-align: center; letter-spacing: .04em; }
.asset-label .meta { font-size: 9.5px; text-align: center; color: #333; }

@media print {
  body { background: #fff; }
  .side, .top, .no-print, #toasts { display: none !important; }
  .shell { display: block; }
  .content { padding: 0; max-width: none; }
  .card { box-shadow: none; border: none; }
}

/* ---------- responsive */
@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; width: 260px; transform: translateX(-100%); transition: transform .18s; box-shadow: 0 0 40px rgba(0,0,0,.4); }
  .side.open { transform: none; }
  .top { padding: 0 14px; }
  .top .menu-btn { display: inline-flex; }
  .user-chip .who { display: none; }
  .content { padding: 16px 14px 40px; }
  .g2, .g3, .g4 { grid-template-columns: 1fr; }
  .form { grid-template-columns: 1fr; }
  .login-wrap { grid-template-columns: 1fr; }
  .login-art { display: none; }
  .login-form .card .logo-m { display: block; }
  .timeline li { grid-template-columns: 1fr; gap: 2px; }
  .bar-row { grid-template-columns: 100px 1fr 54px; }
}
