/* ============================================================
   Panora · 全景生活 — Design System / Stylesheet
   ============================================================ */
:root {
  --bg: #F6F7F9;
  --surface: #FFFFFF;
  --border: #E6E9EA;
  --border-strong: #D8DCE0;

  --text: #1A1D21;
  --text-2: #6B7280;
  --text-3: #9CA3AF;

  --accent: #0E9F6E;       /* 祖母绿 */
  --accent-soft: #E6F6EF;
  --accent-strong: #0B8A5F;
  --success: #16A34A;
  --danger: #DC2626;
  --warn: #E08A00;
  --info: #3BB0A3;
  --purple: #7C6CF0;

  --radius-lg: 16px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --radius-xs: 8px;

  --shadow-sm: 0 1px 2px rgba(16,24,40,.04), 0 1px 3px rgba(16,24,40,.06);
  --shadow-md: 0 4px 16px rgba(16,24,40,.06);

  --sidebar-w: 256px;
  --topbar-h: 72px;

  --font-sans: "Inter", "Noto Sans SC", system-ui, -apple-system, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-mono: "JetBrains Mono", "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

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

html, body { height: 100%; }

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }

/* ---------- App layout ---------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), var(--info));
  display: grid; place-items: center; color: #fff; flex: 0 0 auto;
}
.brand-name { font-weight: 700; font-size: 16px; letter-spacing: .2px; }
.brand-sub { font-size: 11px; color: var(--text-3); font-weight: 500; }

.nav-group { margin-top: 14px; }
.nav-group-label {
  font-size: 11px; font-weight: 600; color: var(--text-3);
  letter-spacing: .6px; text-transform: uppercase;
  padding: 6px 10px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: var(--radius-sm);
  color: var(--text-2); cursor: pointer; font-weight: 500;
  position: relative; transition: background .12s, color .12s;
}
.nav-item:hover { background: var(--bg); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--accent-strong); font-weight: 600; }
.nav-item.active::before {
  content: ""; position: absolute; left: -14px; top: 8px; bottom: 8px;
  width: 3px; border-radius: 0 3px 3px 0; background: var(--accent);
}
.nav-item svg { flex: 0 0 auto; }

.sidebar-footer { margin-top: auto; padding-top: 14px; }
.user-card {
  display: flex; align-items: center; gap: 10px;
  padding: 8px; border-radius: var(--radius-sm); border: 1px solid var(--border);
}
.avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: 0 0 auto;
  background: var(--accent); color: #fff; display: grid; place-items: center;
  font-weight: 600; font-size: 14px;
}
.user-name { font-weight: 600; font-size: 13px; }
.user-role { font-size: 11px; color: var(--text-3); }

/* ---------- Main ---------- */
.main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: var(--topbar-h); flex: 0 0 var(--topbar-h);
  background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 32px; position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-size: 20px; font-weight: 700; }
.topbar .sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.search {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 999px; padding: 8px 14px; color: var(--text-3);
  font-size: 13px; min-width: 240px;
}
.icon-btn {
  width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--border);
  background: var(--surface); display: grid; place-items: center; cursor: pointer; color: var(--text-2);
}
.icon-btn:hover { background: var(--bg); }

.content { padding: 32px; display: flex; flex-direction: column; gap: 24px; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px; box-shadow: var(--shadow-sm);
}
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-title { font-size: 15px; font-weight: 700; }
.card-sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.link { color: var(--accent); font-weight: 600; font-size: 13px; cursor: pointer; }
.link:hover { text-decoration: underline; }

/* ---------- Stat cards ---------- */
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 18px 20px; box-shadow: var(--shadow-sm);
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.stat[data-view]:hover { border-color: var(--accent); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.stat-label { font-size: 13px; color: var(--text-2); }
.stat-value { font-family: var(--font-mono); font-size: 30px; font-weight: 700; margin: 6px 0 2px; letter-spacing: -.5px; }
.stat-delta { font-size: 12px; font-weight: 600; }
.stat-delta.up { color: var(--success); }
.stat-delta.down { color: var(--danger); }
.stat-delta.flat { color: var(--text-3); }

/* ---------- Two-column rows ---------- */
.row { display: grid; gap: 16px; }
.row.charts { grid-template-columns: minmax(0, 1.9fr) minmax(0, 1fr); }
.row.two { grid-template-columns: 1fr 1fr; }

/* ---------- Charts ---------- */
.chart { width: 100%; display: block; }
.legend { display: flex; flex-wrap: wrap; gap: 12px 18px; margin-top: 14px; }
.legend-item { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); }
.legend-dot { width: 10px; height: 10px; border-radius: 3px; flex: 0 0 auto; }
.legend-val { font-family: var(--font-mono); font-weight: 700; color: var(--text); margin-left: 2px; }

/* horizontal bars */
.bar-item { margin-bottom: 14px; }
.bar-item:last-child { margin-bottom: 0; }
.bar-top { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 6px; }
.bar-top .val { font-family: var(--font-mono); font-weight: 700; }
.bar-track { height: 8px; background: var(--bg); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: var(--accent); }

