/* ==========================================================
   工地管理系统 - 样式表
   ========================================================== */

:root {
  --bg:        #f2f5f9;
  --panel:     #ffffff;
  --panel-2:   #f8fafc;
  --panel-3:   #eef2f7;
  --text:      #1a2233;
  --text-2:    #3d4a60;
  --muted:     #75839a;
  --border:    #e2e8f0;
  --border-2:  #cbd5e1;
  --primary:   #2563eb;
  --primary-2: #1d4ed8;
  --primary-w: #eaf1fe;
  --accent:    #f59e0b;
  --accent-w:  #fef3c7;
  --ok:        #15a35b;
  --ok-w:      #e3f7ec;
  --warn:      #e08a00;
  --warn-w:    #fdf1dc;
  --danger:    #dc2626;
  --danger-w:  #fdeaea;
  --info:      #0891b2;
  --info-w:    #e0f5fa;
  --shadow:    0 1px 2px rgba(15,23,42,.05), 0 8px 24px -12px rgba(15,23,42,.18);
  --shadow-lg: 0 24px 60px -20px rgba(15,23,42,.35);
  --radius:    12px;
  --radius-sm: 8px;
}

html[data-theme="dark"] {
  --bg:        #0d1524;
  --panel:     #16203300;
  --panel:     #17202f;
  --panel-2:   #1b2637;
  --panel-3:   #223046;
  --text:      #e8eef7;
  --text-2:    #c2cee0;
  --muted:     #8b9bb4;
  --border:    #26344a;
  --border-2:  #35486a;
  --primary:   #4d8cf5;
  --primary-2: #6ba0f7;
  --primary-w: #1b2f52;
  --accent:    #f0b03c;
  --accent-w:  #3a2d13;
  --ok:        #34c776;
  --ok-w:      #12331f;
  --warn:      #e0a53a;
  --warn-w:    #38290f;
  --danger:    #f36060;
  --danger-w:  #3d1a1a;
  --info:      #34b6d4;
  --info-w:    #0e2f3a;
  --shadow:    0 1px 2px rgba(0,0,0,.3), 0 8px 24px -12px rgba(0,0,0,.6);
  --shadow-lg: 0 24px 60px -20px rgba(0,0,0,.75);
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", "Source Han Sans SC",
               -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
a { color: var(--primary); text-decoration: none; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); background-clip: content-box; }

/* ---------------- layout ---------------- */
.app { display: flex; height: 100vh; overflow: hidden; }

.sidebar {
  width: 226px; flex: 0 0 226px;
  background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  transition: width .2s ease, flex-basis .2s ease;
  z-index: 40;
}

.brand { display: flex; align-items: center; gap: 10px; padding: 18px 16px 14px; }
.brand-logo {
  width: 36px; height: 36px; flex: 0 0 36px; border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  color: #fff; display: grid; place-items: center; box-shadow: 0 4px 12px -4px var(--primary);
}
.brand-logo svg { width: 20px; height: 20px; }
.brand-name { font-weight: 700; font-size: 15px; letter-spacing: .2px; }
.brand-sub { font-size: 11px; color: var(--muted); margin-top: 1px; }

.nav { flex: 1; overflow-y: auto; padding: 6px 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 9px 11px;
  background: transparent; border: 0; border-radius: var(--radius-sm);
  color: var(--text-2); font-weight: 500; font-size: 13.5px;
  cursor: pointer; text-align: left; white-space: nowrap;
  transition: background .14s, color .14s;
}
.nav-item svg { width: 17px; height: 17px; flex: 0 0 17px; opacity: .85; }
.nav-item:hover { background: var(--panel-3); color: var(--text); }
.nav-item.active { background: var(--primary-w); color: var(--primary); font-weight: 600; }
.nav-item.active svg { opacity: 1; }

.sidebar-foot { padding: 10px; border-top: 1px solid var(--border); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }

