:root {
  --teal-900: #163642;
  --teal-700: #2c6e8e;
  --teal-500: #4a94b5;
  --teal-100: #e6f1f5;
  --amber-500: #c98a2e;
  --amber-100: #faf0dd;
  --ink: #1c2733;
  --ink-soft: #4a5a68;
  --line: #d8e2e8;
  --bg: #f6f9fa;
  --card-bg: #ffffff;
  --gold: #f4c542;
  --danger: #b3392c;
  --danger-bg: #fbe9e6;
  --radius: 10px;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
}

a { color: var(--teal-700); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  background: var(--teal-900);
  color: white;
}
.topbar-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.brand {
  color: white;
  font-weight: 700;
  font-size: 1.1rem;
}
.brand:hover { text-decoration: none; opacity: 0.9; }
.topnav {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: center;
  font-size: 0.92rem;
}
.topnav a { color: #cfe4ec; }
.topnav a:hover { color: white; }

.link-btn {
  background: none;
  border: none;
  color: #cfe4ec;
  font: inherit;
  cursor: pointer;
  padding: 0;
}
.link-btn:hover { color: white; text-decoration: underline; }
.inline-form { display: inline; }

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
}

h1 { font-size: 1.5rem; margin: 0 0 0.25rem; }
h2 { font-size: 1.15rem; margin: 1.75rem 0 0.75rem; color: var(--teal-900); }
.subtitle { color: var(--ink-soft); margin: 0 0 1.5rem; }

.card {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

.grid {
  display: grid;
  gap: 1rem;
}
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

.stat {
  background: var(--teal-100);
  border-radius: var(--radius);
  padding: 1rem;
}
.stat .label { font-size: 0.8rem; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.03em; }
.stat .value { font-size: 1.6rem; font-weight: 700; color: var(--teal-900); font-family: var(--font-mono); }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}
th, td {
  text-align: left;
  padding: 0.55rem 0.6rem;
  border-bottom: 1px solid var(--line);
}
th { color: var(--ink-soft); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.02em; }
td.num, th.num { text-align: right; font-family: var(--font-mono); }
tr.rank-1 { background: linear-gradient(90deg, rgba(244,197,66,0.25), transparent); }
tr.rank-1 td:first-child { font-weight: 700; }

.table-wrap { overflow-x: auto; }

form.stacked { display: flex; flex-direction: column; gap: 0.9rem; max-width: 480px; }
.field { display: flex; flex-direction: column; gap: 0.3rem; }
.field label { font-size: 0.85rem; font-weight: 600; color: var(--ink-soft); }
.field-row { display: flex; gap: 1rem; flex-wrap: wrap; }
.field-row .field { flex: 1; min-width: 140px; }

input[type=text], input[type=password], input[type=number], input[type=date], input[type=time],
textarea, select {
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
  background: white;
  color: var(--ink);
}
textarea { resize: vertical; width: 100%; }
input[type=file] { font-size: 0.88rem; }
input[type=range] { width: 100%; accent-color: var(--teal-700); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--teal-500); outline-offset: 1px; }

.checkbox-row { display: flex; align-items: center; gap: 0.5rem; }

button, .btn {
  background: var(--teal-700);
  color: white;
  border: none;
  padding: 0.6rem 1.1rem;
  border-radius: 6px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
button:hover, .btn:hover { background: var(--teal-900); text-decoration: none; }
.btn-secondary { background: transparent; color: var(--teal-700); border: 1px solid var(--teal-700); }
.btn-secondary:hover { background: var(--teal-100); color: var(--teal-900); }

.pill {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}
.pill-amber { background: var(--amber-100); color: var(--amber-500); }
.pill-teal { background: var(--teal-100); color: var(--teal-700); }

.alert {
  padding: 0.8rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-size: 0.92rem;
}
.alert-error { background: var(--danger-bg); color: var(--danger); border: 1px solid #eec9c3; }
.alert-success { background: var(--teal-100); color: var(--teal-900); border: 1px solid #bcd8e2; }

.explainer p { margin: 0.4rem 0; }
.explainer ul { margin: 0.4rem 0; padding-left: 1.2rem; }

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--teal-900);
  padding: 1.5rem;
}
.login-card {
  background: white;
  border-radius: var(--radius);
  padding: 2rem;
  width: 100%;
  max-width: 360px;
}
.login-card h1 { text-align: center; }
.login-card .subtitle { text-align: center; }
.login-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.25rem 0;
  color: var(--ink-soft);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.login-divider::before, .login-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--teal-100);
}

.activity-grid { font-size: 0.82rem; }
.activity-grid th, .activity-grid td { padding: 0.35rem 0.4rem; }
.week-cell { display: flex; flex-direction: column; gap: 0.15rem; align-items: center; }

@media (max-width: 700px) {
  .topnav { font-size: 0.85rem; gap: 0.6rem; }
  main { padding: 1rem 0.85rem 2.5rem; }
}
