:root {
  --primary: #027C7D;
  --primary-dark: #015E5F;
  --primary-soft: #E6F4F4;
  --success: #2F9E44;
  --success-soft: #E8F8EC;
  --warning: #F59F00;
  --warning-soft: #FFF6E0;
  --danger: #E03131;
  --danger-soft: #FDECEC;
  --surface: #fff;
  --bg: #F4F6FB;
  --text: #1F2933;
  --muted: #6B7280;
  --border: #E6E8EE;
  --shadow: 0 12px 40px rgba(2, 80, 82, .07);
  --r: 16px;
  --r-lg: 24px;
  --side: 248px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  color: var(--text);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.5;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 13px; }
.danger-text { color: var(--danger); font-weight: 600; }

.app {
  display: grid;
  grid-template-columns: var(--side) 1fr;
  min-height: 100vh;
}

.sidebar {
  background: #fff;
  border-right: 1px solid var(--border);
  padding: 18px 14px 28px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
  padding: 4px 8px 16px;
}
.brand-link { display: block; line-height: 0; }
.brand-logo {
  display: block;
  width: 100%;
  max-width: 200px;
  height: auto;
}
.brand-logo-login {
  max-width: 280px;
  margin: 0 auto;
}
.login-brand {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 0 0 8px;
  text-align: center;
}
.login-brand .brand-tag { margin: 0; font-size: 12px; color: var(--muted); }
.brand-mark {
  width: 40px; height: 40px; border-radius: 14px;
  background: linear-gradient(145deg, #2AA8A9, #027C7D 55%, #015E5F);
  color: #fff; display: grid; place-items: center; font-weight: 800;
  box-shadow: 0 8px 18px rgba(2,124,125,.28);
}
.brand h1 { margin: 0; font-size: 15px; letter-spacing: .02em; }
.brand p { margin: 0; font-size: 12px; color: var(--muted); }
.topbar-logo { display: none; height: 28px; width: auto; }
.hello-wrap { display: flex; align-items: center; gap: 12px; min-width: 0; }

.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 14px;
  color: #3d4654; font-weight: 500;
}
.nav a svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.7; flex: 0 0 18px; }
.nav a:hover { background: #F7F8FC; }
.nav a.active { background: var(--primary-soft); color: var(--primary); font-weight: 650; }
.nav .group { margin-top: 18px; padding: 0 12px 6px; font-size: 11px; color: var(--muted); letter-spacing: .12em; text-transform: uppercase; }
.badge {
  margin-left: auto; min-width: 18px; height: 18px; padding: 0 6px;
  border-radius: 999px; background: var(--danger); color: #fff;
  font-size: 11px; display: grid; place-items: center;
}

.mobile-nav { display: none; }
.mobile-nav .badge { margin-left: 6px; }

.main { min-width: 0; background:
  radial-gradient(900px 280px at 100% 0, rgba(2,124,125,.06), transparent 50%),
  var(--bg);
}
.topbar {
  height: 72px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 32px;
}
.hello { font-size: 20px; font-weight: 750; margin: 0; letter-spacing: -.02em; }
.hello span { color: var(--muted); font-weight: 400; font-size: 13px; margin-left: 10px; }
.userbox { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: linear-gradient(180deg, #E6F4F4, #D5EEEE); color: var(--primary);
  display: grid; place-items: center; font-weight: 700;
  border: 1px solid #CDE8E8;
}
.content { padding: 0 32px 48px; }

.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 8px; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.card-head h3, .card h3 { margin: 0 0 12px; font-size: 15px; }

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.card {
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  padding: 22px 24px;
  border: 1px solid rgba(230,232,238,.8);
}
.kpi { display: flex; align-items: center; gap: 14px; }
.kpi-ico {
  width: 44px; height: 44px; border-radius: 16px;
  display: grid; place-items: center; font-weight: 800; color: var(--primary);
  background: var(--primary-soft);
}
.kpi-b .kpi-ico { color: var(--success); background: var(--success-soft); }
.kpi-c .kpi-ico { color: #B88600; background: var(--warning-soft); }
.kpi-d .kpi-ico { color: #5B4B8A; background: #F3EEFF; }
.kpi .label { color: var(--muted); font-size: 13px; }
.kpi .num { font-size: 28px; font-weight: 800; margin-top: 2px; letter-spacing: -.04em; }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin-bottom: 16px; }
.toolbar-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; color: var(--muted); }
.req {
  color: var(--danger);
  font-size: 16px;
  font-weight: 700;
  margin-left: 2px;
  line-height: 1;
  vertical-align: -1px;
}
.field input, .field select, .field textarea {
  border: 1px solid var(--border); border-radius: var(--r);
  padding: 10px 14px; min-width: 160px; font: inherit; background: #fff;
}
.field textarea { min-width: 100%; min-height: 90px; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59,91,219,.12);
}
.field.wide { flex: 1; }
.field.wide input { width: 100%; }

.btn {
  border: 0; border-radius: var(--r); padding: 10px 18px; font: inherit; font-weight: 600;
  cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
}
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 8px 16px rgba(2,124,125,.22); }
.btn-primary:hover { filter: brightness(1.05); }
.btn-ghost { background: #fff; border: 1px solid var(--border); color: var(--text); }
.btn-warn { background: var(--warning); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-link { background: none; border: 0; color: var(--primary); padding: 0; font-weight: 600; cursor: pointer; font: inherit; }
.btn-link.bad, a.bad { color: var(--danger); }

table.data { width: 100%; border-collapse: collapse; }
table.data th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12px; padding: 10px 8px; border-bottom: 1px solid var(--border); }
table.data td { padding: 14px 8px; border-bottom: 1px solid #F0F2F6; vertical-align: middle; }
table.data tbody tr:hover { background: #FAFBFF; }
table.data tr:last-child td { border-bottom: 0; }
.ops { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.pager { display: flex; gap: 10px; align-items: center; justify-content: flex-end; flex-wrap: wrap; padding: 12px 8px 4px; }

.pill { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.pill-lg { padding: 8px 16px; font-size: 15px; }
.pill-info { background: var(--primary-soft); color: var(--primary); }
.pill-ok { background: var(--success-soft); color: var(--success); }
.pill-bad { background: var(--danger-soft); color: var(--danger); }
.pill-mute { background: #F1F3F6; color: var(--muted); }
.pill-warn { background: var(--warning-soft); color: #B88600; }

.page-title { font-size: 22px; margin: 0 0 6px; letter-spacing: -.03em; }
.lead { color: var(--muted); margin: 0 0 20px; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid .span2 { grid-column: span 2; }
.form-section { margin-bottom: 16px; }
.form-section h3 { margin: 0 0 14px; font-size: 15px; }
.sticky-actions {
  display: flex; justify-content: flex-end; gap: 10px; margin-top: 12px;
}

.search-hero { max-width: 860px; }
.search-result {
  margin-top: 16px; padding: 28px; display: flex; justify-content: space-between; align-items: center;
  max-width: 860px;
}
.search-result h3 { margin: 4px 0 0; font-size: 20px; }
.hint-inline { max-width: 860px; color: var(--muted); margin-top: 12px; }

.empty { text-align: center; color: var(--muted); padding: 40px 12px; }
.empty-art {
  width: 56px; height: 56px; border-radius: 18px; margin: 0 auto 12px;
  background: var(--primary-soft); color: var(--primary);
  display: grid; place-items: center; font-weight: 800; font-size: 18px;
}
.empty-art.big { width: 88px; height: 88px; font-size: 28px; border-radius: 28px; }
.empty-page { min-height: 60vh; display: grid; place-items: center; }
.empty-card { text-align: center; max-width: 420px; }

.login-wrap {
  min-height: 100vh; display: grid; place-items: center;
  background:
    radial-gradient(1000px 480px at 8% -10%, #d7efef 0%, transparent 52%),
    radial-gradient(800px 420px at 100% 0%, #e7f5f5 0%, transparent 48%),
    linear-gradient(180deg, #F7FBFC, var(--bg));
}
.login-card { width: 440px; padding: 40px 40px 32px; }
.login-card h2 { margin: 8px 0 4px; font-size: 22px; }
.login-card .sub { color: var(--muted); margin: 0 0 24px; }
.login-card .field input { width: 100%; min-width: 0; }
.pwd-wrap { position: relative; display: block; }
.pwd-wrap input { width: 100%; padding-right: 52px; box-sizing: border-box; min-width: 0; }
.pwd-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0;
  margin: 0;
  height: auto;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  line-height: 1;
  box-shadow: none;
}
.pwd-toggle:hover,
.pwd-toggle.is-on {
  color: var(--primary);
  background: transparent;
  border: 0;
}
.login-card .btn-primary { width: 100%; justify-content: center; margin-top: 10px; padding: 12px; }
.hint { color: var(--muted); font-size: 12px; margin-top: 18px; text-align: center; }
.check { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 13px; margin: 4px 0 4px; }
.alert { background: var(--danger-soft); color: var(--danger); padding: 10px 12px; border-radius: 12px; margin-bottom: 12px; }
.ok { background: var(--success-soft); color: var(--success); padding: 10px 12px; border-radius: 12px; margin-bottom: 12px; }
.reset-box { border: 1px solid #b7e0e0; background: #f3fbfb; margin-bottom: 16px; }
.reset-box h3 { margin-top: 0; }
.reset-pwd {
  font-size: 20px; font-weight: 700; letter-spacing: .04em;
  background: #fff; border: 1px dashed var(--border); border-radius: 12px;
  padding: 12px 14px; margin: 12px 0; user-select: all; word-break: break-all;
}

.dl { display: grid; grid-template-columns: 140px 1fr; gap: 10px 16px; }
.dl dt { color: var(--muted); }
.modal-bg { position: fixed; inset: 0; background: rgba(20,24,40,.35); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 40; }
.modal { width: 480px; }

.review-grid { display: grid; grid-template-columns: 1.3fr .7fr; gap: 16px; align-items: start; }

.drawer { position: fixed; inset: 0; pointer-events: none; z-index: 50; }
.drawer.open { pointer-events: auto; }
.drawer-mask { position: absolute; inset: 0; background: rgba(20,24,40,.28); opacity: 0; transition: .2s; }
.drawer.open .drawer-mask { opacity: 1; }
.drawer-panel {
  position: absolute; right: 0; top: 0; height: 100%; width: 420px; margin: 0;
  border-radius: 24px 0 0 24px; transform: translateX(100%); transition: .22s ease;
  display: flex; flex-direction: column; gap: 12px;
}
.drawer.open .drawer-panel { transform: none; }

@media (max-width: 1100px) {
  .kpis { grid-template-columns: 1fr 1fr; }
  .form-grid, .review-grid { grid-template-columns: 1fr 1fr; }
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .topbar {
    height: auto;
    min-height: 56px;
    padding: 10px 16px;
    gap: 10px;
  }
  .hello { display: none; }
  .topbar-logo {
    display: block;
    height: 26px;
    max-width: min(148px, 46vw);
    object-fit: contain;
  }
  .user-name { display: none; }
  .userbox { flex-shrink: 0; }
  .user-actions { font-size: 12px; white-space: nowrap; }
  .avatar { width: 32px; height: 32px; font-size: 13px; }
  .mobile-nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 0 16px 12px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .mobile-nav::-webkit-scrollbar { display: none; }
  .mobile-nav a {
    white-space: nowrap;
    padding: 8px 12px;
    border-radius: 999px;
    background: #fff;
    color: var(--text);
    border: 1px solid var(--border);
    font-size: 13px;
    flex: 0 0 auto;
  }
  .mobile-nav a.active { background: var(--primary-soft); color: var(--primary); border-color: transparent; }
  .content { padding: 4px 16px 40px; }
  .card { padding: 16px; }
  .kpi .num { font-size: 22px; }
  .search-hero .toolbar { flex-direction: column; align-items: stretch; }
  .search-hero .field.wide { flex: none; width: 100%; }
  .search-hero .btn { width: 100%; justify-content: center; }
}
@media (max-width: 720px) {
  .form-grid, .review-grid { grid-template-columns: 1fr; }
  .form-grid .span2 { grid-column: auto; }
  .login-card { width: calc(100% - 24px); padding: 28px 20px 24px; }
  .page-head { flex-direction: column; align-items: stretch; }
  .toolbar, .toolbar-form { width: 100%; flex-direction: column; align-items: stretch; }
  .field { width: 100%; }
  .field.wide { flex: none; width: 100%; }
  .field input, .field select, .field textarea { min-width: 0; width: 100%; }
  .toolbar .btn, .toolbar-form .btn { width: 100%; justify-content: center; }
  .sticky-actions {
    justify-content: stretch;
    position: sticky;
    bottom: 0;
    background: var(--bg);
    padding: 10px 0 calc(10px + env(safe-area-inset-bottom, 0px));
  }
  .sticky-actions .btn { flex: 1; justify-content: center; }
  .dl { grid-template-columns: 1fr; }
  .search-result { flex-direction: column; align-items: flex-start; gap: 12px; padding: 20px; }
  .modal { width: calc(100% - 24px); max-width: 480px; }
  .drawer-panel { width: 100%; max-width: 100%; border-radius: 16px 16px 0 0; }
  .card { overflow-x: auto; }
  table.data { min-width: 520px; }
  .kpi { gap: 10px; }
  .kpi-ico { width: 36px; height: 36px; border-radius: 12px; font-size: 13px; }
}
