/* DeepSeek palette + blue fat-fish theme */
:root {
  --primary: #4D6BFE;
  --primary-600: #3A57EE;
  --primary-50: #EEF2FF;
  --primary-100: #DDE4FF;
  --ink: #1C1F2B;
  --text: #2D3142;
  --muted: #8A8FA3;
  --border: #E6E9F2;
  --bg: #F6F8FD;
  --card: #FFFFFF;
  --ok: #1FA971;
  --warn: #E8A317;
  --err: #E5484D;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(28, 31, 43, .04), 0 6px 24px rgba(77, 107, 254, .06);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Inter", "Segoe UI", "Microsoft YaHei", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-size: 14px; }
a { color: var(--primary); text-decoration: none; }
code, .mono { font-family: "JetBrains Mono", "SF Mono", ui-monospace, Menlo, monospace; font-size: 12.5px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }

/* ---------- login ---------- */
.login { min-height: 100%; display: grid; place-items: center; position: relative; overflow: hidden;
  background: radial-gradient(1200px 600px at 50% -10%, #E7ECFF 0%, var(--bg) 60%); }
.login-card { position: relative; z-index: 1; width: min(440px, 92vw); text-align: center; padding: 40px 36px 36px;
  background: rgba(255,255,255,.86); backdrop-filter: blur(6px); border: 1px solid var(--border);
  border-radius: 24px; box-shadow: var(--shadow); }
.login-mascot { width: 168px; height: 168px; object-fit: cover; border-radius: 50%; border: 6px solid var(--primary-50);
  box-shadow: 0 10px 30px rgba(77,107,254,.25); animation: bob 4s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-8px); } }
.login h1 { margin: 18px 0 6px; color: var(--ink); font-size: 26px; letter-spacing: .2px; }
.login p { margin: 0 0 26px; line-height: 1.7; }
.waves { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 220px; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100%; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; background: #FBFCFF;
  border-right: 1px solid var(--border); padding: 18px 14px 0; }
.brand { display: flex; gap: 10px; align-items: center; padding: 6px 8px 18px; color: var(--ink); }
.brand img { width: 40px; height: 40px; border-radius: 12px; border: 2px solid var(--primary-100); }
.brand b { display: block; font-size: 16px; }
.brand span { display: block; font-size: 12px; color: var(--muted); }
nav a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin: 2px 0; border-radius: 10px;
  color: var(--text); font-weight: 500; }