.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 24px; background: var(--panel);
  border-bottom: 1px solid var(--border);
  position: relative; z-index: 20;
}
.topbar-title h1 { margin: 0; font-size: 18px; font-weight: 700; letter-spacing: .2px; }
.topbar-title p { margin: 1px 0 0; font-size: 12px; color: var(--muted); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.today-chip {
  font-size: 12px; color: var(--muted); background: var(--panel-3);
  padding: 5px 10px; border-radius: 20px; white-space: nowrap;
}

.view { flex: 1; overflow-y: auto; padding: 20px 24px 80px; }

.only-mobile { display: none; }
.scrim { display: none; }

@media (max-width: 1000px) {
  .sidebar { width: 64px; flex: 0 0 64px; }
  .sidebar .brand-text, .sidebar .nav-item span, .sidebar .nav-label { display: none; }
  .sidebar .nav-item { justify-content: center; padding: 10px 0; }
  .sidebar .brand { justify-content: center; padding: 16px 8px 10px; }
  .sidebar .btn-ghost { width: 100%; justify-content: center; }
}
@media (max-width: 700px) {
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; width: 226px; flex-basis: 226px;
    transform: translateX(-100%); transition: transform .22s ease; box-shadow: var(--shadow-lg);
  }
  .sidebar .brand-text, .sidebar .nav-item span, .sidebar .nav-label { display: block; }
  .sidebar .nav-item { justify-content: flex-start; padding: 10px 12px; }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 30; }
  .only-mobile { display: grid; }
  .view { padding: 14px 14px 70px; }
  .topbar { padding: 12px 14px; }
  .topbar-actions .today-chip { display: none; }
}

/* ---------------- generic ---------------- */
.card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card + .card { margin-top: 16px; }
.card-head {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 14px 16px; border-bottom: 1px solid var(--border);
}
.card-head h3 { margin: 0; font-size: 14.5px; font-weight: 650; }
.card-head .sub { font-size: 12px; color: var(--muted); }
.card-head .spacer { flex: 1; }
.card-body { padding: 16px; }
.card-body.tight { padding: 0; }

.grid { display: grid; gap: 16px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: 14px; }
.cols-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }

.kpi {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.kpi::after {
  content: ""; position: absolute; right: -18px; top: -18px; width: 74px; height: 74px;
  border-radius: 50%; background: var(--primary-w); opacity: .7;
}
.kpi.k-ok::after   { background: var(--ok-w); }
.kpi.k-warn::after { background: var(--warn-w); }
.kpi.k-danger::after { background: var(--danger-w); }
.kpi.k-info::after { background: var(--info-w); }
.kpi-label { font-size: 12px; color: var(--muted); position: relative; z-index: 1; }
.kpi-value { font-size: 25px; font-weight: 750; letter-spacing: -.4px; margin-top: 4px; position: relative; z-index: 1; }
.kpi-value small { font-size: 13px; font-weight: 600; color: var(--muted); margin-left: 3px; }
.kpi-foot { font-size: 11.5px; color: var(--muted); margin-top: 4px; position: relative; z-index: 1; }

/* ---------------- buttons ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-2); background: var(--panel); color: var(--text-2);
  font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: background .14s, border-color .14s, color .14s, transform .05s;
}
.btn:hover { background: var(--panel-3); color: var(--text); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 15px; height: 15px; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-2); border-color: var(--primary-2); color: #fff; }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #4a3200; }
.btn-accent:hover { filter: brightness(1.06); color: #4a3200; }
.btn-danger { background: var(--danger-w); border-color: transparent; color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--panel-3); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-xs { padding: 3px 8px; font-size: 11.5px; border-radius: 6px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.icon-btn {
  width: 32px; height: 32px; display: grid; place-items: center;
  border-radius: 8px; border: 1px solid transparent; background: transparent;
  color: var(--text-2); cursor: pointer;
}
.icon-btn:hover { background: var(--panel-3); color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; }

.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------------- table ---------------- */
.tbl-wrap { overflow-x: auto; border-radius: 0 0 var(--radius) var(--radius); }
table.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
table.tbl th {
  text-align: left; font-weight: 600; font-size: 12px; color: var(--muted);
  padding: 10px 12px; background: var(--panel-2); border-bottom: 1px solid var(--border);
  white-space: nowrap; position: sticky; top: 0; z-index: 2;
}
table.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.tbl tbody tr:hover td { background: var(--panel-2); }
table.tbl tbody tr:last-child td { border-bottom: 0; }
table.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
table.tbl .center { text-align: center; }
table.tbl .strong { font-weight: 650; }
table.tbl tfoot td {
  padding: 10px 12px; background: var(--panel-3); font-weight: 700;
  border-top: 2px solid var(--border-2); position: sticky; bottom: 0;
}
.clickable { cursor: pointer; }
.elli { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.empty { padding: 44px 20px; text-align: center; color: var(--muted); }
.empty svg { width: 42px; height: 42px; opacity: .35; margin-bottom: 8px; }
.empty p { margin: 0; font-size: 13px; }

/* ---------------- badges / tags ---------------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 20px; font-size: 11.5px; font-weight: 600;
  background: var(--panel-3); color: var(--text-2); white-space: nowrap;
}
.badge.b-ok     { background: var(--ok-w);     color: var(--ok); }
.badge.b-warn   { background: var(--warn-w);   color: var(--warn); }
.badge.b-danger { background: var(--danger-w); color: var(--danger); }
.badge.b-info   { background: var(--info-w);   color: var(--info); }
.badge.b-primary{ background: var(--primary-w);color: var(--primary); }
.badge.b-gray   { background: var(--panel-3);  color: var(--muted); }

.tag-trade { background: var(--primary-w); color: var(--primary); padding: 2px 8px; border-radius: 6px; font-size: 11.5px; font-weight: 600; }

.avatar {
  width: 30px; height: 30px; border-radius: 50%; flex: 0 0 30px;
  display: grid; place-items: center; font-size: 12px; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
}
.avatar.a2 { background: linear-gradient(135deg, #f59e0b, #ef4444); }
.avatar.a3 { background: linear-gradient(135deg, #10b981, #06b6d4); }
.avatar.a4 { background: linear-gradient(135deg, #8b5cf6, #ec4899); }
.wcell { display: flex; align-items: center; gap: 9px; }

/* ---------------- forms ---------------- */
.field { display: flex; flex-direction: column; gap: 5px; }
.field > label { font-size: 12px; font-weight: 600; color: var(--text-2); }
.field .hint { font-size: 11px; color: var(--muted); }
.field .req { color: var(--danger); margin-left: 2px; }

.input, select.input, textarea.input {
  width: 100%; padding: 8px 11px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-2); background: var(--panel);
  color: var(--text); outline: none; transition: border-color .14s, box-shadow .14s;
  font-size: 13px;
}
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-w); }
.input::placeholder { color: var(--muted); }
textarea.input { resize: vertical; min-height: 66px; }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%); background-position: calc(100% - 15px) 16px, calc(100% - 10px) 16px; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 30px; }
select.input option { background: var(--panel); color: var(--text); }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; }
.form-grid .span-2 { grid-column: span 2; }
@media (max-width: 560px) { .form-grid { grid-template-columns: 1fr; } .form-grid .span-2 { grid-column: span 1; } }

