/* 设备一本账 · 样式（零外链字体与图标，全部系统字体 + 内联 SVG） */
:root {
  --ink: #12233a;
  --ink-2: #4a5b73;
  --ink-3: #7b8ba3;
  --line: #e3e9f2;
  --bg: #f4f7fb;
  --card: #ffffff;
  --brand: #0f2b46;
  --brand-2: #17456b;
  --gold: #c9a227;
  --red: #d92d20;
  --green: #12805c;
  --amber: #b45309;
  --blue: #1d6fb8;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 40, 70, .06), 0 6px 20px rgba(16, 40, 70, .06);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans CN", sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--blue); text-decoration: none; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; }
/* 图标默认跟随文字大小，防止 SVG 无限撑开 */
svg.ic { width: 1.05em; height: 1.05em; flex: none; vertical-align: -0.14em; }
.notice svg.ic, .hint svg.ic, .mic-hint svg.ic { width: 17px; height: 17px; }
.btn svg.ic { width: 16px; height: 16px; }
.item svg.ic, .empty svg.ic { width: 20px; height: 20px; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; }
.mono { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }

/* ---------- 启动 ---------- */
.boot { min-height: 100vh; display: grid; place-content: center; text-align: center; gap: 8px; }
.boot-logo { font-size: 22px; font-weight: 700; letter-spacing: 2px; color: var(--brand); }
.boot-tip { color: var(--ink-3); font-size: 13px; }

/* ---------- 布局 ---------- */
.shell { display: flex; min-height: 100vh; }
.side { display: none; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  background: linear-gradient(160deg, var(--brand), var(--brand-2));
  color: #fff;
  padding: calc(env(safe-area-inset-top, 0px) + 12px) 16px 14px;
  display: flex; align-items: center; gap: 12px;
}
.topbar .tb-title { flex: 1; min-width: 0; }
.topbar .tb-title b { font-size: 17px; letter-spacing: .5px; display: block; }
.topbar .tb-title span { font-size: 12px; opacity: .72; }
.topbar .tb-btn {
  background: rgba(255, 255, 255, .14); border: 0; color: #fff;
  border-radius: 10px; padding: 7px 11px; font-size: 13px;
}
.topbar .tb-btn:active { background: rgba(255, 255, 255, .26); }
.topbar .avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--gold); color: #2a2000;
  display: grid; place-content: center; font-size: 13px; font-weight: 700; border: 0;
}

