/* ============ 设计变量 ============ */
:root {
  --bg: #070b12;
  --bg-soft: #0b1220;
  --panel: rgba(255, 255, 255, .045);
  --panel-hover: rgba(255, 255, 255, .07);
  --line: rgba(255, 255, 255, .09);
  --line-soft: rgba(255, 255, 255, .055);
  --text: #e8effa;
  --muted: #8b98ad;
  --primary: #38bdf8;
  --primary-dark: #0ea5e9;
  --green: #34d399;
  --red: #f87171;
  --amber: #fbbf24;
  --purple: #a78bfa;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 20px 45px -30px rgba(0, 0, 0, .9);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  --mono: "SFMono-Regular", "JetBrains Mono", Consolas, "Cascadia Mono", monospace;
}

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background-color: var(--bg);
  background-image:
    radial-gradient(900px 500px at 8% -8%, rgba(56, 189, 248, .12), transparent 62%),
    radial-gradient(760px 460px at 96% -6%, rgba(139, 92, 246, .10), transparent 62%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
code { font-family: var(--mono); font-size: 12px; color: var(--primary); }
h1, h2, h3 { margin: 0; font-weight: 600; }
input, select, button, textarea { font-family: inherit; font-size: 14px; }
ul { margin: 0; padding: 0; list-style: none; }

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

.sidebar {
  width: 232px;
  flex: none;
  display: flex;
  flex-direction: column;
  padding: 22px 16px 16px;
  border-right: 1px solid var(--line-soft);
  background: linear-gradient(180deg, rgba(255, 255, 255, .035), rgba(255, 255, 255, .012));
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand { display: flex; align-items: center; gap: 11px; padding: 0 6px 20px; border-bottom: 1px solid var(--line-soft); }
.brand-mark {
  width: 38px; height: 38px; flex: none;
  display: grid; place-items: center;
  border-radius: 10px; color: #cfe4ff;
  background: linear-gradient(150deg, rgba(56, 189, 248, .28), rgba(139, 92, 246, .26));
  border: 1px solid rgba(160, 200, 255, .26);
  box-shadow: 0 0 24px -8px rgba(56, 189, 248, .5);
}
.brand-mark svg { width: 20px; height: 20px; }
.brand-text strong { display: block; font-size: 14px; letter-spacing: .02em; }
.brand-text span { display: block; margin-top: 3px; font-family: var(--mono); font-size: 9.5px; letter-spacing: .2em; color: var(--muted); }

.nav { display: flex; flex-direction: column; gap: 3px; padding: 16px 0; flex: 1; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 10px;
  color: #9aa8bd; font-size: 13.5px;
  transition: background .2s, color .2s;
}
.nav-item svg { width: 17px; height: 17px; opacity: .75; flex: none; }
.nav-item:hover { background: rgba(255, 255, 255, .05); color: #d9e4f4; }
.nav-item.active { background: rgba(56, 189, 248, .12); color: #bae6fd; box-shadow: inset 0 0 0 1px rgba(56, 189, 248, .25); }
.nav-item.active svg { opacity: 1; color: var(--primary); }

.side-foot { display: flex; align-items: center; gap: 8px; padding: 12px 8px 0; border-top: 1px solid var(--line-soft); font-family: var(--mono); font-size: 10px; color: rgba(255, 255, 255, .3); }
.dot-live { width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px rgba(52, 211, 153, .8); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 18px 26px;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(7, 11, 18, .7);
  backdrop-filter: blur(12px);
  position: sticky; top: 0; z-index: 20;
}
.topbar-title h1 { font-size: 19px; letter-spacing: .02em; }
.topbar-title p { margin: 4px 0 0; font-size: 12px; color: var(--muted); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.topbar-date { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.user-chip { display: flex; align-items: center; gap: 8px; padding: 5px 10px 5px 5px; border-radius: 999px; border: 1px solid var(--line-soft); background: rgba(255, 255, 255, .03); }
.avatar { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; background: radial-gradient(circle at 30% 25%, rgba(125, 211, 252, .45), rgba(30, 64, 175, .4)); border: 1px solid rgba(147, 197, 253, .3); }
.user-meta strong { display: block; font-size: 12px; font-weight: 500; line-height: 1.2; }
.user-meta small { display: block; font-size: 9.5px; color: var(--muted); }

.content { padding: 22px 26px 34px; flex: 1; width: 100%; max-width: 1400px; }
.app-foot { padding: 14px 26px 22px; font-size: 11px; color: rgba(255, 255, 255, .28); display: flex; gap: 8px; }

/* ============ 按钮 / 表单 ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 15px; border-radius: 9px; border: 1px solid transparent;
  background: rgba(255, 255, 255, .06); color: var(--text);
  font-size: 13px; cursor: pointer; white-space: nowrap;
  transition: background .2s, border-color .2s, transform .15s, color .2s;
}
.btn:hover { background: rgba(255, 255, 255, .1); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: linear-gradient(135deg, #0ea5e9, #6366f1); border-color: rgba(56, 189, 248, .4); color: #fff; box-shadow: 0 8px 22px -12px rgba(14, 165, 233, .8); }
.btn-primary:hover { background: linear-gradient(135deg, #38bdf8, #7c3aed); }
.btn-ghost { background: rgba(255, 255, 255, .03); border-color: var(--line); color: #b6c4d8; }
.btn-ghost:hover { border-color: rgba(56, 189, 248, .4); color: #e2eefc; }
.btn-danger { background: rgba(248, 113, 113, .16); border-color: rgba(248, 113, 113, .35); color: #fca5a5; }
.btn-danger:hover { background: rgba(248, 113, 113, .26); }
.btn-warn { background: rgba(251, 191, 36, .16); border-color: rgba(251, 191, 36, .35); color: #fcd34d; }
.btn-warn:hover { background: rgba(251, 191, 36, .26); }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 7px; }
.btn-block { width: 100%; padding: 12px; font-size: 14px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: 12px; color: var(--muted); }
.field input, .field select, .field textarea, .select, .search-form input[type="search"] {
  width: 100%; padding: 9px 11px; border-radius: 9px;
  border: 1px solid var(--line); background: rgba(255, 255, 255, .04);
  color: var(--text); outline: none;
  transition: border-color .2s, background .2s;
}
.field input:focus, .field select:focus, .select:focus, .search-form input:focus {
  border-color: rgba(56, 189, 248, .55); background: rgba(56, 189, 248, .06);
}
.field input[readonly] { color: #97a6bb; background: rgba(255, 255, 255, .02); }
select option { background: #101827; color: #e6edf6; }
select option:disabled { color: #5b6779; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.form-grid .field-wide { grid-column: 1 / -1; }
.form-actions { grid-column: 1 / -1; display: flex; gap: 10px; padding-top: 4px; }
.form-panel { margin-bottom: 18px; }
.inline-form { display: inline-flex; }
.inline-form-block { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 10px 0; }
.sub-title { margin: 18px 0 6px; font-size: 13px; color: #c4d3e6; }

/* ============ 提示 ============ */
.alert { padding: 11px 14px; border-radius: 10px; margin-bottom: 14px; font-size: 13px; border: 1px solid transparent; }
.alert-ok { background: rgba(52, 211, 153, .1); border-color: rgba(52, 211, 153, .3); color: #a7f3d0; }
.alert-error { background: rgba(248, 113, 113, .1); border-color: rgba(248, 113, 113, .3); color: #fecaca; }
.alert-warn { background: rgba(251, 191, 36, .1); border-color: rgba(251, 191, 36, .3); color: #fde68a; }
.alert-info { background: rgba(56, 189, 248, .08); border-color: rgba(56, 189, 248, .28); color: #bae6fd; }
.mt { margin-top: 14px; }

/* ============ 工具条 ============ */
.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 16px; }
.toolbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.search-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.search-form input[type="search"] { width: 230px; }
.search-form .select { width: auto; min-width: 110px; }

.seg { display: inline-flex; padding: 3px; border-radius: 10px; background: rgba(255, 255, 255, .04); border: 1px solid var(--line-soft); }
.seg-item { padding: 6px 13px; border-radius: 7px; font-size: 12.5px; color: #9aa8bd; transition: background .2s, color .2s; }
.seg-item:hover { color: #dbe7f6; }
.seg-item.active { background: rgba(56, 189, 248, .16); color: #bae6fd; box-shadow: inset 0 0 0 1px rgba(56, 189, 248, .3); }

.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.chip-static { padding: 4px 11px; border-radius: 999px; font-size: 12px; border: 1px solid var(--line-soft); background: rgba(255, 255, 255, .03); color: #a9b8cc; }
.chip-static.is-green { color: #a7f3d0; border-color: rgba(52, 211, 153, .3); background: rgba(52, 211, 153, .1); }
.chip-static.is-red { color: #fecaca; border-color: rgba(248, 113, 113, .3); background: rgba(248, 113, 113, .1); }
.chip-static.is-yellow { color: #fde68a; border-color: rgba(251, 191, 36, .3); background: rgba(251, 191, 36, .1); }

/* ============ 面板 / 卡片 ============ */
.panel { background: linear-gradient(160deg, rgba(255, 255, 255, .05), rgba(255, 255, 255, .018)); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.panel-head h2 { font-size: 15px; letter-spacing: .02em; }
.link { font-size: 12.5px; color: #7fc4ee; }
.link:hover { color: #bae6fd; text-decoration: underline; }

.panel-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.panel-grid.two-col { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 16px; }
.stat-card { position: relative; padding: 16px 18px; border-radius: var(--radius); border: 1px solid var(--line-soft); background: linear-gradient(160deg, rgba(255, 255, 255, .055), rgba(255, 255, 255, .02)); overflow: hidden; }
.stat-card .stat-label { display: block; font-size: 12px; color: var(--muted); }
.stat-card .stat-value { display: block; margin: 6px 0 2px; font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.stat-card .stat-note { display: block; font-size: 11.5px; color: rgba(255, 255, 255, .4); }
.stat-card.is-green { border-color: rgba(52, 211, 153, .28); }
.stat-card.is-green .stat-value { color: #6ee7b7; }
.stat-card.is-red { border-color: rgba(248, 113, 113, .28); }
.stat-card.is-red .stat-value { color: #fca5a5; }

/* ============ 仪表盘小块 ============ */
.rent-sum { margin-bottom: 14px; }
.rent-num { display: flex; align-items: baseline; gap: 10px; }
.rent-num strong { font-size: 24px; font-variant-numeric: tabular-nums; }
.rent-num span { font-size: 12px; color: var(--muted); }
.progress { height: 7px; margin-top: 10px; border-radius: 999px; background: rgba(255, 255, 255, .07); overflow: hidden; }
.progress span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #38bdf8, #34d399); transition: width .4s; }
.mini-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 12px 0; border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); }
.mini-stats div span { display: block; font-size: 11.5px; color: var(--muted); }
.mini-stats div strong { font-size: 16px; font-variant-numeric: tabular-nums; }
.owe-list li, .todo-list li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px dashed rgba(255, 255, 255, .06); font-size: 13px; }
.owe-list li:last-child, .todo-list li:last-child { border-bottom: 0; }
.owe-list li strong { margin-left: auto; }
.todo-list li .tag { margin-left: auto; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.small { font-size: 11.5px; }
.muted { color: var(--muted); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.text-danger { color: #fca5a5; }
.empty-hint { padding: 22px 0; text-align: center; color: rgba(255, 255, 255, .35); font-size: 13px; }
.vacant-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 5px 12px; border-radius: 8px; border: 1px dashed rgba(255, 255, 255, .22); background: rgba(255, 255, 255, .03); font-family: var(--mono); font-size: 12px; color: #cbd8e8; transition: border-color .2s, color .2s; }
.chip:hover { border-color: rgba(56, 189, 248, .5); color: #bae6fd; }
.mini-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.mini-table td { padding: 7px 4px; border-bottom: 1px solid rgba(255, 255, 255, .05); }

/* ============ 表格 ============ */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 720px; }
.data-table th { text-align: left; font-weight: 500; font-size: 11.5px; letter-spacing: .04em; color: #7d8ea6; padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.data-table td { padding: 11px 10px; border-bottom: 1px solid rgba(255, 255, 255, .05); vertical-align: middle; }
.data-table tbody tr:hover { background: rgba(255, 255, 255, .035); }
.data-table .col-actions { text-align: right; white-space: nowrap; }
.data-table .col-actions form { margin-left: 6px; }
.data-table td.num { padding-right: 14px; }

/* ============ 标签 ============ */
.tag { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; border: 1px solid transparent; white-space: nowrap; }
.tag-rented { background: rgba(52, 211, 153, .14); border-color: rgba(52, 211, 153, .35); color: #a7f3d0; }
.tag-expired { background: rgba(248, 113, 113, .14); border-color: rgba(248, 113, 113, .35); color: #fecaca; }
.tag-warn { background: rgba(251, 191, 36, .14); border-color: rgba(251, 191, 36, .35); color: #fde68a; }
.tag-vacant { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .2); color: #dbe6f5; }
.tag-self { background: rgba(167, 139, 250, .14); border-color: rgba(167, 139, 250, .35); color: #ddd6fe; }
.tag-ended { background: rgba(255, 255, 255, .06); border-color: rgba(255, 255, 255, .16); color: #9aa8bd; }
.tag-log { background: rgba(56, 189, 248, .1); border-color: rgba(56, 189, 248, .28); color: #bae6fd; }

/* ============ 房间方块 ============ */
.room-sections { display: flex; flex-direction: column; gap: 22px; }
.room-block { }
.block-title { font-size: 14px; color: #cfe0f2; margin-bottom: 10px; }
.room-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 10px; }
.room-tile {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 76px; padding: 8px 6px; border-radius: 11px;
  border: 1px solid var(--line-soft); background: rgba(255, 255, 255, .035);
  transition: transform .2s, border-color .2s, background .2s, box-shadow .2s;
}
.room-tile:hover { transform: translateY(-3px); border-color: rgba(56, 189, 248, .4); box-shadow: 0 14px 30px -20px rgba(0, 0, 0, .9); }
.tile-no { font-family: var(--mono); font-size: 15px; font-weight: 600; letter-spacing: .04em; }
.tile-sub { font-size: 11px; color: rgba(255, 255, 255, .62); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-meta { font-family: var(--mono); font-size: 10.5px; color: rgba(255, 255, 255, .45); }
.state-rented { background: rgba(52, 211, 153, .13); border-color: rgba(52, 211, 153, .4); }
.state-rented .tile-no { color: #a7f3d0; }
.state-expired { background: rgba(248, 113, 113, .13); border-color: rgba(248, 113, 113, .4); }
.state-expired .tile-no { color: #fecaca; }
.state-vacant { background: rgba(255, 255, 255, .055); border-style: dashed; border-color: rgba(255, 255, 255, .2); }
.state-vacant .tile-no { color: #e4ecf8; }
.state-self { background: rgba(251, 191, 36, .1); border-color: rgba(251, 191, 36, .3); }
.state-self .tile-no { color: #fde68a; }

/* ============ 分页 ============ */
.pager { display: flex; gap: 6px; margin-top: 16px; flex-wrap: wrap; }
.pager-item { min-width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; border: 1px solid var(--line-soft); font-size: 12px; color: #9aa8bd; }
.pager-item:hover { border-color: rgba(56, 189, 248, .4); color: #dbe7f6; }
.pager-item.active { background: rgba(56, 189, 248, .16); color: #bae6fd; border-color: rgba(56, 189, 248, .35); }

/* ============ 趋势图 ============ */
.trend-chart { display: flex; align-items: flex-end; gap: 14px; height: 230px; padding: 10px 4px 0; }
.trend-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; }
.trend-val { font-family: var(--mono); font-size: 11px; color: #a9b8cc; }
.trend-bar { flex: 1; width: 100%; max-width: 46px; display: flex; align-items: flex-end; border-radius: 8px; background: rgba(255, 255, 255, .04); }
.trend-bar span { display: block; width: 100%; border-radius: 8px; background: linear-gradient(180deg, #38bdf8, rgba(99, 102, 241, .7)); }
.trend-label { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.trend-sub { font-size: 10.5px; color: rgba(255, 255, 255, .3); }

/* ============ 检查清单 / 文件列表 ============ */
.check-list li { display: flex; align-items: center; gap: 9px; padding: 8px 0; font-size: 12.5px; border-bottom: 1px dashed rgba(255, 255, 255, .06); }
.check-list li .mark { width: 7px; height: 7px; border-radius: 50%; flex: none; background: #64748b; }
.check-list li.ok .mark { background: var(--green); box-shadow: 0 0 8px rgba(52, 211, 153, .7); }
.check-list li.bad .mark { background: var(--red); box-shadow: 0 0 8px rgba(248, 113, 113, .7); }
.file-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 0; font-size: 12.5px; border-bottom: 1px dashed rgba(255, 255, 255, .06); }

/* ============ 登录页 ============ */
.login-body { min-height: 100vh; display: grid; place-items: center; padding: 30px 18px; position: relative; overflow: hidden; }
.login-glow { position: fixed; inset: 0; pointer-events: none; background:
  radial-gradient(700px 420px at 20% 10%, rgba(56, 189, 248, .18), transparent 60%),
  radial-gradient(600px 400px at 85% 90%, rgba(139, 92, 246, .16), transparent 60%); }
.login-card {
  position: relative; width: 100%; max-width: 380px; padding: 32px 28px 26px;
  border-radius: 18px; border: 1px solid var(--line);
  background: linear-gradient(160deg, rgba(255, 255, 255, .07), rgba(255, 255, 255, .02));
  box-shadow: 0 30px 70px -40px rgba(0, 0, 0, .95), inset 0 1px 0 rgba(255, 255, 255, .1);
  backdrop-filter: blur(16px);
}
.login-brand { text-align: center; margin-bottom: 22px; }
.login-brand .brand-mark { margin: 0 auto 14px; width: 46px; height: 46px; }
.login-brand h1 { font-size: 18px; letter-spacing: .04em; }
.login-brand p { margin: 6px 0 0; font-size: 12px; color: var(--muted); }
.login-card .field { margin-bottom: 14px; }
.login-foot { margin: 16px 0 0; text-align: center; font-size: 11px; color: rgba(255, 255, 255, .3); }

/* ============ 响应式 ============ */
@media (max-width: 980px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: relative; padding: 14px 14px 10px; border-right: 0; border-bottom: 1px solid var(--line-soft); }
  .brand { padding-bottom: 12px; }
  .nav { flex-direction: row; overflow-x: auto; padding: 10px 0 4px; gap: 6px; }
  .nav-item { white-space: nowrap; padding: 8px 11px; }
  .side-foot { display: none; }
  .topbar { padding: 13px 16px; flex-wrap: wrap; }
  .topbar-right { width: 100%; margin-left: 0; justify-content: space-between; }
  .content { padding: 16px 14px 28px; }
  .panel-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr 1fr; }
  .search-form input[type="search"] { width: 100%; }
  .toolbar-right { width: 100%; }
  .data-table { min-width: 640px; font-size: 12.5px; }
  .trend-chart { height: 190px; gap: 8px; }
}

@media (max-width: 560px) {
  .form-grid { grid-template-columns: 1fr; }
  .mini-stats { grid-template-columns: 1fr; gap: 6px; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .topbar-title h1 { font-size: 16px; }
  .room-grid { grid-template-columns: repeat(auto-fill, minmax(74px, 1fr)); }
}

/* 打印：报表可干净导出 */
@media print {
  body { background: #fff; color: #111; }
  .sidebar, .topbar, .toolbar, .app-foot, .col-actions, .pager { display: none !important; }
  .panel { border-color: #ddd; box-shadow: none; background: #fff; }
  .data-table td, .data-table th { color: #111; border-color: #ddd; }
}
