/* ===================================================================
   保单数据库管理系统 - Premium Design System
   浅色 / 深色主题 · 玻璃拟态 · 流畅微交互
   =================================================================== */

:root {
  --brand: #1F4E79;
  --brand-2: #2E6CB8;
  --brand-grad: linear-gradient(135deg, #1F4E79 0%, #3A7BD5 100%);
  --accent: #0EA5E9;
  --warn: #F59E0B;
  --danger: #EF4444;
  --success: #10B981;

  --bg: #F1F5F9;
  --bg-soft: #FFFFFF;
  --surface: rgba(255, 255, 255, 0.72);
  --surface-solid: #FFFFFF;
  --border: rgba(15, 23, 42, 0.08);
  --text: #0F172A;
  --text-soft: #64748B;
  --text-faint: #94A3B8;
  --shadow: 0 10px 40px -12px rgba(15, 23, 42, 0.18);
  --shadow-sm: 0 4px 16px -6px rgba(15, 23, 42, 0.12);
  --radius: 18px;
  --radius-sm: 12px;
}

[data-theme="dark"] {
  --bg: #0B1120;
  --bg-soft: #111827;
  --surface: rgba(30, 41, 59, 0.55);
  --surface-solid: #1E293B;
  --border: rgba(148, 163, 184, 0.12);
  --text: #F1F5F9;
  --text-soft: #94A3B8;
  --text-faint: #64748B;
  --shadow: 0 16px 48px -12px rgba(0, 0, 0, 0.6);
  --shadow-sm: 0 4px 16px -6px rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  transition: background 0.4s ease, color 0.3s ease;
  min-height: 100vh;
}

a { color: var(--brand-2); text-decoration: none; }

/* ---------- 布局 ---------- */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 248px;
  flex-shrink: 0;
  background: var(--surface);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-right: 1px solid var(--border);
  padding: 28px 18px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex; align-items: center; gap: 12px;
  padding: 0 8px 24px; margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.brand-logo {
  width: 42px; height: 42px; border-radius: 12px;
  background: var(--brand-grad);
  display: grid; place-items: center;
  font-size: 22px; box-shadow: var(--shadow-sm);
}
.brand-text { font-weight: 700; font-size: 16px; letter-spacing: .3px; }
.brand-text small { display: block; font-weight: 400; font-size: 11px; color: var(--text-soft); }

.nav { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-radius: var(--radius-sm);
  color: var(--text-soft); font-weight: 500; font-size: 14px;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.nav a:hover { background: var(--surface-solid); color: var(--text); transform: translateX(2px); }
.nav a.active { background: var(--brand-grad); color: #fff; box-shadow: var(--shadow-sm); }
.nav a .ico { font-size: 17px; width: 22px; text-align: center; }

.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }

.main { flex: 1; padding: 32px 40px; max-width: 1280px; margin: 0 auto; width: 100%; }

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 28px;
}
.topbar h1 { font-size: 26px; font-weight: 700; letter-spacing: .2px; }
.topbar .sub { color: var(--text-soft); font-size: 13px; margin-top: 2px; }

.toolbar { display: flex; align-items: center; gap: 12px; }

/* ---------- 卡片 / 玻璃拟态 ---------- */
.glass {
  background: var(--surface);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card { padding: 24px; background: var(--surface-solid); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); transition: transform 0.3s cubic-bezier(0.16,1,0.3,1), box-shadow 0.3s; }
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.card h3 { font-size: 15px; font-weight: 600; margin-bottom: 6px; }

/* ---------- 统计卡 ---------- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 18px; margin-bottom: 28px; }
.stat {
  padding: 22px 24px; border-radius: var(--radius);
  background: var(--surface-solid); border: 1px solid var(--border);
  box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
  transition: transform 0.3s cubic-bezier(0.16,1,0.3,1);
}
.stat:hover { transform: translateY(-4px); }
.stat::before { content:""; position:absolute; inset:0; background: var(--brand-grad); opacity: .07; }
.stat .label { font-size: 13px; color: var(--text-soft); display: flex; align-items: center; gap: 8px; }
.stat .value { font-size: 32px; font-weight: 700; margin-top: 8px; letter-spacing: -.5px; }
.stat .value small { font-size: 15px; color: var(--text-soft); font-weight: 500; }
.stat .ico { font-size: 18px; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface-solid); box-shadow: var(--shadow-sm); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th {
  text-align: left; padding: 14px 18px; font-weight: 600; font-size: 12.5px;
  color: var(--text-soft); background: var(--bg-soft);
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
tbody td { padding: 14px 18px; border-bottom: 1px solid var(--border); }
tbody tr { transition: background 0.2s; }
tbody tr:hover { background: var(--bg-soft); }
tbody tr:last-child td { border-bottom: none; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 13px; }

/* ---------- 徽章 ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 11px; border-radius: 99px; font-size: 12px; font-weight: 600; }
.badge.green { background: rgba(16,185,129,.14); color: #059669; }
.badge.blue { background: rgba(14,165,233,.14); color: #0284C7; }
.badge.amber { background: rgba(245,158,11,.16); color: #D97706; }
.badge.red { background: rgba(239,68,68,.14); color: #DC2626; }
.badge.gray { background: rgba(100,116,139,.14); color: #64748B; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  padding: 10px 18px; border-radius: var(--radius-sm); border: 1px solid transparent;
  font-size: 14px; font-weight: 600; font-family: inherit;
  transition: all 0.28s cubic-bezier(0.16,1,0.3,1); white-space: nowrap;
}
.btn-primary { background: var(--brand-grad); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { transform: translateY(-2px) scale(1.02); box-shadow: var(--shadow); }
.btn-ghost { background: var(--surface-solid); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--brand-2); color: var(--brand-2); transform: translateY(-1px); }
.btn-danger { background: rgba(239,68,68,.1); color: #DC2626; border-color: rgba(239,68,68,.2); }
.btn-danger:hover { background: #DC2626; color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-icon { padding: 8px 10px; }

/* ---------- 表单 ---------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--text-soft); }
.field input, .field select, .field textarea {
  width: 100%; padding: 11px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg-soft); color: var(--text);
  font-size: 14px; font-family: inherit; transition: border-color .2s, box-shadow .2s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(46,108,184,.15);
}
.field textarea { resize: vertical; min-height: 80px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.form-grid .full { grid-column: 1 / -1; }

/* ---------- 弹窗 ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(15,23,42,.5);
  backdrop-filter: blur(6px); display: none; align-items: flex-start; justify-content: center;
  z-index: 100; padding: 40px 20px; overflow-y: auto;
}
.modal-backdrop.open { display: flex; animation: fade .25s ease; }
.modal {
  width: 100%; max-width: 640px; background: var(--surface-solid);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 28px; animation: pop .3s cubic-bezier(0.16,1,0.3,1);
}
.modal h2 { font-size: 19px; margin-bottom: 20px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; }
.modal-close { cursor: pointer; font-size: 22px; color: var(--text-soft); background: none; border: none; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(16px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }

/* ---------- 主题切换 ---------- */
.theme-toggle {
  cursor: pointer; width: 42px; height: 42px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface-solid);
  display: grid; place-items: center; font-size: 18px; transition: all .3s;
}
.theme-toggle:hover { transform: rotate(15deg) scale(1.05); }

