/* WorxOS — China Worx design language (dark chrome, off-white ink, one red accent), toned down for daily work. */
@font-face { font-family: "IBM Plex Sans"; font-weight: 400; font-display: swap; src: url("fonts/ibm-plex-sans-400-latin.woff2") format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+20AC,U+2122,U+2212,U+FEFF; }
@font-face { font-family: "IBM Plex Sans"; font-weight: 400; font-display: swap; src: url("fonts/ibm-plex-sans-400-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA,U+1E00-1EFF,U+20A0-20AB,U+20AD-20C0; }
@font-face { font-family: "IBM Plex Sans"; font-weight: 500; font-display: swap; src: url("fonts/ibm-plex-sans-500-latin.woff2") format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+20AC,U+2122,U+2212,U+FEFF; }
@font-face { font-family: "IBM Plex Sans"; font-weight: 500; font-display: swap; src: url("fonts/ibm-plex-sans-500-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA,U+1E00-1EFF,U+20A0-20AB,U+20AD-20C0; }
@font-face { font-family: "IBM Plex Sans"; font-weight: 600; font-display: swap; src: url("fonts/ibm-plex-sans-600-latin.woff2") format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+20AC,U+2122,U+2212,U+FEFF; }
@font-face { font-family: "IBM Plex Sans"; font-weight: 600; font-display: swap; src: url("fonts/ibm-plex-sans-600-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA,U+1E00-1EFF,U+20A0-20AB,U+20AD-20C0; }
@font-face { font-family: "Space Grotesk"; font-weight: 500; font-display: swap; src: url("fonts/space-grotesk-500-latin.woff2") format("woff2"); }
@font-face { font-family: "Space Grotesk"; font-weight: 600; font-display: swap; src: url("fonts/space-grotesk-600-latin.woff2") format("woff2"); }
@font-face { font-family: "Space Grotesk"; font-weight: 700; font-display: swap; src: url("fonts/space-grotesk-700-latin.woff2") format("woff2"); }
@font-face { font-family: "Space Mono"; font-weight: 400; font-display: swap; src: url("fonts/space-mono-400-latin.woff2") format("woff2"); }
@font-face { font-family: "Space Mono"; font-weight: 700; font-display: swap; src: url("fonts/space-mono-700-latin.woff2") format("woff2"); }

:root {
  --chrome: #0a0b0d; --chrome-2: #16191e; --chrome-ink: #e9ecef; --chrome-ink-2: #aab1b8;
  --bg: #f3f4f6; --panel: #fff; --panel-2: #f8f9fa; --ink: #121418; --ink-2: #474e56; --muted: #6c747c;
  --line: #e4e7eb; --line2: #cfd4da;
  --red: #f80404; --red-2: #d40303; --red-soft: #fdeaea;
  --ok: #157347; --ok-soft: #e6f4ec; --warn: #a15c00; --warn-soft: #fdf1df; --bad: #c81e1e; --bad-soft: #fde8e8;
  --info: #24548f; --info-soft: #e7eef8; --violet: #5b3a9e; --violet-soft: #efe9f9; --chip: #eef0f2; --hi: #fff6d6;
  --font-display: "Space Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-body: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", Roboto, sans-serif;
  --font-mono: "Space Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --r: 12px; --r-sm: 8px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 13.5px/1.5 var(--font-body); -webkit-font-smoothing: antialiased; }
::selection { background: var(--red); color: #fff; }
a { color: var(--info); text-decoration: none; }
a:hover { text-decoration: underline; }
b, strong { font-weight: 600; }

/* ---- chrome ---- */
header.top { background: var(--chrome); color: var(--chrome-ink); display: flex; align-items: center; gap: 22px; padding: 0 20px; height: 54px;
  position: sticky; top: 0; z-index: 10; border-bottom: 1px solid rgba(255,255,255,.06); }
header.top .brand { font-family: var(--font-display); font-weight: 700; letter-spacing: -0.03em; font-size: 19px; white-space: nowrap; color: #fff; text-decoration: none; }
header.top .brand i { color: var(--red); font-style: normal; text-shadow: 0 0 12px rgba(248,4,4,.45); }
header.top nav { display: flex; gap: 2px; overflow-x: auto; flex: 1; min-width: 0; scrollbar-width: none; align-self: stretch; }
header.top nav a { color: var(--chrome-ink-2); padding: 0 12px; white-space: nowrap; font-weight: 500; font-size: 13.5px; display: flex; align-items: center;
  border-bottom: 2px solid transparent; text-decoration: none; transition: color .15s; }
header.top nav a:hover { color: #fff; }
header.top nav a.on { color: #fff; border-bottom-color: var(--red); }
header.top .me { color: var(--chrome-ink-2); white-space: nowrap; font-size: 12.5px; flex-shrink: 0; }
header.top .me a { color: var(--chrome-ink); }
main { padding: 22px 20px 70px; max-width: 1500px; margin: 0 auto; }

/* ---- type ---- */
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; letter-spacing: -0.02em; color: var(--ink); }
h1 { font-size: 23px; margin: 0 0 14px; }
h2 { font-size: 15.5px; margin: 22px 0 10px; }
h3 { font-size: 13.5px; margin: 14px 0 6px; }
.eyebrow, .kpi .l, table.t th { font-family: var(--font-mono); text-transform: uppercase; letter-spacing: .06em; font-weight: 400; }
.mono { font-family: var(--font-mono); font-size: 12px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.r, td.r, th.r { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.neg { color: var(--bad); font-weight: 600; } .pos { color: var(--ok); }

/* ---- layout ---- */
.row { display: flex; gap: 16px; flex-wrap: wrap; align-items: flex-start; }
.grow { flex: 1; min-width: 300px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; margin-bottom: 16px; }
.panel h2:first-child, .panel h3:first-child { margin-top: 0; }
.bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.bar .sp { flex: 1; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(175px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; position: relative; }
.kpi .v { font-family: var(--font-display); font-size: 24px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.kpi .l { color: var(--muted); font-size: 10.5px; margin-top: 2px; }
.kpi.bad { border-color: #f3c4c4; } .kpi.bad .v { color: var(--bad); }
.kpi.bad::before { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px; border-radius: 0 3px 3px 0; background: var(--red); }

/* ---- tables ---- */
table.t { width: 100%; border-collapse: collapse; background: var(--panel); }
table.t th { text-align: left; color: var(--muted); font-size: 10.5px; padding: 8px 10px; border-bottom: 1px solid var(--line2); white-space: nowrap;
  background: var(--panel-2); position: sticky; top: 54px; }
table.t td { padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.t tr:last-child td { border-bottom: none; }
table.t tr:hover td { background: #fafbfc; }
table.t tr.muted td { color: #a3a9b0; }
.wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); }
.wrap table.t th { top: 0; }
.panel table.t th { position: static; }

/* ---- chips & flags ---- */
.chip { display: inline-block; padding: 1px 8px; border-radius: 999px; background: var(--chip); font-size: 11.5px; white-space: nowrap; color: var(--ink-2); font-weight: 500; }
.chip.ok { background: var(--ok-soft); color: var(--ok); } .chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.warn { background: var(--warn-soft); color: var(--warn); } .chip.info { background: var(--info-soft); color: var(--info); }
.st-sourcing { background: var(--info-soft); color: var(--info); } .st-pricing { background: var(--warn-soft); color: var(--warn); }
.st-quoted { background: var(--violet-soft); color: var(--violet); }
.st-ordered, .st-paid, .st-shipped, .st-closed { background: var(--ok-soft); color: var(--ok); }
.st-lost, .st-cancelled, .st-written_off { background: #eceef0; color: #8a9097; } .st-overdue { background: var(--bad-soft); color: var(--bad); }
.st-open, .st-part_paid { background: var(--warn-soft); color: var(--warn); }
.flag { font-size: 11px; padding: 0 6px; border-radius: 5px; margin-right: 3px; white-space: nowrap; }
.flag.cost_up, .flag.low_margin, .flag.above_catalog, .flag.above_target { background: var(--bad-soft); color: var(--bad); }
.flag.quoted_before, .flag.no_cost { background: var(--warn-soft); color: var(--warn); }
.flag.below_catalog, .flag.high_margin { background: var(--ok-soft); color: var(--ok); }

/* ---- forms ---- */
input, select, textarea, button { font: inherit; color: inherit; }
input[type=text], input[type=number], input[type=date], input[type=password], input[type=file], input:not([type]), select, textarea {
  border: 1px solid var(--line2); border-radius: var(--r-sm); padding: 6px 9px; background: #fff; max-width: 100%; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ink-2); box-shadow: 0 0 0 3px rgba(18,20,24,.08); }
textarea { width: 100%; min-height: 120px; font-family: var(--font-mono); font-size: 12px; }
input.n { width: 92px; text-align: right; font-variant-numeric: tabular-nums; } input.s { width: 120px; } input.xs { width: 70px; }
label { display: block; font-size: 12px; color: var(--muted); margin: 10px 0 4px; font-weight: 500; }
label.inline { display: inline-flex; gap: 6px; align-items: center; margin: 0; color: var(--ink); font-size: 13px; font-weight: 400; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 0 16px; }
.btn, button { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line2); background: #fff; color: var(--ink);
  padding: 7px 14px; border-radius: 9px; cursor: pointer; white-space: nowrap; text-decoration: none !important; font-size: 13px; font-weight: 500;
  transition: background .15s, border-color .15s, box-shadow .2s; }
.btn:hover, button:hover { background: var(--panel-2); border-color: #b9c0c7; }
.btn.primary, button.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.primary:hover, button.primary:hover { background: #2a2f36; }
.btn.accent, button.accent { background: var(--red); border-color: var(--red); color: #fff; }
.btn.accent:hover, button.accent:hover { background: var(--red-2); box-shadow: 0 6px 18px -8px rgba(248,4,4,.6); }
.btn.sm, button.sm { padding: 3px 9px; font-size: 12px; border-radius: 7px; }
button.link { border: none; background: none; padding: 0; color: var(--info); }
details summary { cursor: pointer; color: var(--info); list-style: none; }
details summary::-webkit-details-marker { display: none; }
details summary.btn { color: var(--ink); }

/* ---- tabs, flash ---- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line2); margin: 14px 0 16px; }
.tabs a { padding: 8px 14px; color: var(--muted); border-bottom: 2px solid transparent; font-weight: 500; margin-bottom: -1px; }
.tabs a.on { color: var(--ink); border-color: var(--red); text-decoration: none; }
.flash { background: var(--hi); border: 1px solid #efdc9b; padding: 9px 14px; border-radius: var(--r-sm); margin-bottom: 14px; }

/* ---- inquiry line cards ---- */
.line-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 12px; }
.line-card .lh { display: flex; gap: 12px; align-items: baseline; padding: 10px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; position: relative; }
.line-card .lh .mpn { font-weight: 600; font-size: 14.5px; font-family: var(--font-display); letter-spacing: -0.01em; }
.line-card.nooffer { box-shadow: inset 3px 0 0 var(--warn); }
.line-card .lb { padding: 10px 14px; }
.line-card .otab { overflow-x: auto; }
.line-card .otab td:first-child { white-space: nowrap; }
.offer-form { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
.hist { font-size: 12px; color: var(--muted); line-height: 1.6; }
.hist b { color: var(--ink); }
tr.chosen td { background: var(--ok-soft) !important; }
td.pricecell input { width: 96px; text-align: right; font-weight: 600; }
.sugg { cursor: pointer; color: var(--info); }
.sticky-actions { position: sticky; bottom: 0; background: rgba(243,244,246,.94); backdrop-filter: blur(8px); padding: 12px 0; border-top: 1px solid var(--line);
  margin-top: 12px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; z-index: 3; }

/* ---- login (dark, like china-worx.com) ---- */
body.auth { background: var(--chrome); color: var(--chrome-ink); min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login { width: 100%; max-width: 360px; background: #121418; border: 1px solid rgba(255,255,255,.09); border-radius: 16px; padding: 30px 28px; box-shadow: 0 30px 80px -40px rgba(248,4,4,.25); }
.login img { width: 150px; margin-bottom: 18px; }
.login .name { font-family: var(--font-display); font-weight: 700; font-size: 20px; letter-spacing: -0.03em; margin-bottom: 16px; }
.login .name i { color: var(--red); font-style: normal; text-shadow: 0 0 12px rgba(248,4,4,.5); }
.login label { color: var(--chrome-ink-2); }
.login input { width: 100%; background: #0d0f12; border-color: rgba(255,255,255,.14); color: var(--chrome-ink); }
.login input:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(248,4,4,.18); }
.login button { width: 100%; justify-content: center; margin-top: 18px; background: var(--red); border-color: var(--red); color: #fff; padding: 10px; font-family: var(--font-display); font-weight: 600; }
.login button:hover { background: var(--red-2); }
.login .flash { background: rgba(248,4,4,.12); border-color: rgba(248,4,4,.35); color: #ffd7d7; }

@media (max-width: 720px) {
  header.top { gap: 10px; padding: 0 12px; } header.top .me span { display: none; }
  main { padding: 14px 12px 60px; }
  table.t th { top: 0; }
  h1 { font-size: 20px; }
}
