:root {
  --navy: #0d1b2e;
  --navy-2: #13253e;
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --blue-soft: #e8f0ff;
  --teal: #0f9f8f;
  --teal-soft: #e4f7f3;
  --amber: #e9a23b;
  --amber-soft: #fff5df;
  --red: #dc4a4a;
  --red-soft: #fdecec;
  --green: #1f9d63;
  --green-soft: #e8f8ef;
  --purple: #7c5ce5;
  --purple-soft: #f0ecff;
  --ink: #172033;
  --muted: #69758a;
  --line: #e4e9f2;
  --bg: #f4f7fb;
  --card: #ffffff;
  --radius: 14px;
  --shadow: 0 8px 28px rgba(22, 40, 72, .07);
  --shadow-lg: 0 22px 60px rgba(14, 28, 50, .18);
  --sidebar-w: 238px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100%; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
img { max-width: 100%; }
h1, h2, h3, h4, p { margin: 0; }
h1 { font-size: 26px; font-weight: 700; letter-spacing: -.4px; }
h2 { font-size: 18px; font-weight: 700; letter-spacing: -.2px; }
h3 { font-size: 15px; font-weight: 700; }
small, .small { font-size: 12px; }
.muted { color: var(--muted); }
.mono { font-variant-numeric: tabular-nums; font-family: "Cascadia Mono", Consolas, monospace; }
.nowrap { white-space: nowrap; }
.center { text-align: center; }
.right { text-align: right; }
.hidden { display: none !important; }
.flex { display: flex; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-6 { gap: 6px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }

/* ---------------- boot / auth ---------------- */
.app-boot { min-height: 100vh; }
.boot-screen { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 14px; background: radial-gradient(circle at 50% 30%, #1a355c, #0c1728); color: #dbe7ff; }
.boot-logo { width: 64px; height: 64px; border-radius: 18px; display: grid; place-content: center; font-weight: 800; font-size: 24px; letter-spacing: 1px; background: linear-gradient(135deg, var(--blue), var(--teal)); box-shadow: 0 14px 40px rgba(37, 99, 235, .5); }
.boot-text { font-size: 13px; letter-spacing: 2px; opacity: .72; }

.auth-page { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; background: #fff; }
.auth-visual { position: relative; overflow: hidden; padding: 54px 60px; background: radial-gradient(circle at 15% 10%, #21477c 0, transparent 42%), radial-gradient(circle at 85% 90%, #0f6f68 0, transparent 40%), linear-gradient(145deg, #0b1728, #11233d 62%, #0d2529); color: #fff; display: flex; flex-direction: column; }
.auth-visual:after { content: ""; position: absolute; width: 560px; height: 560px; border: 1px solid rgba(255,255,255,.09); border-radius: 50%; right: -230px; bottom: -250px; box-shadow: 0 0 0 80px rgba(255,255,255,.025), 0 0 0 160px rgba(255,255,255,.018); }
.auth-brand { display: flex; align-items: center; gap: 12px; position: relative; z-index: 1; }
.auth-brand-mark { width: 42px; height: 42px; border-radius: 12px; display: grid; place-content: center; font-weight: 800; background: linear-gradient(135deg, #3b82f6, #14b8a6); }
.auth-brand strong { display: block; font-size: 16px; letter-spacing: .5px; }
.auth-brand span { display: block; font-size: 11px; opacity: .58; letter-spacing: 1.5px; }
.auth-hero { margin-top: auto; margin-bottom: auto; position: relative; z-index: 1; max-width: 490px; }
.auth-hero h1 { font-size: 43px; line-height: 1.22; letter-spacing: -1px; margin-bottom: 18px; }
.auth-hero h1 em { font-style: normal; color: #67e8d5; }
.auth-hero p { color: rgba(255,255,255,.62); font-size: 15px; line-height: 1.8; }
.auth-points { margin-top: 34px; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.auth-point { padding: 14px; border: 1px solid rgba(255,255,255,.09); border-radius: 12px; background: rgba(255,255,255,.035); }
.auth-point b { display: block; font-size: 13px; margin-bottom: 3px; }
.auth-point span { font-size: 11px; color: rgba(255,255,255,.48); }
.auth-visual-foot { position: relative; z-index: 1; font-size: 11px; color: rgba(255,255,255,.32); letter-spacing: .5px; }
.auth-panel { display: grid; place-items: center; padding: 40px; }
.auth-card { width: 100%; max-width: 370px; }
.auth-card .eyebrow { color: var(--blue); font-size: 11px; font-weight: 700; letter-spacing: 2px; margin-bottom: 8px; }
.auth-card h2 { font-size: 28px; margin-bottom: 6px; }
.auth-card .sub { color: var(--muted); margin-bottom: 28px; font-size: 13px; }
.auth-hint { margin-top: 20px; padding: 12px 14px; border-radius: 10px; background: #f6f8fc; color: var(--muted); font-size: 12px; line-height: 1.7; border: 1px solid var(--line); }
.auth-extras { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; font-size: 12px; color: var(--muted); }
.auth-footer { margin-top: 26px; text-align: center; color: #98a2b5; font-size: 11px; }
@media (max-width: 900px) {
  .auth-page { grid-template-columns: 1fr; }
  .auth-visual { display: none; }
  .auth-panel { min-height: 100vh; padding: 28px; background: radial-gradient(circle at 50% 0, #e9f0ff, transparent 50%), #fff; }
  .auth-card { padding: 6px; }
}

/* ---------------- shell ---------------- */
.shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); background: linear-gradient(180deg, var(--navy), #0a1626); color: #b8c6da; display: flex; flex-direction: column; z-index: 40; border-right: 1px solid rgba(255,255,255,.04); }
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 20px 18px 16px; }
.sidebar-logo { width: 36px; height: 36px; border-radius: 10px; display: grid; place-content: center; font-weight: 800; font-size: 14px; color: #fff; background: linear-gradient(135deg, #2563eb, #0d9488); box-shadow: 0 6px 18px rgba(37,99,235,.35); }
.sidebar-brand strong { display: block; color: #f0f5ff; font-size: 14px; letter-spacing: .4px; }
.sidebar-brand span { display: block; color: #607492; font-size: 10px; letter-spacing: 1.2px; }
.company-switch { margin: 2px 12px 10px; padding: 8px; background: rgba(255,255,255,.045); border: 1px solid rgba(255,255,255,.06); border-radius: 10px; }
.company-switch label { display: block; font-size: 9px; letter-spacing: 1.4px; color: #5e7491; margin-bottom: 4px; text-transform: uppercase; }
.company-switch select { width: 100%; background: transparent; color: #d9e5f7; border: 0; outline: 0; font-size: 12px; cursor: pointer; }
.company-switch select option { background: #13253e; }
.nav-scroll { flex: 1; overflow-y: auto; padding: 4px 10px 10px; scrollbar-width: thin; scrollbar-color: #273a53 transparent; }
.nav-section { margin-top: 14px; padding: 0 8px 5px; font-size: 9px; letter-spacing: 1.7px; color: #50647e; font-weight: 700; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px; color: #9db0c7; font-size: 13px; margin-bottom: 2px; cursor: pointer; transition: background .15s, color .15s; position: relative; border: 0; background: transparent; width: 100%; text-align: left; }
.nav-item svg { width: 17px; height: 17px; opacity: .78; flex: none; }
.nav-item:hover { background: rgba(255,255,255,.055); color: #e4edfa; text-decoration: none; }
.nav-item.active { background: linear-gradient(90deg, rgba(37,99,235,.24), rgba(13,148,136,.07)); color: #fff; }
.nav-item.active:before { content: ""; position: absolute; left: -10px; width: 3px; height: 18px; border-radius: 3px; background: #47b7ff; }
.nav-item .nav-count { margin-left: auto; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--red); color: #fff; font-size: 10px; display: grid; place-content: center; }
.sidebar-user { margin-top: auto; border-top: 1px solid rgba(255,255,255,.07); padding: 12px 14px 14px; display: flex; align-items: center; gap: 9px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-content: center; background: linear-gradient(135deg, #2c4a71, #1b304b); color: #fff; font-size: 13px; font-weight: 700; flex: none; }
.sidebar-user .meta { min-width: 0; flex: 1; }
.sidebar-user .meta b { display: block; color: #dce8f8; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user .meta span { display: block; color: #5d7491; font-size: 10px; }
.sidebar-user button { border: 0; background: transparent; color: #6c819c; padding: 4px; }
.sidebar-user button:hover { color: #fff; }

.main { grid-column: 2; min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }
.topbar { height: 64px; padding: 0 26px; display: flex; align-items: center; gap: 14px; background: rgba(255,255,255,.88); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 30; }
.mobile-menu { display: none; border: 1px solid var(--line); background: #fff; width: 36px; height: 36px; border-radius: 9px; }
.topbar-title { min-width: 0; }
.topbar-title h1 { font-size: 18px; letter-spacing: 0; }
.topbar-title .crumbs { color: #929db1; font-size: 11px; margin-top: 1px; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.topbar-date { color: var(--muted); font-size: 12px; padding-right: 6px; }
.icon-btn { width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line); background: #fff; color: #4a5870; display: grid; place-content: center; position: relative; }
.icon-btn:hover { background: #f7f9fd; }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn .dot { position: absolute; top: 6px; right: 6px; min-width: 15px; height: 15px; border-radius: 8px; background: var(--red); color: #fff; font-size: 9px; display: grid; place-content: center; padding: 0 3px; border: 2px solid #fff; }
.content { padding: 24px 26px 46px; max-width: 1640px; width: 100%; margin: 0 auto; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .title h1 { font-size: 24px; }
.page-head .title p { color: var(--muted); font-size: 12px; margin-top: 4px; }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.mobile-nav { display: none; }

/* ---------------- buttons ---------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 7px 14px; border-radius: 9px; border: 1px solid var(--line); background: #fff; color: #354258; font-size: 13px; font-weight: 500; white-space: nowrap; transition: .15s; }
.btn:hover { background: #f8faff; border-color: #cfd8e6; text-decoration: none; }
.btn svg { width: 15px; height: 15px; }
.btn-primary { background: var(--blue); border-color: var(--blue); color: #fff; box-shadow: 0 5px 14px rgba(37,99,235,.2); }
.btn-primary:hover { background: var(--blue-dark); border-color: var(--blue-dark); }
.btn-teal { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn-teal:hover { background: #0b887b; border-color: #0b887b; }
.btn-dark { background: var(--navy-2); border-color: var(--navy-2); color: #fff; }
.btn-dark:hover { background: var(--navy); border-color: var(--navy); }
.btn-danger { color: var(--red); border-color: #f0caca; background: #fff; }
.btn-danger:hover { background: var(--red-soft); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: #f1f5fa; color: var(--ink); }
.btn-sm { min-height: 30px; padding: 4px 10px; font-size: 12px; border-radius: 7px; }
.btn-xs { min-height: 25px; padding: 2px 8px; font-size: 11px; border-radius: 6px; }
.btn-lg { min-height: 43px; padding: 10px 20px; font-size: 14px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn-group { display: inline-flex; gap: 6px; flex-wrap: wrap; }

/* ---------------- forms ---------------- */
.field { margin-bottom: 15px; }
.field > label, .label { display: block; font-size: 12px; color: #536179; font-weight: 600; margin-bottom: 6px; }
.field .hint { font-size: 11px; color: #93a0b4; margin-top: 4px; line-height: 1.5; }
.input, .select, .textarea {
  width: 100%; border: 1px solid #dbe2ee; background: #fff; border-radius: 9px;
  padding: 9px 11px; color: var(--ink); outline: 0; transition: border .15s, box-shadow .15s;
  font-size: 13px; min-height: 38px;
}
.input:focus, .select:focus, .textarea:focus { border-color: #7da6f8; box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.input::placeholder, .textarea::placeholder { color: #aab5c5; }
.textarea { min-height: 82px; resize: vertical; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23818fa5' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 30px; }
.input-sm { min-height: 32px; padding: 5px 8px; font-size: 12px; border-radius: 7px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.form-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid .full { grid-column: 1 / -1; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #3d4b61; cursor: pointer; }
.check input { width: 15px; height: 15px; accent-color: var(--blue); }
.check-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 12px; }
.radio-row { display: flex; gap: 18px; flex-wrap: wrap; padding: 3px 0; }
.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.search-box { position: relative; min-width: 210px; }
.search-box svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: #9aa6b8; }
.search-box .input { padding-left: 32px; }
.total-line { display: flex; justify-content: flex-end; align-items: baseline; gap: 10px; padding: 12px 0; }
.total-line b { font-size: 23px; color: var(--red); }

/* ---------------- cards ---------------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px; border-bottom: 1px solid #edf1f7; }
.card-head h2, .card-head h3 { font-size: 14px; }
.card-head .sub { color: var(--muted); font-size: 11px; margin-top: 2px; }
.card-body { padding: 18px; }
.card-body.tight { padding: 12px 14px; }
.card + .card { margin-top: 16px; }
.card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.card-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.card-grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.card-link { cursor: pointer; transition: transform .15s, box-shadow .15s; }
.card-link:hover { transform: translateY(-1px); box-shadow: 0 12px 34px rgba(22,40,72,.1); }
.section-title { display: flex; align-items: center; justify-content: space-between; margin: 24px 0 12px; }
.section-title h2 { font-size: 16px; }
.section-title .more { font-size: 12px; color: var(--muted); }

/* ---------------- stats ---------------- */
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 13px; padding: 16px 17px; position: relative; overflow: hidden; box-shadow: 0 4px 16px rgba(22,40,72,.04); }
.stat:after { content: ""; position: absolute; width: 80px; height: 80px; border-radius: 50%; right: -30px; top: -34px; background: var(--tint, #eef4ff); opacity: .8; }
.stat .label { font-size: 11px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.stat .value { font-size: 25px; font-weight: 700; letter-spacing: -.8px; margin-top: 7px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat .foot { margin-top: 7px; font-size: 11px; color: #8a96a9; display: flex; align-items: center; gap: 6px; }
.stat.blue { --tint: #e7efff; } .stat.blue .value { color: var(--blue); }
.stat.teal { --tint: #e0f7f2; } .stat.teal .value { color: var(--teal); }
.stat.amber { --tint: #fff2d7; } .stat.amber .value { color: #b77712; }
.stat.red { --tint: #ffe7e7; } .stat.red .value { color: var(--red); }
.stat.purple { --tint: #eee9ff; } .stat.purple .value { color: var(--purple); }
.hero-strip { background: linear-gradient(120deg, #0f2542, #163a55 60%, #0d4b47); border-radius: 16px; padding: 22px 24px; color: #fff; display: flex; justify-content: space-between; align-items: center; gap: 20px; box-shadow: 0 14px 40px rgba(13,27,46,.2); position: relative; overflow: hidden; }
.hero-strip:after { content: ""; position: absolute; width: 330px; height: 330px; border: 1px solid rgba(255,255,255,.09); border-radius: 50%; right: -100px; top: -150px; box-shadow: 0 0 0 60px rgba(255,255,255,.02); }
.hero-strip h2 { font-size: 20px; letter-spacing: -.3px; }
.hero-strip p { color: rgba(255,255,255,.58); font-size: 12px; margin-top: 5px; }
.hero-strip .hero-nums { display: flex; gap: 28px; position: relative; z-index: 1; }
.hero-nums .n b { display: block; font-size: 21px; font-variant-numeric: tabular-nums; }
.hero-nums .n span { font-size: 10px; color: rgba(255,255,255,.52); letter-spacing: .5px; }

.onboard-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.onboard-step { display: block; padding: 14px; border: 1px solid #e7edf6; border-radius: 11px; background: #fbfdff; color: var(--ink); text-decoration: none; transition: .15s; }
.onboard-step:hover { border-color: #bcd0f4; background: #f6f9ff; text-decoration: none; transform: translateY(-1px); }
.onboard-step span { display: inline-grid; place-content: center; width: 25px; height: 25px; border-radius: 7px; background: var(--blue-soft); color: var(--blue); font-size: 10px; font-weight: 800; margin-bottom: 8px; }
.onboard-step b { display: block; font-size: 12.5px; }
.onboard-step small { display: block; color: #8c98aa; font-size: 10.5px; line-height: 1.55; margin-top: 3px; }
.dash-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(300px, .9fr); gap: 16px; align-items: start; }
.dash-grid > * { min-width: 0; }
.card { min-width: 0; }
.table-wrap { max-width: 100%; }
.dash-grid > div > .card + .card { margin-top: 16px; }
.dash-grid .side > .card + .card { margin-top: 16px; }

/* ---------------- chart ---------------- */
.chart-wrap { padding: 8px 4px 0; }
.chart { width: 100%; height: 176px; display: block; overflow: visible; }
.chart .axis { stroke: #eef2f8; stroke-width: 1; }
.chart .bar { fill: url(#barGrad); rx: 4; }
.chart .bar-repair { fill: #b9e7df; rx: 4; }
.chart text { fill: #98a3b5; font-size: 9px; }
.chart .line { fill: none; stroke: #0f9f8f; stroke-width: 2; }
.chart .dot { fill: #fff; stroke: #0f9f8f; stroke-width: 2; }
.legend { display: flex; gap: 16px; font-size: 11px; color: var(--muted); justify-content: flex-end; padding: 2px 8px 0; }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; }

/* ---------------- tables ---------------- */
.table-wrap { overflow-x: auto; border-radius: 0 0 var(--radius) var(--radius); }
table.data { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.data th { text-align: left; font-weight: 600; color: #7f8ca1; font-size: 11px; letter-spacing: .2px; background: #f9fbfe; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data td { padding: 11px 12px; border-bottom: 1px solid #f0f3f8; vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: #fafcff; }
table.data tr.clickable { cursor: pointer; }
table.data .order-no { font-weight: 600; color: #20304a; font-variant-numeric: tabular-nums; }
table.data .sub { display: block; font-size: 10.5px; color: #98a3b5; margin-top: 1px; }
table.data .amount { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data .actions { white-space: nowrap; text-align: right; }
.table-empty { padding: 44px 20px; text-align: center; color: #96a2b4; font-size: 13px; }
.table-tools { display: flex; align-items: center; gap: 8px; padding: 14px 16px; border-bottom: 1px solid #edf1f7; flex-wrap: wrap; }
.table-tools .spacer { flex: 1; }
.order-cards { display: none; }
.order-card { padding: 13px 14px; border-bottom: 1px solid #eef2f8; }
.order-card:last-child { border-bottom: 0; }
.order-card .oc-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.order-card .oc-name { font-size: 13px; font-weight: 600; margin-top: 5px; }
.order-card .oc-line { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 5px; font-size: 11.5px; color: #667389; }
.order-card .oc-line b { color: var(--ink); font-size: 14px; }
.order-card .oc-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 7px; font-size: 10.5px; color: #98a3b5; }
.pagination { display: flex; justify-content: flex-end; align-items: center; gap: 8px; padding: 13px 16px; border-top: 1px solid #f0f3f8; font-size: 12px; color: var(--muted); }
.pagination button { border: 1px solid var(--line); background: #fff; border-radius: 7px; width: 28px; height: 28px; }
.pagination button[disabled] { opacity: .4; }

/* ---------------- badges ---------------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 7px; border-radius: 5px; font-size: 10.5px; font-weight: 600; line-height: 1.5; white-space: nowrap; border: 1px solid transparent; }
.badge:before { content: ""; width: 4px; height: 4px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge.no-dot:before { display: none; }
.badge.gray { background: #f0f3f8; color: #68758a; }
.badge.blue { background: var(--blue-soft); color: var(--blue-dark); }
.badge.teal { background: var(--teal-soft); color: #0a7d72; }
.badge.green { background: var(--green-soft); color: var(--green); }
.badge.amber { background: var(--amber-soft); color: #a97014; }
.badge.red { background: var(--red-soft); color: var(--red); }
.badge.purple { background: var(--purple-soft); color: var(--purple); }
.badge.dark { background: #e9eef6; color: #293b57; }
.tag { font-size: 10px; padding: 2px 6px; border-radius: 4px; background: #f2f5fa; color: #718097; }

/* ---------------- lists / feed ---------------- */
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: flex-start; gap: 10px; padding: 11px 0; border-bottom: 1px solid #f1f4f9; }
.list-item:last-child { border-bottom: 0; }
.list-item .li-icon { width: 30px; height: 30px; border-radius: 8px; display: grid; place-content: center; flex: none; background: #f3f6fb; color: #64738b; font-size: 13px; }
.list-item .li-main { min-width: 0; flex: 1; }
.list-item .li-main b { display: block; font-size: 12px; font-weight: 600; }
.list-item .li-main span { display: block; font-size: 11px; color: #8e9aad; margin-top: 2px; }
.list-item .li-side { text-align: right; font-size: 11px; color: #8e9aad; flex: none; }
.alert-item { display: flex; gap: 9px; padding: 9px 10px; border-radius: 9px; background: #fbfcfe; border: 1px solid #eef2f8; margin-bottom: 7px; align-items: center; }
.alert-item .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--amber); flex: none; }
.alert-item .dot.red { background: var(--red); }
.alert-item .dot.blue { background: var(--blue); }
.alert-item .ai-text { font-size: 11.5px; min-width: 0; flex: 1; }
.alert-item .ai-text b { font-weight: 600; }
.alert-item .ai-text span { display: block; color: #929dae; font-size: 10.5px; }
.staff-pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 7px; border-radius: 20px; background: #f7f9fd; border: 1px solid #edf1f7; font-size: 11px; margin: 0 5px 5px 0; }
.staff-pill .online { width: 6px; height: 6px; border-radius: 50%; background: #c8d1df; }
.staff-pill .online.on { background: #22c55e; box-shadow: 0 0 0 3px rgba(34,197,94,.13); }

/* ---------------- tabs ---------------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab { padding: 9px 14px; border: 0; background: transparent; color: #7a879c; font-size: 12.5px; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab:hover { color: var(--ink); }
.tab.active { color: var(--blue); border-bottom-color: var(--blue); font-weight: 600; }
.segmented { display: inline-flex; padding: 3px; background: #f1f5fa; border-radius: 9px; gap: 2px; }
.segmented button { border: 0; background: transparent; color: #6f7c91; font-size: 12px; padding: 5px 11px; border-radius: 6px; }
.segmented button.active { background: #fff; color: var(--ink); box-shadow: 0 2px 6px rgba(20,40,70,.08); font-weight: 600; }

/* ---------------- detail ---------------- */
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 16px; align-items: start; }
.info-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 18px; }
.info-item .k { font-size: 10.5px; color: #8d99ac; margin-bottom: 3px; }
.info-item .v { font-size: 13px; color: #25344b; word-break: break-word; }
.info-item .v.strong { font-weight: 600; }
.detail-hero { background: linear-gradient(120deg, #0f2542, #163d57); border-radius: var(--radius); padding: 20px 22px; color: #fff; display: flex; justify-content: space-between; gap: 18px; flex-wrap: wrap; margin-bottom: 16px; }
.detail-hero h1 { font-size: 20px; letter-spacing: .4px; }
.detail-hero .sub { color: rgba(255,255,255,.55); font-size: 11px; margin-top: 3px; }
.detail-hero .amount { text-align: right; }
.detail-hero .amount b { display: block; font-size: 29px; font-variant-numeric: tabular-nums; }
.detail-hero .amount span { font-size: 10px; color: rgba(255,255,255,.55); }
.amount-summary { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid #edf1f7; }
.amount-summary .as { padding: 13px 16px; border-right: 1px solid #edf1f7; }
.amount-summary .as:last-child { border-right: 0; }
.amount-summary .as span { display: block; font-size: 10.5px; color: #8d99ac; }
.amount-summary .as b { display: block; font-size: 17px; margin-top: 2px; font-variant-numeric: tabular-nums; }
.timeline { position: relative; padding-left: 17px; }
.timeline:before { content: ""; position: absolute; left: 5px; top: 5px; bottom: 8px; width: 1px; background: #e6ecf5; }
.tl-item { position: relative; padding-bottom: 13px; }
.tl-item:before { content: ""; position: absolute; left: -15px; top: 5px; width: 7px; height: 7px; border-radius: 50%; background: #c7d3e5; border: 2px solid #fff; box-shadow: 0 0 0 1px #dbe4f0; }
.tl-item:first-child:before { background: var(--blue); box-shadow: 0 0 0 1px #bcd0fa; }
.tl-item b { display: block; font-size: 12px; font-weight: 600; }
.tl-item span { display: block; color: #95a0b2; font-size: 10.5px; }
.sig-img { display: block; max-height: 100px; max-width: 100%; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.qr-box { text-align: center; padding: 12px; border: 1px dashed #d6dfec; border-radius: 10px; background: #fbfdff; }
.qr-box img { width: 160px; height: 160px; object-fit: contain; }
.qr-box p { font-size: 10.5px; color: var(--muted); margin-top: 5px; }
.attachment-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.attachment-grid img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); cursor: zoom-in; }

/* ---------------- modal / toast / drawer ---------------- */
.modal-backdrop { position: fixed; inset: 0; z-index: 100; background: rgba(12,22,38,.48); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; padding: 20px; animation: fadeIn .15s ease; }
.modal { background: #fff; border-radius: 16px; width: 100%; max-width: 560px; max-height: calc(100vh - 40px); display: flex; flex-direction: column; box-shadow: var(--shadow-lg); animation: popIn .18s ease; }
.modal.wide { max-width: 860px; }
.modal.xwide { max-width: 1080px; }
.modal.slim { max-width: 430px; }
.modal-head { display: flex; align-items: flex-start; gap: 12px; padding: 18px 20px 14px; border-bottom: 1px solid #eef2f8; }
.modal-head h2 { font-size: 17px; }
.modal-head p { color: var(--muted); font-size: 11.5px; margin-top: 3px; }
.modal-head .close { margin-left: auto; border: 0; background: #f4f7fb; width: 30px; height: 30px; border-radius: 8px; color: #7d899c; flex: none; }
.modal-body { padding: 18px 20px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 13px 20px; border-top: 1px solid #eef2f8; background: #fbfcfe; border-radius: 0 0 16px 16px; flex-wrap: wrap; }
.modal-foot .left { margin-right: auto; }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes popIn { from { opacity: 0; transform: translateY(8px) scale(.985); } }
.toast-root { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 300; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { pointer-events: auto; min-width: 220px; max-width: min(460px, 92vw); padding: 10px 15px; border-radius: 10px; background: #13243c; color: #fff; font-size: 12.5px; box-shadow: 0 14px 36px rgba(0,0,0,.2); display: flex; align-items: center; gap: 8px; animation: toastIn .2s ease; }
.toast.success { background: #0d7a5f; }
.toast.error { background: #b93636; }
.toast.warn { background: #9a6514; }
.toast .t-icon { width: 16px; height: 16px; border-radius: 50%; background: rgba(255,255,255,.2); display: grid; place-content: center; font-size: 10px; flex: none; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } }
.drawer-backdrop { position: fixed; inset: 0; z-index: 90; background: rgba(12,22,38,.34); animation: fadeIn .15s; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(430px, 94vw); background: #fff; z-index: 91; display: flex; flex-direction: column; box-shadow: -14px 0 40px rgba(14,28,50,.14); animation: slideIn .22s ease; }
@keyframes slideIn { from { transform: translateX(30px); opacity: .7; } }
.drawer-head { padding: 18px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.drawer-head h2 { font-size: 16px; }
.drawer-head button { margin-left: auto; }
.drawer-body { padding: 10px 14px; overflow-y: auto; flex: 1; }

/* ---------------- empty / loading ---------------- */
.empty { padding: 52px 20px; text-align: center; color: #9aa6b8; }
.empty .empty-icon { width: 54px; height: 54px; border-radius: 50%; background: #f2f6fb; display: grid; place-content: center; margin: 0 auto 12px; color: #b2bdcc; }
.empty b { display: block; color: #5f6d83; font-size: 13px; margin-bottom: 4px; }
.empty p { font-size: 11.5px; }
.spinner { width: 20px; height: 20px; border: 2px solid #dbe5f4; border-top-color: var(--blue); border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-panel { padding: 60px; display: grid; place-items: center; gap: 10px; color: #8d99ac; font-size: 12px; }
.skeleton { background: linear-gradient(90deg, #f0f4f9, #f8fafd, #f0f4f9); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: 8px; height: 14px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------------- login helpers ---------------- */
.password-wrap { position: relative; }
.password-wrap .input { padding-right: 42px; }
.password-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: #8c98aa; padding: 5px; }

/* ---------------- misc ---------------- */
.notice { padding: 10px 12px; border-radius: 9px; background: #f5f9ff; border: 1px solid #dce9ff; color: #3c5a86; font-size: 11.5px; line-height: 1.65; }
.notice.warn { background: #fff9ec; border-color: #f6e2b8; color: #8a641d; }
.notice.danger { background: #fff5f5; border-color: #f3d2d2; color: #9d3b3b; }
.notice.success { background: #f1fbf7; border-color: #cdeede; color: #1d7a58; }
.divider { height: 1px; background: var(--line); margin: 16px 0; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; font-size: 12px; border-bottom: 1px dashed #eef2f8; }
.kv:last-child { border-bottom: 0; }
.kv span { color: #8b97aa; }
.kv b { font-weight: 600; text-align: right; }
.avatar-sm { width: 26px; height: 26px; border-radius: 50%; background: #edf3fb; color: #51627c; display: inline-grid; place-content: center; font-size: 10px; font-weight: 700; }
.fab { display: none; }

/* ---------------- portal / public ---------------- */
.public-page { min-height: 100vh; background: #f0f4fa; display: flex; justify-content: center; }
.portal { width: 100%; max-width: 640px; min-height: 100vh; background: #f4f7fb; position: relative; padding-bottom: 76px; box-shadow: 0 0 60px rgba(20,40,72,.08); }
.portal-top { background: linear-gradient(135deg, #0f2542, #154455 62%, #0d6157); color: #fff; padding: 22px 20px 26px; border-radius: 0 0 22px 22px; position: relative; overflow: hidden; }
.portal-top:after { content: ""; position: absolute; width: 220px; height: 220px; border: 1px solid rgba(255,255,255,.1); border-radius: 50%; right: -80px; top: -100px; box-shadow: 0 0 0 40px rgba(255,255,255,.025); }
.portal-brand { display: flex; align-items: center; gap: 9px; position: relative; z-index: 1; }
.portal-brand .mark { width: 32px; height: 32px; border-radius: 9px; background: linear-gradient(135deg,#3b82f6,#14b8a6); display: grid; place-content: center; font-weight: 800; font-size: 12px; }
.portal-brand b { font-size: 13px; display: block; }
.portal-brand span { display: block; font-size: 9px; color: rgba(255,255,255,.5); letter-spacing: 1px; }
.portal-greet { margin-top: 22px; position: relative; z-index: 1; }
.portal-greet h1 { font-size: 22px; letter-spacing: -.3px; }
.portal-greet p { color: rgba(255,255,255,.6); font-size: 11.5px; margin-top: 4px; }
.portal-body { padding: 16px; }
.portal-card { background: #fff; border-radius: 14px; border: 1px solid #e8eef7; box-shadow: 0 6px 20px rgba(22,40,72,.045); padding: 16px; margin-bottom: 12px; }
.portal-card h3 { font-size: 14px; margin-bottom: 10px; display: flex; align-items: center; justify-content: space-between; }
.portal-quick { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: -28px; position: relative; z-index: 2; padding: 0 16px; }
.quick-card { background: #fff; border-radius: 12px; padding: 13px; border: 1px solid #e8eef7; box-shadow: 0 8px 24px rgba(22,40,72,.08); display: flex; align-items: center; gap: 10px; cursor: pointer; }
.quick-card .qi { width: 34px; height: 34px; border-radius: 9px; display: grid; place-content: center; background: #eaf2ff; color: var(--blue); }
.quick-card .qi.teal { background: var(--teal-soft); color: var(--teal); }
.quick-card b { display: block; font-size: 12.5px; }
.quick-card span { display: block; font-size: 10px; color: #96a2b4; }
.portal-tabs { display: grid; grid-template-columns: repeat(5, 1fr); background: #fff; border-top: 1px solid #e8eef7; position: fixed; bottom: 0; width: 100%; max-width: 640px; z-index: 20; padding-bottom: env(safe-area-inset-bottom); }
.portal-tab { border: 0; background: transparent; padding: 8px 0 7px; color: #8d99ac; font-size: 10px; display: grid; gap: 2px; justify-items: center; }
.portal-tab svg { width: 20px; height: 20px; }
.portal-tab.active { color: var(--blue); }
.portal .page-head { padding: 2px 2px 0; }
.portal .page-head h1 { font-size: 19px; }
.portal-form .field > label { font-size: 11.5px; }
.portal-form .input, .portal-form .select, .portal-form .textarea { min-height: 42px; font-size: 14px; }
.portal-empty { text-align: center; color: #94a0b2; padding: 28px 10px; font-size: 12px; }
.repair-item { border: 1px solid #e8eef7; border-radius: 11px; padding: 12px; margin-bottom: 9px; background: #fff; }
.repair-item .ri-top { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.repair-item .ri-top b { font-size: 12.5px; }
.repair-item .ri-dev { font-size: 12px; margin-top: 4px; color: #516078; }
.repair-item .ri-fault { font-size: 11px; color: #8c98aa; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.repair-item .ri-foot { display: flex; justify-content: space-between; margin-top: 7px; font-size: 10px; color: #99a5b7; }
.portal-success { text-align: center; padding: 38px 20px; }
.success-check { width: 66px; height: 66px; border-radius: 50%; background: var(--green-soft); color: var(--green); display: grid; place-content: center; margin: 0 auto 16px; animation: popIn .3s; }
.success-check svg { width: 32px; height: 32px; }
.portal-success h2 { font-size: 20px; margin-bottom: 6px; }
.portal-success p { color: var(--muted); font-size: 12px; line-height: 1.7; }
.portal-success .order-badge { display: inline-block; margin: 14px 0; padding: 8px 18px; border-radius: 8px; background: #f2f7ff; color: var(--blue); font-weight: 700; letter-spacing: .5px; }
.join-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 22px; background: radial-gradient(circle at 20% 0, #e7efff, transparent 45%), radial-gradient(circle at 100% 100%, #e2f8f2, transparent 35%), #f5f8fc; }
.join-card { width: 100%; max-width: 460px; background: #fff; border-radius: 18px; border: 1px solid var(--line); box-shadow: 0 22px 60px rgba(22,40,72,.12); overflow: hidden; }
.join-head { padding: 26px 26px 20px; color: #fff; background: linear-gradient(135deg, #0f2542, #164454); }
.join-head .mark { width: 40px; height: 40px; border-radius: 11px; background: linear-gradient(135deg,#3b82f6,#14b8a6); display: grid; place-content: center; font-weight: 800; margin-bottom: 14px; }
.join-head h1 { font-size: 20px; }
.join-head p { color: rgba(255,255,255,.58); font-size: 11.5px; margin-top: 4px; }
.join-body { padding: 22px 26px 26px; }
.sign-page { min-height: 100vh; background: #f0f4fa; padding: 20px; display: flex; justify-content: center; align-items: flex-start; }
.sign-card { width: 100%; max-width: 680px; background: #fff; border-radius: 16px; border: 1px solid var(--line); box-shadow: 0 18px 50px rgba(22,40,72,.1); overflow: hidden; }
.sign-head { padding: 18px 22px; background: linear-gradient(120deg, #0f2542, #164454); color: #fff; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sign-head h1 { font-size: 17px; }
.sign-head p { color: rgba(255,255,255,.55); font-size: 10.5px; margin-top: 2px; }
.sign-body { padding: 20px 22px; }
.sign-items { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin: 12px 0; }
.sign-items .si { display: flex; justify-content: space-between; padding: 8px 11px; border-bottom: 1px solid #f0f3f8; font-size: 12px; }
.sign-items .si:last-child { border-bottom: 0; }
.sig-pad-wrap { border: 1.5px dashed #b9c8dc; border-radius: 10px; background: #fbfdff; overflow: hidden; position: relative; }
.sig-pad-wrap canvas { display: block; width: 100%; height: 190px; touch-action: none; cursor: crosshair; }
.sig-pad-tip { position: absolute; inset: 0; display: grid; place-items: center; color: #b3bfce; font-size: 12px; pointer-events: none; }
.sig-pad-tools { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.public-foot { text-align: center; color: #a3adbd; font-size: 10.5px; padding: 18px 0 8px; }

/* ---------------- report ---------------- */
.report-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; }
.bar-row { display: grid; grid-template-columns: 100px 1fr 76px; align-items: center; gap: 10px; margin-bottom: 9px; font-size: 11.5px; }
.bar-track { height: 7px; background: #f0f4f9; border-radius: 4px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 4px; background: linear-gradient(90deg, #3b82f6, #14b8a6); }
.bar-row .val { text-align: right; color: #536179; font-variant-numeric: tabular-nums; }

/* ---------------- responsive ---------------- */
@media (max-width: 1200px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .card-grid-4 { grid-template-columns: repeat(2, 1fr); }
  .detail-grid { grid-template-columns: 1fr; }
  .detail-grid .side { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
  .detail-grid .side .card + .card { margin-top: 0; }
}
@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { transform: translateX(-100%); transition: transform .22s; box-shadow: 20px 0 50px rgba(0,0,0,.2); }
  .sidebar.open { transform: translateX(0); }
  .main { grid-column: 1; }
  .mobile-menu { display: grid; }
  .topbar { padding: 0 16px; height: 58px; }
  .topbar-date { display: none; }
  .content { padding: 18px 16px 86px; overflow-x: hidden; }
  .mobile-nav { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; bottom: 0; left: 0; right: 0; z-index: 35; background: rgba(255,255,255,.96); border-top: 1px solid var(--line); backdrop-filter: blur(10px); padding-bottom: env(safe-area-inset-bottom); }
  .mobile-nav a, .mobile-more { display: grid; justify-items: center; gap: 2px; padding: 7px 0 6px; color: #8a96aa; font-size: 9.5px; text-decoration: none; border: 0; background: transparent; }
  .mobile-nav a.active { color: var(--blue); }
  .mobile-nav svg { width: 20px; height: 20px; }
  .card-grid, .card-grid-3 { grid-template-columns: 1fr; }
  .report-grid { grid-template-columns: 1fr; }
  .dash-grid { grid-template-columns: 1fr; }
  .onboard-grid { grid-template-columns: repeat(2, 1fr); }
  .hero-strip { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 680px) {
  h1 { font-size: 22px; }
  .page-head { margin-bottom: 14px; }
  .page-head .title h1 { font-size: 20px; }
  .stat-grid { gap: 9px; }
  .stat { padding: 13px; }
  .stat .value { font-size: 21px; }
  .form-grid, .form-grid-3 { grid-template-columns: 1fr; }
  .check-grid { grid-template-columns: repeat(2, 1fr); }
  .info-grid { grid-template-columns: repeat(2, 1fr); }
  .card-body { padding: 14px; }
  .card-head { padding: 13px 14px; }
  .table-wrap table.data { min-width: 680px; }
  .mobile-hide { display: none !important; }
  .amount-summary .as { padding: 10px; }
  .amount-summary .as b { font-size: 15px; }
  .modal-backdrop { padding: 10px; align-items: flex-end; }
  .modal { max-height: calc(100vh - 20px); border-radius: 16px 16px 10px 10px; }
  .modal-foot { border-radius: 0 0 10px 10px; }
  .detail-grid .side { grid-template-columns: 1fr; }
  .detail-hero { padding: 16px; }
  .detail-hero .amount b { font-size: 23px; }
  .auth-panel { padding: 22px; }
  .attachment-grid { grid-template-columns: repeat(3, 1fr); }
  .order-table { display: none; }
  .order-cards { display: block; }
}
@media print {
  body { background: #fff; }
  .sidebar, .topbar, .mobile-nav, .page-actions, .no-print, .toast-root { display: none !important; }
  .shell { display: block; }
  .main { grid-column: 1; }
  .content { padding: 0; max-width: none; }
  .card { box-shadow: none; border-color: #ccd6e4; break-inside: avoid; }
  .print-only { display: block !important; }
  .print-sheet { padding: 10mm 8mm; }
  table.data th { background: #f2f5f9 !important; -webkit-print-color-adjust: exact; }
}
.print-only { display: none; }