/* ---------- Todo / list rows ---------- */
.todo { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.todo:last-child { border-bottom: none; }
.check {
  width: 20px; height: 20px; border-radius: 6px; border: 2px solid var(--border-strong);
  flex: 0 0 auto; cursor: pointer; display: grid; place-items: center; transition: .12s;
}
.check.done { background: var(--accent); border-color: var(--accent); color: #fff; }
.todo-main { flex: 1 1 auto; min-width: 0; }
.todo-title { font-weight: 500; }
.todo-title.done { text-decoration: line-through; color: var(--text-3); }
.todo-meta { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.badge {
  display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 600; line-height: 1.6;
}
.badge.high { background: #FDECEC; color: var(--danger); }
.badge.mid  { background: #FEF3E2; color: var(--warn); }
.badge.low  { background: #EEF2F5; color: var(--text-2); }
.badge.ok   { background: var(--accent-soft); color: var(--accent-strong); }
.badge.fail { background: #FDECEC; color: var(--danger); }

/* activity feed */
.feed-item { display: flex; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.feed-item:last-child { border-bottom: none; }
.feed-ico {
  width: 34px; height: 34px; border-radius: 10px; flex: 0 0 auto;
  display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-strong);
}
.feed-body { flex: 1 1 auto; min-width: 0; }
.feed-text { font-size: 13px; }
.feed-text b { font-weight: 600; }
.feed-time { font-size: 11px; color: var(--text-3); margin-top: 2px; }

/* ---------- Module grid ---------- */
.module-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 14px; }
.module-card {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 16px; cursor: pointer; transition: .12s;
}
.module-card:hover { border-color: var(--accent); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.module-ico {
  width: 40px; height: 40px; border-radius: 11px; flex: 0 0 auto;
  display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-strong);
}
.module-name { font-weight: 600; font-size: 14px; }
.module-meta { font-size: 11px; color: var(--text-3); margin-top: 2px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; justify-content: center;
  padding: 9px 16px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font-weight: 600; cursor: pointer; transition: .12s;
  white-space: nowrap;
}
.btn:hover { background: var(--bg); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-strong); }
.btn-danger { color: var(--danger); border-color: #F1C9C9; }
.btn-danger:hover { background: #FDECEC; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--bg); }
.btn-sm { padding: 6px 12px; font-size: 13px; }

/* ---------- Forms ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.input, .select, .textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); background: var(--surface); outline: none; transition: border .12s;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); }
.textarea { resize: vertical; min-height: 90px; }
.form-row { display: flex; gap: 12px; flex-wrap: wrap; }
.form-row > .field { flex: 1 1 160px; }

/* ---------- Tables ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--border); font-size: 13px; }
.table th { color: var(--text-3); font-weight: 600; font-size: 12px; }
.table tr:hover td { background: var(--bg); }
.table .num { font-family: var(--font-mono); font-weight: 700; }

/* ---------- Pagination ---------- */
.pagination { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 16px; }
.page-btn {
  min-width: 34px; height: 34px; padding: 0 10px; border-radius: var(--radius-xs);
  border: 1px solid var(--border); background: var(--surface); cursor: pointer;
  font-weight: 600; font-size: 13px; color: var(--text-2);
}
.page-btn:hover:not(:disabled) { background: var(--bg); }
.page-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.page-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ---------- Empty state ---------- */
.empty { text-align: center; color: var(--text-3); padding: 36px 0; font-size: 13px; }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(16,24,40,.45);
  display: grid; place-items: center; z-index: 100; padding: 20px;
}
.modal {
  background: var(--surface); border-radius: var(--radius-lg); width: 100%; max-width: 480px;
  padding: 24px; box-shadow: var(--shadow-md); max-height: 90vh; overflow-y: auto;
}
.modal h3 { font-size: 17px; font-weight: 700; margin-bottom: 18px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* ---------- Segmented (success/fail) ---------- */
.segment { display: flex; gap: 8px; }
.seg {
  flex: 1; padding: 10px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  text-align: center; cursor: pointer; font-weight: 600; color: var(--text-2);
}
.seg.sel-ok { border-color: var(--success); background: #EAF7EF; color: var(--success); }
.seg.sel-fail { border-color: var(--danger); background: #FDECEC; color: var(--danger); }

/* ---------- Calendar ---------- */
.calendar {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 18px; box-shadow: var(--shadow-sm);
}
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.cal-month { font-size: 16px; font-weight: 700; }
.cal-weekdays { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; margin-bottom: 6px; }
.cal-weekdays span { text-align: center; font-size: 12px; font-weight: 600; color: var(--text-3); padding: 4px 0; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-day {
  aspect-ratio: 1; min-height: 36px; border-radius: var(--radius-xs);
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  padding-top: 4px; cursor: pointer; transition: background .12s;
  position: relative; font-size: 13px; color: var(--text);
}
.cal-day:hover { background: var(--bg); }
.cal-day.cal-empty { cursor: default; background: transparent; }
.cal-day.cal-empty:hover { background: transparent; }
.cal-num { font-weight: 600; font-size: 13px; line-height: 1.4; }
.cal-day.cal-today .cal-num {
  background: var(--accent); color: #fff; width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center; line-height: 1;
}
.cal-day.cal-has-event { background: var(--accent-soft); }
.cal-day.cal-selected { outline: 2px solid var(--accent); outline-offset: -2px; }
.cal-day.cal-selected .cal-num { font-weight: 700; color: var(--accent-strong); }
.cal-dots { display: flex; gap: 3px; margin-top: 2px; }
.cal-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }

/* ---------- Misc ---------- */
.section-title { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.muted { color: var(--text-3); }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.flex { display: flex; align-items: center; gap: 10px; }
.wrap { flex-wrap: wrap; }
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; } .mt24 { margin-top: 24px; }
.gap8 { gap: 8px; } .gap12 { gap: 12px; }
.right { margin-left: auto; }
.nowrap { white-space: nowrap; }

/* ---------- Schedule cards (mobile) ---------- */
.sched-cards-wrap { display: none; }
.sched-card {
  padding: 12px 14px; border-bottom: 1px solid var(--border);
  transition: background .12s;
}
.sched-card:last-child { border-bottom: none; }
.sched-card:hover { background: var(--bg); }
.sched-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.sched-card-title { font-weight: 600; font-size: 14px; }
.sched-card-meta { display: flex; gap: 16px; margin-top: 4px; font-size: 12px; }

/* ---------- Button icon-only variant ---------- */
.btn-icon-only {
  padding: 6px; min-width: unset; border-color: transparent;
  color: var(--text-3);
}
.btn-icon-only:hover { background: #FDECEC; color: var(--danger); border-color: #F1C9C9; }

/* ---------- Dropdown panels (notifications / user menu) ---------- */
.dropdown-panel {
  position: fixed; z-index: 90;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: 0 8px 32px rgba(16,24,40,.14), 0 2px 8px rgba(16,24,40,.06);
  width: 340px; max-height: 420px;
  display: flex; flex-direction: column;
  animation: dropIn .15s ease-out;
}
@keyframes dropIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}
.dropdown-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--border); font-weight: 700; font-size: 14px;
}
.dropdown-body { overflow-y: auto; flex: 1; }

/* notification items */
.notif-item {
  display: flex; gap: 10px; padding: 12px 16px;
  border-bottom: 1px solid var(--border); transition: background .12s; cursor: default;
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--bg); }
.notif-ico {
  width: 32px; height: 32px; border-radius: 9px; flex: 0 0 auto;
  display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-strong);
}
.notif-ico svg { width: 15px; height: 15px; }
.notif-body { flex: 1; min-width: 0; }
.notif-text { font-size: 13px; line-height: 1.4; }
.notif-text b { font-weight: 600; }
.notif-time { font-size: 11px; color: var(--text-3); margin-top: 3px; }

/* user menu */
.user-menu-header {
  display: flex; align-items: center; gap: 12px;
  padding: 18px 16px; border-bottom: 1px solid var(--border);
}
.user-menu-items { padding: 6px 0; }
.user-menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 10px 16px; border: none; background: transparent;
  color: var(--text); font-size: 14px; font-weight: 500; cursor: pointer;
  transition: background .12s; text-align: left;
}
.user-menu-item:hover { background: var(--bg); }
.user-menu-item span { display: grid; place-items: center; width: 20px; height: 20px; color: var(--text-2); }
.user-menu-footer {
  padding: 10px 16px; border-top: 1px solid var(--border);
  text-align: center;
}

/* bell badge dot (future use) */
.bell-btn { position: relative; }
.bell-btn::after {
  content: ""; position: absolute; top: 7px; right: 7px;
  width: 8px; height: 8px; border-radius: 50%; background: var(--danger);
  /* hide by default — show when there are unread notifications */
  display: none;
}

/* ---------- Responsive ---------- */
.menu-toggle { display: none; }
@media (max-width: 1024px) {
  .row.charts { grid-template-columns: 1fr; }
  .row.two { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; width: 82vw; max-width: 300px; z-index: 60;
    transform: translateX(-100%); transition: transform .22s ease; box-shadow: var(--shadow-md);
  }
  .sidebar.open { transform: none; }
  .menu-toggle { display: grid; }
  .topbar { padding: 0 14px; }
  .topbar .sub { display: none; }
  .content { padding: 14px; gap: 16px; }
  .card { padding: 16px; overflow-x: auto; }
  .card-head { margin-bottom: 12px; }
  .stat-row { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .stat { padding: 14px 16px; }
  .stat-value { font-size: 25px; margin: 4px 0 0; }
  .search { display: none; }
  .module-grid { grid-template-columns: repeat(3, 1fr); gap: 10px; }
  .module-card { padding: 12px; gap: 8px; }
  .module-ico { width: 32px; height: 32px; border-radius: 9px; }
  .module-name { font-size: 13px; }
  .backdrop-mobile { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 55; }
  /* schedule: show cards on mobile, table on desktop */
  .sched-table-wrap { display: none; }
  .sched-cards-wrap { display: block; }
}
@media (min-width: 721px) {
  .sched-table-wrap { display: block; }
  .sched-cards-wrap { display: none; }
}