/* ---------- 提醒条目 ---------- */
.reminder-item {
  display: flex; align-items: center; gap: 16px; padding: 16px 20px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-solid); margin-bottom: 12px; transition: transform .25s;
}
.reminder-item:hover { transform: translateX(4px); }
.reminder-ring {
  width: 48px; height: 48px; border-radius: 13px; flex-shrink: 0;
  display: grid; place-items: center; font-size: 22px; color: #fff;
}
.reminder-ring.renew { background: linear-gradient(135deg,#0EA5E9,#38BDF8); }
.reminder-ring.expire { background: linear-gradient(135deg,#F59E0B,#FBBF24); }
.reminder-ring.switch { background: linear-gradient(135deg,#EF4444,#F87171); }
.reminder-body { flex: 1; }
.reminder-body .t { font-weight: 600; font-size: 15px; }
.reminder-body .d { font-size: 13px; color: var(--text-soft); margin-top: 2px; }
.countdown { font-weight: 700; font-size: 15px; padding: 4px 12px; border-radius: 99px; }
.countdown.urgent { background: rgba(239,68,68,.14); color: #DC2626; }
.countdown.soon { background: rgba(245,158,11,.16); color: #D97706; }
.countdown.ok { background: rgba(16,185,129,.14); color: #059669; }

/* ---------- 登录页 ---------- */
.login-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(circle at 20% 20%, rgba(46,108,184,.18), transparent 40%),
              radial-gradient(circle at 80% 80%, rgba(14,165,233,.15), transparent 45%), var(--bg);
}
.login-card { width: 100%; max-width: 400px; padding: 40px 36px; }
.login-card .brand { border: none; justify-content: center; padding-bottom: 8px; }
.login-card h2 { text-align: center; font-size: 22px; margin-bottom: 6px; }
.login-card .hint { text-align: center; color: var(--text-soft); font-size: 13px; margin-bottom: 24px; }
.login-error { background: rgba(239,68,68,.1); color: #DC2626; padding: 10px 14px; border-radius: 10px; font-size: 13px; margin-bottom: 16px; }

/* ---------- 空态 ---------- */
.empty { text-align: center; padding: 60px 20px; color: var(--text-soft); }
.empty .ico { font-size: 48px; opacity: .4; }
.empty p { margin-top: 12px; }

/* ---------- 工具类 ---------- */
.row { display: flex; align-items: center; gap: 12px; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.muted { color: var(--text-soft); }
.faint { color: var(--text-faint); }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; } .mb-24 { margin-bottom: 24px; }
.section-title { font-size: 18px; font-weight: 700; margin-bottom: 16px; display: flex; align-items: center; gap: 10px; }
.search-box { position: relative; }
.search-box input { padding-left: 38px; }
.search-box .s-ico { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--text-faint); }

/* ---------- 响应式 ---------- */
@media (max-width: 860px) {
  .sidebar { position: fixed; z-index: 50; transform: translateX(-100%); transition: transform .3s; }
  .sidebar.open { transform: translateX(0); }
  .main { padding: 20px; }
  .form-grid { grid-template-columns: 1fr; }
  .menu-btn { display: grid !important; }
}
.menu-btn { display: none; width: 42px; height: 42px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-solid); place-items: center; font-size: 18px; cursor: pointer; }

/* ---------- 台账导入 ---------- */
.import-tips { background: var(--surface-soft); border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px; margin-bottom: 16px; }
.import-tips p { font-size: 13px; line-height: 1.7; color: var(--text-soft); margin: 0 0 8px; }
.import-tips p:last-child { margin-bottom: 0; }
.alert { padding: 12px 16px; border-radius: 12px; font-size: 14px; line-height: 1.6; }
.alert.success { background: rgba(16,185,129,.12); color: #059669; border: 1px solid rgba(16,185,129,.3); }
.alert.danger { background: rgba(239,68,68,.12); color: #DC2626; border: 1px solid rgba(239,68,68,.3); }
.sub-title { font-size: 13px; font-weight: 600; color: var(--text-soft); margin-bottom: 8px; }
.mini-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.mini-table th, .mini-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.mini-table th { color: var(--text-faint); font-weight: 600; }
.mini-table td.mono { font-variant-numeric: tabular-nums; color: var(--text-soft); }

/* ---------- 账户设置 ---------- */
.settings-wrap { max-width: 720px; margin: 0 auto; display: flex; flex-direction: column; gap: 20px; }
.card-elevated { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 22px 24px; box-shadow: 0 10px 30px rgba(20,30,60,.06); }
.card-title { font-size: 17px; font-weight: 700; margin: 0 0 6px; }
.card-elevated .muted { color: var(--text-soft); font-size: 14px; line-height: 1.6; margin: 0 0 16px; }
.form-grid { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.label { font-size: 13px; font-weight: 600; color: var(--text); }
.field input { width: 100%; padding: 11px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-solid); color: var(--text); font-size: 14px; transition: border-color .2s, box-shadow .2s; }
.field input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.hint { font-size: 12px; color: var(--text-faint); }
.form-actions { display: flex; align-items: center; gap: 14px; margin-top: 4px; }
.inline-msg { font-size: 13px; font-weight: 600; }
.inline-msg.ok { color: #059669; }
.inline-msg.err { color: #DC2626; }
.tips-list { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 8px; }
.tips-list li { font-size: 13px; line-height: 1.6; color: var(--text-soft); }
.tips-list code { background: var(--surface-soft); border: 1px solid var(--border); border-radius: 6px; padding: 1px 6px; font-size: 12px; color: var(--brand); }
