:root {
  --teal: #16867e;
  --teal-dark: #0f6862;
  --teal-soft: #e8f5f3;
  --ink: #17212f;
  --muted: #728096;
  --line: #e5eaf0;
  --bg: #f4f7f9;
  --white: #fff;
  --danger: #d84f4f;
  --shadow: 0 8px 30px rgba(30, 52, 68, .07);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
}
button, input, select { font: inherit; }
button { cursor: pointer; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 230px;
  display: flex;
  flex-direction: column;
  padding: 28px 18px 22px;
  background: #102a2d;
  color: white;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 0 10px 28px; }
.brand-mark {
  width: 42px; height: 42px; display: grid; place-items: center;
  border-radius: 13px; background: linear-gradient(135deg, #39c9bc, var(--teal));
  font-size: 22px; font-weight: 800;
}
.brand strong, .brand small { display: block; }
.brand strong { letter-spacing: 1px; font-size: 17px; }
.brand small { margin-top: 3px; color: #a9c3c3; }
nav { display: grid; gap: 7px; }
.nav {
  padding: 13px 15px;
  text-align: left;
  color: #bbcecf;
  border: 0;
  border-radius: 9px;
  background: transparent;
}
.nav:hover, .nav.active { color: white; background: rgba(57, 201, 188, .18); }
.nav.active { box-shadow: inset 3px 0 #4ad5c7; }
.sidebar-footer {
  margin-top: auto; padding: 14px 10px 0; border-top: 1px solid #294346;
  display: flex; align-items: center; gap: 8px; color: #a9c3c3; font-size: 12px;
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: #879498; }
.dot.ok { background: #45d18b; box-shadow: 0 0 0 4px rgba(69,209,139,.13); }

main { margin-left: 230px; min-height: 100vh; padding: 30px 38px 60px; }
header {
  display: flex; justify-content: space-between; align-items: flex-end;
  gap: 24px; margin-bottom: 20px;
}
h1, h2, p { margin: 0; }
h1 { font-size: 27px; letter-spacing: -.5px; }
h2 { font-size: 17px; }
header p, .panel-head p { color: var(--muted); margin-top: 6px; }
.header-actions { display: flex; align-items: end; gap: 9px; }
label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; }
input, select {
  min-height: 38px; border: 1px solid #d9e0e7; border-radius: 8px;
  padding: 8px 11px; background: white; color: var(--ink); outline: 0;
}
input:focus, select:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(22,134,126,.1); }

.btn { min-height: 38px; padding: 8px 16px; border-radius: 8px; border: 1px solid transparent; font-weight: 600; }
.btn.primary { color: white; background: var(--teal); }
.btn.primary:hover { background: var(--teal-dark); }
.btn.secondary { color: var(--teal-dark); background: var(--teal-soft); border-color: #c5e3df; }
.btn.ghost { color: var(--ink); background: white; border-color: var(--line); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.wide { width: 100%; margin-top: 15px; }

.notice {
  margin-bottom: 20px; padding: 13px 16px; border: 1px solid #f0d89a;
  border-radius: 10px; color: #705318; background: #fff9e9;
}
.page { display: none; }
.page.active { display: block; }
.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 18px; }
.card, .panel { border: 1px solid var(--line); border-radius: 14px; background: var(--white); box-shadow: var(--shadow); }
.card { min-height: 142px; padding: 22px; }
.card span, .card small { display: block; color: var(--muted); }
.card strong { display: block; margin: 13px 0 5px; font-size: 29px; letter-spacing: -.5px; }
.panel { padding: 22px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.search { width: 290px; }

.trend-chart { display: flex; align-items: end; gap: 8px; min-height: 300px; padding: 20px 8px 0; overflow-x: auto; }
.trend-chart.empty, .empty { display: grid; place-items: center; color: #9aa5b4; }
.trend-item { min-width: 34px; height: 250px; display: flex; flex-direction: column; justify-content: end; align-items: center; gap: 7px; }
.trend-bar { width: 24px; min-height: 2px; border-radius: 5px 5px 2px 2px; background: linear-gradient(180deg, #45c8bb, var(--teal)); }
.trend-label { color: var(--muted); font-size: 10px; white-space: nowrap; transform: rotate(-35deg); transform-origin: center; }
.trend-value { color: #415060; font-size: 10px; white-space: nowrap; }

.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; white-space: nowrap; }
th { padding: 12px; background: #f6f8fa; color: #627084; text-align: left; font-size: 12px; }
td { padding: 13px 12px; border-bottom: 1px solid #edf0f3; }
tbody tr:hover { background: #fbfdfd; }
.table-title { max-width: 230px; overflow: hidden; text-overflow: ellipsis; }
.money { font-variant-numeric: tabular-nums; font-weight: 700; }
.tag { display: inline-block; padding: 3px 7px; border-radius: 5px; font-size: 11px; background: #eef2f5; color: #657386; }
.tag.ok { color: #0b7168; background: var(--teal-soft); }
.link-btn { border: 0; color: var(--teal); background: transparent; padding: 4px; }
.pager { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 17px; color: var(--muted); }
.pager > span:first-child { margin-right: auto; }

.split { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.wide-select { width: 100%; }
.session-summary { min-height: 70px; margin: 14px 0; padding: 14px; border-radius: 9px; background: #f6f8fa; line-height: 1.8; color: #526174; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.form-grid label input, .form-grid label select { width: 100%; }
.form-grid .full { grid-column: 1 / -1; }
.host-add > div { display: flex; gap: 7px; }
.host-add input { min-width: 0; flex: 1; }
.handover-list { display: block; min-height: 300px; }
.handover-item { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 14px 4px; border-bottom: 1px solid var(--line); }
.handover-item strong, .handover-item small { display: block; }
.handover-item small { color: var(--muted); margin-top: 5px; }
.danger-link { border: 0; color: var(--danger); background: transparent; }

.modal { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; padding: 30px; background: rgba(12,27,35,.55); }
.modal.hidden, .toast.hidden { display: none; }
.modal-card { width: min(1100px, 95vw); max-height: 88vh; display: flex; flex-direction: column; padding: 22px; border-radius: 15px; background: white; box-shadow: 0 24px 80px rgba(0,0,0,.25); }
.modal-head, .modal-actions { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.modal-head p, .modal-actions { color: var(--muted); }
.modal-actions { justify-content: flex-start; margin: 15px 0; }
.icon-btn { border: 0; background: transparent; font-size: 28px; color: #6d7784; }
.modal-table { max-height: 60vh; }
.toast { position: fixed; right: 28px; bottom: 28px; z-index: 20; max-width: 420px; padding: 13px 17px; color: white; border-radius: 9px; background: #20333a; box-shadow: var(--shadow); }
.toast.error { background: #a53d3d; }
.tag.live { color: #0b5cab; background: #e7f2ff; }
.tag.pending { color: #8a5a00; background: #fff3d6; }
.tag.failed { color: #a53d3d; background: #fde8e8; }
.recon { margin: 12px 0 18px; padding: 12px 14px; border-radius: 10px; background: #f6f8fa; color: #526174; }
.sync-meta { margin-top: 10px; color: var(--muted); font-size: 12px; }
.login-body {
  min-height: 100vh; display: grid; place-items: center;
  background: #102a2d; margin: 0;
}
.login-card {
  width: min(420px, 92vw); padding: 32px; border-radius: 16px;
  background: #fff; display: grid; gap: 12px;
}
.login-card h1 { font-size: 22px; }
.login-card .brand { color: #102a2d; padding: 0 0 8px; }
.login-error { color: var(--danger); min-height: 18px; }

@media (max-width: 1300px) {
  header { align-items: stretch; flex-direction: column; }
  .header-actions { flex-wrap: wrap; }
  .cards { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 1000px) {
  .sidebar { width: 155px; padding-inline: 10px; }
  .brand { padding-inline: 6px; }
  .brand small { display: none; }
  .brand strong { font-size: 14px; }
  .nav { font-size: 14px; }
  .sidebar-footer span:last-child { display: none; }
  main { margin-left: 155px; padding: 24px 20px; }
  .split { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
  .sidebar { width: 110px; }
  .brand { gap: 7px; }
  .brand-mark { width: 34px; height: 34px; font-size: 17px; }
  .brand strong { font-size: 11px; }
  .nav { padding: 11px 10px; font-size: 12px; }
  main { margin-left: 110px; padding: 20px 14px 45px; }
  h1 { font-size: 24px; }
  .cards { grid-template-columns: 1fr; }
  .card { min-height: 120px; }
  .header-actions label { width: calc(50% - 5px); }
  .header-actions label input { width: 100%; }
  .panel { padding: 16px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .full { grid-column: auto; }
}