.content { flex: 1; padding: 14px 14px calc(84px + var(--safe-b)); max-width: 1180px; width: 100%; margin: 0 auto; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(5, 1fr);
  padding-bottom: var(--safe-b);
}
.tabbar a {
  display: grid; place-items: center; gap: 3px; padding: 9px 0 8px;
  color: var(--ink-3); font-size: 11px; font-weight: 500;
}
.tabbar a.on { color: var(--brand); }
.tabbar a.on .ic { color: var(--brand); }
.tabbar .ic { width: 22px; height: 22px; display: block; }
.tabbar a.center .ic {
  width: 44px; height: 44px; margin-top: -18px; border-radius: 50%;
  background: linear-gradient(150deg, var(--brand), var(--brand-2));
  color: #fff; display: grid; place-items: center;
  box-shadow: 0 6px 16px rgba(15, 43, 70, .32);
}
.tabbar a.center.on .ic { background: linear-gradient(150deg, var(--gold), #a8871a); color: #2a2000; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 15px; margin-bottom: 12px;
}
.card.tight { padding: 12px; }
.card-h { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.card-h h3 { font-size: 15px; flex: 1; }
.card-h .hint { font-size: 12px; color: var(--ink-3); }

.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 12px; }
.kpi {
  background: var(--card); border-radius: var(--radius); padding: 13px 14px; box-shadow: var(--shadow);
}
.kpi .k { font-size: 12px; color: var(--ink-3); display: flex; align-items: center; gap: 5px; }
.kpi .v { font-size: 21px; font-weight: 700; margin-top: 3px; letter-spacing: -.3px; }
.kpi .v small { font-size: 12px; font-weight: 500; color: var(--ink-3); margin-left: 3px; }
.kpi.red .v { color: var(--red); }
.kpi.green .v { color: var(--green); }
.kpi.brand { background: linear-gradient(160deg, var(--brand), var(--brand-2)); color: #fff; }
.kpi.brand .k { color: rgba(255, 255, 255, .78); }
.kpi.brand .v { color: #fff; }
.kpi.brand .v small { color: rgba(255, 255, 255, .6); }

/* ---------- 按钮 ---------- */
.btn {
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  border-radius: 10px; padding: 10px 15px; font-size: 14px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  white-space: nowrap;
  transition: transform .06s ease, background .15s;
}
.btn:active { transform: scale(.985); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:active { background: var(--brand-2); }
.btn.gold { background: var(--gold); border-color: var(--gold); color: #2a2000; }
.btn.danger { background: #fff; border-color: #f3c3bf; color: var(--red); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--blue); padding: 8px 10px; }
.btn.sm { padding: 7px 11px; font-size: 13px; border-radius: 9px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; }
.btn-row { display: flex; gap: 9px; flex-wrap: wrap; }

/* ---------- 表单 ---------- */
.field { margin-bottom: 12px; }
.field > label { display: block; font-size: 12.5px; color: var(--ink-2); font-weight: 600; margin-bottom: 5px; }
.field .tip { font-size: 12px; color: var(--ink-3); margin-top: 4px; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=tel], select, textarea {
  width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: #fff; outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(23, 69, 107, .10); }
textarea { resize: vertical; min-height: 88px; line-height: 1.6; }
select { appearance: none; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8'><path d='M1 1l5 5 5-5' stroke='%237b8ba3' stroke-width='1.6' fill='none' stroke-linecap='round'/></svg>"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.switch { display: flex; align-items: center; gap: 10px; padding: 10px 0; }
.switch input { width: 44px; height: 26px; appearance: none; background: #d6dee9; border-radius: 20px; position: relative; transition: background .2s; flex: none; }
.switch input:checked { background: var(--brand); }
.switch input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .18s; }
.switch input:checked::after { transform: translateX(18px); }

/* ---------- 标签 ---------- */
.tag { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; padding: 2px 8px; border-radius: 20px; background: #eef3f9; color: var(--ink-2); font-weight: 600; white-space: nowrap; }
.tag.red { background: #fdecea; color: var(--red); }
.tag.green { background: #e6f5f0; color: var(--green); }
.tag.amber { background: #fdf3e3; color: var(--amber); }
.tag.blue { background: #e8f2fb; color: var(--blue); }
.tag.gold { background: #fbf3d8; color: #8a6d0b; }
.tag.gray { background: #eef1f5; color: var(--ink-3); }

/* ---------- 列表 ---------- */
.list { display: flex; flex-direction: column; }
.item {
  display: flex; gap: 11px; padding: 12px 0; border-bottom: 1px solid var(--line); align-items: flex-start;
}
.item:last-child { border-bottom: 0; }
.item .lv { flex: 1; min-width: 0; }
.item .lt { font-size: 14.5px; font-weight: 600; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.item .ls { font-size: 12.5px; color: var(--ink-3); margin-top: 3px; display: flex; gap: 8px; flex-wrap: wrap; }
.item .amt { font-size: 16px; font-weight: 700; white-space: nowrap; letter-spacing: -.2px; }
.item .amt.out { color: var(--red); }
.item .amt.in { color: var(--green); }
.item.tap:active { background: #f7fafd; }

/* ---------- 表格 ---------- */
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -4px; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 520px; }
table.tbl th, table.tbl td { padding: 9px 8px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.tbl th:first-child, table.tbl td:first-child { text-align: left; position: sticky; left: 0; background: #fff; }
table.tbl thead th { background: #f7fafd; color: var(--ink-2); font-size: 12px; font-weight: 650; position: sticky; top: 0; }
table.tbl thead th:first-child { background: #f7fafd; z-index: 2; }
table.tbl tbody tr:active { background: #f7fafd; }
table.tbl tfoot td { font-weight: 700; background: #f7fafd; border-top: 2px solid var(--line); }
table.tbl td.zero { color: #c8d2e0; }
table.tbl td.sum { font-weight: 700; }

/* ---------- 空态 / 提示 ---------- */
.empty { text-align: center; padding: 34px 16px; color: var(--ink-3); }
.empty .e-ic { font-size: 30px; opacity: .5; margin-bottom: 6px; }
.empty p { margin: 4px 0; font-size: 13.5px; }
.notice { border-radius: 11px; padding: 11px 13px; font-size: 13px; display: flex; gap: 9px; align-items: flex-start; margin-bottom: 12px; }
.notice.info { background: #eaf3fd; color: #14497a; }
.notice.warn { background: #fdf4e5; color: #7d4a06; }
.notice.danger { background: #fdecea; color: #8f1d15; }
.notice.ok { background: #e8f6f1; color: #0c5c42; }
.notice b { font-weight: 700; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(96px + var(--safe-b)); transform: translateX(-50%);
  background: rgba(18, 35, 58, .94); color: #fff; padding: 10px 18px; border-radius: 22px;
  font-size: 13.5px; z-index: 200; max-width: 86vw; text-align: center;
  animation: tin .2s ease;
}
.toast.err { background: rgba(180, 35, 25, .96); }
@keyframes tin { from { opacity: 0; transform: translate(-50%, 8px); } }

/* ---------- 弹层 ---------- */
.mask { position: fixed; inset: 0; background: rgba(10, 22, 38, .45); z-index: 100; display: flex; align-items: flex-end; justify-content: center; animation: fade .16s; }
@keyframes fade { from { opacity: 0; } }
.sheet {
  background: #fff; width: 100%; max-width: 620px; border-radius: 18px 18px 0 0;
  padding: 16px 16px calc(16px + var(--safe-b)); max-height: 88vh; overflow-y: auto;
  animation: up .2s cubic-bezier(.2, .9, .3, 1);
}
@keyframes up { from { transform: translateY(30px); } }
.sheet-h { display: flex; align-items: center; margin-bottom: 12px; }
.sheet-h h3 { flex: 1; font-size: 16px; }
.sheet-h .x { border: 0; background: #f1f5fa; width: 30px; height: 30px; border-radius: 50%; font-size: 16px; color: var(--ink-2); }

/* ---------- 登录 ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 22px; background: radial-gradient(1200px 600px at 50% -10%, #1b4a74, var(--brand) 60%); }
.login-box { width: 100%; max-width: 380px; }
.login-logo { text-align: center; color: #fff; margin-bottom: 20px; }
.login-logo b { display: block; font-size: 24px; letter-spacing: 3px; }
.login-logo span { font-size: 12.5px; opacity: .7; letter-spacing: 1px; }
.login-card { background: #fff; border-radius: 18px; padding: 22px 20px; box-shadow: 0 20px 50px rgba(0, 0, 0, .28); }
.login-foot { text-align: center; color: rgba(255, 255, 255, .55); font-size: 11.5px; margin-top: 16px; line-height: 1.7; }

/* ---------- 分段控件 ---------- */
.seg { display: flex; background: #eef3f9; border-radius: 11px; padding: 3px; gap: 3px; margin-bottom: 12px; }
.seg button { flex: 1; border: 0; background: transparent; padding: 8px 6px; border-radius: 9px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.seg button.on { background: #fff; color: var(--brand); box-shadow: 0 1px 4px rgba(16, 40, 70, .10); }

/* ---------- 抽取卡 ---------- */
.draft-card { border: 1px solid #d8e3f0; border-radius: 12px; padding: 13px; background: #fbfdff; }
.draft-card .dc-raw { font-size: 13px; color: var(--ink-2); background: #eef4fa; border-radius: 8px; padding: 9px 11px; margin-bottom: 11px; word-break: break-all; }
.conf { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--ink-3); margin-bottom: 10px; }
.conf .bar { flex: 1; height: 5px; border-radius: 4px; background: #e4ebf4; overflow: hidden; }
.conf .bar i { display: block; height: 100%; background: linear-gradient(90deg, #d92d20, #eab308, #12805c); }
.why { font-size: 12px; color: var(--amber); background: #fdf4e5; border-radius: 8px; padding: 8px 10px; margin-bottom: 10px; }

/* ---------- 记一笔大输入 ---------- */
.mic-box { position: relative; }
.mic-box textarea { min-height: 104px; padding-right: 44px; font-size: 15.5px; }
.mic-hint { font-size: 12px; color: var(--ink-3); margin-top: 6px; display: flex; gap: 6px; align-items: center; }
.samples { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 9px; }
.samples button { border: 1px dashed #cddaea; background: #fbfdff; color: var(--ink-2); font-size: 12px; padding: 5px 10px; border-radius: 20px; }

/* ---------- 设备卡 ---------- */
.dev-hero { background: linear-gradient(160deg, var(--brand), var(--brand-2)); color: #fff; border-radius: var(--radius); padding: 16px; margin-bottom: 12px; }
.dev-hero .dh-code { font-size: 12px; opacity: .72; letter-spacing: 1.5px; }
.dev-hero .dh-name { font-size: 19px; font-weight: 700; margin: 2px 0 10px; }
.dev-hero .dh-total { font-size: 30px; font-weight: 750; letter-spacing: -1px; }
.dev-hero .dh-sub { font-size: 12px; opacity: .76; margin-top: 2px; }
.dev-hero .dh-tags { display: flex; gap: 6px; margin-top: 11px; flex-wrap: wrap; }
.dev-hero .dh-tags .tag { background: rgba(255, 255, 255, .16); color: #fff; }
.cat-bars { display: flex; flex-direction: column; gap: 9px; }
.cat-bars .cb { display: flex; align-items: center; gap: 9px; font-size: 13px; }
.cat-bars .cb .n { width: 68px; color: var(--ink-2); flex: none; }
.cat-bars .cb .t { flex: 1; height: 7px; background: #eef3f9; border-radius: 6px; overflow: hidden; }
.cat-bars .cb .t i { display: block; height: 100%; background: linear-gradient(90deg, #17456b, #2f7cb8); border-radius: 6px; }
.cat-bars .cb .v { width: 86px; text-align: right; font-weight: 650; font-variant-numeric: tabular-nums; }

/* ---------- 桌面 ---------- */
@media (min-width: 920px) {
  .side {
    display: flex; flex-direction: column; width: 214px; flex: none;
    background: var(--brand); color: #fff; padding: 18px 12px; position: sticky; top: 0; height: 100vh;
  }
  .side .s-logo { font-size: 16px; font-weight: 700; letter-spacing: 2px; padding: 4px 10px 18px; color: #fff; }
  .side .s-logo span { display: block; font-size: 11px; letter-spacing: 1px; opacity: .55; font-weight: 400; margin-top: 3px; }
  .side nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
  .side nav a { color: rgba(255, 255, 255, .74); padding: 9px 11px; border-radius: 9px; font-size: 13.5px; display: flex; align-items: center; gap: 9px; }
  .side nav a:hover { background: rgba(255, 255, 255, .08); color: #fff; }
  .side nav a.on { background: rgba(255, 255, 255, .14); color: #fff; font-weight: 600; }
  .side nav a .ic { width: 17px; height: 17px; opacity: .9; }
  .side .s-foot { margin-top: auto; font-size: 11px; color: rgba(255, 255, 255, .42); padding: 10px; line-height: 1.7; }
  .tabbar { display: none; }
  .content { padding: 20px 24px 40px; }
  .topbar { padding: 16px 24px; }
  .topbar .tb-title b { font-size: 19px; }
  .kpis { grid-template-columns: repeat(4, 1fr); }
  .two-col { display: grid; grid-template-columns: 1.15fr .85fr; gap: 14px; align-items: start; }
  .toast { bottom: 32px; }
}
@media (max-width: 380px) {
  .kpi .v { font-size: 19px; }
  .content { padding-left: 11px; padding-right: 11px; }
}
