:root {
  --bg: #0f1115;
  --panel: #171a21;
  --panel-2: #1e222b;
  --border: #2a2f3a;
  --text: #e8eaed;
  --text-dim: #9aa1ac;
  --accent: #4f8cff;
  --accent-dim: #2c3f66;
  --good: #3ecf8e;
  --warn: #f5b942;
  --bad: #f2545b;
  --radius: 10px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

#app {
  min-height: 100vh;
}

a { color: var(--accent); }

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  border-radius: var(--radius);
  padding: 9px 16px;
  font-size: 14px;
  font-weight: 600;
  background: var(--accent);
  color: #fff;
  transition: opacity .15s ease;
}
button:hover { opacity: .88; }
button.secondary {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
}
button.danger { background: var(--bad); }
button:disabled { opacity: .45; cursor: not-allowed; }

input, select, textarea {
  font-family: inherit;
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 9px 11px;
  font-size: 14px;
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
}
label {
  display: block;
  font-size: 12.5px;
  color: var(--text-dim);
  margin-bottom: 5px;
  margin-top: 12px;
}
label:first-child { margin-top: 0; }

/* ---------- Login ---------- */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-card {
  width: 340px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
}
.login-card h1 {
  font-size: 18px;
  margin: 0 0 4px;
}
.login-card p.sub {
  color: var(--text-dim);
  font-size: 13px;
  margin: 0 0 20px;
}
.login-card button { width: 100%; margin-top: 18px; }
.error-msg {
  color: var(--bad);
  font-size: 13px;
  margin-top: 10px;
}

/* ---------- Shell ---------- */
.shell {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 100vh;
}
.sidebar {
  background: var(--panel);
  border-right: 1px solid var(--border);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
}
.sidebar .brand {
  font-weight: 700;
  font-size: 15px;
  padding: 0 8px 18px;
}
.sidebar .brand small {
  display: block;
  color: var(--text-dim);
  font-weight: 400;
  font-size: 11.5px;
  margin-top: 2px;
}
.nav-item {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  color: var(--text-dim);
  font-weight: 500;
  padding: 9px 10px;
  border-radius: 8px;
  margin-bottom: 2px;
  font-size: 13.5px;
  text-decoration: none;
  box-sizing: border-box;
}
.nav-item:hover { background: var(--panel-2); color: var(--text); opacity: 1; }
.nav-item:visited { color: var(--text-dim); }
.nav-item.active { background: var(--accent-dim); color: var(--accent); }
.sidebar .spacer { flex: 1; }
.sidebar .who {
  font-size: 12px;
  color: var(--text-dim);
  padding: 8px 8px 4px;
  border-top: 1px solid var(--border);
  margin-top: 10px;
}
.sidebar .who strong { color: var(--text); display: block; font-size: 13px; }

.main {
  padding: 26px 32px 60px;
  max-width: 1180px;
}
.main h2 {
  font-size: 20px;
  margin: 0 0 4px;
}
.main p.page-sub {
  color: var(--text-dim);
  font-size: 13.5px;
  margin: 0 0 22px;
}

/* ---------- Layout bits ---------- */
.grid {
  display: grid;
  gap: 14px;
}
.grid.cols-2 { grid-template-columns: 1fr 1fr; }
.grid.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) {
  .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; }
  .shell { grid-template-columns: 1fr; }
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}
.card h3 {
  margin: 0 0 12px;
  font-size: 14px;
  color: var(--text-dim);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.stat {
  font-size: 26px;
  font-weight: 700;
}
.stat.small { font-size: 20px; }
.stat-label {
  color: var(--text-dim);
  font-size: 12.5px;
  margin-top: 2px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
th {
  text-align: left;
  color: var(--text-dim);
  font-weight: 600;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .03em;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}
td {
  padding: 10px 10px;
  border-bottom: 1px solid var(--border);
}
tr:last-child td { border-bottom: none; }
.right { text-align: right; }

.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .02em;
}
.badge.good { background: rgba(62,207,142,.15); color: var(--good); }
.badge.warn { background: rgba(245,185,66,.15); color: var(--warn); }
.badge.bad { background: rgba(242,84,91,.15); color: var(--bad); }
.badge.neutral { background: var(--panel-2); color: var(--text-dim); }

.progress-track {
  background: var(--panel-2);
  border-radius: 999px;
  height: 8px;
  overflow: hidden;
  margin-top: 6px;
}
.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
}
.progress-fill.good { background: var(--good); }
.progress-fill.warn { background: var(--warn); }
.progress-fill.bad { background: var(--bad); }

.bucket-row {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.bucket-row:last-child { border-bottom: none; }
.bucket-row .top-line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 13.5px;
}
.bucket-row .top-line .name { font-weight: 600; }
.bucket-row .meta {
  color: var(--text-dim);
  font-size: 12px;
  margin-top: 3px;
}

.form-row { display: flex; gap: 12px; }
.form-row > div { flex: 1; }

.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 13.5px;
  max-width: 360px;
  z-index: 100;
}
.toast.good { border-color: var(--good); }
.toast.bad { border-color: var(--bad); }

.section-gap { margin-top: 26px; }
.muted { color: var(--text-dim); }
.hr { border: none; border-top: 1px solid var(--border); margin: 18px 0; }

.tag-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.tag-btns button { padding: 6px 12px; font-size: 12.5px; }

.wife-shell {
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px;
}
.wife-card {
  width: 100%;
  max-width: 460px;
}
