* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--surface-0);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-weight: 500; margin: 0; }

button {
  font-family: inherit;
  font-size: 12px;
  color: var(--text-primary);
  background: var(--surface-2);
  border: 0.5px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 7px 11px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: background 0.12s;
}
button:hover { background: var(--surface-1); }
button:active { transform: scale(0.98); }

.app {
  display: grid;
  grid-template-columns: 184px 1fr;
  max-width: 1120px;
  min-height: 100vh;
  margin: 0 auto;
  background: var(--surface-2);
  border-left: 0.5px solid var(--border);
  border-right: 0.5px solid var(--border);
}

.sidebar {
  background: var(--surface-1);
  border-right: 0.5px solid var(--border);
  padding: 18px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 4px 6px 16px;
}
.brand-mark {
  width: 28px; height: 28px;
  border-radius: 7px;
  background: var(--text-primary);
  color: var(--surface-2);
  display: flex; align-items: center; justify-content: center;
  font-weight: 500; font-size: 14px;
}
.brand-name { font-weight: 500; font-size: 15px; line-height: 1.2; }
.brand-tag {
  display: inline-block; margin-top: 3px;
  font-size: 10px; color: var(--text-warning); background: var(--bg-warning);
  padding: 1px 7px; border-radius: 99px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 9px;
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  transition: background 0.12s;
}
.nav-item:hover { background: var(--surface-2); }
.nav-item.active { background: var(--bg-accent); color: var(--text-accent); font-weight: 500; }
.nav-item i { font-size: 18px; }
.nav-foot {
  margin-top: auto;
  padding: 12px 8px 4px;
  border-top: 0.5px solid var(--border);
  display: flex; align-items: center; gap: 8px;
  color: var(--text-muted); font-size: 12px;
}

.main { padding: 24px 26px 40px; min-width: 0; }
.page { display: none; }
.page.active { display: block; }

.page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 18px;
}
.page-title { font-size: 19px; }
.page-sub { font-size: 13px; color: var(--text-secondary); margin-top: 3px; }

.crumb {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--text-secondary);
  margin-bottom: 16px;
}
.crumb .sep { color: var(--text-muted); }
.crumb .cur { color: var(--text-primary); }

.pill {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12px; color: var(--text-secondary);
  border: 0.5px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 6px 10px; white-space: nowrap;
}

.actions { display: flex; gap: 8px; flex-wrap: wrap; }

.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 11px;
  margin-bottom: 20px;
}
.kpi { background: var(--surface-1); border-radius: var(--radius); padding: 12px; }
.kpi-label { font-size: 12px; color: var(--text-secondary); }
.kpi-val { font-size: 24px; font-weight: 500; margin-top: 4px; }
.kpi-delta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.t-good { color: var(--status-good); }
.t-warn { color: var(--text-warning); }
.t-danger { color: var(--text-danger); }
.t-success { color: var(--text-success); }
.t-accent { color: var(--text-accent); }

.section-title { font-size: 15px; font-weight: 500; margin-bottom: 9px; }
.section-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 9px;
}
.section-head .hint { font-size: 12px; color: var(--text-accent); }
.muted-hint { font-size: 12px; color: var(--text-secondary); margin: -4px 0 9px; }

.block { margin-bottom: 24px; }