/* 表单错误提示 */
.form-alert {
  margin-bottom: 14px; padding: 10px 13px; border-radius: var(--radius-sm);
  background: var(--danger-w); color: var(--danger);
  border-left: 3px solid var(--danger); font-size: 12.5px; line-height: 1.6;
}
.alert-chip {
  display: inline-block; margin: 4px 6px 0 0; padding: 1px 8px;
  background: rgba(220, 38, 38, .13); border-radius: 20px; font-weight: 600;
}
.field.has-error > label { color: var(--danger); }
.field.has-error .input,
.field.has-error .mini-txt,
.field.has-error .chk-list {
  border-color: var(--danger) !important;
  box-shadow: 0 0 0 3px var(--danger-w);
}
.field-err { font-size: 11.5px; color: var(--danger); font-weight: 500; margin-top: 1px; }

/* 数据持久化告警条 */
.persist-warn {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 14px; background: var(--warn-w); color: var(--warn);
  font-size: 12.5px; font-weight: 500; border-bottom: 1px solid var(--border);
}
.persist-warn svg { width: 16px; height: 16px; flex: 0 0 16px; }
.persist-warn b { font-weight: 700; }

.toolbar { display: flex; gap: 9px; flex-wrap: wrap; align-items: flex-end; }
.toolbar .field { min-width: 130px; }
.toolbar .field.grow { flex: 1; min-width: 180px; }
.search-box { position: relative; }
.search-box svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--muted); }
.search-box .input { padding-left: 32px; }

.chk-list {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px;
  max-height: 190px; overflow-y: auto; border: 1px solid var(--border-2);
  border-radius: var(--radius-sm); padding: 9px; background: var(--panel-2);
}
.chk { display: flex; align-items: center; gap: 7px; font-size: 12.5px; padding: 3px 5px; border-radius: 6px; cursor: pointer; }
.chk:hover { background: var(--panel-3); }
.chk input { accent-color: var(--primary); width: 15px; height: 15px; }

.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.switch-row:last-child { border-bottom: 0; }

