/* ============================================================
   团队管理系统 - UI Framework v4 (Light Modern)
   ============================================================ */
:root {
  --primary: #002FA7;
  --primary-dark: #001E6E;
  --primary-light: #eef3ff;
  --primary-soft: #f5f7ff;
  --bg: #f7f8fa;
  --panel: #ffffff;
  --border: #e8eaef;
  --border-strong: #d9dce3;
  --text: #111827;
  --text2: #6b7280;
  --text3: #9ca3af;
  --danger: #dc2626;
  --success: #059669;
  --warn: #d97706;
  --radius: 10px;
  --shadow-xs: 0 1px 2px rgba(17,24,39,.04);
  --shadow-sm: 0 1px 2px rgba(17,24,39,.04), 0 2px 8px rgba(17,24,39,.05);
  --shadow-md: 0 4px 12px rgba(17,24,39,.08), 0 2px 4px rgba(17,24,39,.04);
  --sidebar-w: 224px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; }
input, select, textarea {
  font-family: inherit; font-size: 14px; padding: 8px 12px;
  border: 1px solid var(--border-strong); border-radius: 8px;
  background: #fff; color: var(--text); outline: none; width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,.12);
}
label { font-size: 13px; color: var(--text2); display: block; margin-bottom: 5px; font-weight: 500; }
a { color: var(--primary); }

/* ---------- Login ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(900px 480px at 85% -10%, rgba(79,70,229,.16), transparent 60%),
    radial-gradient(700px 420px at -5% 110%, rgba(99,102,241,.12), transparent 55%),
    #f7f8fa;
  padding: 20px;
}
.login-box {
  background: #fff; border-radius: 16px; padding: 42px 40px; width: 400px; max-width: 100%;
  box-shadow: 0 8px 30px rgba(17,24,39,.10), 0 2px 8px rgba(17,24,39,.06);
  border: 1px solid var(--border);
}
.login-box h1 { font-size: 22px; text-align: center; margin-bottom: 6px; color: var(--text); }
.login-box .sub { text-align: center; color: var(--text2); font-size: 13px; margin-bottom: 26px; }
.login-box .field { margin-bottom: 14px; }
.login-box .btn-primary { width: 100%; margin-top: 8px; padding: 10px; font-size: 15px; }
.login-err { color: var(--danger); font-size: 13px; text-align: center; margin-top: 10px; min-height: 18px; }

/* ---------- Layout ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); background: #fff; color: var(--text); flex-shrink: 0;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
  border-right: 1px solid var(--border);
}
.sidebar .brand {
  padding: 20px 18px 16px; font-size: 16px; font-weight: 700; color: var(--text);
  border-bottom: 1px solid var(--border); letter-spacing: .3px;
  display: flex; align-items: center; gap: 10px;
}
.sidebar .brand::before {
  content: ''; width: 10px; height: 28px; border-radius: 4px; flex-shrink: 0;
  background: linear-gradient(180deg, #6366f1, #4f46e5);
}
.sidebar .brand small { display: block; font-size: 11px; font-weight: 400; color: var(--text3); margin-top: 3px; letter-spacing: 0; }
.nav { flex: 1; padding: 12px 10px; overflow-y: auto; }
.nav-group { margin-bottom: 6px; }
.nav-group-title {
  padding: 10px 12px 6px; font-size: 13px; font-weight: 600; color: var(--text3);
  letter-spacing: .4px; display: flex; justify-content: space-between; align-items: center;
  cursor: pointer; user-select: none; border-radius: 8px;
}
.nav-group-title:hover { color: var(--text2); }
.nav-group-title .arrow { font-size: 10px; color: var(--text3); }
.nav-group-body { padding-left: 0; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px;
  cursor: pointer; margin: 2px 0; color: #374151; font-size: 14px; user-select: none;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: #f3f4f6; color: var(--text); }
.nav-item.active {
  background: var(--primary-light); color: var(--primary); font-weight: 600;
}
.nav-item.active::before {
  content: ''; width: 3px; height: 16px; border-radius: 2px; background: var(--primary);
  margin-left: -12px; margin-right: 9px;
}
.nav-item .ico { width: 20px; text-align: center; font-size: 15px; }
.sidebar .foot { padding: 14px 16px; border-top: 1px solid var(--border); font-size: 12px; background: #fafafa; }
.sidebar .foot .uname { color: var(--text); font-size: 13px; font-weight: 600; }
.sidebar .foot a { color: var(--primary); cursor: pointer; margin-right: 10px; text-decoration: none; font-size: 12px; }
.sidebar .foot a:hover { text-decoration: underline; }

.main { flex: 1; padding: 24px 28px 40px; min-width: 0; max-width: 1500px; }
.page-title { font-size: 20px; font-weight: 700; margin-bottom: 4px; color: var(--text); }
.page-sub { color: var(--text2); font-size: 13px; margin-bottom: 18px; }

/* ---------- Panels & Cards ---------- */
.panel {
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  padding: 18px 20px; margin-bottom: 18px; box-shadow: var(--shadow-xs);
}
.panel h3 {
  font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 14px;
  display: flex; align-items: center; gap: 8px;
}
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  padding: 18px; box-shadow: var(--shadow-xs);
}
.stat-card .num { font-size: 26px; font-weight: 700; margin-top: 6px; color: var(--text); font-variant-numeric: tabular-nums; }
.stat-card .num.muted { color: var(--text3); }
.stat-card .lab { color: var(--text2); font-size: 13px; }
.stat-card .hint { color: var(--text2); font-size: 12px; margin-top: 4px; }

