:root {
  --brand: #0d9488;
  --brand-dark: #0f766e;
  --forest: #14532d;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --bg: #f4f7f6;
  --card: #ffffff;
  --amber: #d97706;
  --amber-bg: #fef3c7;
  --orange: #ea580c;
  --orange-bg: #ffedd5;
  --green: #16a34a;
  --green-bg: #dcfce7;
  --red: #dc2626;
  --red-bg: #fee2e2;
  --gray: #64748b;
  --gray-bg: #f1f5f9;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px rgba(15, 23, 42, .06);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
.icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.icon-lg { width: 22px; height: 22px; }

/* ---------- 登录 ---------- */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(1200px 600px at 85% -10%, rgba(13, 148, 136, .35), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(20, 83, 45, .45), transparent 60%),
    linear-gradient(150deg, #0b2b1d 0%, #0e3a35 55%, #0d3f46 100%);
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: rgba(255, 255, 255, .96);
  border-radius: 20px;
  padding: 36px 32px 30px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .35);
}
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.login-logo {
  width: 46px; height: 46px; border-radius: 13px;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  background: linear-gradient(135deg, var(--forest), var(--brand));
  box-shadow: 0 8px 20px rgba(13, 148, 136, .35);
}
.login-title { font-size: 19px; font-weight: 700; letter-spacing: .5px; }
.login-sub { color: var(--muted); font-size: 13px; margin: 2px 0 26px; line-height: 1.6; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field .input-wrap { position: relative; }
.field .input-wrap .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: #94a3b8; }
.field input {
  width: 100%; height: 44px; border: 1px solid var(--line); border-radius: 10px;
  padding: 0 12px 0 40px; font-size: 15px; background: #fff; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(13, 148, 136, .15); }
.btn-primary {
  width: 100%; height: 44px; border: 0; border-radius: 10px; cursor: pointer;
  color: #fff; font-size: 15px; font-weight: 600; letter-spacing: 1px;
  background: linear-gradient(135deg, var(--forest), var(--brand));
  box-shadow: 0 10px 22px rgba(13, 148, 136, .28);
  transition: transform .1s, opacity .15s;
}
.btn-primary:active { transform: scale(.98); }
.btn-primary[disabled] { opacity: .6; cursor: wait; }
.login-foot { margin-top: 18px; text-align: center; font-size: 12px; color: #94a3b8; }

/* ---------- 布局 ---------- */
.shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: linear-gradient(120deg, #103a28, #0c4a43 60%, #0b4c56);
  color: #fff;
  box-shadow: 0 2px 12px rgba(0, 0, 0, .18);
}
.topbar-inner {
  max-width: 1080px; margin: 0 auto; padding: 0 16px;
  height: 56px; display: flex; align-items: center; gap: 12px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 15px; white-space: nowrap; }
.brand-logo {
  width: 32px; height: 32px; border-radius: 9px; display: flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .2);
}
.topnav { display: flex; gap: 4px; margin-left: 8px; overflow-x: auto; scrollbar-width: none; }
.topnav::-webkit-scrollbar { display: none; }
.topnav a {
  font-size: 13px; padding: 7px 12px; border-radius: 8px; white-space: nowrap;
  color: rgba(255, 255, 255, .78); transition: background .15s, color .15s;
}
.topnav a:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.topnav a.active { background: rgba(255, 255, 255, .18); color: #fff; font-weight: 600; }
.topbar-user { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 13px; color: rgba(255,255,255,.85); }
.btn-ghost {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid rgba(255, 255, 255, .25); background: rgba(255, 255, 255, .08);
  color: #fff; font-size: 12px; padding: 6px 10px; border-radius: 8px; cursor: pointer;
}
.btn-ghost:hover { background: rgba(255, 255, 255, .16); }

.main { flex: 1; width: 100%; max-width: 1080px; margin: 0 auto; padding: 20px 16px 60px; }
.footer { text-align: center; color: #94a3b8; font-size: 12px; padding: 18px 0 28px; }

/* ---------- 工作台 ---------- */
.hero {
  position: relative; overflow: hidden; border-radius: 18px; color: #fff;
  background:
    radial-gradient(600px 240px at 90% -20%, rgba(94, 234, 212, .38), transparent 70%),
    linear-gradient(120deg, #14532d 0%, #0d9488 100%);
  padding: 26px 24px 64px;
  box-shadow: var(--shadow);
}
.hero::after {
  content: ""; position: absolute; right: -40px; bottom: -60px; width: 220px; height: 220px;
  border-radius: 50%; border: 26px dashed rgba(255, 255, 255, .1);
}
.hero-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.hero h1 { font-size: 20px; margin: 0 0 6px; font-weight: 700; }
.hero .date { font-size: 13px; color: rgba(255, 255, 255, .78); }
.hero-pending { text-align: right; z-index: 1; }
.hero-pending .num { font-size: 44px; font-weight: 800; line-height: 1; letter-spacing: -1px; }
.hero-pending .label { font-size: 12px; color: rgba(255, 255, 255, .8); margin-top: 6px; }
.hero-actions { margin-top: 16px; z-index: 1; position: relative; }
.btn-light {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255, 255, 255, .16); border: 1px solid rgba(255, 255, 255, .35);
  color: #fff; font-size: 13px; font-weight: 600; padding: 9px 16px; border-radius: 10px; cursor: pointer;
  backdrop-filter: blur(4px);
}
.btn-light:hover { background: rgba(255, 255, 255, .26); }

.stat-grid {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px;
  margin: -44px 12px 0; position: relative; z-index: 2;
}
.stat-card {
  background: var(--card); border-radius: var(--radius); padding: 14px 14px 12px;
  box-shadow: var(--shadow); cursor: pointer; border: 1px solid rgba(226, 232, 240, .6);
  transition: transform .12s, box-shadow .15s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(15, 23, 42, .1); }
.stat-card .ic {
  width: 34px; height: 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center; margin-bottom: 10px;
}
.stat-card .val { font-size: 24px; font-weight: 800; line-height: 1.1; }
.stat-card .lbl { font-size: 12px; color: var(--muted); margin-top: 2px; }
.ic-amber { background: var(--amber-bg); color: var(--amber); }
.ic-orange { background: var(--orange-bg); color: var(--orange); }
.ic-green { background: var(--green-bg); color: var(--green); }
.ic-red { background: var(--red-bg); color: var(--red); }
.ic-teal { background: #ccfbf1; color: var(--brand-dark); }

.grid-2 { display: grid; grid-template-columns: 3fr 2fr; gap: 16px; margin-top: 18px; }
.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  border: 1px solid rgba(226, 232, 240, .6); padding: 18px;
}
.card + .card { margin-top: 16px; }
.card-title { display: flex; align-items: center; justify-content: space-between; margin: 0 0 14px; font-size: 15px; font-weight: 700; }
.card-title .sub { font-size: 12px; color: var(--muted); font-weight: 400; }

.chart { display: flex; align-items: flex-end; gap: 10px; height: 170px; padding-top: 10px; }
.chart-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.chart-bars { display: flex; align-items: flex-end; gap: 4px; height: 130px; width: 100%; justify-content: center; }
.bar { width: 12px; border-radius: 4px 4px 0 0; min-height: 2px; position: relative; transition: height .3s; }
.bar.green { background: linear-gradient(180deg, #34d399, #059669); }
.bar.teal { background: linear-gradient(180deg, #2dd4bf, #0d9488); }
.chart-date { font-size: 11px; color: var(--muted); }
.chart-legend { display: flex; gap: 16px; font-size: 12px; color: var(--muted); margin-top: 8px; }
.legend-dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.dot-green { background: #059669; }
.dot-teal { background: #0d9488; }

.todo-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px dashed var(--line);
}
.todo-item:last-child { border-bottom: 0; }
.todo-avatar {
  width: 38px; height: 38px; border-radius: 50%; flex: none;
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 15px;
  color: #0f766e; background: #ccfbf1;
}
.todo-main { flex: 1; min-width: 0; }
.todo-main .t1 { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.todo-main .t2 { font-size: 12px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.todo-time { font-size: 12px; color: var(--muted); flex: none; }
.link-btn { border: 0; background: none; color: var(--brand-dark); font-size: 13px; font-weight: 600; cursor: pointer; padding: 6px 8px; border-radius: 8px; white-space: nowrap; }
.link-btn:hover { background: #f0fdfa; }

.empty { text-align: center; padding: 36px 10px; color: #94a3b8; font-size: 13px; }
.empty .icon { width: 40px; height: 40px; stroke-width: 1.5; margin-bottom: 8px; color: #cbd5e1; }

/* ---------- 列表 ---------- */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 2px 16px; flex-wrap: wrap; }
.page-title { font-size: 19px; font-weight: 800; }
.page-title .count { font-size: 13px; color: var(--muted); font-weight: 400; margin-left: 8px; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.search-box { position: relative; }
.search-box .icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: #94a3b8; width: 16px; height: 16px; }
.search-box input {
  height: 38px; width: 220px; border: 1px solid var(--line); border-radius: 10px;
  padding: 0 12px 0 34px; font-size: 13px; background: #fff; outline: none;
}
.search-box input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(13, 148, 136, .12); }
.btn {
  display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 14px;
  border-radius: 10px; border: 1px solid var(--line); background: #fff; cursor: pointer;
  font-size: 13px; font-weight: 600; color: var(--ink); transition: background .15s;
}
.btn:hover { background: #f8fafc; }
.btn .icon { width: 16px; height: 16px; }

.tabs { display: flex; gap: 6px; overflow-x: auto; padding: 4px 2px 14px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  border: 1px solid var(--line); background: #fff; color: var(--muted);
  padding: 7px 14px; border-radius: 999px; font-size: 13px; cursor: pointer; white-space: nowrap;
}
.tab.active { background: var(--forest); color: #fff; border-color: var(--forest); font-weight: 600; }
.tab .n { opacity: .7; margin-left: 4px; font-size: 12px; }

.app-card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  border: 1px solid rgba(226, 232, 240, .6);
  padding: 16px; margin-bottom: 12px; cursor: pointer; transition: transform .12s, box-shadow .15s;
}
.app-card:hover { transform: translateY(-1px); box-shadow: 0 12px 28px rgba(15, 23, 42, .09); }
.app-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.app-no { font-weight: 700; font-size: 15px; letter-spacing: .3px; }
.app-version { font-size: 11px; color: var(--muted); background: var(--gray-bg); padding: 2px 7px; border-radius: 6px; }
.app-body { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px 18px; margin-top: 12px; }
.kv .k { font-size: 11px; color: var(--muted); }
.kv .v { font-size: 13px; font-weight: 600; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-bottom { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); gap: 10px; flex-wrap: wrap; }
.app-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; padding: 3px 8px; border-radius: 999px; }
.chip-ok { background: var(--green-bg); color: var(--green); }
.chip-warn { background: var(--amber-bg); color: var(--amber); }
.chip-gray { background: var(--gray-bg); color: var(--gray); }
.chip .icon { width: 12px; height: 12px; }

.badge { display: inline-flex; align-items: center; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.badge-amber { background: var(--amber-bg); color: var(--amber); }
.badge-orange { background: var(--orange-bg); color: var(--orange); }
.badge-green { background: var(--green-bg); color: var(--green); }
.badge-red { background: var(--red-bg); color: var(--red); }
.badge-gray { background: var(--gray-bg); color: var(--gray); }

.pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 20px 0 8px; font-size: 13px; color: var(--muted); }
.pager .btn { height: 34px; }

/* ---------- 详情 ---------- */
.back-link { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 13px; margin: 2px 0 12px; cursor: pointer; border: 0; background: none; padding: 4px; }
.back-link:hover { color: var(--ink); }
.detail-head {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  border: 1px solid rgba(226, 232, 240, .6); padding: 18px; margin-bottom: 14px;
}
.detail-title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.detail-title { font-size: 18px; font-weight: 800; letter-spacing: .3px; }
.detail-meta { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 8px; font-size: 12px; color: var(--muted); }
.action-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.btn-action {
  display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px;
  border-radius: 9px; border: 1px solid var(--line); background: #fff; cursor: pointer;
  font-size: 13px; font-weight: 600; color: var(--ink);
}
.btn-action:hover { background: #f8fafc; }
.btn-action .icon { width: 15px; height: 15px; }
.btn-approve { background: linear-gradient(135deg, #15803d, #16a34a); border-color: transparent; color: #fff; }
.btn-approve:hover { background: linear-gradient(135deg, #166534, #15803d); }
.btn-reject { color: var(--red); border-color: #fecaca; }
.btn-reject:hover { background: var(--red-bg); }
.btn-supplement { color: var(--orange); border-color: #fed7aa; }
.btn-supplement:hover { background: var(--orange-bg); }
.btn-seal { color: var(--brand-dark); border-color: #99f6e4; background: #f0fdfa; }
.btn-seal:hover { background: #ccfbf1; }
.btn-action[disabled], .btn[disabled] { opacity: .5; cursor: not-allowed; }
select, input[type="password"] { outline: none; }
select:focus, input[type="password"]:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(13, 148, 136, .12); }

.section-title { font-size: 14px; font-weight: 700; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
.section-title::before { content: ""; width: 4px; height: 14px; border-radius: 2px; background: linear-gradient(180deg, var(--forest), var(--brand)); }
.kv-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px 20px; }
.kv-line { display: flex; font-size: 13px; line-height: 1.6; }
.kv-line .k { color: var(--muted); flex: none; width: 92px; }
.kv-line .v { font-weight: 600; word-break: break-all; }
.kv-wide { grid-column: 1 / -1; }

.mat-item { display: flex; align-items: flex-start; gap: 10px; padding: 10px 2px; border-bottom: 1px dashed var(--line); font-size: 13px; }
.mat-item:last-child { border-bottom: 0; }
.mat-ic { flex: none; width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; margin-top: 1px; }
.mat-ic .icon { width: 13px; height: 13px; stroke-width: 3; }
.mat-ok { background: var(--green-bg); color: var(--green); }
.mat-missing { background: var(--red-bg); color: var(--red); }
.mat-main { flex: 1; }
.mat-main .t { font-weight: 600; }
.mat-main .d { font-size: 12px; color: var(--red); margin-top: 2px; }
.mat-state { font-size: 12px; color: var(--muted); }

.log-item { position: relative; padding: 0 0 16px 22px; font-size: 13px; }
.log-item::before { content: ""; position: absolute; left: 5px; top: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 3px #ccfbf1; }
.log-item::after { content: ""; position: absolute; left: 8.5px; top: 18px; bottom: 2px; width: 1px; background: var(--line); }
.log-item:last-child::after { display: none; }
.log-item:last-child { padding-bottom: 0; }
.log-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.log-action { font-weight: 700; }
.log-time { color: var(--muted); font-size: 12px; }
.log-desc { color: var(--muted); font-size: 12px; margin-top: 3px; word-break: break-all; }

/* ---------- 弹窗 / Toast ---------- */
.modal-mask {
  position: fixed; inset: 0; z-index: 60; background: rgba(15, 23, 42, .45);
  display: flex; align-items: center; justify-content: center; padding: 18px;
  animation: fadeIn .15s ease;
}
.modal {
  width: 100%; max-width: 480px; background: #fff; border-radius: 16px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .3); overflow: hidden;
  animation: popIn .18s ease;
}
.modal-lg { max-width: 860px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--line); font-weight: 700; font-size: 15px; }
.modal-close { border: 0; background: none; cursor: pointer; color: var(--muted); padding: 4px; border-radius: 6px; }
.modal-close:hover { background: var(--gray-bg); }
.modal-body { padding: 18px; max-height: 70vh; overflow: auto; font-size: 14px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 18px; border-top: 1px solid var(--line); background: #fbfdfc; }
.modal textarea {
  width: 100%; min-height: 96px; border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; font-size: 14px; font-family: inherit; resize: vertical; outline: none;
}
.modal textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(13, 148, 136, .12); }
.modal .hint { font-size: 12px; color: var(--muted); margin: 8px 0 0; line-height: 1.6; }
.modal .hint.warn { color: var(--orange); }
.check-item { display: flex; align-items: center; gap: 8px; padding: 8px 4px; font-size: 13px; border-bottom: 1px dashed var(--line); }
.check-item:last-child { border-bottom: 0; }
.check-item input { width: 16px; height: 16px; accent-color: var(--brand); }
.pdf-frame { width: 100%; height: 68vh; border: 0; border-radius: 8px; background: #f1f5f9; }
.btn-cancel { background: #fff; border: 1px solid var(--line); color: var(--ink); height: 36px; padding: 0 16px; border-radius: 9px; font-size: 13px; cursor: pointer; font-weight: 600; }
.btn-confirm { background: linear-gradient(135deg, var(--forest), var(--brand)); color: #fff; border: 0; height: 36px; padding: 0 18px; border-radius: 9px; font-size: 13px; cursor: pointer; font-weight: 600; }
.btn-confirm[disabled] { opacity: .6; cursor: wait; }

.toast {
  position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%);
  z-index: 90; background: rgba(15, 23, 42, .92); color: #fff;
  padding: 10px 18px; border-radius: 10px; font-size: 13px; max-width: 86vw;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .25);
}
.toast.ok { background: rgba(21, 128, 61, .95); }
.toast.err { background: rgba(185, 28, 28, .95); }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 响应式 ---------- */
@media (max-width: 860px) {
  .grid-2 { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); margin: -40px 8px 0; }
  .stat-grid .stat-card:nth-child(5) { grid-column: span 2; }
  .app-body { grid-template-columns: repeat(2, 1fr); }
  .kv-grid { grid-template-columns: 1fr; }
  .topnav { display: none; }
  .hero { padding: 22px 18px 58px; }
  .hero-pending .num { font-size: 38px; }
  .search-box input { width: 160px; }
  .detail-title { font-size: 16px; }
}
@media (max-width: 420px) {
  .brand span.brand-text { display: none; }
  .topbar-user .uname { display: none; }
  .search-box input { width: 130px; }
}