/* ---------------- attendance grid ---------------- */
.att-status { display: inline-flex; border: 1px solid var(--border-2); border-radius: 7px; overflow: hidden; }
.att-status button {
  padding: 4px 10px; font-size: 12px; border: 0; background: var(--panel);
  color: var(--muted); cursor: pointer; font-weight: 600; border-right: 1px solid var(--border);
}
.att-status button:last-child { border-right: 0; }
.att-status button.on-1 { background: var(--ok); color: #fff; }
.att-status button.on-h { background: var(--accent); color: #4a3200; }
.att-status button.on-0 { background: var(--danger); color: #fff; }

.mini-num { width: 66px; padding: 5px 7px; text-align: center; border-radius: 6px; border: 1px solid var(--border-2); background: var(--panel); font-variant-numeric: tabular-nums; }
.mini-num:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-w); }
.mini-txt { width: 100%; min-width: 90px; padding: 5px 8px; border-radius: 6px; border: 1px solid var(--border-2); background: var(--panel); font-size: 12.5px; }
.mini-txt:focus { outline: none; border-color: var(--primary); }

tr.row-off td { opacity: .5; }

/* ---------------- charts ---------------- */
.chart-box { position: relative; width: 100%; }
.chart-box canvas { display: block; width: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 10px 16px; margin-top: 12px; }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); }
.legend-dot { width: 9px; height: 9px; border-radius: 3px; flex: 0 0 9px; }

/* ---------------- tabs ---------------- */
.tabs { display: inline-flex; gap: 3px; padding: 3px; background: var(--panel-3); border-radius: 9px; }
.tab {
  padding: 6px 14px; border: 0; background: transparent; border-radius: 7px;
  font-size: 12.5px; font-weight: 600; color: var(--muted); cursor: pointer;
}
.tab:hover { color: var(--text); }
.tab.active { background: var(--panel); color: var(--primary); box-shadow: var(--shadow); }