nav a i { font-style: normal; width: 18px; text-align: center; color: var(--muted); }
nav a:hover { background: var(--primary-50); }
nav a.on { background: var(--primary-50); color: var(--primary); }
nav a.on i { color: var(--primary); }
.side-foot { margin-top: auto; position: relative; }
.side-foot svg { display: block; width: 100%; height: 60px; }
.me { display: flex; align-items: center; gap: 10px; padding: 12px 6px 16px; background: #EEF2FF; margin: 0 -14px; padding-left: 20px; }
.me img { width: 30px; height: 30px; border-radius: 50%; }
.me .who { flex: 1; min-width: 0; }
.me .who b { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me .who span { font-size: 11px; color: var(--muted); }
.me button { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 12px; }

main { padding: 28px 34px 60px; min-width: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.page-head h2 { margin: 0; color: var(--ink); font-size: 22px; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ---------- cards / stats ---------- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 18px 20px; }
.card h3 { margin: 0 0 12px; font-size: 15px; color: var(--ink); }
.grid { display: grid; gap: 16px; }
.grid > * { min-width: 0; }
.stats { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: 18px; }
.stat { padding: 16px 18px; position: relative; overflow: hidden; }
.stat .k { color: var(--muted); font-size: 12.5px; }
.stat .v { font-size: 28px; font-weight: 700; color: var(--ink); margin-top: 6px; font-variant-numeric: tabular-nums; }
.stat::after { content: ""; position: absolute; right: -18px; bottom: -18px; width: 70px; height: 70px; border-radius: 50%;
  background: var(--primary-50); }
.two { grid-template-columns: 1.4fr 1fr; }
@media (max-width: 1100px) { .two { grid-template-columns: 1fr; } }

/* ---------- table ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { font-size: 12px; font-weight: 600; color: var(--muted); background: #FAFBFE; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #FAFBFF; }
td.wrap { white-space: normal; }
.click { cursor: pointer; }
.empty { padding: 44px 20px; text-align: center; color: var(--muted); }
.empty img { width: 96px; height: 96px; border-radius: 50%; opacity: .9; display: block; margin: 0 auto 12px; }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 500;
  background: #F1F3F8; color: var(--text); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .7; }
.b-blue { background: var(--primary-50); color: var(--primary); }
.b-ok { background: #E7F7EF; color: var(--ok); }
.b-warn { background: #FFF5E0; color: #B97D00; }
.b-err { background: #FDECEC; color: var(--err); }
.b-gray { background: #F1F3F8; color: var(--muted); }

/* ---------- forms ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 16px; border-radius: 10px;
  border: 1px solid var(--border); background: #fff; color: var(--text); font-weight: 500; cursor: pointer; font-size: 14px; }
.btn:hover { border-color: var(--primary-100); color: var(--primary); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-600); color: #fff; }
.btn-lg { height: 46px; padding: 0 26px; font-size: 15px; border-radius: 12px; }
.btn-danger { color: var(--err); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
label { display: block; font-size: 13px; font-weight: 500; color: var(--ink); margin-bottom: 6px; }
.hint { font-size: 12px; color: var(--muted); margin-top: 5px; line-height: 1.5; }
input, select, textarea { width: 100%; height: 38px; padding: 0 12px; border: 1px solid var(--border); border-radius: 10px;
  background: #fff; color: var(--text); font: inherit; outline: none; transition: border .15s, box-shadow .15s; }
textarea { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; font-family: "SF Mono", ui-monospace, Menlo, monospace; font-size: 12.5px; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-50); }
/* in-page dropdown (replaces native select popups) */
.dd { position: relative; }
.dd-btn { width: 100%; height: 38px; padding: 0 12px; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  border: 1px solid var(--border); border-radius: 10px; background: #fff; color: var(--text); font: inherit; cursor: pointer; text-align: left; }
.dd-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dd-btn svg { color: var(--muted); flex: none; transition: transform .15s; }
.dd.open .dd-btn { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-50); }
.dd.open .dd-btn svg { transform: rotate(180deg); color: var(--primary); }
.dd-list { position: absolute; z-index: 40; left: 0; right: 0; top: calc(100% + 6px); max-height: 280px; overflow: auto; padding: 6px;
  background: #fff; border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 12px 32px rgba(28, 31, 43, .12); }
.dd-opt { padding: 8px 10px; border-radius: 8px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dd-opt:hover { background: var(--primary-50); }
.dd-opt.on { color: var(--primary); font-weight: 600; background: var(--primary-50); }
.form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; }
.form .full { grid-column: 1 / -1; }
.section-title { grid-column: 1 / -1; font-size: 13px; font-weight: 600; color: var(--primary); margin-top: 6px;
  padding-top: 14px; border-top: 1px dashed var(--border); }
.search { width: 260px; }
.drop { border: 2px dashed var(--primary-100); border-radius: 14px; padding: 26px; text-align: center; background: #FAFBFF; cursor: pointer; }
.drop.over { background: var(--primary-50); border-color: var(--primary); }

/* ---------- modal / toast ---------- */
.modal { position: fixed; inset: 0; background: rgba(28,31,43,.32); display: grid; place-items: center; z-index: 50; }
.modal-card { width: auto; min-width: min(560px, 94vw); max-width: 94vw; max-height: 88vh; overflow: auto; background: #fff; border-radius: 18px; padding: 24px; box-shadow: 0 20px 60px rgba(28,31,43,.2); }
.modal-card h3 { margin: 0 0 16px; color: var(--ink); }
.toast { position: fixed; right: 24px; bottom: 24px; padding: 12px 16px; border-radius: 12px; background: var(--ink); color: #fff; z-index: 60;
  box-shadow: var(--shadow); max-width: 420px; }
.toast.err { background: var(--err); }

/* ---------- misc ---------- */
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 8px 16px; }
.kv div:nth-child(odd) { color: var(--muted); }
.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ""; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 2px; background: var(--primary-100); }
.tl-item { position: relative; margin-bottom: 14px; }
.tl-item::before { content: ""; position: absolute; left: -20px; top: 18px; width: 10px; height: 10px; border-radius: 50%;
  background: #fff; border: 3px solid var(--primary); }
.bar { height: 8px; border-radius: 99px; background: var(--primary-50); overflow: hidden; min-width: 90px; }
.bar > span { display: block; height: 100%; background: var(--primary); border-radius: 99px; }
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; background: var(--primary-50);
  color: #2C3E9E; margin-bottom: 16px; line-height: 1.6; }
.notice.warn { background: #FFF6E5; color: #8A5B00; }
.summary { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin: 12px 0; }
.summary div { background: #FAFBFE; border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; }
.summary b { display: block; font-size: 18px; color: var(--ink); }
.summary span { font-size: 12px; color: var(--muted); }

/* dashboard */
.section-head { display: flex; align-items: center; gap: 10px; margin: 6px 0 12px; }
.section-head h3 { margin: 0; font-size: 16px; color: var(--ink); }
.stat .sub { font-size: 12px; color: var(--muted); margin-top: 4px; position: relative; z-index: 1; }
.stat .v.bad, td.bad { color: var(--err); }
.stat .v.warn { color: #B97D00; }
.chart { width: 100%; height: auto; display: block; }
.chart .gl { stroke: var(--border); stroke-width: 1; }
.chart .ax { fill: var(--muted); font-size: 11px; }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--muted); margin: -4px 0 8px; }
.legend i, .tip i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.tip { position: absolute; pointer-events: none; background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px;
  font-size: 12px; box-shadow: 0 8px 24px rgba(28,31,43,.12); min-width: 130px; line-height: 1.7; }
