:root {
  --ink: #0e1726;
  --muted: #64748b;
  --soft: #94a3b8;
  --line: #e6ebf2;
  --bg: #f4f7fb;
  --card: #fff;
  --brand: #0f766e;
  --brand2: #14b8a6;
  --brand-soft: #e6f7f4;
  --amber: #d97706;
  --amber-soft: #fff7e6;
  --red: #dc2626;
  --red-soft: #fef2f2;
  --blue: #2563eb;
  --blue-soft: #eff6ff;
  --radius: 18px;
  --shadow: 0 12px 30px rgba(15, 23, 42, .05);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
}
button, input, select, textarea { font-family: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
.hidden { display: none !important; }
.boot-error {
  position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 999;
  background: #fef2f2; border: 1px solid #fecaca; color: #991b1b;
  padding: 12px 14px; border-radius: 10px; font-size: 12px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, .15); line-height: 1.6;
}
.muted { color: var(--muted); }
.soft { color: var(--soft); }
.strong { font-weight: 650; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.divider { height: 1px; background: var(--line); margin: 14px 0; }
.link { color: var(--brand); font-weight: 600; cursor: pointer; }
.link:hover { text-decoration: underline; }

/* ============ buttons ============ */
.btn {
  border: 0; border-radius: 10px; padding: 10px 16px;
  font-size: 12px; font-weight: 600; background: var(--brand); color: #fff;
  box-shadow: 0 8px 18px rgba(15, 118, 110, .18);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  transition: .18s;
}
.btn:hover { background: #0b5f59; }
.btn.ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); box-shadow: none; }
.btn.ghost:hover { border-color: #cbd5e1; background: #f8fafc; }
.btn.small { padding: 7px 11px; font-size: 11px; border-radius: 8px; }
.btn.large { padding: 13px 22px; font-size: 13px; }
.btn.danger { background: var(--red); box-shadow: 0 8px 18px rgba(220, 38, 38, .15); }
.btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }

/* ============ public ============ */
.public-shell { min-height: 100vh; background: #f8fafc; }
.public-header {
  height: 64px; padding: 0 5vw;
  background: radial-gradient(560px 320px at 6% -40%, rgba(59,130,246,.28) 0%, transparent 60%), linear-gradient(180deg, #0a1830 0%, #0f2c56 100%);
  border-bottom: 1px solid rgba(255,255,255,.08);
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  position: sticky; top: 0; z-index: 20;
}
.public-brand { display: flex; align-items: baseline; gap: 9px; font-weight: 800; font-size: 18px; letter-spacing: -.3px; color: #fff; }
.public-brand span { font-size: 10px; font-weight: 500; color: #7d93b4; letter-spacing: .3px; }
.public-nav { display: flex; gap: 24px; font-size: 12px; color: #a9bdd8; }
.public-nav a:hover { color: #fff; }
.public-actions { display: flex; gap: 8px; align-items: center; }
.public-header .btn.ghost { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.16); color: #dce6f5; }
.public-header .btn.ghost:hover { background: rgba(255,255,255,.16); border-color: rgba(255,255,255,.28); color: #fff; }
.public-header .btn.btn-brand { background: linear-gradient(135deg, #14b8a6, #0f766e); border: 0; color: #fff; box-shadow: 0 6px 16px rgba(20,184,166,.35); }
.public-header .btn.btn-brand:hover { background: linear-gradient(135deg, #0f9488, #0b5f59); }
.public-main { max-width: 1220px; margin: 0 auto; padding: 0 32px 54px; }

.hero {
  display: grid; grid-template-columns: 1.15fr .85fr; gap: 54px; align-items: center;
  padding: 64px 0 38px;
}
.hero-kicker { font-size: 11px; letter-spacing: 2px; color: var(--brand); font-weight: 700; }
.hero h1 { font-size: 50px; line-height: 1.08; letter-spacing: -2.5px; margin: 15px 0 17px; font-weight: 800; }
.hero h1 em { font-style: normal; color: var(--brand); }
.hero p { font-size: 14px; line-height: 1.9; color: var(--muted); max-width: 540px; margin: 0 0 23px; }
.hero-search {
  display: flex; background: #fff; border: 1px solid var(--line); border-radius: 14px;
  padding: 7px; box-shadow: 0 18px 40px rgba(15, 23, 42, .08); max-width: 680px;
}
.hero-search select { border: 0; background: #f8fafc; border-radius: 9px; padding: 0 12px; font-size: 12px; color: var(--ink); outline: none; }
.hero-search input { flex: 1; border: 0; padding: 12px 13px; font-size: 13px; outline: none; min-width: 0; }
.hero-search button { border: 0; background: var(--brand); color: #fff; border-radius: 9px; padding: 0 22px; font-size: 12px; font-weight: 600; }
.hero-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.hero-chips a, .hero-chips span { font-size: 11px; color: var(--muted); background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 6px 10px; }
.hero-chips a:hover { color: var(--brand); border-color: #99f6e4; }

.hero-card {
  background: linear-gradient(145deg, #0b1220, #12283a); border-radius: 24px; color: #fff;
  padding: 26px; box-shadow: 0 30px 60px rgba(15, 23, 42, .25); position: relative; overflow: hidden;
}
.hero-card::after {
  content: ""; position: absolute; width: 220px; height: 220px; border-radius: 50%;
  background: radial-gradient(circle, rgba(20, 184, 166, .35), transparent 70%);
  right: -70px; top: -70px;
}
.hero-card h3 { font-size: 12px; color: #94a3b8; font-weight: 500; margin: 0 0 18px; }
.hero-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; position: relative; z-index: 1; }
.hero-stat strong { display: block; font-size: 26px; letter-spacing: -1px; }
.hero-stat span { display: block; font-size: 10px; color: #94a3b8; margin-top: 4px; }
.hero-note { margin-top: 22px; padding-top: 16px; border-top: 1px solid rgba(255,255,255,.1); font-size: 10px; color: #94a3b8; line-height: 1.8; position: relative; z-index: 1; }

.section { padding: 18px 0 28px; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 16px; gap: 12px; }
.section-head h2 { font-size: 20px; letter-spacing: -.5px; margin: 0; }
.section-head span { font-size: 11px; color: var(--soft); }
.listing-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.listing-card { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 16px; box-shadow: var(--shadow); }
.listing-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 11px; }
.listing-time { font-size: 10px; color: var(--soft); }
.listing-card h3 { font-size: 14px; margin: 0 0 6px; letter-spacing: -.2px; }
.listing-spec { font-size: 11px; color: var(--muted); margin: 0 0 13px; line-height: 1.6; min-height: 35px; }
.listing-meta { display: flex; justify-content: space-between; font-size: 11px; color: var(--ink); padding: 10px 0; border-top: 1px solid #f1f5f9; border-bottom: 1px solid #f1f5f9; }
.listing-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 11px; font-size: 10px; color: var(--soft); gap: 10px; }
.listing-foot a, .listing-foot button { border: 0; background: transparent; color: var(--brand); font-size: 11px; font-weight: 600; padding: 0; }
.listing-foot a:hover { text-decoration: underline; }
.public-footer { max-width: 1220px; margin: 0 auto; padding: 24px 32px 40px; border-top: 1px solid var(--line); color: var(--soft); font-size: 10px; display: flex; justify-content: space-between; gap: 20px; }

.channel-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 20px; }
.channel-chip { font-size: 11px; color: var(--muted); background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 7px 12px; }
.channel-chip.active { background: var(--brand-soft); border-color: #99f6e4; color: var(--brand); font-weight: 600; }
.chip-x { border: 0; background: transparent; color: var(--brand); font-size: 12px; padding: 0 2px; margin-left: 3px; }
.type-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.type-card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 5px; box-shadow: var(--shadow); transition: .18s; }
.type-card:hover { border-color: #99f6e4; transform: translateY(-2px); }
.type-card .type-icon { width: 28px; height: 28px; border-radius: 8px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-size: 13px; margin-bottom: 3px; }
.type-card strong { font-size: 12px; }
.type-card span { font-size: 9px; color: var(--soft); line-height: 1.5; }
.channel-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.channel-card { border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: #fbfdff; }
.channel-card-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 5px; }
.channel-card-top strong { font-size: 12px; }
.channel-card p { font-size: 10px; color: var(--soft); line-height: 1.6; margin: 0 0 10px; min-height: 30px; }
.search-form { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 12px; box-shadow: var(--shadow); margin: 18px 0 24px; }
.search-main { display: flex; gap: 8px; align-items: center; }
.search-main select, .search-main input { border: 1px solid var(--line); border-radius: 9px; padding: 10px 11px; font-size: 12px; outline: none; background: #fff; }
.search-main input { flex: 1; min-width: 0; }
.search-main select:focus, .search-main input:focus { border-color: var(--brand2); box-shadow: 0 0 0 3px var(--brand-soft); }
.search-filters { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.search-filters label { display: flex; flex-direction: column; gap: 4px; font-size: 9px; color: var(--soft); }
.search-filters input, .search-filters select { border: 1px solid var(--line); border-radius: 8px; padding: 8px 9px; font-size: 10px; outline: none; background: #fff; }
.search-filters input:focus, .search-filters select:focus { border-color: var(--brand2); box-shadow: 0 0 0 3px var(--brand-soft); }

/* ============ auth ============ */
.auth-wrap { min-height: calc(100vh - 68px); display: grid; place-items: center; padding: 40px 20px; }
.auth-card { width: min(420px, 100%); background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: 28px; box-shadow: 0 24px 50px rgba(15, 23, 42, .08); }
.auth-card h1 { font-size: 24px; letter-spacing: -.6px; margin: 0 0 8px; }
.auth-card p { color: var(--muted); font-size: 12px; line-height: 1.7; margin: 0 0 20px; }
.auth-form { display: flex; flex-direction: column; gap: 13px; }
.auth-form label { font-size: 11px; color: var(--muted); font-weight: 600; display: block; margin-bottom: 5px; }
.auth-form input { width: 100%; border: 1px solid var(--line); border-radius: 9px; padding: 11px 12px; font-size: 13px; outline: none; }
.auth-form input:focus { border-color: var(--brand2); box-shadow: 0 0 0 3px var(--brand-soft); }
.auth-actions { display: flex; gap: 9px; flex-direction: column; margin-top: 4px; }
.auth-note { background: #f8fafc; border: 1px dashed var(--line); border-radius: 10px; padding: 10px 12px; font-size: 11px; color: var(--muted); line-height: 1.7; margin-top: 16px; }
.auth-error { color: var(--red); font-size: 11px; min-height: 16px; }

/* ============ console shell ============ */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 244px; flex: 0 0 244px; background: linear-gradient(180deg, #0b1220, #101b2f);
  color: #cbd5e1; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
  border-right: 1px solid rgba(255,255,255,.05);
}
.brand { display: flex; align-items: center; gap: 12px; padding: 24px 22px 18px; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 12px;
  background: linear-gradient(135deg, var(--brand2), var(--brand));
  display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 19px;
  box-shadow: 0 8px 20px rgba(20, 184, 166, .28);
}
.brand-text strong { display: block; font-size: 16px; letter-spacing: .5px; color: #fff; }
.brand-text span { display: block; font-size: 9px; letter-spacing: 2.2px; color: #64748b; margin-top: 3px; }
.workspace { margin: 6px 16px 16px; padding: 12px 14px; border-radius: 12px; background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.06); }
.workspace-label { font-size: 10px; color: #64748b; letter-spacing: .8px; }
.workspace-name { font-size: 13px; color: #e2e8f0; margin-top: 5px; display: flex; justify-content: space-between; gap: 8px; }
.chev { color: #64748b; }
.nav { padding: 4px 12px; display: flex; flex-direction: column; gap: 3px; flex: 1; overflow: auto; }
.nav-item {
  display: flex; align-items: center; gap: 11px; border: 0; background: transparent;
  color: #94a3b8; padding: 11px 12px; border-radius: 10px; font-size: 13px; text-align: left; transition: .18s;
}
.nav-ico { width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center; background: rgba(255,255,255,.04); color: #64748b; font-size: 12px; }
.nav-item:hover { background: rgba(255,255,255,.05); color: #e2e8f0; }
.nav-item.active { background: linear-gradient(90deg, rgba(20,184,166,.18), rgba(20,184,166,.04)); color: #fff; box-shadow: inset 2px 0 0 var(--brand2); }
.nav-item.active .nav-ico { background: rgba(20,184,166,.2); color: #5eead4; }
.nav-sep { height: 1px; background: rgba(255,255,255,.06); margin: 10px 12px; }
.sidebar-bottom { padding: 12px 16px 18px; border-top: 1px solid rgba(255,255,255,.06); }
.portal-link { width: 100%; border: 1px solid rgba(255,255,255,.1); background: rgba(255,255,255,.04); color: #cbd5e1; border-radius: 10px; padding: 10px 12px; font-size: 12px; display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.portal-link:hover { background: rgba(255,255,255,.08); color: #fff; }
.user-card { display: flex; align-items: center; gap: 10px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg, #f59e0b, #ef4444); color: #fff; display: grid; place-items: center; font-size: 13px; font-weight: 700; flex: 0 0 34px; }
.user-card strong { display: block; font-size: 12px; color: #e2e8f0; }
.user-card span { display: block; font-size: 10px; color: #64748b; margin-top: 2px; }

.main { flex: 1; min-width: 0; }
.topbar { height: 64px; background: radial-gradient(560px 320px at 6% -40%, rgba(59,130,246,.28) 0%, transparent 60%), linear-gradient(180deg, #0a1830 0%, #0f2c56 100%); border-bottom: 1px solid rgba(255,255,255,.08); display: flex; align-items: center; justify-content: space-between; padding: 0 28px; position: sticky; top: 0; z-index: 20; }
.topbar .crumb { color: #9db3d2; }
.topbar .crumb .tenant { color: #fff; }
.topbar .crumb .slash { color: #3f587e; }
.topbar .icon-btn { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.16); color: #c4d4ea; }
.topbar .icon-btn:hover { background: rgba(255,255,255,.16); border-color: rgba(255,255,255,.28); color: #fff; }
.topbar .role-select { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.16); color: #c4d4ea; }
.topbar .role-wrap { color: #7d93b4; }
.topbar .btn.ghost { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.16); color: #dce6f5; }
.topbar .btn.ghost:hover { background: rgba(255,255,255,.16); border-color: rgba(255,255,255,.28); color: #fff; }
.topbar .btn:not(.ghost) { background: linear-gradient(135deg, #14b8a6, #0f766e); }
.crumb { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 9px; }
.crumb .tenant { color: var(--ink); font-weight: 600; }
.crumb .slash { color: #cbd5e1; }
.crumb .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--brand2); box-shadow: 0 0 0 4px var(--brand-soft); }
.top-actions { display: flex; align-items: center; gap: 12px; }
.demo-pill { font-size: 10px; color: var(--amber); background: var(--amber-soft); border: 1px solid #fde68a; border-radius: 999px; padding: 5px 10px; letter-spacing: .4px; white-space: nowrap; }
.role-select { border: 1px solid var(--line); background: #fff; color: var(--muted); border-radius: 8px; padding: 7px 9px; font-size: 11px; outline: none; max-width: 110px; }
.role-select:focus { border-color: var(--brand2); box-shadow: 0 0 0 3px var(--brand-soft); }
.role-wrap { display: inline-flex; align-items: center; gap: 6px; font-size: 10px; color: var(--soft); }
.icon-btn { width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--line); background: #fff; color: var(--muted); display: grid; place-items: center; position: relative; font-size: 14px; }
.icon-btn:hover { border-color: #cbd5e1; color: var(--ink); }
.content { padding: 26px 30px 54px; max-width: 1500px; margin: 0 auto; }

/* ============ page/card ============ */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.eyebrow { font-size: 11px; color: var(--soft); letter-spacing: .8px; margin: 0 0 7px; }
.page-head h1 { font-size: 26px; line-height: 1.1; margin: 0 0 7px; letter-spacing: -.6px; }
.page-head .sub { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.7; }
.head-actions { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; }
.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; padding: 20px 22px 0; gap: 16px; }
.card-head h2 { font-size: 14px; margin: 0; letter-spacing: -.1px; }
.card-head .hint { font-size: 11px; color: var(--soft); }
.card-body { padding: 18px 22px 22px; }
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 18px; }
.kpi { position: relative; overflow: hidden; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 18px 19px 16px; box-shadow: var(--shadow); }
.kpi::after { content: ""; position: absolute; left: 0; top: 0; width: 3px; height: 100%; background: var(--brand2); }
.kpi.amber::after { background: #f59e0b; }
.kpi.red::after { background: #ef4444; }
.kpi.blue::after { background: #3b82f6; }
.kpi-top { display: flex; align-items: center; justify-content: space-between; font-size: 11px; color: var(--muted); gap: 8px; }
.kpi-tag { font-size: 10px; padding: 4px 7px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); white-space: nowrap; }
.kpi-tag.amber { background: var(--amber-soft); color: var(--amber); }
.kpi-tag.red { background: var(--red-soft); color: var(--red); }
.kpi-value { font-size: 28px; font-weight: 750; letter-spacing: -1px; margin: 12px 0 5px; line-height: 1; }
.kpi-value span { font-size: 12px; font-weight: 500; color: var(--muted); margin-left: 5px; letter-spacing: 0; }
.kpi-foot { font-size: 11px; color: var(--soft); }
.grid-2 { display: grid; grid-template-columns: 1.55fr 1fr; gap: 18px; margin-bottom: 18px; }
.grid-2.equal { grid-template-columns: 1fr 1fr; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; min-width: 640px; }
.table th { text-align: left; font-size: 10px; letter-spacing: .6px; text-transform: uppercase; color: var(--soft); font-weight: 600; padding: 12px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 13px 10px; border-bottom: 1px solid #f1f5f9; font-size: 12px; vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fbfdff; }
.sub-cell { display: block; font-size: 10px; color: var(--soft); margin-top: 3px; font-weight: 400; }
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 10px; font-weight: 600; padding: 5px 8px; border-radius: 999px; white-space: nowrap; }
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge.green { color: #047857; background: #ecfdf5; }
.badge.amber { color: #b45309; background: #fffbeb; }
.badge.red { color: #b91c1c; background: #fef2f2; }
.badge.blue { color: #1d4ed8; background: #eff6ff; }
.badge.slate { color: #475569; background: #f1f5f9; }
.progress { height: 6px; border-radius: 999px; background: #eef2f7; overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--brand2), var(--brand)); }
.empty-state { text-align: center; padding: 32px 16px; color: var(--soft); font-size: 12px; line-height: 1.8; }

/* ============ dashboard/details ============ */
.contract-row { display: grid; grid-template-columns: 1.2fr .8fr .8fr; gap: 12px; padding: 12px 0; border-bottom: 1px solid #f1f5f9; align-items: center; }
.contract-row:last-child { border-bottom: 0; }
.contract-row .name { font-size: 12px; font-weight: 650; }
.contract-row .meta { font-size: 10px; color: var(--soft); margin-top: 3px; }
.contract-row .right { text-align: right; font-size: 11px; color: var(--muted); }
.todo { display: flex; gap: 11px; padding: 11px 0; border-bottom: 1px solid #f1f5f9; align-items: center; }
.todo:last-child { border-bottom: 0; }
.todo-dot { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; flex: 0 0 28px; font-size: 11px; }
.todo-dot.amber { background: var(--amber-soft); color: var(--amber); }
.todo-dot.red { background: var(--red-soft); color: var(--red); }
.todo-dot.green { background: var(--brand-soft); color: var(--brand); }
.todo-dot.blue { background: var(--blue-soft); color: var(--blue); }
.todo-title { font-size: 12px; font-weight: 600; }
.todo-sub { font-size: 10px; color: var(--soft); margin-top: 2px; }
.bars { display: flex; align-items: flex-end; gap: 14px; height: 150px; padding-top: 12px; }
.bar-item { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; justify-content: flex-end; }
.bar { width: 100%; max-width: 34px; border-radius: 7px 7px 3px 3px; background: linear-gradient(180deg, #99f6e4, #14b8a6); min-height: 6px; }
.bar-item:nth-child(6) .bar { background: linear-gradient(180deg, #fde68a, #f59e0b); }
.bar-label { font-size: 9px; color: var(--soft); }
.bar-val { font-size: 9px; color: var(--muted); }

.detail-metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
.metric { background: #f8fafc; border: 1px solid var(--line); border-radius: 12px; padding: 12px 13px; }
.metric span { display: block; font-size: 10px; color: var(--soft); }
.metric strong { display: block; font-size: 20px; margin-top: 5px; letter-spacing: -.4px; }
.metric strong small { font-size: 10px; color: var(--muted); font-weight: 500; margin-left: 3px; }

/* ============ workflow ============ */
.workflow { display: flex; align-items: flex-start; gap: 0; overflow-x: auto; padding: 8px 0 4px; }
.step { min-width: 92px; flex: 1; text-align: center; position: relative; }
.step:not(:last-child)::after { content: ""; position: absolute; top: 15px; left: calc(50% + 18px); right: calc(-50% + 18px); height: 1px; background: #e2e8f0; }
.step.done:not(:last-child)::after { background: var(--brand2); }
.step-dot { width: 30px; height: 30px; border-radius: 50%; margin: 0 auto 8px; display: grid; place-items: center; font-size: 10px; font-weight: 700; background: #fff; border: 1px solid #e2e8f0; color: var(--soft); position: relative; z-index: 1; }
.step.done .step-dot { background: var(--brand); border-color: var(--brand); color: #fff; }
.step.active .step-dot { background: #fff; border: 2px solid var(--brand2); color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.step-name { font-size: 10px; color: var(--muted); }
.step.done .step-name, .step.active .step-name { color: var(--ink); font-weight: 600; }

.vehicle-row { display: flex; align-items: center; gap: 12px; padding: 13px 0; border-bottom: 1px solid #f1f5f9; }
.vehicle-row:last-child { border-bottom: 0; }
.plate { width: 76px; text-align: center; font-size: 11px; font-weight: 750; letter-spacing: .5px; background: #0f172a; color: #e2e8f0; border-radius: 6px; padding: 7px 4px; flex: 0 0 76px; }
.vehicle-info { flex: 1; }
.vehicle-info strong { display: block; font-size: 12px; }
.vehicle-info span { display: block; font-size: 10px; color: var(--soft); margin-top: 3px; }

.agent-banner { display: flex; align-items: center; justify-content: space-between; gap: 16px; background: linear-gradient(110deg, #0b1220, #123042 60%, #0f766e); color: #fff; border-radius: 18px; padding: 22px 24px; margin-bottom: 18px; box-shadow: 0 20px 40px rgba(15, 23, 42, .18); }
.agent-banner h2 { margin: 0 0 6px; font-size: 18px; letter-spacing: -.3px; }
.agent-banner p { margin: 0; font-size: 12px; color: #a7f3d0; max-width: 680px; line-height: 1.7; }
.agent-banner .seal { flex: 0 0 auto; border: 1px solid rgba(255,255,255,.25); border-radius: 12px; padding: 11px 14px; font-size: 11px; color: #ccfbf1; background: rgba(255,255,255,.06); text-align: center; }
.commission-row { display: flex; justify-content: space-between; padding: 11px 0; border-bottom: 1px solid #f1f5f9; font-size: 12px; }
.commission-row:last-child { border-bottom: 0; }
.commission-row strong { color: var(--brand); }

/* ============ modal/form ============ */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15, 23, 42, .46); backdrop-filter: blur(5px); display: grid; place-items: center; z-index: 80; padding: 24px; }
.modal { width: min(720px, 100%); max-height: 90vh; overflow: auto; background: #fff; border-radius: 20px; box-shadow: 0 40px 80px rgba(15, 23, 42, .3); animation: pop .2s ease; }
@keyframes pop { from { transform: translateY(8px) scale(.99); opacity: .7; } to { transform: none; opacity: 1; } }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; padding: 22px 24px 0; gap: 16px; }
.modal-head h2 { margin: 0; font-size: 18px; letter-spacing: -.3px; }
.modal-head p { margin: 5px 0 0; color: var(--soft); font-size: 11px; line-height: 1.6; }
.modal-close { border: 0; background: #f8fafc; color: var(--muted); width: 30px; height: 30px; border-radius: 9px; font-size: 16px; flex: 0 0 30px; }
.modal-body { padding: 18px 24px 24px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 18px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 11px; color: var(--muted); font-weight: 600; }
.field input, .field select, .field textarea { border: 1px solid var(--line); border-radius: 9px; padding: 10px 11px; font-size: 12px; color: var(--ink); background: #fff; outline: none; width: 100%; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--brand2); box-shadow: 0 0 0 3px var(--brand-soft); }
.field textarea { resize: vertical; min-height: 70px; }
.hint { font-size: 10px; color: var(--soft); margin-top: 2px; line-height: 1.5; }
.hint.ok { color: var(--brand); }
.hint.err { color: var(--red); }
.l2-note { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; border-radius: 12px; padding: 12px 14px; font-size: 11px; line-height: 1.8; }
.api-mode-bar { max-width: 1180px; margin: 12px auto 0; padding: 7px 12px; border-radius: 9px; background: #ecfdf5; border: 1px solid #a7f3d0; color: #047857; font-size: 10px; line-height: 1.7; }
.api-mode-bar.error { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }
.form-error { color: var(--red); font-size: 11px; min-height: 16px; margin-top: 4px; }

/* ============ toast ============ */
.toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); background: #0f172a; color: #e2e8f0; padding: 12px 18px; border-radius: 11px; font-size: 12px; box-shadow: 0 20px 40px rgba(15, 23, 42, .25); opacity: 0; pointer-events: none; transition: .22s; z-index: 200; max-width: 80vw; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ============ responsive ============ */
@media (max-width: 1180px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
  .hero { grid-template-columns: 1fr; gap: 30px; padding-top: 42px; }
  .hero h1 { font-size: 42px; }
  .listing-grid { grid-template-columns: 1fr 1fr; }
  .type-grid { grid-template-columns: repeat(3, 1fr); }
  .channel-grid { grid-template-columns: repeat(2, 1fr); }
  .search-filters { grid-template-columns: repeat(3, 1fr); }
  .grid-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 860px) {
  .sidebar { width: 76px; flex: 0 0 76px; }
  .brand { padding: 18px 16px; }
  .brand-text, .workspace, .nav-item span:not(.nav-ico), .user-card div, .portal-link span.text { display: none; }
  .nav-item { justify-content: center; padding: 11px 0; }
  .nav-ico { width: 30px; height: 30px; }
  .sidebar-bottom { padding: 10px; }
  .user-card { justify-content: center; }
  .content { padding: 20px 16px 40px; }
  .topbar { padding: 0 16px; }
  .top-actions .demo-pill { display: none; }
  .role-select { max-width: 88px; }
  .page-head { flex-direction: column; align-items: flex-start; }
  .kpi-grid { grid-template-columns: 1fr; }
  .grid-3, .listing-grid { grid-template-columns: 1fr; }
  .type-grid { grid-template-columns: 1fr 1fr; }
  .channel-grid { grid-template-columns: 1fr; }
  .search-main { flex-direction: column; align-items: stretch; }
  .search-filters { grid-template-columns: 1fr 1fr; }
  .public-header { padding: 0 16px; gap: 10px; }
  .public-nav { display: none; }
  .public-brand span { display: none; }
  .public-main { padding: 0 16px 40px; }
  .hero { padding: 34px 0 24px; }
  .hero h1 { font-size: 34px; }
  .form-grid { grid-template-columns: 1fr; }
  .detail-metrics { grid-template-columns: 1fr 1fr; }
  .agent-banner { flex-direction: column; align-items: flex-start; }
  .modal-backdrop { padding: 12px; }
  .public-footer { padding: 20px 16px 30px; }
}