/* ---------- Toolbar ---------- */
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar input, .toolbar select { width: auto; }
.toolbar .spacer { flex: 1; }
.filter-bar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.filter-bar input, .filter-bar select { width: auto; }
.filter-bar .chk { display: flex; align-items: center; gap: 5px; font-size: 13px; color: var(--text2); white-space: nowrap; cursor: pointer; }
.grp-row td { background: #f4f6fb; font-weight: 600; color: var(--text); padding: 6px 10px; }

/* ---------- Buttons ---------- */
.btn {
  padding: 8px 15px; border: 1px solid var(--border-strong); background: #fff; border-radius: 8px;
  cursor: pointer; font-size: 13px; color: var(--text); white-space: nowrap; font-weight: 500;
  transition: all .15s ease;
}
.btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.btn-primary, button.btn.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover, button.btn.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }
.btn-danger { color: var(--danger); }
.btn-danger:hover { border-color: var(--danger); color: var(--danger); background: #fef2f2; }
.btn-sm { padding: 4px 9px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.big-check { width: 100%; padding: 12px; font-size: 15px; border-radius: 10px; }

/* ---------- Tables ---------- */
.tbl-wrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th {
  background: #fafbfc; text-align: left; padding: 11px 12px; font-weight: 600;
  border-bottom: 1px solid var(--border); color: var(--text2); white-space: nowrap;
}
.tbl td { padding: 10px 12px; border-bottom: 1px solid #f3f4f6; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tbody tr:hover { background: #fafbff; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl th.num { text-align: right; }
.tbl .row-total { background: #f5f6ff; font-weight: 700; }
.tbl .row-total:hover { background: #f5f6ff; }
.tbl .group-row td { background: #fafbfc; font-weight: 600; color: var(--primary-dark); }
.empty { text-align: center; color: var(--text3); padding: 32px; }

/* ---------- Tags ---------- */
.tag { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; background: #f3f4f6; color: var(--text2); font-weight: 500; }
.tag.blue { background: var(--primary-light); color: var(--primary-dark); }
.tag.green { background: #ecfdf5; color: var(--success); }
.tag.orange { background: #fff7ed; color: var(--warn); }
.tag.red { background: #fef2f2; color: var(--danger); }
.tag.gray { background: #f3f4f6; color: var(--text3); }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 18px; flex-wrap: wrap; }
.tab {
  padding: 10px 16px; cursor: pointer; color: var(--text2); font-size: 14px;
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid-3 { grid-template-columns: 1fr 1fr 1fr; }

/* ---------- Modal ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(17,24,39,.45); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal {
  background: #fff; border-radius: 14px; width: 640px; max-width: 100%;
  box-shadow: 0 25px 70px rgba(0,0,0,.25); animation: pop .15s ease;
}
.modal.wide { width: 880px; }
@keyframes pop { from { transform: scale(.97); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-head h3 { font-size: 16px; font-weight: 700; }
.modal-head .x { cursor: pointer; font-size: 20px; color: var(--text2); line-height: 1; }
.modal-body { padding: 20px; max-height: 65vh; overflow-y: auto; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

/* ---------- Toast ---------- */
#toast-root { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); z-index: 200; }
.toast {
  background: #111827; color: #fff; padding: 10px 20px; border-radius: 8px; margin-bottom: 8px;
  font-size: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.2); animation: pop .15s ease;
}
.toast.err { background: var(--danger); }
.toast.ok { background: var(--success); }

/* ---------- Text utilities ---------- */
.muted { color: var(--text2); }
.right { text-align: right; }
.mb0 { margin-bottom: 0; }
.pointer { cursor: pointer; }
a.plink { color: var(--primary); cursor: pointer; text-decoration: none; }
a.plink:hover { text-decoration: underline; }
.warn-text { color: var(--warn); }
.danger-text { color: var(--danger); }
.success-text { color: var(--success); }

/* ---------- Dashboard / Workbench ---------- */
.dash-welcome {
  display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap;
  background: #f7f7f8;
  border: 1px solid var(--border); border-radius: 14px;
  padding: 20px 24px; margin-bottom: 18px;
}
.dw-title { font-size: 19px; font-weight: 700; color: var(--text); }
.dw-sub { font-size: 13px; color: var(--text2); margin-top: 4px; }
.dw-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi-card {
  background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 16px;
  display: flex; gap: 12px; align-items: center; box-shadow: var(--shadow-xs);
  transition: box-shadow .15s ease, transform .15s ease;
}
.kpi-card:hover { box-shadow: var(--shadow-sm); transform: translateY(-2px); }
.kpi-icon { width: 42px; height: 42px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }
.kpi-body { min-width: 0; }
.kpi-num { font-size: 22px; font-weight: 700; line-height: 1.15; color: var(--text); font-variant-numeric: tabular-nums; }
.kpi-lab { font-size: 12.5px; color: var(--text2); margin-top: 2px; font-weight: 500; }
.kpi-sub { font-size: 11.5px; color: var(--text3); margin-top: 2px; }

.dash-main { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.dash-col { min-width: 0; }
.panel .ph-more { font-size: 12px; font-weight: 400; color: var(--primary); margin-left: auto; cursor: pointer; text-decoration: none; }
.panel .ph-more:hover { text-decoration: underline; }
.panel h3 .badge { background: #fef2f2; color: var(--danger); border-radius: 999px; padding: 1px 9px; font-size: 12px; font-weight: 600; }

.sbar-row { display: flex; align-items: center; gap: 10px; padding: 5px 0; cursor: pointer; }
.sbar-row:hover .sbar-lab { color: var(--primary); }
.sbar-lab { width: 92px; flex-shrink: 0; font-size: 12.5px; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text2); }
.sbar-track { flex: 1; height: 14px; background: #f3f4f6; border-radius: 7px; overflow: hidden; }
.sbar-fill { height: 100%; border-radius: 7px; min-width: 2px; transition: width .3s ease; }
.sbar-num { width: 30px; font-size: 13px; font-weight: 700; text-align: left; }

.p-tbl td { vertical-align: middle; }
.p-name { font-weight: 600; font-size: 13.5px; }
.p-code { font-size: 11.5px; color: var(--text3); }
.pbar { height: 6px; background: #eef0f3; border-radius: 4px; overflow: hidden; margin-bottom: 3px; }
.pbar-fill { height: 100%; background: var(--success); border-radius: 4px; }
.pbar-fill.overdue { background: var(--danger); }
.pbar-txt { font-size: 11px; color: var(--text2); }
.due-cell { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text2); margin-top: 2px; flex-wrap: wrap; }
.tbl-more { padding: 10px 12px; text-align: center; border-top: 1px solid var(--border); font-size: 13px; }
.tbl-more a { color: var(--primary); cursor: pointer; }
.tbl-more a:hover { text-decoration: underline; }

.reminder-item { padding: 8px 0; border-bottom: 1px solid #f3f4f6; font-size: 13px; }
.reminder-item:last-child { border-bottom: none; }
.feed-item { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid #f3f4f6; font-size: 13px; }
.feed-item:last-child { border-bottom: none; }
.feed-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; margin-top: 6px; }
.feed-dot.green { background: var(--success); }
.feed-dot.orange { background: var(--warn); }
.feed-dot.red { background: var(--danger); }

/* ---------- Employee dashboard ---------- */
.emp-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 18px; }
.emp-card { text-align: center; padding: 22px 20px; }
.emp-card h3 { justify-content: center; }
.emp-clock { font-size: 34px; font-weight: 700; font-variant-numeric: tabular-nums; margin: 4px 0 10px; color: var(--primary); }
.emp-att { display: flex; justify-content: center; gap: 28px; margin-bottom: 12px; font-size: 13px; }
.emp-att b { display: block; font-size: 17px; margin-top: 2px; }
.emp-state { font-size: 16px; font-weight: 600; margin: 10px 0 6px; }
.emp-state.ok { color: var(--success); }
.emp-duty { font-size: 13px; padding: 6px 0; }
.emp-duty b { margin-left: 6px; }

/* ---------- Project detail ---------- */
.stage-flow { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.stage-chip {
  padding: 8px 14px; border-radius: 8px; border: 1px solid var(--border); background: #fff;
  font-size: 13px; display: flex; align-items: center; gap: 6px;
}
.stage-chip.done { background: #ecfdf5; border-color: #a7f3d0; color: var(--success); }
.stage-chip.doing { background: var(--primary-light); border-color: #c7d2fe; color: var(--primary-dark); font-weight: 600; }
.cost-summary { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; margin-bottom: 16px; }
.cost-summary .item { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 14px; }
.cost-summary .item .k { color: var(--text2); font-size: 13px; }
.cost-summary .item .v { font-size: 20px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.cost-summary .item.hl { border-color: var(--primary); background: var(--primary-soft); }
.cost-summary .item.hl .v { color: var(--primary-dark); }
.progress-card { padding: 10px 0; border-bottom: 1px solid #f3f4f6; }
.progress-card:last-child { border-bottom: none; }
.progress-card .pc-head { display: flex; align-items: center; gap: 8px; font-size: 14px; flex-wrap: wrap; }
.progress-card .pc-sub { color: var(--text2); font-size: 12px; margin: 4px 0 6px; }
.progress-bar { height: 8px; background: #eef0f3; border-radius: 5px; overflow: hidden; }
.progress-fill { height: 8px; background: var(--success); border-radius: 5px; transition: width .2s ease; }
.progress-fill.overdue { background: var(--danger); }
.timeline { list-style: none; }
.tl-item { position: relative; padding-left: 24px; padding-bottom: 16px; }
.tl-item::before { content: ''; position: absolute; left: 6px; top: 14px; bottom: -2px; width: 2px; background: var(--border); }
.tl-item:last-child::before { display: none; }
.tl-dot { position: absolute; left: 0; top: 4px; width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 3px solid var(--primary); }
.tl-head { font-weight: 600; font-size: 13.5px; }
.tl-body { color: var(--text2); font-size: 12.5px; margin-top: 2px; }

/* ---------- Gantt ---------- */
.gantt-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 10px; flex-wrap: wrap; }
.gantt-head h3 { margin-bottom: 0; }
.gantt-tools { display: flex; gap: 8px; flex-wrap: wrap; }
.gantt { display: flex; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: #fff; }
.gantt-labels { flex: 0 0 190px; border-right: 1px solid var(--border); background: #fafbfc; }
.gantt-labels .g-head { height: 30px; border-bottom: 1px solid var(--border); padding: 7px 10px; font-size: 12px; color: var(--text2); }
.gantt-label { height: 48px; padding: 5px 10px; border-bottom: 1px solid #f3f4f6; font-size: 13px; cursor: pointer; overflow: hidden; }
.gantt-label:hover { background: var(--primary-soft); }
.gantt-label .g-sub { font-size: 11px; color: var(--text2); margin-top: 2px; white-space: nowrap; }
.gantt-scroll { flex: 1; overflow-x: auto; }
.gantt-canvas { position: relative; min-width: 100%; }
.gantt-months { position: relative; height: 30px; border-bottom: 1px solid var(--border); background: #fafbfc; }
.gantt-month { position: absolute; top: 0; height: 30px; padding: 7px 0 0 5px; font-size: 11px; color: var(--text2); border-left: 1px solid var(--border); white-space: nowrap; }
.gantt-body { position: relative; }
.gantt-grid { position: absolute; top: 0; bottom: 0; border-left: 1px dashed #e9ecf1; }
.gantt-today { position: absolute; top: 0; bottom: 0; border-left: 2px solid var(--danger); z-index: 3; }
.gantt-today span { position: absolute; top: 2px; left: 3px; font-size: 10px; color: var(--danger); white-space: nowrap; }
.gantt-row { position: relative; height: 48px; border-bottom: 1px solid #f3f4f6; cursor: pointer; }
.gantt-row:hover { background: #fafbff; }
.gantt-bar { position: absolute; height: 13px; border-radius: 3px; font-size: 10px; line-height: 13px; color: #fff; overflow: hidden; white-space: nowrap; }
.gantt-bar.plan { top: 6px; background: #93c5fd; }
.gantt-bar.plan.overdue { background: #f87171; }
.gantt-bar.plan.duesoon { background: #fbbf24; }
.gantt-bar.actual { top: 28px; background: #34d399; }
.gantt-bar.actual.doing { background: repeating-linear-gradient(45deg, #34d399, #34d399 6px, #6ee7b7 6px, #6ee7b7 12px); }
.gantt-legend { display: flex; gap: 16px; align-items: center; font-size: 12px; color: var(--text2); flex-wrap: wrap; }
.gantt-legend i { display: inline-block; width: 14px; height: 10px; border-radius: 2px; margin-right: 4px; vertical-align: -1px; }

/* ---------- Duty ---------- */
.duty-area-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid #f3f4f6; }
.duty-area-row:last-child { border-bottom: none; }

/* ---------- Mobile ---------- */
.mobile-nav { display: none; }

@media (max-width: 900px) {
  .dash-main { grid-template-columns: 1fr; }
  .sbar-lab { width: 72px; }
}

@media (max-width: 768px) {
  .sidebar { display: none; }
  .main { padding: 16px 14px 84px; }
  .mobile-nav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; height: 58px;
    background: #fff; border-top: 1px solid var(--border); z-index: 50;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .mn-item {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 2px; font-size: 11px; color: var(--text2); cursor: pointer; font-style: normal;
  }
  .mn-item span { font-size: 18px; }
  .mn-item em { font-style: normal; }
  .mn-item.active { color: var(--primary); font-weight: 600; }
  .cards { grid-template-columns: 1fr 1fr; }
  .form-grid, .form-grid-3 { grid-template-columns: 1fr; }
  .dash-grid { grid-template-columns: 1fr; }
}


/* ===================== 全局框架：顶部栏 + 布局骨架 ===================== */
.shell { min-height: 100vh; }
.topbar {
  position: fixed; top: 0; left: 0; right: 0; height: 58px; z-index: 60;
  background: #fff; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 20px; padding: 0 20px;
}
.topbar-brand {
  display: flex; align-items: center; gap: 10px; cursor: pointer; flex-shrink: 0;
  min-width: var(--sidebar-w); padding-right: 12px;
}
.tb-mark {
  width: 12px; height: 26px; border-radius: 3px; flex-shrink: 0;
  background: linear-gradient(180deg, #1e3a8a, #002FA7);
}
.tb-brand-meta b { display: block; font-size: 15px; color: var(--text); letter-spacing: .3px; }
.tb-brand-meta small { display: block; font-size: 10px; color: var(--text3); letter-spacing: 1.5px; margin-top: 1px; }
.topbar-search {
  flex: 1; max-width: 460px; position: relative;
}
.topbar-search .tb-search-ico {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--text3); font-size: 16px; line-height: 1;
}
.topbar-search input {
  width: 100%; padding: 8px 12px 8px 34px; border-radius: 8px;
  background: #f3f4f6; border: 1px solid transparent;
}
.topbar-search input:focus { background: #fff; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0,47,167,.10); }
.topbar-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; flex-shrink: 0; }
.tb-user { display: flex; align-items: center; gap: 8px; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700;
}
.tb-user-meta b { display: block; font-size: 13px; line-height: 1.2; color: var(--text); }
.tb-user-meta small { font-size: 11px; color: var(--text3); }
.tb-link { color: var(--primary); cursor: pointer; text-decoration: none; font-size: 12px; white-space: nowrap; }
.tb-link:hover { text-decoration: underline; }

.layout { padding-top: 58px; }
.sidebar { top: 58px; height: calc(100vh - 58px); }

@media (max-width: 768px) {
  .topbar { padding: 0 12px; gap: 10px; }
  .topbar-brand { min-width: 0; padding-right: 0; }
  .topbar-brand .tb-brand-meta small { display: none; }
  .topbar-search { display: block; flex: 1; min-width: 0; }
  .topbar-actions .btn { display: none; }
  .tb-user-meta { display: none; }
}


/* ===================== 登录页（左右分栏品牌化） ===================== */
.login-shell { min-height: 100vh; display: flex; }
.login-brand {
  flex: 1.15; min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(700px 500px at 85% 10%, rgba(255,255,255,.10), transparent 55%),
    radial-gradient(500px 420px at -5% 100%, rgba(0,0,0,.25), transparent 55%),
    linear-gradient(135deg, #0b1f4b 0%, #002FA7 55%, #1e3a8a 100%);
  color: #fff; padding: 48px; position: relative; overflow: hidden;
}
.lb-inner { max-width: 460px; }
.lb-mark { width: 14px; height: 42px; border-radius: 4px; background: #fff; margin-bottom: 26px; }
.login-brand h1 { font-size: 30px; font-weight: 700; letter-spacing: 1px; color: #fff; margin-bottom: 10px; }
.lb-sub { font-size: 14px; color: #c7d2fe; margin-bottom: 36px; }
.lb-features { list-style: none; }
.lb-features li {
  display: flex; align-items: center; gap: 12px; padding: 12px 0;
  font-size: 14px; color: #e0e7ff; border-bottom: 1px solid rgba(255,255,255,.10);
}
.lb-features li:last-child { border-bottom: none; }
.lb-features li span {
  font-size: 11px; color: #93a8e8; font-variant-numeric: tabular-nums; width: 22px; flex-shrink: 0;
}
.login-form-side { flex: 1; display: flex; align-items: center; justify-content: center; background: #fff; padding: 40px 24px; }
.login-box { width: 380px; max-width: 100%; }
.login-box h2 { font-size: 22px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.login-box .sub { color: var(--text2); font-size: 13px; margin-bottom: 28px; }
.login-box .field { margin-bottom: 16px; }
.login-box .field input { padding: 10px 12px; }
.btn-login { width: 100%; padding: 11px; font-size: 15px; margin-top: 8px; }
.login-err { color: var(--danger); font-size: 13px; text-align: center; margin-top: 12px; min-height: 18px; }

@media (max-width: 860px) {
  .login-brand { display: none; }
  .login-form-side { flex: 1; }
}


/* ===================== 工作台驾驶舱 ===================== */
.section-label {
  font-size: 12px; font-weight: 700; color: var(--text3); letter-spacing: 1.5px;
  text-transform: uppercase; margin: 22px 0 10px;
}
.todo-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; margin-bottom: 4px; }
.todo-card { padding: 18px; }
.todo-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.todo-ico { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 19px; flex-shrink: 0; }
.todo-head b { display: block; font-size: 14px; color: var(--text); }
.todo-head small { font-size: 12px; }


/* ===================== 页头（列表/详情统一） ===================== */
.page-head {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap;
  margin-bottom: 16px;
}
.page-head .page-title { margin-bottom: 4px; }
.page-head .page-sub { margin-bottom: 0; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.crumb { color: var(--text3); margin: 0 4px; }


/* ===================== 甘特图整合优化 ===================== */
.gantt-labels { flex: 0 0 280px; }
.gantt-labels .g-head { height: 34px; }
.gantt-label {
  height: 46px; padding: 4px 10px; border-bottom: 1px solid #f3f4f6;
  font-size: 13px; cursor: pointer; overflow: hidden; position: relative; display: flex; flex-direction: column; justify-content: center;
}
.gantt-label:hover { background: var(--primary-soft); }
.gantt-label.selected { background: var(--primary-light); box-shadow: inset 3px 0 0 var(--primary); }
.g-lab-main { display: flex; align-items: center; gap: 6px; font-size: 13px; line-height: 1.3; }
.g-lab-main b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 0 1 auto; min-width: 0; }
.g-sub { font-size: 11px; color: var(--text2); margin-top: 2px; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gantt-label .g-edit { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); opacity: 0; }
.gantt-label:hover .g-edit { opacity: 1; }
.gantt-months { height: 34px; }
.gantt-month { height: 34px; padding-top: 8px; }
.gantt-row { height: 46px; }
.gantt-row.selected { background: var(--primary-light); }
.gantt-row:hover { background: #fafbff; }
.gantt-bar { height: 12px; line-height: 12px; }
.gantt-bar.plan { top: 8px; }
.gantt-bar.actual { top: 26px; }

/* 项目概况分区 */
.ov-grid { display: grid; grid-template-columns: 1fr; gap: 0; }

/* 审批流 */
.ap-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid #f3f4f6; font-size: 13px; flex-wrap: wrap; }
.ap-row:last-child { border-bottom: none; }

.ap-panel { border-color: #fca5a5; background: #fff7f7; }
.ap-panel h3 { color: var(--danger); }
.ap-panel .ap-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }


/* ===================== 移动端专项优化 ===================== */
@media (max-width: 768px) {
  /* 甘特图：手机端左侧收窄只显示阶段名，时间轴横向滚动 */
  .gantt-labels { flex: 0 0 112px; }
  .gantt-label { padding: 5px 8px; }
  .gantt-label .g-sub { display: none; }
  .gantt-label .g-edit { display: block; opacity: 1; font-size: 11px; padding: 2px 6px; }
  .gantt-label .g-lab-main { flex-wrap: nowrap; }
  .gantt-label .g-lab-main b { max-width: 64px; font-size: 12px; }
  .gantt-label .g-lab-main .tag { display: none; }
  .gantt-labels .g-head { font-size: 11px; padding: 7px 8px; }
  .gantt-month { font-size: 10px; padding-left: 4px; }

  /* 工作台：KPI 两列、待办卡片单列 */
  .todo-grid { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi-card { padding: 12px; }
  .kpi-num { font-size: 20px; }

  /* 表格：更紧凑 */
  .tbl td, .tbl th { padding: 8px 9px; font-size: 12px; }

  /* 页头操作按钮换行 */
  .page-head { flex-direction: column; gap: 10px; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; }

  /* 弹窗全宽 */
  .modal { width: 100%; border-radius: 14px 14px 0 0; margin-top: auto; }
  .modal-mask { align-items: flex-end; padding: 0; }
}

.tab-more { color: var(--text2); }
.tab-more .arrow { font-size: 10px; margin-left: 4px; }
.tabs-more { border-bottom: 1px dashed var(--border); padding-bottom: 8px; margin-top: -8px; }


/* ==========================================================================
   Mobile portrait polish (appended; desktop rules remain untouched)
   ========================================================================== */
@media (max-width: 768px) {
  html, body { overscroll-behavior-y: none; }

  .main { padding: 12px 12px calc(76px + env(safe-area-inset-bottom)); }

  .panel { padding: 14px; margin-bottom: 12px; border-radius: 10px; }
  .panel h3 { font-size: 14px; margin-bottom: 10px; flex-wrap: wrap; row-gap: 6px; }

  .section-label { margin: 16px 0 8px; font-size: 11px; letter-spacing: 1.2px; }

  .btn, .btn-sm { min-height: 40px; }
  .btn { padding: 8px 12px; }
  .btn-sm { padding: 6px 10px; }
  .big-check { min-height: 46px; }

  input, select, textarea { min-height: 40px; font-size: 16px; }
  label { font-size: 12.5px; margin-bottom: 4px; }

  .page-head { gap: 10px; }
  .page-head .page-title { font-size: 17px; }
  .page-head .page-sub { font-size: 12px; }
  .page-actions .btn { flex: 1 1 calc(50% - 5px); min-height: 40px; }

  .toolbar { align-items: stretch; gap: 8px; }
  .toolbar input, .toolbar select { flex: 1 1 100%; width: 100% !important; min-width: 0; }
  .toolbar .spacer { display: none; }
  .toolbar .btn { flex: 1 1 auto; }

  .tabs { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; padding-bottom: 2px; margin-bottom: 12px; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { flex: 0 0 auto; display: inline-flex; align-items: center; min-height: 40px; padding: 9px 12px; font-size: 13px; }
  .tab-more { position: sticky; right: 0; background: #fff; z-index: 1; }

  .form-grid, .form-grid-3 { grid-template-columns: 1fr; gap: 12px; }
  .form-grid .full { grid-column: 1; }

  .dash-welcome { flex-direction: column; align-items: stretch; padding: 14px; border-radius: 12px; gap: 12px; }
  .dash-welcome .dw-title { font-size: 17px; }
  .dash-welcome .dw-sub { font-size: 12px; line-height: 1.5; }
  .dash-welcome .dw-actions { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .dash-welcome .dw-actions .btn { min-height: 42px; }
  .dash-welcome .dw-actions .btn:only-child { grid-column: 1 / -1; }

  .todo-grid { grid-template-columns: 1fr; gap: 10px; }
  .todo-card { padding: 14px; }
  .todo-head { gap: 10px; margin-bottom: 10px; }
  .todo-ico { width: 36px; height: 36px; font-size: 17px; border-radius: 9px; }
  .todo-head b { font-size: 13px; }
  .todo-head small { font-size: 11px; }

  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .kpi-card { padding: 10px; gap: 8px; border-radius: 10px; }
  .kpi-icon { width: 34px; height: 34px; font-size: 17px; border-radius: 8px; }
  .kpi-num { font-size: 18px; }
  .kpi-lab { font-size: 11px; }

  .dash-main, .dash-grid { gap: 12px; }
  .dash-main .panel .tbl-wrap { margin-left: -14px; margin-right: -14px; width: calc(100% + 28px); }

  .tbl-wrap { -webkit-overflow-scrolling: touch; }
  .tbl-wrap .tbl { min-width: 540px; }
  .tbl td, .tbl th { padding: 8px 10px; font-size: 12px; }
  .tbl-wrap .p-tbl { min-width: 0; }
  .p-name { font-size: 13px; }
  .p-code { font-size: 10.5px; }
  .pbar-txt, .due-cell { font-size: 10.5px; }

  .reminder-item { display: flex; flex-wrap: wrap; align-items: flex-start; column-gap: 8px; row-gap: 4px; padding: 9px 0; font-size: 12.5px; line-height: 1.45; }
  .reminder-item .muted { flex-basis: 100%; font-size: 11.5px; }
  .feed-item { gap: 8px; padding: 9px 0; font-size: 12.5px; line-height: 1.45; }

  .ap-panel .ap-row { flex-wrap: wrap; row-gap: 8px; }
  .ap-panel .ap-row .plink { flex-basis: 100%; }
  .ap-panel .ap-row .muted { flex-basis: 100%; }
  .ap-panel .ap-row .spacer { display: none; }
  .ap-panel .ap-row .btn { flex: 1 1 auto; }

  .stage-flow { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; gap: 6px; padding-bottom: 2px; }
  .stage-chip { flex: 0 0 auto; padding: 7px 10px; font-size: 12px; }

  .gantt-head { flex-direction: column; align-items: stretch; gap: 10px; }
  .gantt-tools { width: 100%; display: flex; flex-wrap: wrap; gap: 6px; }
  .gantt-tools .muted { flex: 1 1 100%; order: -1; text-align: center; }
  .gantt-tools .btn { flex: 1 1 calc(50% - 4px); min-width: 0; }
  .gantt-legend { gap: 8px 12px; font-size: 11px; }
  .gantt-scroll { -webkit-overflow-scrolling: touch; }
  .gantt-labels { flex: 0 0 96px; }
  .gantt-labels .g-head { height: 30px; padding: 7px 6px; font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .gantt-months, .gantt-month { height: 30px; }
  .gantt-label { height: 46px; padding: 5px 6px; }
  .gantt-label .g-sub,
  .gantt-label .g-lab-main .tag { display: none; }
  .gantt-label .g-edit { display: block; opacity: 1; font-size: 11px; padding: 2px 5px; }
  .gantt-label .g-lab-main b { max-width: 58px; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .gantt-month { font-size: 9px; padding-left: 3px; }

  .modal-mask { align-items: flex-end; padding: 0; }
  .modal { width: 100%; max-width: 100%; border-radius: 16px 16px 0 0; margin: 0; max-height: 92vh; display: flex; flex-direction: column; animation: sheetUp .18s ease; }
  .modal.wide { width: 100%; max-width: 100%; }
  .modal-head { padding: 14px 16px; flex-shrink: 0; }
  .modal-head h3 { font-size: 15px; }
  .modal-head .x { font-size: 22px; padding: 2px; }
  .modal-body { padding: 16px; max-height: calc(92vh - 118px); min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; }
  .modal-foot { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); flex-shrink: 0; flex-wrap: wrap; gap: 8px; }
  .modal-foot .btn { flex: 1; min-height: 44px; }

  @keyframes sheetUp {
    from { transform: translateY(100%); opacity: .6; }
    to { transform: translateY(0); opacity: 1; }
  }

  .login-form-side { padding: 20px 16px; }
  .login-box { padding: 28px 20px; border-radius: 14px; }
}

@media (max-width: 600px) {
  .panel { padding: 12px; }
  .dash-main .panel .tbl-wrap { margin-left: -12px; margin-right: -12px; width: calc(100% + 24px); }

  .kpi-sub { display: none; }
  .tbl td, .tbl th { padding: 8px; font-size: 11.5px; }

  .p-tbl th:nth-child(2),
  .p-tbl td:nth-child(2),
  .p-tbl th:nth-child(5),
  .p-tbl td:nth-child(5) { display: none; }

  .topbar { padding: 0 10px; }
  .tb-brand-meta b { font-size: 14px; }
  .avatar { width: 28px; height: 28px; font-size: 12px; }
}

/* 项目详情：一级 tab + 二级 tab */
.tabs-l1 { border-bottom: none; margin-bottom: 2px; }
.tabs-l1 .tab { font-size: 15px; font-weight: 600; padding: 9px 18px; border-bottom: 2px solid transparent; }
.tabs-l1 .tab.active { border-bottom-color: var(--primary); }
.tabs-l2 { border-bottom: 1px solid var(--border); padding-bottom: 6px; margin-bottom: 16px; }
.tabs-l2 .tab { font-size: 13px; padding: 6px 14px; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs-l2 .tab.active { border-bottom-color: var(--primary); }

/* 项目详情：一级 tab + 二级 tab */
.tabs-l1 { border-bottom: none; margin-bottom: 2px; }
.tabs-l1 .tab { font-size: 15px; font-weight: 600; padding: 9px 18px; border-bottom: 2px solid transparent; }
.tabs-l1 .tab.active { border-bottom-color: var(--primary); }
.tabs-l2 { border-bottom: 1px solid var(--border); padding-bottom: 6px; margin-bottom: 16px; }
.tabs-l2 .tab { font-size: 13px; padding: 6px 14px; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs-l2 .tab.active { border-bottom-color: var(--primary); }


/* ===================== 侧边栏 + 顶部栏清爽化 ===================== */
.sidebar { width: 208px; }
.topbar-brand .tb-brand-name { font-size: 15px; font-weight: 700; color: var(--text); letter-spacing: .3px; }
.topbar-search { flex: 1; max-width: 520px; }
.topbar-search input {
  width: 100%; padding: 8px 14px; border-radius: 8px; background: #f3f4f6;
  border: 1px solid transparent; font-size: 13px;
}
.topbar-search input:focus { background: #fff; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0,47,167,.08); }
.topbar-user { position: relative; margin-left: auto; }
.tb-user { display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 6px 10px; border-radius: 8px; }
.tb-user:hover { background: #f3f4f6; }
.tb-user-name { font-size: 13px; color: var(--text); font-weight: 500; }
.user-menu {
  position: absolute; right: 0; top: calc(100% + 6px); width: 200px;
  background: #fff; border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(17,24,39,.12); z-index: 80; padding: 6px;
}
.um-head { padding: 8px 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.um-head b { display: block; font-size: 14px; }
.um-head small { color: var(--text2); font-size: 12px; }
.user-menu a { display: block; padding: 8px 10px; border-radius: 6px; cursor: pointer; text-decoration: none; color: var(--text); font-size: 13px; }
.user-menu a:hover { background: #f3f4f6; }
.user-menu a.um-danger { color: var(--danger); }
.user-menu a.um-danger:hover { background: #fef2f2; }

.nav { padding: 14px 12px; }
.nav-group { margin-bottom: 16px; }
.nav-group-title { font-size: 11px; font-weight: 600; color: var(--text3); letter-spacing: 1.5px; padding: 0 10px 6px; }
.nav-item {
  display: block; padding: 8px 10px; border-radius: 7px; cursor: pointer;
  color: #374151; font-size: 14px; position: relative; margin: 1px 0;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: #f3f4f6; color: var(--text); }
.nav-item.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.nav-item.active::before {
  content: ''; position: absolute; left: -12px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 16px; border-radius: 2px; background: var(--primary);
}
/* ============================================================
   工作台 v2 —— 安静、分层、低噪音
   ============================================================ */
.dash-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin: 2px 0 20px; }
.dash-head-main { min-width: 0; }
.dash-title { font-size: 22px; font-weight: 700; letter-spacing: .2px; line-height: 1.25; }
.dash-sub { font-size: 13px; color: var(--text2); margin-top: 6px; }
.dash-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.dash-invite {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: var(--primary-soft); border: 1px solid #dbe3ff; border-radius: 12px;
  padding: 14px 18px; margin-bottom: 18px;
}
.dash-invite-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: 13.5px; }
.dash-invite-body .muted { font-size: 12px; }

.dash-section { margin-bottom: 18px; }
.dash-panel {
  background: #fff; border: 1px solid var(--border); border-radius: 14px;
  padding: 18px 20px; box-shadow: var(--shadow-xs); margin-bottom: 18px;
}
.dash-panel:last-child { margin-bottom: 0; }
.panel-head { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.panel-head h3 { font-size: 14.5px; font-weight: 700; color: var(--text); letter-spacing: .1px; }
.panel-more { font-size: 12.5px; color: var(--text3); margin-left: auto; cursor: pointer; text-decoration: none; }
.panel-more:hover { color: var(--primary); }
.panel-note { font-size: 12px; color: var(--text3); margin-left: auto; }

.count-pill { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #f1f5f9; color: var(--text2); }
.count-pill.red { background: #fef2f2; color: var(--danger); }
.count-pill.orange { background: #fff7ed; color: var(--warn); }

/* 审批块 */
.approval-block { border: 1px solid #fecaca; background: #fffbfb; border-radius: 10px; padding: 2px 14px; margin-bottom: 14px; }
.approval-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid #fde8e8; }
.approval-row:last-child { border-bottom: none; }
.approval-info { flex: 1; min-width: 0; font-size: 13px; }
.approval-info .plink { font-weight: 600; }
.approval-actions { display: flex; gap: 6px; flex-shrink: 0; }
.btn-ghost-danger { color: var(--danger); border-color: #fecaca; background: #fff; }
.btn-ghost-danger:hover { background: #fef2f2; border-color: var(--danger); }

/* 今日待办三格 */
.todo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.todo-item {
  display: flex; align-items: center; gap: 12px; padding: 14px;
  border: 1px solid var(--border); border-radius: 12px; background: #fafbfd;
}
.todo-ic { width: 38px; height: 38px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 17px; flex-shrink: 0; background: #fff; border: 1px solid var(--border); }
.todo-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.todo-body b { font-size: 13.5px; }
.todo-body small { font-size: 12px; }

/* 关键指标 */
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.stat {
  position: relative; background: #fff; border: 1px solid var(--border); border-radius: 14px;
  padding: 16px 18px 15px; cursor: pointer; box-shadow: var(--shadow-xs); overflow: hidden;
  transition: box-shadow .15s ease, border-color .15s ease;
}
.stat::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--text3); opacity: .5; }
.stat.blue::before { background: var(--primary); }
.stat.green::before { background: var(--success); }
.stat.red::before { background: var(--danger); }
.stat.orange::before { background: var(--warn); }
.stat:hover { box-shadow: var(--shadow-sm); border-color: var(--border-strong); }
.stat-num { font-size: 26px; font-weight: 700; line-height: 1.1; color: var(--text); font-variant-numeric: tabular-nums; }
.stat-num-muted { font-size: 15px; font-weight: 600; color: var(--text3); }
.stat-label { font-size: 12.5px; color: var(--text2); margin-top: 6px; font-weight: 500; }
.stat-sub { font-size: 11.5px; color: var(--text3); margin-top: 3px; }

/* 主网格 */
.dash-grid { display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.dash-grid > .dash-panel { margin-bottom: 18px; }
.dash-grid .dash-tbl { border: none; border-radius: 0; }

/* 阶段分布（单色安静） */
.stage-bars { padding: 2px 0; }
.stage-row { display: flex; align-items: center; gap: 12px; padding: 6px 0; cursor: pointer; }
.stage-row:hover .stage-lab { color: var(--primary); }
.stage-lab { width: 64px; flex-shrink: 0; font-size: 12.5px; color: var(--text2); text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stage-track { flex: 1; height: 12px; background: #f3f4f6; border-radius: 6px; overflow: hidden; }
.stage-fill { height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--primary), #4772e6); min-width: 2px; transition: width .35s ease; }
.stage-fill.done { background: #d8dce3; }
.stage-num { width: 26px; font-size: 13px; font-weight: 700; color: var(--text); text-align: left; font-variant-numeric: tabular-nums; }

/* 项目表格 */
.p-leader { color: var(--text2); white-space: nowrap; }
.stage-tag { display: inline-block; padding: 2px 8px; border-radius: 999px; background: var(--primary-soft); color: var(--primary); font-size: 12px; font-weight: 500; }
.stage-tag.overdue { background: #fef2f2; color: var(--danger); margin-left: 4px; }
.p-due { white-space: nowrap; }
.due-stage { display: block; font-size: 12.5px; color: var(--text2); }
.due-date { display: block; font-size: 11.5px; color: var(--text3); margin-top: 1px; }
.due-date.due-overdue { color: var(--danger); font-weight: 600; }
.due-date.due-duesoon { color: var(--warn); font-weight: 500; }

/* 提醒安静列表 */
.quiet-list { display: flex; flex-direction: column; }
.quiet-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 2px;
  border-bottom: 1px solid #f3f4f6; cursor: pointer; font-size: 13px;
}
.quiet-item:last-child { border-bottom: none; }
.quiet-item:hover .q-main { color: var(--primary); }
.q-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; background: var(--text3); }
.q-dot.red { background: var(--danger); }
.q-dot.orange { background: var(--warn); }
.q-main { color: var(--text); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q-sub { color: var(--text3); margin-left: auto; flex-shrink: 0; font-size: 12px; max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 值日 */
.duty-line { display: flex; gap: 10px; padding: 8px 2px; font-size: 13px; align-items: baseline; border-bottom: 1px solid #f3f4f6; }
.duty-line:last-child { border-bottom: none; }
.duty-label { flex-shrink: 0; color: var(--text3); font-size: 12.5px; width: 36px; }
.duty-text { flex: 1; min-width: 0; line-height: 1.5; }

/* 响应式 */
@media (max-width: 1100px) {
  .stat-row { grid-template-columns: repeat(2, 1fr); }
  .dash-grid { grid-template-columns: 1fr; }
  .todo-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .stat-row { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-num { font-size: 22px; }
}
.upload-block { margin-top: 6px; }
.upload-block label { font-size: 13px; color: var(--text2); display: block; margin-bottom: 6px; font-weight: 500; }
.upload-block input[type="file"] { padding: 6px; font-size: 13px; }
.thumb-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.thumb-row img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border-strong); cursor: pointer; background: #f3f4f6; }
.thumb-video { width: 64px; height: 64px; border-radius: 8px; border: 1px solid var(--border-strong); cursor: pointer; background: #111; color: #fff; display: flex; align-items: center; justify-content: center; font-size: 24px; }
.thumb-doc { width: 64px; height: 64px; border-radius: 8px; border: 1px solid var(--border-strong); cursor: pointer; background: #f3f4f6; display: flex; align-items: center; justify-content: center; font-size: 26px; text-decoration: none; }
.thumb-item { position: relative; display: inline-block; }
.thumb-item .thumb-x { position: absolute; top: -6px; right: -6px; width: 18px; height: 18px; line-height: 17px; text-align: center; background: var(--danger); color: #fff; border-radius: 50%; font-size: 13px; cursor: pointer; font-weight: 700; }

/* ===== 大屏展示（DataV 科技感） ===== */
.screen-wrap {
  min-height: 100vh; color: #dbeafe; padding: 20px 24px; box-sizing: border-box;
  background:
    linear-gradient(rgba(0,180,255,.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,180,255,.05) 1px, transparent 1px),
    radial-gradient(900px 420px at 50% -10%, rgba(0,120,255,.28), transparent 65%),
    linear-gradient(180deg, #061224 0%, #0a1c38 55%, #071228 100%);
  background-size: 44px 44px, 44px 44px, 100% 100%, 100% 100%;
}
/* 顶部标题栏 */
.sc-header { display: flex; align-items: center; justify-content: center; gap: 40px; padding: 10px 0 18px; position: relative; }
.sc-main-title {
  font-size: 34px; font-weight: 800; letter-spacing: 8px; margin: 0; text-align: center;
  background: linear-gradient(180deg, #fff 20%, #7dd3fc 80%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: transparent;
}
.sc-clock { position: absolute; left: 0; font-size: 30px; font-weight: 700; font-variant-numeric: tabular-nums; color: #7dd3fc; letter-spacing: 2px; text-shadow: 0 0 14px rgba(56,189,248,.5); }
.sc-date { position: absolute; right: 0; font-size: 16px; color: #93c5fd; letter-spacing: 1px; }
/* 三栏主体 */
.sc-body { display: grid; grid-template-columns: 1fr 1.35fr 1fr; gap: 16px; }
.sc-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
/* 科技面板：四角发光 + 渐变边框 */
.sc-panel {
  position: relative; background: rgba(10,30,60,.5); border: 1px solid rgba(0,150,255,.25);
  border-radius: 6px; padding: 16px; box-shadow: inset 0 0 24px rgba(0,80,180,.12);
}
.sc-panel::before, .sc-panel::after {
  content: ''; position: absolute; width: 14px; height: 14px; border: 2px solid #00d4ff; pointer-events: none;
}
.sc-panel::before { top: -2px; left: -2px; border-right: none; border-bottom: none; }
.sc-panel::after { bottom: -2px; right: -2px; border-left: none; border-top: none; }
.sc-panel-fill { flex: 1; }
.sc-panel-title {
  font-size: 17px; font-weight: 700; color: #7dd3fc; text-align: center; margin: 0 0 14px; position: relative; letter-spacing: 2px;
}
.sc-panel-title::before, .sc-panel-title::after { content: ''; position: absolute; top: 50%; width: 22%; height: 1px; }
.sc-panel-title::before { left: 0; background: linear-gradient(90deg, transparent, #00d4ff); }
.sc-panel-title::after { right: 0; background: linear-gradient(270deg, transparent, #00d4ff); }
/* 大数字 */
.sc-big-num { text-align: center; margin: 4px 0 6px; }
.sc-big-num b { font-size: 44px; font-weight: 800; color: #fff; font-variant-numeric: tabular-nums; text-shadow: 0 0 16px rgba(56,189,248,.6); }
.sc-big-num span { font-size: 20px; color: #93c5fd; }
.sc-sub { font-size: 14px; color: #93c5fd; margin: 10px 0 6px; font-weight: 600; }
.sc-list { display: flex; flex-wrap: wrap; gap: 8px; }
.sc-chip { display: inline-block; padding: 4px 12px; border-radius: 4px; font-size: 14px; }
.sc-chip.ok { background: rgba(22,163,74,.18); color: #4ade80; border: 1px solid rgba(34,197,94,.4); }
.sc-chip.miss { background: rgba(220,38,38,.18); color: #f87171; border: 1px solid rgba(239,68,68,.5); font-weight: 600; }
.sc-empty { color: #64748b; font-size: 13px; }
/* 当月累计表 */
.sc-table { max-height: 280px; overflow: auto; }
.sc-table table { width: 100%; border-collapse: collapse; }
.sc-table th { font-size: 13px; color: #7dd3fc; text-align: left; padding: 7px 8px; border-bottom: 1px solid rgba(0,150,255,.25); font-weight: 600; }
.sc-table td { font-size: 14px; padding: 7px 8px; border-bottom: 1px solid rgba(255,255,255,.06); }
.sc-table .num { text-align: right; }
.sc-warn { color: #f87171; font-weight: 700; }
/* 项目卡片列表 + 阶段时间轴 */
.sc-proj-list { display: flex; flex-direction: column; gap: 12px; max-height: calc(100vh - 220px); overflow: auto; padding-right: 2px; }
.sc-proj { background: rgba(0,120,255,.06); border: 1px solid rgba(0,150,255,.18); border-radius: 6px; padding: 12px 14px; }
.sc-proj-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.sc-proj-name { font-size: 15px; font-weight: 700; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-proj-pct { font-size: 20px; font-weight: 800; color: #7dd3fc; font-variant-numeric: tabular-nums; }
.sc-proj-bar { height: 10px; background: rgba(255,255,255,.1); border-radius: 999px; overflow: hidden; margin-bottom: 10px; }
.sc-proj-fill { height: 100%; background: linear-gradient(90deg, #16a34a, #22c55e); border-radius: 999px; box-shadow: 0 0 8px rgba(34,197,94,.5); }
.sc-proj-fill.over { background: linear-gradient(90deg, #dc2626, #ef4444); box-shadow: 0 0 8px rgba(239,68,68,.6); }
.sc-stage-bar { display: flex; gap: 3px; margin-bottom: 3px; }
.sc-seg { flex: 1; height: 12px; border-radius: 3px; }
.sc-seg.done { background: #16a34a; }
.sc-seg.doing { background: #3b82f6; box-shadow: 0 0 10px rgba(59,130,246,.9); }
.sc-seg.todo { background: rgba(255,255,255,.14); }
.sc-stage-labels { display: flex; gap: 3px; }
.sc-seg-lab { flex: 1; font-size: 10px; color: #7dd3fc; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-tag { display: inline-block; padding: 1px 9px; border-radius: 3px; font-size: 12px; font-weight: 600; background: #f59e0b; color: #fff; }
.sc-tag.over { background: #dc2626; }
/* 滚动报警条 */
.sc-alert { display: flex; align-items: center; gap: 12px; background: rgba(220,38,38,.15); border: 1px solid rgba(239,68,68,.5); border-radius: 6px; padding: 8px 14px; margin-bottom: 14px; overflow: hidden; }
.sc-alert-label { background: #dc2626; color: #fff; font-weight: 700; padding: 3px 12px; border-radius: 4px; white-space: nowrap; font-size: 14px; }
.sc-alert-scroll { flex: 1; overflow: hidden; }
.sc-alert-track { display: inline-flex; white-space: nowrap; animation: sc-marquee 22s linear infinite; }
.sc-alert-item { font-size: 14px; color: #fecaca; }
.sc-alert-item.over { color: #fff; font-weight: 700; }
@keyframes sc-marquee { 0% { transform: translateX(0); } 100% { transform: translateX(-50%); } }
@media (max-width: 900px) {
  .sc-body { grid-template-columns: 1fr; }
  .sc-main-title { font-size: 24px; letter-spacing: 4px; }
  .sc-clock { font-size: 20px; }
  .sc-header { gap: 16px; }
}

/* ==========================================================================
   Premium Visual Overhaul - global high-end skin for all screens
   ========================================================================== */
@media (max-width: 0px) {
:root {
  --primary: #4f46e5;
  --primary-dark: #312e81;
  --primary-soft: rgba(79, 70, 229, 0.12);
  --bg: #f2f4f8;
  --panel: #f8fafc;
  --panel-strong: #ffffff;
  --text: #0f172a;
  --text2: #475569;
  --text3: #94a3b8;
  --border: #dbe0ed;
  --border-strong: #c5cfdf;
  --danger: #dc2626;
  --success: #059669;
  --warn: #d97706;
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-sm: 0 8px 28px rgba(15, 23, 42, 0.1);
  --shadow-md: 0 14px 44px rgba(15, 23, 42, 0.12);
  --bg-grad-1: #edf1ff;
  --bg-grad-2: #f9fafb;
}

*,
*::before,
*::after { box-sizing: border-box; }

html,
body {
  background:
    radial-gradient(circle at 10% -12%, rgba(99, 102, 241, 0.18), transparent 45%),
    radial-gradient(circle at 90% 12%, rgba(139, 92, 246, 0.18), transparent 42%),
    linear-gradient(180deg, var(--bg-grad-1), var(--bg-grad-2));
  color: var(--text);
  scroll-behavior: smooth;
}

body {
  font-family: "Inter", "Noto Sans SC", "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  letter-spacing: 0.2px;
}

.shell {
  position: relative;
}

.topbar {
  height: 66px;
  background: rgba(255, 255, 255, 0.84);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.08);
}

.sidebar {
  background: linear-gradient(180deg, #ffffff, #f7f9ff);
  border-right: 1px solid var(--border);
}

.sidebar .foot {
  background: linear-gradient(180deg, #f7f9ff, #f1f4ff);
}

.nav-item {
  border-radius: 12px;
  margin: 3px 0;
  transition: transform .2s ease, background .2s ease, box-shadow .2s ease, color .2s ease;
}
.nav-item:hover,
.nav-item.active {
  background: var(--primary-soft);
  box-shadow: 0 6px 16px rgba(79, 70, 229, 0.15);
  transform: translateX(2px);
}

.layout { padding-top: 66px; }
.main { padding: 30px 30px 42px; max-width: 1760px; }

.login-shell {
  background:
    linear-gradient(120deg, rgba(79, 70, 229, 0.88), rgba(99, 102, 241, 0.8)),
    radial-gradient(circle at 20% 10%, rgba(255,255,255,0.25), transparent 60%);
}

.login-brand {
  background:
    radial-gradient(720px 360px at 14% 0, rgba(255,255,255,.2), transparent 65%),
    linear-gradient(142deg, rgba(15,23,42,.35), rgba(79,70,229,.75));
}
.lb-mark {
  width: 12px;
  height: 48px;
  border-radius: 6px;
}

.login-box {
  border: 1px solid rgba(255, 255, 255, 0.42);
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.24);
}

.btn,
button.btn {
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 2px 0 rgba(15, 23, 42, 0.02), inset 0 1px 0 rgba(255,255,255,.6);
  transition: transform .18s ease, box-shadow .2s ease, background .2s ease, border-color .2s ease;
}
.btn:hover,
button.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 16px rgba(15, 23, 42, 0.14);
}
.btn-primary {
  background: linear-gradient(180deg, #6366f1, var(--primary));
  border: 1px solid #4f46e5;
}
.btn-primary:hover {
  background: linear-gradient(180deg, #4f46e5, #4338ca);
  border-color: #4338ca;
}

input,
select,
textarea {
  border-radius: 12px;
  border: 1px solid #c7d2fe;
  background: #fff;
  transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.55);
}
input:focus,
select:focus,
textarea:focus {
  border-color: #818cf8;
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.14);
  transform: translateY(-1px);
}

.panel,
.dash-panel,
.stat,
.todo-card,
.kpi-card,
.cost-summary .item,
.stat-card,
.dash-card,
.dash-welcome,
.approval-block,
.quiet-list,
.todo-item,
.stage-row {
  background: var(--panel-strong);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-xs);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.panel:hover,
.dash-panel:hover,
.stat:hover,
.todo-card:hover,
.kpi-card:hover,
.approval-block:hover,
.todo-item:hover,
.stage-row:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
}

.panel h3,
.dash-panel h3,
.dash-head .dash-title,
.page-title {
  color: #111827;
  letter-spacing: .15px;
}

.page-head .page-title,
.dash-title,
.dash-sub,
.page-sub {
  animation: fadeInUp .28s ease both;
}

.tbl-wrap {
  border-radius: 14px;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px var(--border);
  border: none;
}
table.tbl {
  font-size: 13px;
}
thead th,
.tbl th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: linear-gradient(180deg, #f7f8ff, #f1f4ff);
}
.tbl tbody tr:nth-child(even) td {
  background: #fbfcff;
}
.tbl tbody tr:hover td {
  background: #eef2ff;
}
.tbl td,
.tbl th {
  border-bottom-color: #e9e8ff;
}

.tag {
  border: 1px solid transparent;
}
.tag.blue { background: #eef2ff; color: #3730a3; border-color: #c7d2fe; }
.tag.green { background: #ecfdf5; color: #047857; border-color: #bbf7d0; }
.tag.orange { background: #fff7ed; color: #b45309; border-color: #fed7aa; }
.tag.red { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }

.tabs {
  border-bottom: 1px solid #e5e7eb;
  gap: 6px;
}
.tab {
  border-radius: 10px 10px 0 0;
  border: 1px solid transparent;
  padding: 10px 16px;
}
.tab.active {
  background: #fff;
  border-color: var(--border);
  border-bottom-color: #ffffff;
  color: #1d4ed8;
  font-weight: 600;
}
.tab:hover {
  border-color: #e5e7eb;
  background: #f8faff;
}

.modal-mask {
  background: rgba(15, 23, 42, 0.45);
}
.modal {
  border-radius: 18px;
  box-shadow: var(--shadow-md);
  border: 1px solid rgba(255,255,255,.75);
}
.modal-head {
  border-bottom: 1px solid #e5e8f4;
}

.toast {
  border-radius: 999px;
  padding: 10px 18px;
  font-weight: 600;
  letter-spacing: .15px;
}

.mobile-nav {
  box-shadow: 0 -8px 26px rgba(15, 23, 42, 0.14);
  border-top-color: var(--border-strong);
  background: rgba(255,255,255,.96);
}
.mn-item {
  border-top: 3px solid transparent;
}
.mn-item.active {
  border-top-color: var(--primary);
  color: #1e3a8a;
  font-weight: 600;
}

.screen-wrap {
  border-radius: 20px;
  padding: 22px;
  margin: 14px;
}
.screen-wrap,
.sc-panel {
  animation: fadeIn .34s ease both;
}

.sc-panel {
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 12px;
  background: rgba(255,255,255,.06);
}

.topbar-user,
.tb-user,
.topbar-search input,
.avatar,
.kpi-card,
.stat-card,
.todo-ico,
.todo-item {
  transition: transform .2s ease, box-shadow .2s ease;
}
.topbar-user:hover,
.tb-user:hover,
.avatar:hover,
.kpi-card:hover,
.stat-card:hover,
.todo-card:hover,
.todo-ico:hover,
.todo-item:hover {
  transform: translateY(-2px);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 768px) {
  .sidebar { width: 222px; }
  .main { padding-left: 14px; padding-right: 14px; }
  .topbar { height: 62px; }
  .login-shell { background: #fff; }
  .panel,
  .dash-panel,
  .todo-item,
  .kpi-card,
  .stat,
  .stat-card {
    border-radius: 14px;
  }
  .topbar-brand .tb-brand-name { letter-spacing: .3px; }
}
}

/* ==========================================================================
   Swiss operations system - structural UI/UX pass
   ========================================================================== */
:root {
  --primary: #002FA7;
  --primary-dark: #001e6e;
  --primary-light: #eef3ff;
  --primary-soft: #f5f7ff;
  --bg: #f7f7f8;
  --panel: #ffffff;
  --panel-strong: #ffffff;
  --text: #111214;
  --text2: #60646c;
  --text3: #92969f;
  --border: #e0e1e5;
  --border-strong: #c8cad0;
  --radius: 0;
  --shadow-xs: none;
  --shadow-sm: none;
  --shadow-md: none;
  --sidebar-w: 232px;
}

html, body { background: var(--bg); }
body {
  font-family: "Helvetica Neue", Helvetica, Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  letter-spacing: 0;
}

button, input, select, textarea { font-family: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
input, select, textarea {
  border-radius: 0;
  border-color: var(--border-strong);
  box-shadow: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: inset 3px 0 0 var(--primary);
}

.topbar {
  height: 64px;
  padding: 0 20px;
  gap: 18px;
  background: #fff;
  border-bottom: 1px solid var(--border-strong);
  box-shadow: none;
}
.topbar-brand { min-width: calc(var(--sidebar-w) - 20px); gap: 12px; }
.tb-mark { width: 28px; height: 5px; border-radius: 0; background: var(--primary); }
.tb-brand-name { font-size: 15px; font-weight: 700; letter-spacing: .02em; }
.topbar-search { max-width: 560px; }
.topbar-search input {
  height: 36px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 0;
  background: var(--bg);
}
.topbar-search input:focus { background: #fff; border-color: var(--primary); box-shadow: inset 3px 0 0 var(--primary); }
.approval-entry {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  background: #fff;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}
.approval-entry:hover, .approval-entry.active { border-color: var(--primary); color: var(--primary); }
.approval-count, .nav-badge, .mn-badge, .mobile-menu-item em {
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-size: 10px;
  line-height: 1;
  font-style: normal;
  font-variant-numeric: tabular-nums;
}
[data-approval-count][hidden] { display: none !important; }
.topbar-user { position: relative; margin-left: 0; }
.tb-user { cursor: pointer; }
.avatar { border-radius: 0; background: var(--text); }
.user-menu { border-radius: 0 !important; border: 1px solid var(--border-strong) !important; box-shadow: none !important; }

.layout { padding-top: 64px; }
.sidebar {
  top: 64px;
  height: calc(100vh - 64px);
  width: var(--sidebar-w);
  background: #fff;
  border-right: 1px solid var(--border-strong);
}
.nav { padding: 18px 14px; }
.nav-group { margin-bottom: 22px; }
.nav-group-title {
  display: flex;
  justify-content: flex-start;
  gap: 8px;
  padding: 0 8px 7px;
  color: var(--text3);
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
}
.nav-group-title span { color: var(--primary); font-variant-numeric: tabular-nums; }
.nav-item {
  min-height: 40px;
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: center;
  gap: 4px;
  margin: 0;
  padding: 0 8px;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  color: #383b40;
}
.nav-index { color: var(--text3); font-size: 11px; font-variant-numeric: tabular-nums; }
.nav-item:hover { background: var(--bg); color: var(--text); }
.nav-item.active { background: var(--primary); color: #fff; font-weight: 700; }
.nav-item.active::before { display: none; }
.nav-item.active .nav-index { color: rgba(255,255,255,.68); }
.nav-item.active .nav-badge { color: var(--primary); background: #fff; }
.sidebar .foot { background: #fff; border-top: 1px solid var(--border-strong); }

.main { max-width: none; padding: 30px clamp(20px, 3vw, 48px) 48px; }
.page-title, .dash-title, .dw-title { letter-spacing: -.025em; }
.page-title { font-size: clamp(24px, 2.2vw, 34px); line-height: 1.1; }
.page-sub { margin-top: 7px; color: var(--text2); }
.page-folio {
  margin-bottom: 10px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  font-variant-numeric: tabular-nums;
}

.panel, .dash-panel, .stat, .todo-card, .kpi-card, .stat-card, .dash-card, .dash-welcome,
.approval-block, .quiet-list, .todo-item, .stage-row, .cost-summary .item {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 0;
  box-shadow: none;
  transition: border-color .15s ease;
}
.panel:hover, .dash-panel:hover, .stat:hover, .todo-card:hover, .kpi-card:hover,
.approval-block:hover, .todo-item:hover, .stage-row:hover {
  border-color: var(--border-strong);
  box-shadow: none;
  transform: none;
}
.panel, .dash-panel { padding: 20px; }
.stat { border-top: 3px solid var(--primary); }

.btn, button.btn {
  min-height: 36px;
  padding: 7px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 0;
  background: #fff;
  box-shadow: none;
  transition: background .12s, border-color .12s, color .12s;
}
.btn:hover, button.btn:hover { transform: none; box-shadow: none; border-color: var(--primary); color: var(--primary); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }
.btn-sm { min-height: 30px; padding: 4px 10px; }
.tag { border-radius: 0; border: 1px solid currentColor; background: transparent !important; }

.tbl-wrap {
  position: relative;
  overflow-x: auto !important;
  border: 1px solid var(--border-strong);
  border-radius: 0;
  box-shadow: none;
  background: #fff;
  -webkit-overflow-scrolling: touch;
  scrollbar-color: var(--primary) var(--bg);
  scrollbar-width: thin;
}
.tbl-wrap::-webkit-scrollbar { height: 8px; }
.tbl-wrap::-webkit-scrollbar-track { background: var(--bg); }
.tbl-wrap::-webkit-scrollbar-thumb { background: var(--primary); }
table.tbl { font-size: 13px; }
.tbl th, thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bg);
  color: #383b40;
  border-bottom: 1px solid var(--border-strong);
}
.tbl td { border-bottom-color: var(--border); }
.tbl tbody tr:nth-child(even) td { background: #fbfbfc; }
.tbl tbody tr:hover td { background: var(--primary-light); }

.tabs {
  flex-wrap: nowrap;
  gap: 0;
  overflow-x: auto;
  border-bottom: 1px solid var(--border-strong);
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab { border-radius: 0; border: 0; border-right: 1px solid var(--border); padding: 11px 15px; }
.tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.tab:hover { background: var(--bg); }
.tab.active:hover { background: var(--primary); }

.modal-mask { background: rgba(17,18,20,.5); }
.modal { border: 1px solid var(--border-strong); border-radius: 0; box-shadow: none; }
.modal-head, .modal-foot { border-color: var(--border-strong); }
.toast { border-radius: 0; font-weight: 600; }

/* Approval center */
.approval-page-head { align-items: flex-end; padding-bottom: 22px; border-bottom: 1px solid var(--border-strong); }
.approval-summary { display: grid; grid-template-columns: repeat(3, minmax(90px, 1fr)); border: 1px solid var(--border-strong); background: #fff; }
.approval-summary > div { min-width: 105px; padding: 14px 16px; border-right: 1px solid var(--border); }
.approval-summary > div:last-child { border-right: 0; }
.approval-summary b { display: block; font-size: 24px; line-height: 1; font-variant-numeric: tabular-nums; }
.approval-summary span { display: block; margin-top: 7px; color: var(--text2); font-size: 11px; }
.approval-section { margin-top: 22px; border: 1px solid var(--border-strong); background: #fff; }
.approval-section-primary { border-top: 4px solid var(--primary); }
.approval-section-head { min-height: 52px; display: flex; align-items: center; justify-content: space-between; padding: 0 16px; border-bottom: 1px solid var(--border-strong); }
.approval-section-head > div { display: flex; align-items: center; gap: 12px; }
.approval-section-head span { color: var(--primary); font-size: 11px; font-weight: 700; }
.approval-section-head h2 { font-size: 15px; }
.approval-section-head > b { color: var(--text3); font-size: 13px; font-variant-numeric: tabular-nums; }
.approval-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.approval-list { display: flex; flex-direction: column; }
.approval-card { display: grid; grid-template-columns: 46px minmax(0, 1fr) auto; gap: 14px; align-items: center; min-height: 92px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.approval-card:last-child { border-bottom: 0; }
.approval-card-index { align-self: stretch; display: flex; align-items: flex-start; justify-content: center; padding-top: 3px; border-right: 1px solid var(--border); color: var(--text3); font-size: 11px; font-variant-numeric: tabular-nums; }
.approval-card-main { min-width: 0; }
.approval-card-title { display: flex; align-items: center; gap: 9px; min-width: 0; }
.approval-card-title a { min-width: 0; overflow: hidden; color: var(--text); font-size: 14px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.approval-card-title a:hover { color: var(--primary); }
.approval-card-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 7px; color: var(--text2); font-size: 11px; }
.approval-card-meta span { position: relative; }
.approval-card-meta span + span::before { content: ''; position: absolute; left: -8px; top: 50%; width: 2px; height: 2px; background: var(--text3); }
.approval-comment { margin-top: 8px; padding: 7px 9px; border-left: 2px solid var(--primary); background: var(--bg); color: var(--text2); font-size: 12px; }
.approval-card-actions { display: flex; gap: 7px; }
.approval-empty { padding: 34px 16px; color: var(--text3); text-align: center; font-size: 13px; }

/* Mobile navigation and task flow */
.mobile-nav, .mobile-menu-mask { display: none; }
body.mobile-menu-open { overflow: hidden; }

/* Large screen: editorial data grid, readable at distance */
.screen-wrap {
  min-height: 100vh;
  margin: 0;
  padding: clamp(18px, 2vw, 36px);
  box-sizing: border-box;
  border-radius: 0;
  background: var(--bg);
  color: var(--text);
}
.sc-header {
  min-height: 82px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 24px;
  padding: 0 0 18px;
  border-bottom: 3px solid var(--primary);
}
.sc-heading { text-align: center; }
.sc-main-title { margin: 0; color: var(--text); background: none; -webkit-text-fill-color: currentColor; font-size: clamp(26px, 2.2vw, 40px); font-weight: 700; letter-spacing: -.03em; }
.sc-heading span { display: block; margin-top: 6px; color: var(--text3); font-size: 11px; }
.sc-clock, .sc-date { position: static; color: var(--text); text-shadow: none; letter-spacing: 0; }
.sc-clock { justify-self: start; font-size: clamp(25px, 2.4vw, 42px); font-weight: 700; font-variant-numeric: tabular-nums; }
.sc-date { justify-self: end; font-size: 14px; }
.sc-alert { display: grid; grid-template-columns: auto 1fr; gap: 0; align-items: stretch; margin: 14px 0; padding: 0; border: 1px solid var(--border-strong); border-radius: 0; background: #fff; overflow: hidden; }
.sc-alert-label { display: flex; align-items: center; padding: 12px 16px; border-radius: 0; background: var(--text); color: #fff; font-size: 12px; }
.sc-alert-items { display: flex; align-items: center; gap: 0; overflow-x: auto; }
.sc-alert-item { padding: 10px 14px; border-right: 1px solid var(--border); color: var(--text2); font-size: 12px; white-space: nowrap; }
.sc-alert-item.over { color: #a30000; font-weight: 700; }
.sc-body { display: grid; grid-template-columns: .9fr 1.45fr 1fr; gap: 12px; }
.sc-col { gap: 12px; }
.sc-panel { padding: clamp(14px, 1.2vw, 22px); border: 1px solid var(--border-strong); border-radius: 0; background: #fff; box-shadow: none; }
.sc-panel::before, .sc-panel::after, .sc-panel-title::before, .sc-panel-title::after { display: none; }
.sc-panel-title { margin: 0 0 16px; padding-bottom: 10px; border-bottom: 1px solid var(--border); color: var(--text); text-align: left; font-size: 14px; letter-spacing: 0; }
.sc-panel-title::first-letter { color: var(--primary); }
.sc-big-num { margin: 2px 0 16px; text-align: left; }
.sc-big-num b { color: var(--text); font-size: clamp(38px, 4vw, 70px); text-shadow: none; }
.sc-big-num span { color: var(--text3); font-size: clamp(18px, 2vw, 28px); }
.sc-sub { margin: 13px 0 7px; color: var(--text2); font-size: 12px; }
.sc-list { gap: 5px; }
.sc-chip { padding: 4px 8px; border-radius: 0; font-size: 12px; }
.sc-chip.ok { border: 1px solid var(--border-strong); background: var(--bg); color: var(--text); }
.sc-chip.miss { border: 1px solid #a30000; background: #fff; color: #a30000; }
.sc-empty { color: var(--text3); }
.sc-table { max-height: 34vh; }
.sc-table th { position: sticky; top: 0; background: var(--bg); color: var(--text2); border-bottom: 1px solid var(--border-strong); font-size: 11px; }
.sc-table td { border-bottom: 1px solid var(--border); color: var(--text); font-size: 12px; }
.sc-warn { color: #a30000; }
.sc-proj-list { gap: 0; max-height: calc(100vh - 220px); padding: 0; }
.sc-proj { padding: 14px 0; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; background: #fff; }
.sc-proj:first-child { padding-top: 0; }
.sc-proj-name { font-size: 14px; }
.sc-proj-pct { color: var(--primary); font-size: 22px; text-shadow: none; }
.sc-proj-bar { height: 6px; margin-bottom: 9px; border-radius: 0; background: var(--border); }
.sc-proj-fill, .sc-proj-fill.over { border-radius: 0; background: var(--primary); box-shadow: none; }
.sc-proj-fill.over { background: #a30000; }
.sc-stage-bar { gap: 1px; }
.sc-seg { height: 9px; border-radius: 0; }
.sc-seg.done { background: var(--primary); }
.sc-seg.doing { background: #6f87c7; box-shadow: none; }
.sc-seg.todo { background: var(--border); }
.sc-seg-lab { color: var(--text3); }
.sc-tag { border-radius: 0; background: var(--text); }
.sc-tag.over { background: #a30000; }

@media (min-width: 901px) {
  .screen-wrap { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
  .sc-header, .sc-alert { flex: 0 0 auto; }
  .sc-body { flex: 1 1 auto; min-height: 0; }
  .sc-col, .sc-panel, .sc-panel-fill { min-height: 0; }
  .sc-col { overflow: hidden; }
  .sc-panel-fill { overflow: hidden; }
}

@media (max-width: 1180px) {
  .approval-columns { grid-template-columns: 1fr; gap: 0; }
  .sc-body { grid-template-columns: 1fr 1.3fr; }
  .sc-body > .sc-col:last-child { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  .topbar { height: 58px; padding: 0 10px; gap: 8px; }
  .layout { padding-top: 58px; }
  .topbar-brand { min-width: 0; padding: 0; }
  .tb-mark { width: 20px; }
  .tb-brand-name { font-size: 13px; }
  .topbar-search { min-width: 0; }
  .topbar-search input { height: 34px; font-size: 12px; }
  .approval-entry { min-height: 34px; padding: 0 9px; }
  .approval-entry > span { display: inline; font-size: 12px; }
  .tb-user-name { display: none; }
  .avatar { width: 32px; height: 32px; }
  .sidebar { display: none; }
  .main { padding: 18px 12px calc(86px + env(safe-area-inset-bottom)); }
  .page-head { align-items: flex-start; }
  .page-title { font-size: 25px; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1 1 auto; }
  .panel, .dash-panel { padding: 15px 13px; }
  .cards, .stat-row { grid-template-columns: 1fr 1fr; gap: 8px; }
  .toolbar, .filter-bar { align-items: stretch; gap: 8px; }
  .toolbar input, .toolbar select, .filter-bar input, .filter-bar select { width: 100%; min-width: 0; }
  .toolbar .spacer { display: none; }
  .tbl-wrap { margin-right: -12px; border-right: 0; }
  table.tbl { min-width: 720px; }
  .tbl th:first-child, .tbl td:first-child { position: sticky; left: 0; z-index: 1; background: #fff; box-shadow: 1px 0 0 var(--border-strong); }
  .tbl th:first-child { z-index: 3; background: var(--bg); }
  .tbl tbody tr:nth-child(even) td:first-child { background: #fbfbfc; }
  .tabs { margin-right: -12px; }
  .form-grid, .form-grid-3, .form-grid-5 { grid-template-columns: 1fr !important; }
  .modal-mask { align-items: flex-end; padding: 0; }
  .modal, .modal.wide { width: 100%; max-height: 92vh; }
  .modal-body { max-height: calc(92vh - 122px); }
  .modal-foot { padding-bottom: calc(14px + env(safe-area-inset-bottom)); }

  .mobile-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 70;
    height: calc(66px + env(safe-area-inset-bottom));
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    padding: 0 0 env(safe-area-inset-bottom);
    border-top: 1px solid var(--border-strong);
    background: #fff;
    box-shadow: none;
  }
  .mn-item {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    border: 0;
    border-right: 1px solid var(--border);
    border-top: 3px solid transparent;
    background: #fff;
    color: var(--text2);
  }
  .mn-item:last-child { border-right: 0; }
  .mn-item > span { color: var(--text3); font-size: 10px; font-variant-numeric: tabular-nums; }
  .mn-item em { font-size: 12px; font-style: normal; }
  .mn-item.active { border-top-color: var(--primary); color: var(--primary); font-weight: 700; }
  .mn-item.active > span { color: var(--primary); }
  .mn-badge { position: absolute; top: 7px; right: calc(50% - 27px); }
  .mobile-menu-mask { position: fixed; inset: 0; z-index: 90; display: none; align-items: flex-end; background: rgba(17,18,20,.46); }
  .mobile-menu-mask.open { display: flex; }
  .mobile-menu-panel { width: 100%; max-height: 82vh; overflow-y: auto; padding-bottom: env(safe-area-inset-bottom); background: #fff; border-top: 4px solid var(--primary); }
  .mobile-menu-head { min-height: 68px; display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--border-strong); }
  .mobile-menu-head b { display: block; font-size: 17px; }
  .mobile-menu-head span { display: block; margin-top: 2px; color: var(--text2); font-size: 11px; }
  .mobile-menu-head button { padding: 8px 0 8px 16px; border: 0; background: #fff; color: var(--primary); }
  .mobile-menu-grid { display: grid; grid-template-columns: 1fr 1fr; }
  .mobile-menu-item { position: relative; min-height: 76px; display: grid; grid-template-columns: 32px 1fr; align-items: center; padding: 0 14px; border: 0; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); background: #fff; text-align: left; }
  .mobile-menu-item:nth-child(even) { border-right: 0; }
  .mobile-menu-item > span { color: var(--text3); font-size: 10px; }
  .mobile-menu-item > b { font-size: 13px; }
  .mobile-menu-item.active { background: var(--primary); color: #fff; }
  .mobile-menu-item.active > span { color: rgba(255,255,255,.65); }
  .mobile-menu-item em { position: absolute; top: 9px; right: 9px; }

  .approval-page-head { display: block; }
  .approval-summary { width: 100%; margin-top: 18px; grid-template-columns: repeat(3, 1fr); }
  .approval-summary > div { min-width: 0; padding: 12px 9px; }
  .approval-summary b { font-size: 20px; }
  .approval-card { grid-template-columns: 34px minmax(0, 1fr); gap: 10px; padding: 13px 11px; }
  .approval-card-actions { grid-column: 2; }
  .approval-card-actions .btn { flex: 1; }
  .approval-card-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 8px; }
  .approval-card-meta span + span::before { display: none; }
}

@media (max-width: 520px) {
  .topbar-search { display: none; }
  .approval-entry { margin-left: auto; }
  .cards, .stat-row { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .screen-wrap { padding: 14px; }
  .sc-header { grid-template-columns: 1fr auto; gap: 10px; }
  .sc-heading { grid-column: 1 / -1; grid-row: 1; }
  .sc-clock { grid-column: 1; grid-row: 2; font-size: 25px; }
  .sc-date { grid-column: 2; grid-row: 2; }
  .sc-alert { grid-template-columns: 1fr; }
  .sc-alert-label { justify-content: center; }
  .sc-body { grid-template-columns: 1fr; }
  .sc-body > .sc-col:last-child { grid-column: auto; display: flex; }
  .sc-proj-list, .sc-table { max-height: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
