/* ============ Raise3D SLS Hub · design system ============ */
:root {
  --red: #D0011B;
  --red-dark: #A80115;
  --ink: #1A1D21;
  --ink-2: #4B5563;
  --muted: #8A94A6;
  --line: #E7EAF0;
  --border: #E7EAF0;
  --hover: #F1F5F9;
  --bg: #F4F6F9;
  --card: #FFFFFF;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16,24,40,.04), 0 4px 16px rgba(16,24,40,.06);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.65 -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", Roboto, sans-serif;
}
a { color: var(--red); text-decoration: none; }
a:hover { color: var(--red-dark); }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); }
.tiny { font-size: 12px; }
pre { font-family: inherit; background: #F7F8FA; padding: 12px 14px; border-radius: 8px; white-space: pre-wrap; margin: 8px 0 0; }

/* ---------- 顶栏 ---------- */
.topbar {
  background: var(--card); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.bar-inner { display: flex; align-items: center; gap: 22px; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.brand-logo { height: 30px; width: auto; display: block; }
.brand-name { font-weight: 700; color: var(--ink); font-size: 15px; white-space: nowrap; }
.brand-name em {
  font-style: normal; font-size: 10px; font-weight: 600; color: var(--red);
  border: 1px solid var(--red); border-radius: 20px; padding: 1px 7px;
  vertical-align: 2px; margin-left: 4px;
}
.mainnav { display: flex; gap: 2px; flex-wrap: wrap; }
.mainnav a {
  color: var(--ink-2); font-size: 14px; padding: 6px 12px; border-radius: 8px;
  white-space: nowrap; transition: background .15s;
}
.mainnav a:hover { background: #F2F4F8; color: var(--ink); }
.bar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.topsearch input {
  border: 1px solid var(--line); border-radius: 20px; padding: 6px 14px;
  font-size: 13px; width: 150px; background: var(--bg); outline: none;
  transition: border-color .15s, width .2s;
}
.topsearch input:focus { border-color: var(--red); width: 190px; background: #fff; }
.lang-toggle {
  font-size: 12px; font-weight: 600; color: var(--ink-2);
  border: 1px solid var(--line); border-radius: 20px; padding: 4px 12px;
}
.lang-toggle:hover { border-color: var(--red); color: var(--red); }
.who { font-size: 13px; color: var(--ink-2); font-weight: 600; white-space: nowrap; }
.signout { font-size: 13px; color: var(--muted); }

/* ---------- 主体 ---------- */
main.wrap { padding-top: 26px; padding-bottom: 40px; min-height: 60vh; }
.flash {
  background: #FFF5F5; border: 1px solid #F5C2C7; color: var(--red-dark);
  border-radius: 8px; padding: 10px 14px; margin-bottom: 16px; font-size: 14px;
}
.pagetitle { font-size: 24px; margin: 4px 0 18px; }
.hero h1 { font-size: 26px; margin: 6px 0 4px; }
.hero p { margin-top: 0; }

/* 统计卡 */
.statgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 18px; }
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow); display: block; transition: transform .15s;
}
.stat:hover { transform: translateY(-2px); }
.stat .num { font-size: 30px; font-weight: 800; color: var(--ink); }
.stat .muted { font-size: 13px; }

/* 卡片 */
.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; margin-bottom: 14px; box-shadow: var(--shadow);
}
.cards .card { margin-bottom: 0; }
.card h3 { margin: 0 0 10px; font-size: 16px; }
.card p { margin: 6px 0; }
.card.product { color: var(--ink); }
.card.product:hover { border-color: var(--red); }
.card .more { float: right; font-size: 13px; font-weight: 400; }
.row { display: flex; align-items: center; gap: 8px; }
.hl { background: #FFFBEB !important; }

/* 徽章 */
.badge {
  display: inline-block; font-size: 11px; font-weight: 600; color: var(--red);
  background: #FDECEE; border-radius: 20px; padding: 2px 9px; white-space: nowrap;
}
.badge.warn { color: #B45309; background: #FEF3C7; }

/* 表格 */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  text-align: left; font-size: 12px; color: var(--muted); font-weight: 600;
  border-bottom: 1px solid var(--line); padding: 8px 10px;
}
td { padding: 10px; border-bottom: 1px solid #F0F2F6; vertical-align: top; }
tr:last-child td { border-bottom: none; }

/* 表单 */
input[type="text"], input:not([type]), input[type="password"], select, textarea {
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px;
  font: inherit; font-size: 14px; background: #fff; outline: none; color: var(--ink);
}
input:focus, select:focus, textarea:focus { border-color: var(--red); }
textarea { width: 100%; resize: vertical; }
label { font-size: 13px; color: var(--ink-2); margin-right: 4px; }
.check { display: inline-flex; align-items: center; gap: 6px; }
.formgrid p { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.btn {
  display: inline-block; border: 1px solid var(--line); background: #fff;
  color: var(--ink-2); border-radius: 8px; padding: 8px 18px;
  font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; transition: all .15s;
}
.btn:hover { border-color: var(--red); color: var(--red); }
.btn.primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn.primary:hover { background: var(--red-dark); }
.btn.block { width: 100%; }
.tiny-btn { padding: 2px 10px; font-size: 12px; }
.catnav { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.catnav a {
  border: 1px solid var(--line); border-radius: 20px; padding: 4px 14px;
  font-size: 13px; color: var(--ink-2); background: #fff;
}
.catnav a.on { border-color: var(--red); color: var(--red); font-weight: 600; }
.searchpage { display: flex; gap: 10px; margin-bottom: 16px; }
.searchpage input { flex: 1; }

/* 登录页 */
.login-card {
  max-width: 360px; margin: 8vh auto; background: var(--card);
  border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow);
  padding: 34px 34px 26px; text-align: center;
}
.login-mark { width: 64px; height: auto; margin-bottom: 10px; }
.login-card h1 { font-size: 20px; margin: 0 0 4px; }
.login-card form { margin-top: 18px; display: grid; gap: 12px; }
.login-card .lang-toggle { display: inline-block; margin-top: 14px; }

/* 页脚 */
.foot { color: var(--muted); font-size: 12px; padding-bottom: 30px; }

/* 表格在卡片内局部滚动，不撑破页面 */
.card table { display: block; overflow-x: auto; }
.card table tbody, .card table thead { display: table; width: 100%; min-width: 560px; }
.card table.kv tbody, .card table.kv thead { min-width: 0; }

/* 响应式：导航自动换行，绝不横向滚动 */
@media (max-width: 1080px) {
  .bar-inner { flex-wrap: wrap; height: auto; padding: 8px 20px; row-gap: 4px; }
  .brand { order: 1; }
  .bar-right { order: 2; margin-left: auto; }
  .mainnav { order: 3; width: 100%; padding-bottom: 4px; }
}
@media (max-width: 860px) {
  .cards, .statgrid { grid-template-columns: 1fr; }
  .topsearch input { width: 100px; }
  .topsearch input:focus { width: 130px; }
}
@media (max-width: 560px) {
  .bar-right { order: 3; width: 100%; margin-left: 0; }
  .mainnav { order: 2; width: 100%; }
  .who { display: none; }
  table { font-size: 13px; }
  td, th { padding: 8px 6px; }
}

/* 设备添加区高亮 */
.add-device { margin-top: 14px; border: 1px dashed var(--red); border-radius: 10px; padding: 12px 14px; background: #FFF8F8; }
.add-device-title { margin: 0 0 8px; font-weight: 700; color: var(--red); font-size: 13px; }

/* 设备追踪看板 */
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.track-layout { display: grid; grid-template-columns: 250px 1fr; gap: 14px; align-items: start; }
.track-devs { max-height: 70vh; overflow-y: auto; padding: 10px; }
.dev-row { display: flex; align-items: center; gap: 8px; padding: 7px 9px; border-radius: 8px; color: var(--ink); border: 1px solid transparent; font-size: 13px; }
.dev-row:hover { background: #F7F8FA; }
.dev-row.on { background: #fff; border-color: var(--red); }
.dev-row .nm { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.event-row { margin-bottom: 10px; }
.event-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
@media (max-width: 860px) { .track-layout { grid-template-columns: 1fr; } .track-devs { max-height: none; } }

/* ---------- 客户目录（卡片网格） ---------- */
.dir-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; flex-wrap: wrap; margin: 4px 0 18px;
}
.dir-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.dir-tools input[type="search"] {
  border: 1px solid var(--line); border-radius: 20px; padding: 8px 18px;
  font: inherit; font-size: 14px; width: 260px; max-width: 100%;
  background: #fff; outline: none; transition: border-color .15s;
}
.dir-tools input[type="search"]:focus { border-color: var(--red); }

.cust-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 14px;
}
.cust-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px 12px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 8px; transition: all .15s;
  min-width: 0;
}
.cust-card:hover { border-color: var(--red); transform: translateY(-2px); }
.cust-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.cust-name { font-size: 16px; font-weight: 700; color: var(--ink); line-height: 1.35; word-break: break-word; }
.cust-name:hover { color: var(--red); }
.cust-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.cust-meta { display: flex; gap: 6px 14px; flex-wrap: wrap; font-size: 13px; color: var(--ink-2); }
.cust-mail { word-break: break-all; }
.cust-devs {
  font-size: 13px; color: var(--ink-2); display: flex; align-items: baseline;
  gap: 8px; flex-wrap: wrap; border-top: 1px dashed var(--line); padding-top: 8px;
}
.cust-sns {
  font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 12px;
  color: var(--muted); word-break: break-all;
}
.cust-note {
  margin: 0; font-size: 13px; color: var(--muted); line-height: 1.55;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.cust-foot {
  margin-top: auto; display: flex; align-items: center; justify-content: space-between;
  gap: 8px; border-top: 1px solid #F0F2F6; padding-top: 8px;
}
.cust-go { font-size: 13px; font-weight: 600; }

/* 添加客户表单 */
.addform-panel { margin-bottom: 16px; }
.addform { display: grid; gap: 12px; margin: 10px 0 14px; }
.af-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.af-field { display: grid; gap: 4px; min-width: 0; }
.af-field label { font-size: 12px; color: var(--muted); font-weight: 600; margin: 0; }
.af-field input, .af-field select { width: 100%; }
.af-field.span2 { grid-column: span 2; }
.af-field.span4 { grid-column: span 4; }
@media (max-width: 860px) {
  .af-row { grid-template-columns: 1fr 1fr; }
  .af-field.span2, .af-field.span4 { grid-column: span 2; }
  .dir-tools input[type="search"] { width: 180px; }
}
@media (max-width: 560px) {
  .af-row { grid-template-columns: 1fr; }
  .af-field.span2, .af-field.span4 { grid-column: span 1; }
  .dir-toolbar { flex-direction: column; align-items: stretch; }
  .dir-tools input[type="search"] { flex: 1; width: auto; }
  .cust-grid { grid-template-columns: 1fr; }
}

/* ---------- 客户区：左目录 + 右详情 ---------- */
.split-layout {
  display: grid; grid-template-columns: 290px minmax(0, 1fr);
  gap: 14px; align-items: start;
}
.split-main { min-width: 0; }
.cust-nav {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
  position: sticky; top: 20px;
}
.cust-nav-head {
  display: flex; align-items: center; gap: 8px; padding: 12px 14px;
  border-bottom: 1px solid var(--line); cursor: pointer; user-select: none;
}
.cust-nav-title { font-weight: 700; font-size: 14px; }
.cust-nav-count {
  font-size: 11px; font-weight: 700; color: var(--red); background: #FDECEE;
  border-radius: 20px; padding: 1px 8px;
}
.cust-nav-arrow { margin-left: auto; color: var(--muted); font-size: 12px; transition: transform .15s; }
.cust-nav.open .cust-nav-arrow { transform: rotate(180deg); }
.cust-nav-body { padding: 10px; }
#custNavSearch {
  width: 100%; border: 1px solid var(--line); border-radius: 8px;
  padding: 7px 12px; font: inherit; font-size: 13px; outline: none; margin-bottom: 8px;
}
#custNavSearch:focus { border-color: var(--red); }
.cust-nav-list { max-height: calc(100vh - 220px); overflow-y: auto; display: grid; gap: 2px; }
.cust-item {
  display: grid; gap: 1px; padding: 8px 10px; border-radius: 8px;
  border: 1px solid transparent; color: var(--ink); min-width: 0;
}
.cust-item:hover { background: #F7F8FA; }
.cust-item.on { background: #FDECEE; border-color: var(--red); }
.ci-name { font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ci-meta { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cust-welcome { text-align: center; padding: 46px 24px; }
.cust-welcome h3 { font-size: 18px; }
@media (max-width: 860px) {
  .split-layout { grid-template-columns: 1fr; }
  .cust-nav { position: static; }
  .cust-nav .cust-nav-body { display: none; }
  .cust-nav.open .cust-nav-body { display: block; }
  .cust-nav-list { max-height: 50vh; }
}

/* ---------- 左侧图标导航栏 ---------- */
.siderail {
  position: fixed; left: 0; top: 0; bottom: 0; width: 216px; z-index: 20;
  background: var(--card); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 14px 10px;
}
.rail-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 8px 14px; border-bottom: 1px solid var(--line);
}
.rail-logo { height: 34px; width: auto; display: block; }
.rail-title { font-weight: 700; font-size: 14px; color: var(--ink); line-height: 1.3; }
.rail-title em {
  font-style: normal; font-size: 9px; font-weight: 600; color: var(--red);
  border: 1px solid var(--red); border-radius: 20px; padding: 0 6px;
  vertical-align: 2px; margin-left: 2px; white-space: nowrap;
}
.railnav {
  display: flex; flex-direction: column; gap: 2px;
  padding: 12px 0; flex: 1; overflow-y: auto;
}
.railnav a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 10px;
  color: var(--ink-2); font-size: 14px; font-weight: 600; transition: background .15s;
}
.railnav a .ri { font-size: 16px; width: 22px; text-align: center; flex-shrink: 0; }
.railnav a:hover { background: #F2F4F8; color: var(--ink); }
.railnav a.on { background: #FDECEE; color: var(--red); }
/* Makula 风格资产行 */
.asset-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 12px; border: 1px solid transparent;
  color: var(--ink); transition: background .15s, border-color .15s;
}
.asset-row:hover { background: #F8FAFC; border-color: #EDF0F5; }
.asset-row.on { background: #FDECEE; border-color: #F5C6CB; }
.asset-thumb {
  width: 52px; height: 52px; border-radius: 10px; flex-shrink: 0;
  background: #F1F5F9; display: flex; align-items: center; justify-content: center;
  overflow: hidden; border: 1px solid #E8ECF2;
}
.asset-thumb img { width: 100%; height: 100%; object-fit: cover; }
.asset-thumb-ph { font-size: 22px; opacity: .55; }
.asset-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.asset-main b { font-size: 14.5px; }
.asset-main .tiny { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.asset-side { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
[data-theme="dark"] .asset-row:hover { background: #161C26; border-color: #232B3A; }
[data-theme="dark"] .asset-thumb { background: #1B2230; border-color: #232B3A; }
/* 产品卡片网格 */
.prod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.prod-card { display: flex; flex-direction: column; padding: 0; overflow: hidden; transition: transform .15s, box-shadow .15s; }
.prod-card:hover { transform: translateY(-2px); box-shadow: 0 6px 18px #0f172a14; }
.prod-img { height: 150px; background: #F4F6FA; display: flex; align-items: center; justify-content: center; border-bottom: 1px solid var(--bd,#EEF1F5); }
.prod-img img { width: 100%; height: 100%; object-fit: contain; }
.prod-img-ph { font-size: 40px; opacity: .4; }
.prod-body { padding: 12px 14px; }
.prod-body h3 { margin: 0 0 4px; font-size: 15px; }
.product-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 0 0 16px; }
.product-search { display: flex; align-items: center; gap: 8px; flex: 1; max-width: 720px; }
.product-search input[type="search"] { flex: 1; min-width: 160px; margin: 0; }
.product-stock-date { flex-shrink: 0; }
.product-stock { display: flex; align-items: center; gap: 28px; min-height: 46px; margin: 4px 0 8px; padding: 8px 0; border-top: 1px solid var(--line); }
.product-stock > span { display: grid; gap: 1px; }
.product-stock small { color: var(--muted); font-size: 11px; }
.product-stock strong { color: var(--ink); font-size: 21px; line-height: 1.15; font-variant-numeric: tabular-nums; }
@media (max-width: 720px) {
  .product-toolbar { align-items: flex-start; flex-direction: column; gap: 6px; }
  .product-search { width: 100%; flex-wrap: wrap; }
  .product-search input[type="search"] { flex-basis: 100%; }
}
[data-theme="dark"] .prod-img { background: #161C26; }
.railnav span.raildim {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 10px;
  color: #B7C0CE; font-size: 14px; font-weight: 600; cursor: default; user-select: none;
}
.railnav span.raildim .ri { font-size: 16px; width: 22px; text-align: center; flex-shrink: 0; filter: grayscale(1); opacity: .7; }
.railnav span.raildim .soon {
  margin-left: auto; font-size: 10px; font-weight: 700; color: #94A3B8;
  background: #F1F5F9; border-radius: 999px; padding: 1px 7px;
}
[data-theme="dark"] .railnav span.raildim { color: #5B6472; }
[data-theme="dark"] .railnav span.raildim .soon { background: #1E2530; color: #64748B; }
.rail-bottom { border-top: 1px solid var(--line); padding-top: 10px; display: grid; gap: 10px; }
.railsearch input {
  width: 100%; border: 1px solid var(--line); border-radius: 8px;
  padding: 7px 12px; font: inherit; font-size: 13px; background: var(--bg); outline: none;
}
.railsearch input:focus { border-color: var(--red); background: #fff; }
.rail-user { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 0 4px; }

.rail-main {
  margin-left: 216px; padding: 26px 28px 40px; min-height: 100vh;
}
.rail-main > * { max-width: 1180px; }
.rail-main .foot { padding-top: 30px; }

@media (max-width: 860px) {
  .siderail {
    position: static; width: 100%; flex-direction: row; flex-wrap: wrap;
    align-items: center; border-right: none; border-bottom: 1px solid var(--line);
    padding: 8px 12px; row-gap: 6px;
  }
  .rail-brand { border-bottom: none; padding: 0 8px 0 0; }
  .railnav { flex-direction: row; overflow-x: auto; padding: 0; flex: 1; }
  .railnav a { padding: 7px 10px; white-space: nowrap; }
  .rail-bottom {
    border-top: none; padding-top: 0; display: flex; align-items: center;
    gap: 10px; width: 100%;
  }
  .railsearch { flex: 1; }
  .rail-main { margin-left: 0; padding: 16px 14px 30px; }
}
@media (max-width: 560px) {
  .railnav a .rl { display: none; }
  .railnav a { padding: 8px 10px; }
  .rail-title { display: none; }
  .who { display: inline; font-size: 12px; }
}

/* ---------- 客户 Portal 历史时间线 ---------- */
.hist-list { max-height: 70vh; overflow-y: auto; padding-right: 4px; }
.hist-row { display: flex; gap: 12px; }
.hist-rail { display: flex; flex-direction: column; align-items: center; flex-shrink: 0; width: 14px; }
.hist-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 7px; flex-shrink: 0; }
.hist-rail::after { content: ""; flex: 1; width: 2px; background: #EEF1F5; margin: 4px 0; }
.hist-row:last-child .hist-rail::after { display: none; }
.hist-body { flex: 1; min-width: 0; padding-bottom: 14px; border-bottom: 1px solid #F5F7FA; margin-bottom: 4px; }
.hist-row:last-child .hist-body { border-bottom: none; }
.hist-desc { margin: 4px 0 0; font-size: 13.5px; }

/* ============ UI/UX 升级包（2026-10-13）============ */
/* 全局微交互 */
.card { transition: box-shadow .2s, border-color .2s, transform .2s; }
a.card:hover, .card.stat:hover { box-shadow: 0 4px 8px rgba(16,24,40,.06), 0 12px 28px rgba(16,24,40,.10); }
tbody tr { transition: background .12s; }
tbody tr:hover { background: #FAFBFD; }
.btn.primary { box-shadow: 0 2px 8px rgba(208,1,27,.25); }
.btn.primary:hover { box-shadow: 0 4px 14px rgba(208,1,27,.35); transform: translateY(-1px); }
.btn { transition: all .15s; }
.btn:active { transform: scale(.97); }
:focus-visible { outline: 2px solid rgba(208,1,27,.5); outline-offset: 2px; }
.topbar { box-shadow: 0 1px 8px rgba(16,24,40,.06); }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
main.wrap > .card, main.wrap > .pagetitle, .rail-main > .card, .rail-main > .pagetitle { animation: fadeUp .25s ease both; }

/* 登录页：品牌渐变背景 */
body:has(.login-card) {
  background:
    radial-gradient(1000px 500px at 15% -10%, rgba(208,1,27,.14), transparent 60%),
    radial-gradient(800px 420px at 95% 110%, rgba(208,1,27,.10), transparent 60%),
    var(--bg);
}
.login-card { border: none; box-shadow: 0 12px 40px rgba(16,24,40,.12); }
.login-card input { padding: 11px 14px; border-radius: 10px; }
.login-card .btn { padding: 11px 18px; border-radius: 10px; font-size: 15px; }

/* 门户 Hero 欢迎带 */
.p-hero {
  background: linear-gradient(115deg, #1A1D21 0%, #3A1115 55%, #D0011B 130%);
  border-radius: 16px; color: #fff; padding: 28px 30px; margin-bottom: 16px;
  position: relative; overflow: hidden; box-shadow: 0 10px 30px rgba(26,29,33,.25);
}
.p-hero::after {
  content: ""; position: absolute; right: -60px; top: -60px; width: 240px; height: 240px;
  border-radius: 50%; background: rgba(255,255,255,.06);
}
.p-hero h1 { margin: 0 0 4px; font-size: 24px; color: #fff; }
.p-hero p { margin: 0; color: rgba(255,255,255,.75); font-size: 14px; }
.p-hero .hero-actions { margin-top: 16px; display: flex; gap: 10px; flex-wrap: wrap; }
.p-hero .btn-ghost {
  display: inline-block; padding: 8px 18px; border-radius: 10px; font-weight: 600; font-size: 14px;
  background: rgba(255,255,255,.12); color: #fff; border: 1px solid rgba(255,255,255,.25);
  transition: background .15s;
}
.p-hero .btn-ghost:hover { background: rgba(255,255,255,.22); color: #fff; }
.p-hero .btn-solid {
  display: inline-block; padding: 8px 18px; border-radius: 10px; font-weight: 600; font-size: 14px;
  background: #fff; color: #B00115; border: 1px solid #fff; transition: all .15s;
}
.p-hero .btn-solid:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(0,0,0,.25); color: #8F0112; }

/* 门户设备卡 */
.machine-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.machine-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 16px 18px; box-shadow: var(--shadow); display: block; color: var(--ink);
}
.machine-card:hover { border-color: var(--red); transform: translateY(-2px); }
.machine-card .mc-model { font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; }
.machine-card .mc-sn { font-size: 16px; font-weight: 700; font-family: ui-monospace, "SF Mono", Consolas, monospace; margin: 2px 0 8px; word-break: break-all; }
.machine-card .mc-meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; font-size: 12px; color: var(--ink-2); }
.chip {
  display: inline-block; font-size: 11px; font-weight: 600; border-radius: 6px;
  padding: 1px 8px; background: #F1F5F9; color: var(--ink-2);
}
.chip.ok { background: #DCFCE7; color: #15803D; }
.chip.warn { background: #FEF3C7; color: #B45309; }

/* 工单进度步进条 */
.steps { display: flex; margin: 4px 0 18px; }
.step { flex: 1; text-align: center; position: relative; }
.step::before {
  content: ""; position: absolute; top: 11px; left: -50%; width: 100%; height: 2px;
  background: #E2E8F0;
}
.step:first-child::before { display: none; }
.step .s-dot {
  width: 22px; height: 22px; border-radius: 50%; margin: 0 auto 6px; position: relative;
  background: #E2E8F0; color: #fff; font-size: 11px; font-weight: 700; line-height: 22px;
  z-index: 1;
}
.step .s-label { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.step.done .s-dot { background: #16A34A; }
.step.done::before { background: #16A34A; }
.step.now .s-dot { background: var(--red); box-shadow: 0 0 0 4px rgba(208,1,27,.18); }
.step.now .s-label { color: var(--ink); }

/* 客户门户对话气泡（与内部工作台一致） */
.conv { display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 85%; }
.msg-meta { font-size: 11px; color: #94A3B8; margin: 0 0 3px; }
.msg-body { background: #F1F5F9; border-radius: 12px; padding: 9px 13px; white-space: pre-line; font-size: 14px; }
.msg-mine { align-self: flex-end; text-align: right; }
.msg-mine .msg-body { background: #DBEAFE; text-align: left; }

/* 空状态 */
.empty { text-align: center; padding: 34px 16px; color: var(--muted); }
.empty .e-icon { font-size: 34px; display: block; margin-bottom: 8px; opacity: .6; }

/* 通知页卡片 hover */
.notif-card { transition: box-shadow .2s, transform .2s; }
.notif-card:hover { box-shadow: 0 6px 20px rgba(16,24,40,.10); transform: translateY(-1px); }

/* 内部首页快捷操作 */
.quick-act { display: flex; gap: 10px; flex-wrap: wrap; margin: 0 0 16px; }
.qa-btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px;
  border: 1px solid var(--line); border-radius: 10px; background: #fff;
  font-size: 13.5px; font-weight: 600; color: var(--ink-2); box-shadow: var(--shadow);
  transition: all .15s;
}
.qa-btn:hover { border-color: var(--red); color: var(--red); transform: translateY(-1px); }

/* ---------- 内部端升级（分组侧栏 / 问候条 / 头像） ---------- */
.rail-group {
  font-size: 10.5px; font-weight: 700; color: #A6AFC0; letter-spacing: .08em;
  text-transform: uppercase; padding: 14px 12px 4px; user-select: none;
}
.railnav a.on { box-shadow: inset 2.5px 0 0 var(--red); }
.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, #D0011B, #8F0112); color: #fff;
  font-size: 13px; font-weight: 700;
}
.home-greet {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 14px; margin: 2px 0 16px; flex-wrap: wrap;
}
.home-greet h1 { font-size: 24px; margin: 0 0 2px; }
.home-greet p { margin: 0; }
@media (max-width: 860px) { .rail-group { display: none; } }

/* ---------- 备件库存 ---------- */
.stock-chip {
  display: inline-block; min-width: 40px; text-align: center;
  font-weight: 700; font-size: 14px; border-radius: 8px; padding: 3px 10px;
  background: #DCFCE7; color: #15803D; cursor: default;
}
.stock-chip.low { background: #FEF3C7; color: #B45309; }
.stock-chip.out { background: #FEE2E2; color: #DC2626; }

/* ---------- 头像菜单 ---------- */
.avatar-btn { border: none; padding: 0; cursor: pointer; transition: transform .15s, box-shadow .15s; }
.avatar-btn:hover { transform: scale(1.08); box-shadow: 0 0 0 3px rgba(208,1,27,.2); }
.avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
.user-menu {
  position: fixed; z-index: 100; width: 250px;
  left: 12px; bottom: 88px;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 12px 40px rgba(16,24,40,.18); padding: 14px;
  display: none; animation: fadeUp .18s ease;
}
.user-menu.open { display: block; }
.user-menu.portal-menu { left: auto; right: 20px; top: 64px; bottom: auto; }
.um-head { display: flex; align-items: center; gap: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.um-head .avatar { display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; background: linear-gradient(135deg, #D0011B, #8F0112); color: #fff; font-weight: 700; overflow: hidden; }
.avatar-btn.avatar { overflow: hidden; }
.um-sect { padding: 10px 0 2px; }
.um-label { font-size: 12px; font-weight: 700; color: var(--muted); display: block; margin-bottom: 6px; }
.um-themes { display: flex; gap: 8px; min-width: 0; }
.um-themes form { flex: 1; }
.um-themes select { flex: 1 1 0; width: 0; min-width: 0; text-overflow: ellipsis; }
.um-themes .btn { flex: 0 0 auto; }
.theme-opt {
  width: 100%; padding: 7px 0; border-radius: 9px; border: 1px solid var(--line);
  background: var(--bg); color: var(--ink-2); font-size: 13px; font-weight: 600; cursor: pointer;
  transition: all .15s;
}
.theme-opt:hover { border-color: var(--red); }
.theme-opt.on { border-color: var(--red); color: var(--red); background: #FDECEE; }
.avatar-upload {
  display: block; text-align: center; padding: 8px; border: 1.5px dashed var(--line);
  border-radius: 9px; font-size: 13px; color: var(--ink-2); cursor: pointer; transition: all .15s;
}
.avatar-upload:hover { border-color: var(--red); color: var(--red); }
.um-foot { display: flex; justify-content: space-between; padding-top: 10px; margin-top: 8px;
  border-top: 1px solid var(--line); font-size: 13px; }
@media (max-width: 860px) {
  .user-menu { left: auto; right: 12px; bottom: auto; top: 60px; }
}

/* ---------- 深色主题 ---------- */
[data-theme="dark"] {
  --bg: #101419;
  --card: #1A1F26;
  --ink: #E8ECF2;
  --ink-2: #B7C0CD;
  --muted: #7E8A9C;
  --line: #2A313B;
  --border: #2A313B;
  --hover: #1F262F;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25);
}
[data-theme="dark"] body { background: var(--bg); color: var(--ink); }
[data-theme="dark"] input[type="text"], [data-theme="dark"] input:not([type]),
[data-theme="dark"] input[type="password"], [data-theme="dark"] input[type="email"],
[data-theme="dark"] input[type="date"], [data-theme="dark"] input[type="number"],
[data-theme="dark"] select, [data-theme="dark"] textarea {
  background: #12161C; color: var(--ink); border-color: var(--line);
}
[data-theme="dark"] .btn { background: var(--card); }
[data-theme="dark"] .catnav a { background: var(--card); }
[data-theme="dark"] .badge { background: rgba(208,1,27,.18); }
[data-theme="dark"] .badge.warn { background: rgba(245,158,11,.16); color: #F5B04C; }
[data-theme="dark"] td { border-bottom-color: #232A33; }
[data-theme="dark"] tbody tr:hover { background: #1F262F; }
[data-theme="dark"] .msg-body { background: #242B34; color: var(--ink); }
[data-theme="dark"] .msg-mine .msg-body { background: rgba(59,130,246,.28); }
[data-theme="dark"] .msg-internal .msg-body { background: rgba(245,158,11,.12); }
[data-theme="dark"] .chip { background: #242B34; color: var(--ink-2); }
[data-theme="dark"] .kb-col { background: #141920; }
[data-theme="dark"] .kb-col-head { background: var(--card); }
[data-theme="dark"] .kb-card { background: var(--card); border-color: var(--line); }
[data-theme="dark"] .kpi { background: var(--card); border-color: var(--line); }
[data-theme="dark"] .kpi.on { background: rgba(37,99,235,.15); }
[data-theme="dark"] .qa-btn { background: var(--card); }
[data-theme="dark"] .dev-row:hover, [data-theme="dark"] .cust-item:hover,
[data-theme="dark"] .railnav a:hover, [data-theme="dark"] .mainnav a:hover { background: #222931; }
[data-theme="dark"] pre { background: #141920; }
[data-theme="dark"] .flash { background: rgba(208,1,27,.12); border-color: rgba(208,1,27,.4); color: #FF8A95; }
[data-theme="dark"] .hist-rail::after { background: #2A313B; }
[data-theme="dark"] .hist-body { border-bottom-color: #232A33; }
[data-theme="dark"] .att-chip { background: #242B34; }
[data-theme="dark"] .attach-zone:hover, [data-theme="dark"] .attach-zone.drag { background: rgba(208,1,27,.08); }
[data-theme="dark"] .steps .s-dot, [data-theme="dark"] .step::before { background: #333C47; }
[data-theme="dark"] .step.done .s-dot, [data-theme="dark"] .step.done::before { background: #16A34A; }
[data-theme="dark"] .add-device { background: rgba(208,1,27,.06); }
[data-theme="dark"] .topsearch input, [data-theme="dark"] .railsearch input { background: #12161C; }
[data-theme="dark"] .topsearch input:focus, [data-theme="dark"] .railsearch input:focus { background: #12161C; }
[data-theme="dark"] .theme-opt { background: #12161C; }
[data-theme="dark"] .theme-opt.on { background: rgba(208,1,27,.15); }
[data-theme="dark"] .cust-item.on { background: rgba(208,1,27,.15); }
[data-theme="dark"] .railnav a.on { background: rgba(208,1,27,.15); }
[data-theme="dark"] .user-menu { box-shadow: 0 12px 40px rgba(0,0,0,.5); }
[data-theme="dark"] body:has(.login-card) {
  background:
    radial-gradient(1000px 500px at 15% -10%, rgba(208,1,27,.18), transparent 60%),
    radial-gradient(800px 420px at 95% 110%, rgba(208,1,27,.12), transparent 60%),
    var(--bg);
}

/* ---------- logo 明暗双版本 ---------- */
.logo-dark { display: none; }
[data-theme="dark"] .logo-light { display: none; }
[data-theme="dark"] .logo-dark { display: block; }

/* ============================================================
   Design System 2.0 — unified UI layer (internal + portal)
   2026-10-15 · cascade override, applied after legacy rules
   ============================================================ */
:root {
  --ok: #15803D;      --ok-bg: #DCFCE7;
  --info: #1D4ED8;    --info-bg: #DBEAFE;
  --warn-c: #B45309;  --warn-bg: #FEF3C7;
  --danger: #DC2626;  --danger-bg: #FEE2E2;
  --radius-s: 8px;
  --shadow-2: 0 2px 6px rgba(16,24,40,.06), 0 10px 28px rgba(16,24,40,.09);
}
[data-theme="dark"] {
  --ok-bg: rgba(22,163,74,.18);   --ok: #4ADE80;
  --info-bg: rgba(59,130,246,.18); --info: #7FA8F5;
  --warn-bg: rgba(245,158,11,.16); --warn-c: #F5B04C;
  --danger-bg: rgba(220,38,38,.18); --danger: #F87171;
  --shadow-2: 0 2px 6px rgba(0,0,0,.35), 0 10px 28px rgba(0,0,0,.4);
}

/* ---------- typography & page headers ---------- */
.pagetitle {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  font-size: 22px; font-weight: 800; letter-spacing: -0.01em;
  margin: 2px 0 18px;
}
.pagetitle .badge { font-size: 12px; }
main.wrap > .pagetitle, .rail-main > .pagetitle { animation: fadeUp .25s ease both; }

/* ---------- buttons ---------- */
.btn { border-radius: 9px; line-height: 1.3; }
.btn.primary { box-shadow: 0 1px 3px rgba(208,1,27,.28); }
.btn.primary:hover { box-shadow: 0 4px 14px rgba(208,1,27,.35); transform: translateY(-1px); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger:hover { background: #B91C1C; border-color: #B91C1C; color: #fff; }
.btn.ghost { background: transparent; }
.tiny-btn { border-radius: 7px; }
button.btn, input.btn { -webkit-appearance: none; }

/* ---------- semantic badges / pills ---------- */
.badge { font-weight: 700; letter-spacing: .01em; }
.badge.ok     { color: var(--ok);     background: var(--ok-bg); }
.badge.info   { color: var(--info);   background: var(--info-bg); }
.badge.danger { color: var(--danger); background: var(--danger-bg); }
.badge.neutral { color: var(--ink-2); background: var(--bg); }
.chip { border-radius: 7px; font-weight: 600; }
.chip.ok { background: var(--ok-bg); color: var(--ok); }
.chip.warn { background: var(--warn-bg); color: var(--warn-c); }

/* ---------- cards ---------- */
.card { border-radius: 14px; }
.card > h3 {
  display: flex; align-items: center; gap: 8px;
  font-size: 15px; font-weight: 700; letter-spacing: -0.005em;
  padding-bottom: 10px; margin-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.card > h3 .more { margin-left: auto; float: none; }
.cards { gap: 16px; }

/* ---------- stat tiles ---------- */
.stat { border-radius: 14px; position: relative; overflow: hidden; }
.stat::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--red); opacity: 0; transition: opacity .2s;
}
.stat:hover::before { opacity: 1; }
.stat .num { font-size: 32px; letter-spacing: -0.02em; }

/* ---------- tables ---------- */
table { font-size: 13.5px; }
th {
  font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  padding: 9px 12px; background: color-mix(in srgb, var(--bg) 55%, transparent);
}
td { padding: 11px 12px; }
tbody tr:hover { background: color-mix(in srgb, var(--bg) 60%, transparent); }
.mono, .cust-sns, .machine-card .mc-sn {
  font-family: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
  font-size: 12.5px; letter-spacing: -0.01em;
}

/* ---------- forms ---------- */
input[type="text"], input:not([type]), input[type="password"],
input[type="email"], input[type="date"], input[type="number"], select, textarea {
  border-radius: 9px; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--red); box-shadow: 0 0 0 3px rgba(208,1,27,.12);
}
.formgrid > p { margin: 8px 0; }
select { cursor: pointer; }
::placeholder { color: var(--muted); opacity: .75; }

/* ---------- filter pill nav (catnav / kpi) ---------- */
.catnav a { border-radius: 999px; font-weight: 600; transition: all .15s; }
.catnav a:hover { border-color: var(--red); color: var(--red); }
.catnav a.on { background: var(--red); border-color: var(--red); color: #fff; box-shadow: 0 2px 8px rgba(208,1,27,.3); }
.kpi { border-radius: 12px; transition: all .15s; }

/* ---------- flash ---------- */
.flash {
  border-radius: 10px; font-weight: 600;
  box-shadow: var(--shadow); display: flex; align-items: center; gap: 8px;
}
.flash::before { content: "●"; font-size: 9px; }

/* ---------- internal siderail polish ---------- */
.siderail { padding: 16px 10px; }
.railnav { gap: 3px; }
.railnav a { position: relative; }
.railnav a.on { font-weight: 700; }
.railnav a .badge { border-radius: 999px; }
.rail-group { padding: 16px 12px 5px; }
.railsearch input { border-radius: 9px; }
.railnav::-webkit-scrollbar, .cust-nav-list::-webkit-scrollbar,
.track-devs::-webkit-scrollbar, .hist-list::-webkit-scrollbar { width: 6px; }
.railnav::-webkit-scrollbar-thumb, .cust-nav-list::-webkit-scrollbar-thumb,
.track-devs::-webkit-scrollbar-thumb, .hist-list::-webkit-scrollbar-thumb {
  background: var(--line); border-radius: 3px;
}

/* ---------- portal topbar: active underline ---------- */
.mainnav a { position: relative; border-radius: 9px; font-weight: 600; }
.mainnav a.on { color: var(--red); background: #FDECEE; }
[data-theme="dark"] .mainnav a.on { background: rgba(208,1,27,.15); }
.bar-inner { gap: 26px; }
.topbar .brand-logo { height: 28px; }

/* ---------- user menu polish ---------- */
.user-menu { border-radius: 16px; padding: 16px; }
.theme-opt { border-radius: 10px; }

/* ---------- empty states ---------- */
.empty { padding: 44px 16px; }
.empty .e-icon { font-size: 38px; }

/* ---------- customer split nav polish ---------- */
.cust-item { transition: background .12s, border-color .12s; }
.cust-item.on { box-shadow: inset 2.5px 0 0 var(--red); }

/* ---------- portal hero refinement ---------- */
.p-hero { border-radius: 18px; }
.p-hero h1 { letter-spacing: -0.01em; }

/* ---------- steps ---------- */
.step .s-label { letter-spacing: .01em; }

/* ---------- board / kanban columns ---------- */
.kb-col { border-radius: 14px; }
.kb-card { border-radius: 12px; transition: box-shadow .15s, transform .15s; }
.kb-card:hover { box-shadow: var(--shadow-2); transform: translateY(-1px); }

/* ---------- login ---------- */
.login-card { border-radius: 18px; }
.login-card input, .login-card .btn { border-radius: 10px; }

/* ---------- footer ---------- */
.foot { letter-spacing: .01em; }

/* ---------- selection ---------- */
::selection { background: rgba(208,1,27,.18); }

/* ============================================================
   Assets module · Makula-style (2026-10-15)
   ============================================================ */
/* 设备详情页头 */
.adev-head { display: flex; align-items: center; gap: 16px; padding: 16px 20px; }
.adev-head .pagetitle { font-size: 20px; }
/* 标签页导航 */
.pd-tabs { margin: -4px 0 14px; }
.pd-tabs a .badge { margin-left: 2px; }
/* General Info 双栏 */
.adev-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 960px) { .adev-grid { grid-template-columns: 1fr; } }
/* 键值表 */
table.kv th { width: 130px; background: none; text-transform: none; letter-spacing: 0;
  font-size: 12.5px; color: var(--muted); font-weight: 600; }
table.kv td { font-size: 14px; }

/* Calendar 视图 */
.cal-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.cal-legend { margin-left: auto; display: flex; gap: 14px; align-items: center; }
.cal-legend span { display: inline-flex; align-items: center; gap: 5px; }
.cal-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.cal-grid {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px;
}
.cal-wd {
  text-align: center; font-size: 11px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .06em; padding: 4px 0;
}
.cal-cell {
  min-height: 96px; border: 1px solid var(--line); border-radius: 10px;
  padding: 5px; background: var(--card); overflow: hidden;
}
.cal-cell.today { border-color: var(--red); box-shadow: 0 0 0 2px rgba(208,1,27,.15); }
.cal-cell.empty-cell { background: transparent; border: 1px dashed var(--line); opacity: .4; }
.cal-day {
  font-size: 12px; font-weight: 700; color: var(--ink-2);
  width: 22px; height: 22px; line-height: 22px; text-align: center; border-radius: 50%;
  margin-bottom: 3px;
}
.cal-day.on { background: var(--red); color: #fff; }
.cal-item {
  display: block; font-size: 11px; line-height: 1.35; border-radius: 5px;
  padding: 1.5px 5px; margin-bottom: 2px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; color: var(--ink-2);
}
.cal-item.install { background: var(--info-bg); color: var(--info); }
.cal-item.warranty { background: var(--warn-bg); color: var(--warn-c); }
.cal-item.event { background: rgba(208,1,27,.1); color: var(--red); }
@media (max-width: 860px) {
  .cal-cell { min-height: 64px; }
  .cal-item { font-size: 10px; }
}

/* Assets list：子设备展开 + Board 卡图 */
.subs-toggle {
  display: block; margin: 0 0 2px 74px; border: none; background: none;
  color: var(--muted); font-size: 12px; font-weight: 600; cursor: pointer; padding: 2px 8px;
}
.subs-toggle:hover { color: var(--red); }
.subs-toggle.open { color: var(--red); }
.subs-panel { margin: 0 6px 8px 40px; border-left: 2px solid var(--line); padding-left: 10px; }
.asset-row.sub { padding: 7px 10px; }
.asset-model-filter { flex-wrap: wrap; }
.asset-clear-filter { margin-left: auto; }
.asset-parent-text { display: block; margin: 3px 0 0; color: var(--muted); }
.asset-parent-link { color: var(--muted); text-decoration: none; }
.asset-parent-link:hover { color: var(--red); text-decoration: underline; }
.asset-relation-badge { margin-left: 6px; font-size: 10px; }
.subs-toggle:focus-visible, .asset-parent-link:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; }
.kb-card-img {
  display: flex; align-items: center; justify-content: center;
  height: 90px; background: #F4F6FA; overflow: hidden;
}
.kb-card-img img { width: 100%; height: 100%; object-fit: cover; }
[data-theme="dark"] .kb-card-img { background: #161C26; }

/* Assets list · aligned inventory rows with a compact mobile composition */
.asset-list-card { padding: 0; overflow: hidden; }
.asset-list-head, .asset-row-main {
  display: grid; grid-template-columns: 52px minmax(180px,1.5fr) minmax(104px,.7fr)
    minmax(132px,.9fr) minmax(100px,.7fr) minmax(94px,auto) 18px;
  column-gap: 16px; align-items: center;
}
.asset-list-head {
  padding: 11px 18px; border-bottom: 1px solid var(--line); background: var(--bg);
  color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .02em;
}
.asset-row-main {
  min-height: 78px; padding: 12px 18px; border: 0; border-bottom: 1px solid var(--line);
  border-radius: 0; color: var(--ink);
}
.asset-row-wrap:last-child .asset-row-main { border-bottom: 0; }
.asset-row-main:hover { background: var(--bg); border-color: var(--line); color: var(--ink); }
.asset-row-main:focus-visible { outline: 2px solid var(--red); outline-offset: -2px; }
.asset-row-main .asset-main { gap: 4px; }
.asset-row-main .asset-thumb img { object-fit: contain; padding: 4px; }
.asset-sn-line { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.asset-sn-line b {
  font-size: 15px; line-height: 1.35; font-variant-numeric: tabular-nums; overflow-wrap: anywhere;
}
.asset-sub-count { color: var(--muted); font-size: 11px; white-space: nowrap; }
.asset-row-main .tiny { line-height: 1.45; }
.asset-model-col, .asset-firmware, .asset-install, .asset-status {
  display: flex; align-items: center; flex-wrap: wrap; gap: 4px; min-width: 0;
}
.asset-firmware .chip { max-width: 100%; white-space: normal; overflow-wrap: anywhere; line-height: 1.35; }
.asset-install { color: var(--ink-2); font-variant-numeric: tabular-nums; }
.asset-chevron { width: 16px; height: 16px; color: var(--muted); transition: transform .15s ease, color .15s ease; }
.asset-row-main:hover .asset-chevron { transform: translateX(2px); color: var(--red); }
.asset-list-card .subs-toggle {
  width: calc(100% - 86px); min-height: 44px; margin: 0 0 0 86px; padding: 8px 10px;
  border-bottom: 1px solid var(--line); text-align: left;
}
.asset-list-card .subs-panel {
  margin: 0 18px 12px 86px; padding: 6px 10px; border: 1px solid var(--line);
  border-radius: 8px; background: var(--bg);
}
.asset-list-card .subs-panel .asset-row:last-child { border-bottom: 0; }
[data-theme="dark"] .asset-row-main:hover { background: var(--raised); }
@media (max-width: 1180px) {
  .asset-list-head, .asset-row-main {
    grid-template-columns: 52px minmax(160px,1.4fr) minmax(90px,.65fr)
      minmax(110px,.8fr) minmax(90px,auto) 16px;
    column-gap: 12px;
  }
  .asset-list-head > :nth-child(5), .asset-row-main > .asset-install { display: none; }
}
@media (max-width: 760px) {
  .asset-list-head { display: none; }
  .asset-row-main {
    grid-template-columns: 48px minmax(0,1fr) auto; grid-template-rows: auto auto;
    gap: 10px 12px; min-height: 0; padding: 14px; align-items: start;
  }
  .asset-row-main .asset-thumb { grid-column: 1; grid-row: 1 / span 2; width: 48px; height: 48px; }
  .asset-row-main .asset-main { grid-column: 2; grid-row: 1; }
  .asset-row-main .asset-status { grid-column: 3; grid-row: 1; justify-content: flex-end; }
  .asset-row-main .asset-model-col { grid-column: 2; grid-row: 2; }
  .asset-row-main .asset-firmware { grid-column: 3; grid-row: 2; justify-content: flex-end; text-align: right; }
  .asset-row-main .asset-firmware .chip { font-size: 11px; }
  .asset-row-main > .asset-install, .asset-row-main > .asset-chevron { display: none; }
  .asset-list-card .subs-toggle { width: calc(100% - 74px); margin-left: 74px; }
  .asset-list-card .subs-panel { margin: 0 12px 12px 64px; }
}
[data-theme="dark"] .asset-list-card .badge[style*="#16a34a"] { color: #86EFAC !important; background: #173B27 !important; }
[data-theme="dark"] .asset-list-card .badge[style*="#94a3b8"] { color: #E2E8F0 !important; background: #343A44 !important; }
[data-theme="dark"] .asset-list-card .badge[style*="#dc2626"] { color: #FDA4AF !important; background: #4A2329 !important; }
[data-theme="dark"] .asset-list-card .badge[style*="#4b5563"] { color: #E5E7EB !important; background: #383A40 !important; }
[data-theme="dark"] .asset-list-card .badge[style*="#2563eb"] { color: #93C5FD !important; background: #1E3352 !important; }
@media (max-width: 560px) {
  .asset-statgrid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; margin-top: 12px; }
  .asset-statgrid .stat { min-height: 74px; padding: 12px 14px; box-shadow: none; }
  .asset-statgrid .stat .num { font-size: 24px; line-height: 1.25; }
  .asset-statgrid .stat .muted { font-size: 12px; }
}

/* ---------- Portal polish pack (v1.2) ---------- */
.topbar {
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  background: color-mix(in srgb, var(--card) 88%, transparent);
  box-shadow: 0 1px 0 var(--line), 0 4px 16px rgba(16,24,40,.05);
}
.mainnav a { font-weight: 500; }
.mainnav a.on { font-weight: 700; box-shadow: inset 0 0 0 1px rgba(208,1,27,.18); }
.bar-right .who { padding: 4px 10px; background: var(--bg); border-radius: 20px; font-size: 12.5px; }

/* Hero */
.p-hero { border-radius: 18px; padding: 34px 36px; }
.p-hero::before {
  content: ""; position: absolute; right: 90px; bottom: -90px; width: 200px; height: 200px;
  border-radius: 50%; background: rgba(255,255,255,.045);
}
.p-hero .eyebrow {
  display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .14em;
  text-transform: uppercase; color: rgba(255,255,255,.65); margin-bottom: 8px;
}
.p-hero h1 { font-size: 27px; letter-spacing: -0.01em; }
.p-hero .hero-actions { margin-top: 20px; }
.p-hero .btn-solid, .p-hero .btn-ghost { padding: 10px 20px; border-radius: 11px; }

/* Portal stat cards */
.p-stat { display: flex; align-items: center; gap: 14px; padding: 18px 20px; }
.p-stat .ps-icon {
  width: 44px; height: 44px; border-radius: 12px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 20px;
}
.p-stat .ps-icon.red { background: #FDECEE; }
.p-stat .ps-icon.blue { background: #E8F0FE; }
.p-stat .ps-icon.green { background: #E7F6EE; }
.p-stat .num { font-size: 28px; font-weight: 800; line-height: 1.1; color: var(--ink); }
.p-stat .lbl { font-size: 12.5px; color: var(--muted); font-weight: 600; }
[data-theme="dark"] .p-stat .ps-icon.red { background: rgba(208,1,27,.18); }
[data-theme="dark"] .p-stat .ps-icon.blue { background: rgba(37,99,235,.18); }
[data-theme="dark"] .p-stat .ps-icon.green { background: rgba(22,163,74,.16); }

/* Machine cards with icon band */
.machine-card { padding: 0; overflow: hidden; transition: transform .18s, box-shadow .18s, border-color .18s; }
.machine-card:hover { box-shadow: 0 8px 24px rgba(16,24,40,.12); }
.mc-band {
  height: 140px; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1A1D21 0%, #3A1115 70%, #7A0E1E 130%);
  font-size: 34px; position: relative; overflow: hidden;
}
.mc-band > img { width: 100%; height: 100%; object-fit: contain; padding: 8px 8px 30px; }
.mc-band .mc-model-tag {
  position: absolute; left: 12px; bottom: 10px; font-size: 10.5px; font-weight: 700;
  letter-spacing: .08em; color: rgba(255,255,255,.85); text-transform: uppercase;
  background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.22);
  padding: 2px 8px; border-radius: 20px;
}
.mc-body { padding: 14px 16px 15px; }
.mc-body .mc-sn { margin: 0 0 8px; }
[data-theme="dark"] .mc-band { background: linear-gradient(135deg, #0E1218 0%, #2A0D11 70%, #5A0A16 130%); }

/* Notification cards */
.notif-card { transition: transform .15s, box-shadow .15s; }
a.notif-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(16,24,40,.10); }

/* Portal entrance animation */
main.wrap > .p-hero, main.wrap > .machine-grid, main.wrap > .notif-card,
.rail-main > .p-hero, .rail-main > .machine-grid, .rail-main > .notif-card { animation: fadeUp .25s ease both; }

/* Portal footer */
.foot { color: var(--muted); font-size: 12.5px; padding: 18px 20px 30px; text-align: center; }

/* ---------- Exec dashboard (v1.2) ---------- */
.pipe { display: flex; height: 26px; border-radius: 8px; overflow: hidden; background: var(--bg); }
.pipe-seg { display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 11px; font-weight: 700; min-width: 22px; transition: filter .15s; }
.pipe-seg:hover { filter: brightness(1.12); }
.age-pill { flex: 1; text-align: center; border: 1.5px solid var(--line); border-radius: 10px;
  padding: 8px 4px; display: flex; flex-direction: column; gap: 2px; }
.age-pill b { font-size: 18px; }
.donut-wrap { display: flex; align-items: center; gap: 20px; }
.donut { width: 128px; height: 128px; border-radius: 50%; position: relative; flex-shrink: 0; }
.donut::after { content: ""; position: absolute; inset: 20px; background: var(--card); border-radius: 50%; }
.donut-c { position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; z-index: 1; }
.tech-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.tech-card { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px;
  background: var(--card); transition: box-shadow .15s, transform .15s; }
.tech-card:hover { box-shadow: 0 6px 18px rgba(16,24,40,.10); transform: translateY(-2px); }
.rate-bar { height: 6px; background: var(--bg); border-radius: 4px; overflow: hidden; }
.rate-fill { height: 100%; background: linear-gradient(90deg, #16a34a, #22c55e); border-radius: 4px; }
.mono { font-family: ui-monospace, "SF Mono", Consolas, monospace; }

/* ---------- 返回上一级链接 ---------- */
.back-link {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12.5px; font-weight: 600; color: var(--muted);
  margin-bottom: 10px; border-radius: 8px; padding: 3px 8px 3px 4px;
  transition: color .15s, background .15s;
}
.back-link:hover { color: var(--red); background: var(--hover); }

/* ---------- 可折叠侧栏 ---------- */
.rail-top { display: flex; align-items: center; gap: 4px; border-bottom: 1px solid var(--line); }
.rail-top .rail-brand { flex: 1; border-bottom: none; min-width: 0; }
.rail-toggle {
  border: none; background: none; cursor: pointer; color: var(--muted);
  width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; transition: background .15s;
}
.rail-toggle:hover { background: var(--hover); color: var(--ink); }
.rail-toggle svg { width: 16px; height: 16px; }
.rail-group { display: flex; align-items: center; cursor: pointer; transition: color .15s; }
.rail-group:hover { color: var(--ink); }
.rail-group .rg-chev { margin-left: auto; display: flex; transition: transform .15s; }
.rail-group .rg-chev svg { width: 13px; height: 13px; }
.rail-group.collapsed .rg-chev { transform: rotate(-90deg); }

/* 窄栏（仅图标）模式 */
body.rail-mini .siderail { width: 64px; padding: 14px 8px; }
body.rail-mini .rail-main { margin-left: 64px; }
body.rail-mini .rail-title,
body.rail-mini .rail-group,
body.rail-mini .railsearch,
body.rail-mini .who { display: none; }
body.rail-mini .rail-top { flex-direction: column; gap: 8px; padding-bottom: 10px; }
body.rail-mini .rail-brand { padding: 4px 0 0; justify-content: center; }
body.rail-mini .railnav a { justify-content: center; padding: 10px 0; }
body.rail-mini .railnav a span:not(.ri) { display: none; }
body.rail-mini .rail-user { justify-content: center; padding: 0; }

@media (max-width: 860px) {
  .rail-toggle { display: none; }
  .rail-top { border-bottom: none; }
  body.rail-mini .siderail { width: 100%; }
  body.rail-mini .rail-main { margin-left: 0; }
}

/* ---------- dedicated customer portal sign in ---------- */
.portal-login-body {
  min-height: 100vh; margin: 0; display: flex; flex-direction: column;
  background: radial-gradient(900px 540px at 10% 0%, rgba(208,1,27,.12), transparent 62%), var(--bg);
}
.portal-login-shell {
  width: min(1040px, calc(100% - 40px)); margin: auto; padding: 48px 0;
  display: grid; grid-template-columns: 1.1fr .9fr; gap: 64px; align-items: center;
}
.portal-login-intro { padding: 12px 0; }
.portal-login-brand { display: inline-block; margin-bottom: 52px; }
.portal-login-brand img { width: 156px; height: auto; }
.portal-login-intro h1 { font-size: clamp(32px, 4vw, 48px); line-height: 1.08; letter-spacing: -.035em; margin: 12px 0 18px; max-width: 520px; }
.portal-login-intro > p { max-width: 510px; font-size: 16px; line-height: 1.7; color: var(--muted); }
.portal-login-intro ul { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 13px; color: var(--ink-2); font-size: 14px; }
.portal-login-intro li { display: flex; align-items: center; gap: 10px; }
.portal-login-intro li::before { content: "✓"; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: rgba(208,1,27,.1); color: var(--red); font-weight: 800; }
.portal-login-card { width: 100%; max-width: 410px; margin: 0; padding: 36px; text-align: left; }
.portal-login-card .login-mark { width: 48px; margin-bottom: 20px; }
.portal-login-card h2 { margin: 8px 0; font-size: 24px; letter-spacing: -.02em; }
.portal-login-card > .muted { margin: 0 0 22px; font-size: 13px; }
.portal-login-card .flash { margin: 0 0 16px; font-size: 13px; }
.login-field { display: grid; gap: 7px; color: var(--ink-2); font-size: 12px; font-weight: 700; }
.login-field input { width: 100%; box-sizing: border-box; }
.login-remember { display: flex; align-items: center; gap: 8px; margin: 2px 0 6px; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.login-remember input { width: auto; margin: 0; }
.portal-login-help { margin: 20px 0 10px; color: var(--muted); font-size: 12px; line-height: 1.55; }
.portal-staff-link { display: inline-block; margin-top: 8px; color: var(--muted); font-size: 12px; font-weight: 600; }
.portal-staff-link:hover { color: var(--red); }
.portal-login-foot { padding: 18px 24px; text-align: center; color: var(--muted); font-size: 11px; }
@media (max-width: 800px) {
  .portal-login-shell { grid-template-columns: 1fr; gap: 28px; width: min(440px, calc(100% - 32px)); padding: 32px 0; }
  .portal-login-intro { text-align: center; }
  .portal-login-brand { margin-bottom: 24px; }
  .portal-login-intro h1 { font-size: 30px; margin-left: auto; margin-right: auto; }
  .portal-login-intro > p { font-size: 14px; }
  .portal-login-intro ul { display: none; }
  .portal-login-card { max-width: none; }
}

/* ---------- customer support home ---------- */
.support-home-head { display: flex; justify-content: space-between; align-items: center; gap: 24px; margin: 4px 0 26px; }
.support-home-head h1 { margin: 7px 0 6px; font-size: 28px; letter-spacing: -.025em; }
.support-home-head p { margin: 0; color: var(--muted); font-size: 14px; }
.support-home-actions { display: flex; gap: 9px; flex-shrink: 0; }
.support-home-actions .btn { display: inline-flex; align-items: center; gap: 7px; }
.portal-home-section { margin-bottom: 28px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 13px; }
.section-head h2 { margin: 2px 0 0; font-size: 19px; letter-spacing: -.015em; }
.section-head > h2 { margin: 0; }
.section-kicker { color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .1em; }
.count-pill { display: inline-flex; align-items: center; width: fit-content; padding: 3px 9px; border-radius: 999px; background: var(--hover); color: var(--ink-2); font-size: 11px; font-weight: 700; white-space: nowrap; }
.count-pill.attention { background: #FEF3C7; color: #92400E; }
.count-pill.clear { background: #DCFCE7; color: #15803D; }
.next-action-section { padding: 20px; border: 1px solid #F3D6A0; border-radius: 16px; background: linear-gradient(135deg, rgba(254,243,199,.5), var(--card) 58%); }
.next-action-card { display: grid; grid-template-columns: auto 1fr auto; gap: 15px; align-items: center; padding: 18px; border: 1px solid var(--line); border-radius: 13px; background: var(--card); box-shadow: var(--shadow); }
.next-action-card + .next-action-card { margin-top: 10px; }
.next-action-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; background: #FEF3C7; color: #B45309; font-size: 21px; font-weight: 800; }
.next-action-main h3 { margin: 5px 0 3px; font-size: 16px; }
.next-action-main > p:not(.support-meta) { margin: 10px 0 5px; color: var(--ink-2); font-size: 13px; line-height: 1.5; }
.status-label { font-size: 11px; font-weight: 800; }
.status-label.attention { color: #B45309; }
.support-meta { margin: 0; color: var(--muted); font-size: 12px; }
.portal-clear-state { display: flex; align-items: center; gap: 14px; padding: 22px; border: 1px dashed var(--line); border-radius: 13px; background: var(--card); }
.portal-clear-state h3 { margin: 0 0 3px; font-size: 15px; }
.portal-clear-state p { margin: 0; color: var(--muted); font-size: 13px; }
.portal-clear-state.compact { padding: 26px; }
.portal-clear-state.compact .btn { margin-left: auto; }
.clear-check { display: grid; place-items: center; flex-shrink: 0; width: 34px; height: 34px; border-radius: 50%; background: #DCFCE7; color: #15803D; font-size: 18px; font-weight: 800; }
.support-request-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.support-request { display: block; padding: 17px 18px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); color: inherit; box-shadow: var(--shadow); transition: border-color .15s, transform .15s, box-shadow .15s; }
.support-request:hover { border-color: rgba(208,1,27,.45); transform: translateY(-1px); box-shadow: var(--shadow-2); }
.support-request-top, .support-request-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.support-request h3 { margin: 12px 0 4px; font-size: 15px; }
.support-next-step { margin: 14px 0; padding: 10px 12px; border-radius: 9px; background: var(--bg); }
.support-next-step span { display: block; margin-bottom: 3px; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.support-next-step b { display: block; color: var(--ink-2); font-size: 12px; font-weight: 600; line-height: 1.45; }
.support-request-foot { color: var(--muted); font-size: 11px; }
.home-machine-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.home-machine-card { padding: 17px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); box-shadow: var(--shadow); }
.machine-card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.machine-model { color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.home-machine-media { height: 104px; margin-top: 12px; display: flex; align-items: center; justify-content: center; overflow: hidden; border-radius: 6px; background: var(--raised); }
.home-machine-media img { width: 100%; height: 100%; object-fit: contain; }
.exec-device-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.table-wrap { width: 100%; overflow-x: auto; contain: layout paint; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.card table.sf-order-table { display: table; min-width: 560px; overflow-x: visible; }
.card .sf-order-table thead { display: table-header-group; width: auto; min-width: 0; }
.card .sf-order-table tbody { display: table-row-group; width: auto; min-width: 0; }
.sf-order-table th, .sf-order-table td { white-space: nowrap; }
.sf-order-table td:last-child, .sf-order-table th:last-child { width: 42px; text-align: right; }
.home-machine-card h3 { margin: 12px 0; font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 15px; word-break: break-all; }
.home-machine-card dl { margin: 0 0 15px; display: grid; gap: 6px; }
.home-machine-card dl div { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; }
.home-machine-card dt { color: var(--muted); }
.home-machine-card dd { margin: 0; text-align: right; color: var(--ink-2); }
.machine-card-actions { display: flex; gap: 7px; }
.machine-card-actions .btn { flex: 1; padding: 7px 9px; font-size: 11px; text-align: center; }
.portal-home-lower { display: grid; grid-template-columns: 1.5fr 1fr; gap: 14px; align-items: start; }
.portal-recent-card, .home-notice, .powder-summary { padding: 18px; }
.recent-update { display: grid; grid-template-columns: 82px 1fr; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); color: var(--ink-2); font-size: 12px; line-height: 1.5; }
.recent-update:hover { color: var(--red); }
.portal-home-side { display: grid; gap: 14px; }
.home-notice { display: block; color: inherit; border-left: 3px solid #2563EB; }
.home-notice h3, .powder-summary h3 { margin: 8px 0; font-size: 15px; }
.powder-summary p { margin-bottom: 0; font-size: 12px; }
[data-theme="dark"] .next-action-section { border-color: #71571D; background: linear-gradient(135deg, rgba(113,87,29,.18), var(--card) 58%); }
[data-theme="dark"] .next-action-icon, [data-theme="dark"] .count-pill.attention { background: rgba(245,158,11,.15); color: #FBBF24; }
[data-theme="dark"] .count-pill.clear, [data-theme="dark"] .clear-check { background: rgba(34,197,94,.14); color: #4ADE80; }
@media (max-width: 1100px) { .home-machine-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) {
  .support-home-head { align-items: flex-start; flex-direction: column; gap: 15px; }
  .support-home-head h1 { font-size: 24px; }
  .support-home-actions { width: 100%; }
  .support-home-actions .btn { flex: 1; justify-content: center; }
  .next-action-card { grid-template-columns: auto 1fr; }
  .next-action-card > .btn { grid-column: 1 / -1; text-align: center; }
  .support-request-list, .home-machine-grid, .portal-home-lower { grid-template-columns: 1fr; }
  .support-request-foot { align-items: flex-start; flex-direction: column; gap: 4px; }
  .recent-update { grid-template-columns: 1fr; gap: 2px; }
}

/* ============================================================
   Framed Sheet · shared staff + customer experience
   Taste Skill seed 1267803683 · 2026-10-31
   ============================================================ */
@font-face { font-family: "IBM Plex Sans"; src: url("/static/fonts/ibm-plex-sans-400.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; src: url("/static/fonts/ibm-plex-sans-500.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; src: url("/static/fonts/ibm-plex-sans-600.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("/static/fonts/ibm-plex-mono-400.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
:root {
  --red: #C9001A;
  --red-dark: #A80016;
  --ink: #171719;
  --ink-2: #454549;
  --muted: #65656A;
  --line: #E4E4E7;
  --border: #E4E4E7;
  --hover: #F0F0F2;
  --bg: #F4F4F5;
  --card: #FFFFFF;
  --chrome: #F7F5F5;
  --raised: #F4F4F5;
  --active: #EAE8E9;
  --rule: #EEEEEF;
  --radius: 8px;
  --shadow: none;
  --shadow-2: 0 12px 32px rgba(0,0,0,.14);
}
html { background: var(--chrome); }
body {
  background: var(--chrome); color: var(--ink);
  font: 400 14px/1.55 "IBM Plex Sans", "Segoe UI", Arial, sans-serif;
}
h1, h2, h3, h4 { font-weight: 600; line-height: 1.3; }
a { color: #B60019; }
a:hover { color: var(--red-dark); }
.mono, .cust-sns, .machine-card .mc-sn, .home-machine-card h3, td.num, .num {
  font-family: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  font-variant-numeric: tabular-nums;
}
td:has(.stock-chip), td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.eyebrow, .section-kicker {
  color: var(--muted); font-size: 10px; font-weight: 600; letter-spacing: .11em; line-height: 1.4;
}
svg { flex-shrink: 0; }
.btn svg, .qa-btn svg, .card h3 svg, .um-label svg, .um-foot svg, .back-link svg, .overdue-link svg {
  width: 15px; height: 15px; stroke-width: 1.8; vertical-align: -2px;
}
.empty-icon { display: block; width: 28px; height: 28px; margin: 0 auto 10px; color: var(--muted); stroke-width: 1.5; }

/* Quiet, consistent controls */
.btn {
  min-height: 34px; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 7px 14px; border: 1px solid var(--line); border-radius: 6px;
  background: var(--card); color: var(--ink-2); font-size: 13px; font-weight: 500; line-height: 1.35;
  box-shadow: none; transition: background-color .15s, border-color .15s, color .15s;
}
.btn:hover { background: var(--hover); border-color: #C9C9CD; color: var(--ink); transform: none; box-shadow: none; }
.btn.primary { background: var(--red); border-color: var(--red); color: #FFF; box-shadow: none; }
.btn.primary:hover { background: var(--red-dark); border-color: var(--red-dark); color: #FFF; transform: none; box-shadow: none; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #FFF; }
.btn:active { transform: none; }
input[type="text"], input:not([type]), input[type="password"], input[type="email"],
input[type="date"], input[type="number"], input[type="search"], select, textarea {
  min-height: 34px; border: 1px solid var(--line); border-radius: 6px; background: var(--card); color: var(--ink);
  font-family: inherit; font-size: 13px; box-shadow: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--red); box-shadow: 0 0 0 2px rgba(201,0,26,.11); }
::placeholder { color: #74747A; opacity: 1; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }

/* Static surfaces use borders, not floating shadows */
.card, .stat, .qa-btn, .support-request, .home-machine-card, .next-action-card,
.cust-card, .cust-nav, .machine-card, .kb-card, .tech-card, .notif-card, .login-card {
  box-shadow: none;
}
.card { border: 1px solid var(--line); border-radius: 8px; padding: 20px; background: var(--card); }
.card > h3 { padding-bottom: 12px; margin-bottom: 12px; border-bottom-color: var(--rule); font-size: 15px; }
.card > h3 > svg { color: var(--muted); }
a.card:hover, .card.stat:hover, .prod-card:hover, .cust-card:hover, .machine-card:hover,
.kb-card:hover, .tech-card:hover, .notif-card:hover { box-shadow: none; transform: none; }
main.wrap > .card, main.wrap > .pagetitle, .rail-main > .card, .rail-main > .pagetitle,
main.wrap > .p-hero, main.wrap > .machine-grid, main.wrap > .notif-card,
.rail-main > .p-hero, .rail-main > .machine-grid, .rail-main > .notif-card { animation: none; }
.badge {
  border-radius: 5px; padding: 2px 8px; background: var(--hover); color: var(--ink-2);
  font-size: 11px; font-weight: 500; letter-spacing: 0;
}
.badge.warn { color: var(--warn-c); background: var(--warn-bg); }
.badge.ok { color: var(--ok); background: var(--ok-bg); }
.badge.danger { color: var(--danger); background: var(--danger-bg); }
.chip { border-radius: 5px; }
.flash { border-radius: 6px; box-shadow: none; font-weight: 500; }
.pagetitle { font-size: 22px; font-weight: 600; letter-spacing: -.015em; }
th {
  padding: 9px 12px; background: transparent; color: var(--muted); font-size: 12px;
  font-weight: 500; text-transform: none; letter-spacing: 0;
}
td { padding: 12px; border-bottom-color: var(--rule); }
tbody tr:hover { background: #FAFAFA; }
.catnav { gap: 20px; border-bottom: 1px solid var(--line); margin-bottom: 20px; }
.catnav a {
  position: relative; padding: 7px 0 10px; border: 0; border-radius: 0; background: transparent;
  color: var(--muted); font-size: 13px; font-weight: 500;
}
.catnav a:hover { color: var(--ink); }
.catnav a.on { background: transparent; color: var(--ink); box-shadow: none; font-weight: 600; }
.catnav a.on::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--red); }

/* Shared L-shaped frame and white work sheet */
.mobile-topbar, .mobile-nav-scrim { display: none; }
.siderail {
  position: fixed; inset: 0 auto 0 0; width: 228px; z-index: 40;
  display: flex; flex-direction: column; padding: 12px 10px;
  background: var(--chrome); border-right: 0;
}
.rail-top { min-height: 48px; gap: 4px; border-bottom: 0; }
.rail-top .rail-brand { border-bottom: 0; }
.rail-brand { gap: 9px; padding: 4px 6px; }
.rail-logo { width: 29px; height: 29px; object-fit: contain; }
.rail-title { color: var(--ink); font-size: 12.5px; font-weight: 600; line-height: 1.25; }
.rail-title em {
  display: inline-block; padding: 1px 5px; border: 0; border-radius: 4px; background: var(--active);
  color: var(--muted); font-family: "IBM Plex Mono", monospace; font-size: 8px; font-weight: 400; vertical-align: 1px;
}
.rail-toggle { width: 28px; height: 28px; border-radius: 5px; color: var(--muted); }
.railnav { display: flex; flex-direction: column; gap: 2px; flex: 1; padding: 10px 0; overflow-y: auto; }
.railnav a {
  position: relative; min-height: 35px; display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; border-radius: 6px; color: var(--ink-2); font-size: 13px; font-weight: 400;
  transition: background-color .15s, color .15s;
}
.railnav a .ri { width: 18px; color: var(--muted); font-size: 14px; text-align: center; }
.railnav a .ri svg { width: 16px; height: 16px; stroke-width: 1.8; }
.railnav a:hover { background: var(--hover); color: var(--ink); }
.railnav a.on { background: var(--active); color: var(--ink); box-shadow: none; font-weight: 600; }
.railnav a.on .ri { color: var(--ink); }
.rail-group {
  width: 100%; min-height: 28px; display: flex; align-items: center; margin: 6px 0 0; padding: 5px 10px;
  border: 0; background: transparent; color: var(--muted); font-family: inherit; font-size: 10px;
  font-weight: 500; letter-spacing: .08em; text-align: left; text-transform: uppercase; cursor: pointer;
}
.rail-group:hover { color: var(--ink); }
.rail-group .rg-chev { margin-left: auto; }
.nav-count { margin-left: auto; font-size: 10px; }
.nav-count[hidden] { display: none; }
.soon-tag { margin-left: auto; padding: 1px 6px; border-radius: 4px; background: var(--hover); color: var(--muted); font-size: 9px; font-weight: 500; }
.rail-bottom { display: grid; gap: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.railsearch { position: relative; display: block; }
.railsearch > svg { position: absolute; left: 10px; top: 9px; width: 14px; height: 14px; color: var(--muted); pointer-events: none; }
.railsearch input { width: 100%; min-height: 32px; padding: 6px 10px 6px 31px; border-radius: 6px; background: var(--raised); font-size: 12px; }
.rail-user { padding: 0 5px; }
.avatar { background: #37373B; color: #FFF; font-weight: 500; }
.avatar-btn:hover { transform: none; box-shadow: 0 0 0 2px var(--line); }
.um-avatar { width: 38px; height: 38px; font-size: 15px; }
.who { color: var(--ink-2); font-size: 12px; font-weight: 500; }
.user-menu { border-radius: 10px; border-color: var(--line); box-shadow: var(--shadow-2); }
.um-label { display: flex; align-items: center; gap: 6px; }
.um-foot a { display: inline-flex; align-items: center; gap: 5px; }
.theme-opt { border-radius: 6px; }
.theme-opt svg { width: 13px; height: 13px; vertical-align: -2px; margin-right: 4px; }
.rail-main { margin-left: 228px; padding: 8px 8px 8px 0; min-height: 100vh; background: var(--chrome); }
.rail-main > * { max-width: none; }
.workspace-sheet {
  min-height: calc(100vh - 16px); margin: 0; padding: 24px; border: 1px solid var(--line);
  border-radius: 16px; background: var(--card); box-shadow: none;
}
.workspace-sheet .foot { padding: 26px 0 0; text-align: left; font-size: 11px; }
.back-link { margin: -4px 0 12px; padding-left: 0; font-size: 12px; }
.back-link svg { width: 14px; height: 14px; }

/* Staff overview: queue first, one KPI strip, real records */
.home-greet { margin: 0 0 20px; gap: 16px; }
.home-greet h1 { margin: 3px 0 3px; font-size: 24px; letter-spacing: -.02em; }
.home-greet p { font-size: 12px; }
.overdue-link { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; }
.quick-act { gap: 8px; margin: 0 0 20px; }
.qa-btn {
  gap: 6px; padding: 7px 11px; border-radius: 6px; background: var(--card); color: var(--ink-2);
  font-size: 12px; font-weight: 500; box-shadow: none;
}
.qa-btn svg { color: var(--muted); }
.qa-btn:hover { border-color: #C9C9CD; background: var(--hover); color: var(--ink); transform: none; }
.home-statgrid {
  grid-template-columns: repeat(5, minmax(0,1fr)); gap: 0; margin: 0 0 24px;
  overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: var(--card);
}
.home-statgrid .stat { position: static; padding: 17px 18px; border: 0; border-right: 1px solid var(--rule); border-radius: 0; }
.home-statgrid .stat:last-child { border-right: 0; }
.home-statgrid .stat:hover { background: #FAFAFA; transform: none; }
.stat::before { display: none; }
.stat .num { margin-bottom: 3px; color: var(--ink); font-size: 27px; font-weight: 400; line-height: 1.2; letter-spacing: -.03em; }
.stat.priority-stat .num { color: var(--red); }
.stat-label { color: var(--ink-2); font-size: 12px; font-weight: 600; }
.stat-note { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }
.home-work-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; margin: 0; }
.home-work-grid .card { min-width: 0; }
.my-work-card { grid-column: 1 / -1; }
.my-job-card { padding: 0; overflow: hidden; }
.my-job-head { padding: 18px 20px 16px; border-bottom: 1px solid var(--rule); }
.my-job-head h3 { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 16px; }
.my-job-head h3 svg { width: 18px; color: var(--muted); }
.my-job-head p { margin: 4px 0 0 26px; color: var(--muted); font-size: 12px; }
.my-job-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); }
.my-job-group { min-width: 0; padding: 16px 18px 18px; border-right: 1px solid var(--rule); }
.my-job-group:last-child { border-right: 0; }
.my-job-group-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 28px; }
.my-job-group-head h4 { display: flex; align-items: center; gap: 7px; min-width: 0; margin: 0; font-size: 13px; font-weight: 600; }
.my-job-group-head h4 > svg { width: 15px; height: 15px; flex: 0 0 auto; color: var(--muted); }
.my-job-group-head .more { float: none; flex: 0 0 auto; font-size: 11px; }
.my-job-count { min-width: 20px; padding: 1px 6px; border-radius: 10px; background: var(--raised); color: var(--muted); font-size: 10px; font-weight: 600; text-align: center; }
.my-job-count.unread { background: var(--warn-bg); color: var(--warn-c); }
.my-job-list { margin-top: 10px; }
.my-job-item { min-width: 0; padding: 12px 0; border-top: 1px solid var(--rule); }
.my-job-item-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 20px; margin-bottom: 7px; }
.my-job-item-top time, .my-job-item-time { flex: 0 0 auto; color: var(--muted); font-size: 10px; white-space: nowrap; }
.my-job-item-title { display: -webkit-box; overflow: hidden; color: var(--ink); font-size: 12px; font-weight: 500; line-height: 1.5; overflow-wrap: anywhere; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.my-job-item-title:hover { color: var(--red); }
.my-job-item-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; margin: 5px 0 0; color: var(--muted); font-size: 10px; line-height: 1.5; overflow-wrap: anywhere; }
.my-job-item-time { display: block; margin-top: 4px; }
.my-job-order-no { overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.my-job-status { flex: 0 0 auto; color: var(--muted); font-size: 10px; }
.my-job-status.active { color: var(--ok); font-weight: 600; }
.my-job-unread { color: var(--warn-c); font-size: 10px; }
.my-job-unread b { margin-right: 2px; font-size: 12px; }
.my-job-message-preview { display: -webkit-box; overflow: hidden; margin: 5px 0 0; color: var(--muted); font-size: 11px; line-height: 1.55; overflow-wrap: anywhere; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.my-job-message-preview svg { width: 12px; height: 12px; margin-right: 4px; vertical-align: -2px; }
.my-job-empty { min-height: 136px; display: grid; place-content: center; justify-items: center; padding: 24px 12px; font-size: 11px; line-height: 1.6; }
.my-job-empty .empty-icon { width: 24px; height: 24px; margin-bottom: 8px; }
.work-row { align-items: flex-start; }
.work-row-main { min-width: 0; }
.work-row-main > a { color: var(--ink); }
.due-date { color: var(--danger); font-weight: 600; }
.content-hint { margin: 14px 0 0; }
.empty { color: var(--muted); }

/* Customer overview keeps tasks before service and machines */
.support-home-head { margin: 0 0 26px; }
.support-home-head h1 { margin: 4px 0 5px; font-size: 24px; }
.support-home-head p { font-size: 13px; }
.support-home-head p b { color: var(--ink-2); font-weight: 500; }
.support-home-actions .btn { min-height: 36px; }
.portal-home-section { margin-bottom: 28px; }
.section-head h2 { font-size: 17px; }
.next-action-section { padding: 18px; border: 1px solid #E8D8AD; border-radius: 8px; background: #FFFDF7; }
.next-action-card { border-radius: 7px; }
.next-action-icon { border-radius: 7px; }
.support-request, .home-machine-card { border-radius: 8px; transition: border-color .15s, background-color .15s; }
.support-request:hover { border-color: #C6C6CA; transform: none; box-shadow: none; }
.support-next-step { border-radius: 6px; background: var(--raised); }
.home-notice { border-left: 2px solid var(--info); }
.portal-clear-state { border-radius: 7px; }
.count-pill { border-radius: 5px; }

/* Flat legacy components now share the same visual grammar */
.p-hero { border-radius: 8px; background: #303033; box-shadow: none; }
.p-hero::before, .p-hero::after { display: none; }
.mc-band { background: var(--raised); color: var(--muted); }
.mc-band .mc-model-tag { background: var(--card); border-color: var(--line); color: var(--ink-2); }
.rate-fill { background: var(--ok); }
.topbar { background: var(--card); box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; }
.avatar-upload, .theme-opt { border-radius: 6px; }

/* Staff sign-in and customer sign-in share one calm composition */
body:has(.staff-login-shell), .portal-login-body { background: var(--chrome); }
body:has(.staff-login-shell) .topbar, body:has(.staff-login-shell) > footer { display: none; }
body:has(.staff-login-shell) main.wrap { width: 100%; max-width: none; min-height: 100vh; padding: 0; }
.staff-login-shell, .portal-login-shell {
  width: min(1100px, calc(100% - 64px)); min-height: 100vh; margin: 0 auto; padding: 48px 0;
  display: grid; grid-template-columns: minmax(0,1fr) 400px; gap: 76px; align-items: center;
}
.staff-login-intro h1, .portal-login-intro h1 {
  max-width: 560px; margin: 12px 0 18px; font-size: clamp(32px,4vw,46px); font-weight: 500;
  line-height: 1.12; letter-spacing: -.035em;
}
.staff-login-intro > p, .portal-login-intro > p { max-width: 520px; color: var(--muted); font-size: 15px; line-height: 1.7; }
.staff-login-intro ul { list-style: none; display: grid; gap: 12px; margin: 28px 0 0; padding: 0; color: var(--ink-2); font-size: 13px; }
.staff-login-intro li { display: flex; align-items: center; gap: 10px; }
.staff-login-intro li::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--red); }
.staff-login-card, .portal-login-card {
  width: 100%; max-width: 400px; margin: 0; padding: 32px; border: 1px solid var(--line);
  border-radius: 16px; background: var(--card); box-shadow: none; text-align: left;
}
.staff-login-card h2, .portal-login-card h2 { margin: 7px 0; font-size: 23px; letter-spacing: -.02em; }
.staff-login-card > .muted, .portal-login-card > .muted { margin: 0 0 22px; }
.staff-login-card form, .portal-login-card form { display: grid; gap: 13px; margin: 0; }
.login-card input { min-height: 40px; padding: 9px 12px; border-radius: 6px; }
.login-card .btn { min-height: 40px; border-radius: 6px; }
.login-card .login-remember { margin: 0; }
.login-card .login-remember input { min-height: 0; }
.login-mark { width: 44px; margin-bottom: 18px; }
.dingtalk-status { display: none; margin: 16px 0; text-align: center; }
.sso-login-btn { margin-top: 10px; }
.portal-login-brand { margin-bottom: 44px; }
.portal-login-body { min-height: 100vh; }
.portal-login-shell { min-height: calc(100vh - 52px); }
.portal-login-foot { padding: 14px 24px; }

/* Neutral dark theme, including chat and form surfaces */
[data-theme="dark"] {
  --ink: #F1F1F2; --ink-2: #C8C8CC; --muted: #A3A3A9;
  --line: #3A3A3E; --border: #3A3A3E; --hover: #303034;
  --bg: #1B1B1D; --card: #222224; --chrome: #18181A; --raised: #2A2A2D; --active: #353538; --rule: #323236;
  --shadow: none; --shadow-2: 0 14px 34px rgba(0,0,0,.45);
}
[data-theme="dark"] body, [data-theme="dark"] html { background: var(--chrome); color: var(--ink); }
[data-theme="dark"] a { color: #FF7B86; }
[data-theme="dark"] a:hover { color: #FF9AA2; }
[data-theme="dark"] .btn { background: var(--card); color: var(--ink-2); }
[data-theme="dark"] .btn.primary, [data-theme="dark"] .btn.primary:hover { background: var(--red); color: #FFF; }
[data-theme="dark"] .btn:hover { background: var(--hover); color: var(--ink); }
[data-theme="dark"] input[type="text"], [data-theme="dark"] input:not([type]),
[data-theme="dark"] input[type="password"], [data-theme="dark"] input[type="email"],
[data-theme="dark"] input[type="date"], [data-theme="dark"] input[type="number"],
[data-theme="dark"] input[type="search"], [data-theme="dark"] select, [data-theme="dark"] textarea {
  background: #1C1C1E; color: var(--ink); border-color: var(--line);
}
[data-theme="dark"] .home-statgrid .stat:hover, [data-theme="dark"] tbody tr:hover { background: #28282B; }
[data-theme="dark"] .railnav a:hover, [data-theme="dark"] .mainnav a:hover,
[data-theme="dark"] .dev-row:hover, [data-theme="dark"] .cust-item:hover { background: var(--hover); }
[data-theme="dark"] .railnav a.on, [data-theme="dark"] .mainnav a.on { background: var(--active); color: var(--ink); }
[data-theme="dark"] .rail-title em, [data-theme="dark"] .soon-tag { background: var(--active); color: var(--muted); }
[data-theme="dark"] .next-action-section { border-color: #62532E; background: #29271F; }
[data-theme="dark"] .support-next-step, [data-theme="dark"] .mc-band { background: var(--raised); }
[data-theme="dark"] .msg-body { background: #303033; color: var(--ink); }
[data-theme="dark"] .msg-mine .msg-body { background: #26364A; color: #F2F6FC; }
[data-theme="dark"] .asset-row:hover, [data-theme="dark"] .asset-thumb,
[data-theme="dark"] .prod-img, [data-theme="dark"] .kb-card-img { background: var(--raised); border-color: var(--line); }
[data-theme="dark"] .p-hero { background: #303033; }
[data-theme="dark"] .catnav a, [data-theme="dark"] .catnav a.on { background: transparent; color: var(--ink); }
[data-theme="dark"] .theme-opt, [data-theme="dark"] .railsearch input { background: #1C1C1E; }
[data-theme="dark"] .staff-login-card, [data-theme="dark"] .portal-login-card { background: var(--card); }

@media (max-width: 1180px) {
  .home-statgrid { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .home-statgrid .stat { border-bottom: 1px solid var(--rule); }
  .home-work-grid { grid-template-columns: 1fr 1fr; }
  .my-work-card { grid-column: 1 / -1; }
  .staff-login-shell, .portal-login-shell { gap: 44px; }
}
@media (min-width: 861px) {
  body.rail-mini .siderail { width: 64px; padding: 12px 8px; }
  body.rail-mini .rail-main { margin-left: 64px; }
}
@media (max-width: 860px) {
  .mobile-topbar {
    position: sticky; top: 0; z-index: 70; height: 48px; display: flex; align-items: center; gap: 10px;
    padding: 0 12px; border-bottom: 1px solid var(--line); background: var(--chrome);
  }
  .mobile-nav-btn { width: 32px; height: 32px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--ink); }
  .mobile-nav-btn:hover { background: var(--hover); }
  .mobile-nav-btn svg { width: 20px; height: 20px; }
  .mobile-brand { display: flex; align-items: center; gap: 8px; color: var(--ink); font-size: 13px; font-weight: 600; }
  .mobile-brand img { width: 25px; height: 25px; }
  .mobile-section-label { margin-left: auto; color: var(--muted); font-size: 11px; }
  .mobile-nav-scrim {
    position: fixed; inset: 48px 0 0; z-index: 80; display: block; padding: 0; border: 0;
    background: rgba(0,0,0,.30); opacity: 0; visibility: hidden; pointer-events: none;
  }
  body.nav-open { overflow: hidden; }
  body.nav-open .mobile-nav-scrim { opacity: 1; visibility: visible; pointer-events: auto; }
  .siderail, body.rail-mini .siderail {
    position: fixed; inset: 0 auto 0 0; width: min(304px,86vw); z-index: 90;
    display: flex; flex-direction: column; flex-wrap: nowrap; align-items: stretch; padding: 12px 10px;
    border-right: 1px solid var(--line); border-bottom: 0; background: var(--chrome);
    transform: translateX(-105%); transition: transform .22s ease;
  }
  body.nav-open .siderail { transform: translateX(0); }
  .rail-toggle { display: none; }
  .rail-brand { padding: 4px 6px; }
  .rail-title { display: inline; }
  .railnav { flex: 1; flex-direction: column; gap: 2px; padding: 10px 0; overflow-x: hidden; overflow-y: auto; }
  .railnav a { padding: 8px 10px; white-space: normal; }
  .railnav a .rl { display: inline; }
  .rail-group { display: flex; }
  .rail-bottom { width: auto; display: grid; gap: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
  .railsearch { width: 100%; }
  .rail-main, body.rail-mini .rail-main { margin-left: 0; padding: 0; }
  .workspace-sheet { min-height: calc(100vh - 48px); padding: 20px 16px; border: 0; border-radius: 0; }
  .workspace-sheet .foot { padding-top: 22px; }
  .user-menu { left: 12px; right: auto; top: auto; bottom: 76px; width: min(260px,calc(86vw - 24px)); }
  .home-greet { margin-top: 0; }
  .quick-act { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 3px; }
  .qa-btn { flex-shrink: 0; }
  .home-work-grid { grid-template-columns: 1fr; }
  .my-work-card { grid-column: 1 / -1; }
  .my-job-grid { grid-template-columns: 1fr; }
  .my-job-group { border-right: 0; border-bottom: 1px solid var(--rule); }
  .my-job-group:last-child { border-bottom: 0; }
  .staff-login-shell, .portal-login-shell { grid-template-columns: 1fr; gap: 26px; width: min(440px,calc(100% - 32px)); min-height: 100vh; padding: 28px 0; }
  .staff-login-intro, .portal-login-intro { text-align: center; }
  .staff-login-intro h1, .portal-login-intro h1 { margin-left: auto; margin-right: auto; font-size: 29px; }
  .staff-login-intro ul { display: none; }
  .staff-login-card, .portal-login-card { max-width: none; }
  .portal-login-brand { margin-bottom: 24px; }
  .portal-login-shell { min-height: auto; }
}
@media (max-width: 560px) {
  .home-statgrid { grid-template-columns: 1fr; }
  .home-statgrid .stat { display: grid; grid-template-columns: 64px minmax(0,1fr) auto; align-items: baseline; gap: 10px; padding: 13px 14px; border-right: 0; }
  .home-statgrid .stat .num { margin: 0; font-size: 22px; }
  .stat-note { margin: 0; text-align: right; }
  .home-greet h1, .support-home-head h1 { font-size: 22px; }
  .card { padding: 16px; }
  .card.my-job-card { padding: 0; }
  .catnav { gap: 16px; overflow-x: auto; }
  .catnav a { flex-shrink: 0; }
  .staff-login-intro > p, .portal-login-intro > p { font-size: 13px; }
  .staff-login-card, .portal-login-card { padding: 24px 20px; }
}
/* Final measured typography and contrast refinements */
.eyebrow, .section-kicker { font-size: 11px; letter-spacing: .02em; text-transform: none; }
.brand-name em, .rail-title em, .rail-group, .soon-tag, .stat-note { font-size: 11px; }
.staff-login-intro h1, .portal-login-intro h1 { font-size: 32px; line-height: 1.18; letter-spacing: -.025em; }
body:has(.staff-login-shell), .portal-login-body { background-color: var(--chrome); background-image: none; }
.portal-login-intro li::before { content: ""; width: 6px; height: 6px; padding: 0; border-radius: 50%; background: var(--red); }
[data-theme="dark"] .railnav a, [data-theme="dark"] .qa-btn,
[data-theme="dark"] .work-row-main > a, [data-theme="dark"] .support-request { color: var(--ink-2); }
[data-theme="dark"] .railnav a:hover, [data-theme="dark"] .railnav a.on,
[data-theme="dark"] .qa-btn:hover, [data-theme="dark"] .work-row-main > a:hover { color: var(--ink); }
@media (max-width: 860px) {
  .staff-login-intro h1, .portal-login-intro h1 { font-size: 24px; }
}
/* Five-language preference control; native language names stay unchanged. */
.locale-control {
  position: fixed; top: 16px; right: 18px; z-index: 90;
  display: flex; align-items: center; gap: 6px; padding: 3px 5px 3px 9px;
  border: 1px solid var(--line); border-radius: 7px; background: var(--card); color: var(--muted);
}
.locale-control > svg { width: 15px; height: 15px; pointer-events: none; }
.locale-control select {
  width: auto; min-height: 28px; padding: 2px 24px 2px 5px; border: 0; background: transparent;
  color: var(--ink-2); font-size: 12px; cursor: pointer;
}
.locale-control select:focus { box-shadow: none; }
.locale-control:focus-within { outline: 2px solid var(--red); outline-offset: 2px; }
[data-theme="dark"] .locale-control { background: var(--card); border-color: var(--line); }
@media (max-width: 860px) {
  .locale-control { top: 9px; right: 10px; }
  .staff-app .locale-control, .portal-app .locale-control { top: 68px; }
  .staff-login-shell, .portal-login-shell { padding-top: 54px; }
}
@media (max-width: 420px) {
  .locale-control select { max-width: 108px; }
}
/* Keep compact desktop layouts, but give mobile controls a reliable touch target. */
@media (max-width: 860px) {
  .mobile-nav-btn { width: 44px; height: 44px; flex-shrink: 0; }
  .mobile-brand { min-height: 44px; }
  .mobile-section-label { display: none; }
  .btn, .qa-btn, .support-home-actions .btn { min-height: 44px; }
  .tiny-btn { min-width: 44px; min-height: 44px; }
  .railnav a, .rail-group { min-height: 44px; }
  .mainnav a, .catnav a { min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
  .back-link, .more, .product-stock-date { min-height: 44px; display: inline-flex; align-items: center; }
  .more { min-width: 44px; justify-content: flex-end; }
  .seg-btn, .chip2, .vt-btn { min-height: 44px; }
  .chip2, .vt-btn { min-width: 44px; justify-content: center; }
  input[type="text"], input:not([type]), input[type="password"], input[type="email"],
  input[type="date"], input[type="number"], input[type="search"], select, textarea { min-height: 44px; }
  .locale-control { top: 1px; right: 8px; padding-top: 0; padding-bottom: 0; }
  .staff-app .locale-control, .portal-app .locale-control { top: 1px; }
  .locale-control select { min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