/* ---------------- modal ---------------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(9,16,29,.55); backdrop-filter: blur(2px);
  display: grid; place-items: center; z-index: 100; padding: 18px;
  animation: fadeIn .16s ease;
}
.modal {
  background: var(--panel); border-radius: 14px; width: 100%; max-width: 620px;
  max-height: 92vh; display: flex; flex-direction: column; box-shadow: var(--shadow-lg);
  border: 1px solid var(--border); animation: popIn .18s cubic-bezier(.2,.9,.3,1.2);
}
.modal.wide { max-width: 900px; }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 15px 18px; border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 0; font-size: 15px; font-weight: 700; }
.modal-head .sub { font-size: 12px; color: var(--muted); }
.modal-head .spacer { flex: 1; }
.modal-body { padding: 18px; overflow-y: auto; }
.modal-foot { display: flex; gap: 9px; justify-content: flex-end; padding: 13px 18px; border-top: 1px solid var(--border); background: var(--panel-2); border-radius: 0 0 14px 14px; }
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
@keyframes popIn { from { opacity: 0; transform: translateY(12px) scale(.98) } to { opacity: 1; transform: none } }

/* ---------------- toast ---------------- */
.toast-root { position: fixed; right: 18px; bottom: 18px; z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.toast {
  background: var(--panel); border: 1px solid var(--border); border-left: 3px solid var(--primary);
  padding: 10px 15px; border-radius: 9px; box-shadow: var(--shadow-lg);
  font-size: 13px; font-weight: 500; animation: slideIn .2s ease; max-width: 340px;
}
.toast.t-ok     { border-left-color: var(--ok); }
.toast.t-warn   { border-left-color: var(--warn); }
.toast.t-danger { border-left-color: var(--danger); }
@keyframes slideIn { from { opacity: 0; transform: translateX(20px) } to { opacity: 1; transform: none } }

/* ---------------- misc ---------------- */
.muted { color: var(--muted); }
.small { font-size: 12px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.mt0 { margin-top: 0 } .mt8 { margin-top: 8px } .mt12 { margin-top: 12px } .mt16 { margin-top: 16px } .mt20 { margin-top: 20px }
.divider { height: 1px; background: var(--border); margin: 14px 0; }
.sect-title { font-size: 13px; font-weight: 700; margin: 18px 0 10px; display: flex; align-items: center; gap: 7px; }
.sect-title::before { content: ""; width: 3px; height: 14px; border-radius: 2px; background: var(--primary); }

.progress { height: 7px; border-radius: 6px; background: var(--panel-3); overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--primary), #7c3aed); }

.proj-line { display: flex; align-items: center; gap: 12px; padding: 11px 4px; border-bottom: 1px solid var(--border); }
.proj-line:last-child { border-bottom: 0; }
.proj-line .pl-name { font-weight: 600; font-size: 13px; }
.proj-line .pl-sub { font-size: 11.5px; color: var(--muted); }

.money { font-variant-numeric: tabular-nums; font-weight: 650; }
.money.pos { color: var(--primary); }
.money.due { color: var(--danger); }

.detail-list { display: flex; flex-direction: column; gap: 0; }
.detail-list .dl-row { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--border); font-size: 13px; }
.detail-list .dl-row:last-child { border-bottom: 0; }

/* ---------------- 数据存放位置 ---------------- */
.store-info {
  display: flex; flex-direction: column;
  background: var(--panel-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 12px;
  margin-bottom: 10px;
}
.store-info .si-row {
  display: flex; align-items: baseline; gap: 14px;
  padding: 7px 0; border-bottom: 1px dashed var(--border);
  font-size: 13px;
}
.store-info .si-row:last-child { border-bottom: 0; }
.store-info .si-k { flex: 0 0 76px; color: var(--muted); }
.store-info .si-v { flex: 1 1 auto; min-width: 0; word-break: break-all; }
.store-tip {
  font-size: 12.5px; line-height: 1.85; color: var(--muted);
  margin-bottom: 8px;
}
.store-tip b { color: var(--text); font-weight: 650; }
.store-tip code, .store-info code {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12px; padding: 1px 5px; border-radius: 5px;
  background: var(--panel-2); border: 1px solid var(--border);
}

/* ---------------- print ---------------- */
#printRoot { display: none; }
@media print {
  body { background: #fff !important; color: #000 !important; }
  .app, .toast-root, .modal-mask, .scrim { display: none !important; }
  #printRoot { display: block !important; padding: 0; }
  #printRoot h1 { font-size: 19px; margin: 0 0 4px; }
  #printRoot .p-sub { font-size: 12px; color: #444; margin-bottom: 14px; }
  #printRoot table { width: 100%; border-collapse: collapse; font-size: 11.5px; }
  #printRoot th, #printRoot td { border: 1px solid #999; padding: 5px 6px; }
  #printRoot th { background: #eee !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  #printRoot .num { text-align: right; }
  #printRoot .p-foot { margin-top: 22px; font-size: 11.5px; color: #333; display: flex; justify-content: space-between; }
  @page { margin: 14mm; }
}


/* ==========================================================
   云端同步状态 & 登录门禁
   ========================================================== */
.cloud-chip { font-weight: 600; }
.cloud-chip.is-ok   { color: var(--ok);   background: var(--ok-w); }
.cloud-chip.is-busy { color: var(--warn); background: var(--warn-w); }
.cloud-chip.is-warn { color: var(--warn); background: var(--warn-w); }
.cloud-chip.is-off  { color: var(--muted); background: var(--panel-3); }

.gate {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  background: var(--bg);
  background-image: radial-gradient(900px 420px at 50% -10%, var(--primary-w) 0%, transparent 72%);
}
.gate-card {
  width: 100%; max-width: 372px;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 18px; padding: 30px 28px 22px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}
.gate-logo {
  width: 52px; height: 52px; margin: 0 auto 14px;
  border-radius: 15px; background: var(--primary-w); color: var(--primary);
  display: flex; align-items: center; justify-content: center;
}
.gate-logo svg { width: 27px; height: 27px; }
.gate-card h2 { margin: 0; font-size: 19px; font-weight: 700; letter-spacing: .3px; }
.gate-sub { margin: 6px 0 22px; font-size: 12.5px; color: var(--muted); line-height: 1.6; }
.gate-form { text-align: left; }
.gate-label { display: block; font-size: 12px; font-weight: 600; color: var(--text-2); margin: 0 0 6px; }
.gate-form .input { width: 100%; margin-bottom: 14px; }
.gate-err { min-height: 16px; font-size: 12px; color: var(--danger); margin: -4px 0 8px; line-height: 1.5; }
.gate-btn { width: 100%; height: 40px; font-size: 14.5px; letter-spacing: 2px; }
.gate-row { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; }
.gate-remember { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 5px; cursor: pointer; }
.gate-foot { margin-top: 18px; font-size: 11.5px; color: var(--muted); line-height: 1.7; }
.gate-alt { margin-top: 10px; }
.link-btn {
  background: none; border: 0; padding: 4px; cursor: pointer;
  font-size: 12px; color: var(--primary); text-decoration: underline; font-family: inherit;
}
@media (max-width: 700px) {
  .topbar-actions .cloud-chip { display: inline-block; font-size: 11px; padding: 4px 8px; }
  .gate-card { padding: 24px 20px 18px; }
}