.list { border: 0.5px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.row {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 13px; font-size: 13px;
  border-top: 0.5px solid var(--border);
}
.row:first-child { border-top: none; }
.row .grow { flex: 1; min-width: 0; }
.row .sub { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.row .lead-icon { font-size: 18px; }
.row .ellip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .time { font-size: 13px; font-weight: 500; color: var(--text-secondary); white-space: nowrap; }

.av {
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 500; flex-shrink: 0;
}
.av-danger { background: var(--bg-danger); color: var(--text-danger); }
.av-warn { background: var(--bg-warning); color: var(--text-warning); }
.av-accent { background: var(--bg-accent); color: var(--text-accent); }
.av-lg { width: 46px; height: 46px; font-size: 15px; }

.badge {
  font-size: 11px; padding: 3px 9px; border-radius: var(--radius);
  white-space: nowrap;
}
.badge-danger { background: var(--bg-danger); color: var(--text-danger); }
.badge-warn { background: var(--bg-warning); color: var(--text-warning); }
.badge-accent { background: var(--bg-accent); color: var(--text-accent); }
.badge-muted { background: var(--surface-1); color: var(--text-secondary); }

.assistant {
  display: flex; gap: 11px;
  padding: 12px 14px;
  border: 0.5px solid var(--border-accent);
  background: var(--bg-accent);
  border-radius: var(--radius);
  margin-bottom: 20px;
}
.assistant i { font-size: 18px; color: var(--text-accent); flex-shrink: 0; margin-top: 1px; }
.assistant p { margin: 0; font-size: 13px; color: var(--text-accent); line-height: 1.55; }

.wl-grid {
  display: grid;
  grid-template-columns: 1fr 58px 66px 1fr;
  gap: 8px; align-items: center;
}
.wl-head {
  padding: 8px 13px; background: var(--surface-1);
  font-size: 11px; color: var(--text-muted);
}
.wl-row { padding: 11px 13px; border-top: 0.5px solid var(--border); font-size: 13px; }
.wl-row .name-cell { display: flex; align-items: center; gap: 9px; min-width: 0; }
.right { text-align: right; }
.bold { font-weight: 500; }

.chart-wrap { position: relative; width: 100%; }
.h150 { height: 150px; }
.h170 { height: 170px; }
.h190 { height: 190px; }
.h200 { height: 200px; }
.h210 { height: 210px; }
.h260 { height: 260px; }

.clickable { cursor: pointer; }
.clickable:hover { background: var(--surface-1); }
.crumb .back { cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.crumb .back:hover { color: var(--text-primary); }

.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 11px; color: var(--text-secondary); }
.legend.mb { margin-bottom: 8px; }
.legend-item { display: flex; align-items: center; gap: 5px; }
.swatch { width: 10px; height: 10px; border-radius: 2px; }
.swatch.line { width: 12px; height: 3px; }
.dot { width: 9px; height: 9px; border-radius: 50%; }

.nights {
  display: grid;
  grid-template-columns: repeat(15, 1fr);
  gap: 5px;
}
.night { aspect-ratio: 1; border-radius: 4px; }

.cards { display: grid; grid-template-columns: 1fr; gap: 16px; }

.cat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 11px; }
.cat { border: 0.5px solid var(--border); border-radius: var(--radius); padding: 13px; }
.cat-head { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; margin-bottom: 10px; }
.cat-head i { font-size: 18px; color: var(--text-accent); }
.cat-head .opt { font-size: 11px; color: var(--text-muted); font-weight: 400; }
.metric-rows { display: flex; flex-direction: column; gap: 7px; font-size: 12px; }
.metric-row { display: flex; justify-content: space-between; gap: 8px; }
.metric-row .unit { color: var(--text-muted); }

.chips { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; font-size: 12px; }
.chips .lbl { color: var(--text-secondary); }
.chip {
  border: 0.5px solid var(--border-strong); color: var(--text-secondary);
  padding: 5px 12px; border-radius: 99px; cursor: pointer; background: none;
}
.chip.active { background: var(--bg-accent); color: var(--text-accent); border-color: transparent; }

.stack { display: flex; height: 24px; border-radius: var(--radius); overflow: hidden; margin-bottom: 9px; }

.meter-track {
  position: relative; height: 12px; background: var(--surface-1);
  border-radius: 99px; overflow: hidden; margin-bottom: 7px;
}
.meter-fill { position: absolute; left: 0; top: 0; bottom: 0; }
.meter-mark { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--text-primary); }
.meter-cap { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-secondary); }

.mail { display: grid; grid-template-columns: 210px 1fr; min-height: 250px; }
.mail-list { border-right: 0.5px solid var(--border); background: var(--surface-1); }
.mail-list-head { padding: 12px 13px; font-size: 13px; font-weight: 500; border-bottom: 0.5px solid var(--border); }
.mail-item { padding: 11px 13px; border-bottom: 0.5px solid var(--border); cursor: pointer; }
.mail-item.active { background: var(--surface-2); }
.mail-item .from { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; }
.mail-item .from .dot-accent { width: 6px; height: 6px; border-radius: 50%; background: var(--text-accent); }
.mail-item .subj { font-size: 12px; color: var(--text-secondary); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-body { padding: 15px; }
.mail-meta { font-size: 13px; color: var(--text-secondary); margin-bottom: 5px; }
.draft-tag {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; color: var(--text-accent); background: var(--bg-accent);
  padding: 3px 9px; border-radius: var(--radius); margin-bottom: 11px;
}
.draft-tag i { font-size: 13px; }
.draft-text {
  font-size: 13px; line-height: 1.6;
  border: 0.5px solid var(--border); border-radius: var(--radius);
  padding: 13px; background: var(--surface-1);
}

.todo-row { display: flex; align-items: center; gap: 9px; font-size: 13px; }
.todo-row i { font-size: 17px; color: var(--text-muted); }
.todo-row .who { font-size: 11px; color: var(--text-secondary); }

.note {
  font-size: 12px; color: var(--text-muted);
  background: var(--surface-1); border-radius: var(--radius);
  padding: 10px 12px; margin-bottom: 18px;
  display: flex; gap: 8px; align-items: flex-start;
}
.note i { font-size: 15px; margin-top: 1px; }

@media (max-width: 720px) {
  .app { grid-template-columns: 1fr; border: none; }
  .main { padding: 18px 16px 86px; }
  .brand { display: none; }
  .nav-foot { display: none; }
  .sidebar {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto;
    height: auto; flex-direction: row; gap: 0;
    padding: 5px 2px; border-right: none; border-top: 0.5px solid var(--border);
    background: var(--surface-2); z-index: 50; overflow: hidden;
  }
  .nav-item { flex: 1 1 0; min-width: 0; flex-direction: column; gap: 3px; font-size: 9px; padding: 6px 2px; justify-content: center; text-align: center; }
  .nav-item i { font-size: 19px; }
  .nav-label { white-space: normal; line-height: 1.05; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .mail { grid-template-columns: 1fr; }
  .mail-list { border-right: none; border-bottom: 0.5px solid var(--border); }
  .wl-head { display: none; }
  .wl-grid.wl-row { display: flex; align-items: center; gap: 10px; }
  .wl-row .num { display: none; }
  .wl-row .name-cell { flex: 1; }
  .page-title { font-size: 17px; }
  .cat-grid { grid-template-columns: 1fr; }
  .page-head .actions { width: 100%; }
}
