:root {
  --ink: #0b2530;
  --accent: #1c94ab;
  --accent-bright: #46c2d4;
  --bg: #eef5f6;
  --surface: #ffffff;
  --muted: #5c7680;
  --border: #d7e4e6;
  --danger: #c0392b;
}

* { box-sizing: border-box; }

body {
  color: var(--ink);
}

h1, h2, h3, h4 { margin: 0 0 0.5em; }

/* ---------------- Login ---------------- */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.login-card {
  background: var(--surface);
  border-radius: 16px;
  padding: 32px;
  width: 100%;
  max-width: 360px;
  box-shadow: 0 8px 30px rgba(11, 37, 48, 0.12);
  text-align: center;
}

.login-logo {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  margin-bottom: 12px;
}

.login-card h1 { font-size: 1.3rem; }
.login-card .sub { color: var(--muted); margin-bottom: 20px; }

.login-card label {
  display: block;
  text-align: left;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 12px;
}

.login-card input {
  width: 100%;
  margin-top: 4px;
}

/* ---------------- Shell ---------------- */
.app-shell { min-height: 100vh; }

.top-bar {
  background: var(--ink);
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
}

.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.brand img { width: 32px; height: 32px; border-radius: 8px; }

.who { display: flex; align-items: center; gap: 12px; font-size: 0.9rem; }

.tabs {
  display: flex;
  gap: 4px;
  padding: 8px 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}

.tab-btn {
  border: none;
  background: transparent;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--muted);
  white-space: nowrap;
}

.tab-btn.active { background: var(--ink); color: white; }

.content { padding: 20px; max-width: 900px; margin: 0 auto; }

/* ---------------- Buttons / inputs ---------------- */
.btn {
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 0.9rem;
  cursor: pointer;
}

.btn-accent { background: var(--accent); color: white; }
.btn-accent:hover { background: var(--accent-bright); }
.btn-ghost { background: var(--bg); color: var(--ink); border: 1px solid var(--border); }
.btn-small { padding: 6px 12px; font-size: 0.8rem; }
.btn-block { width: 100%; }

input, select {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 0.9rem;
  font-family: inherit;
}

/* ---------------- Cards / grid ---------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.dash-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  font-size: 0.85rem;
}

.dash-grid h4 { margin-bottom: 4px; font-size: 0.8rem; color: var(--muted); }
.dash-grid p { margin: 2px 0; }

.badge {
  background: var(--accent);
  color: white;
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: normal;
}

.muted { color: var(--muted); }
.error-text { color: var(--danger); }

/* ---------------- Forms ---------------- */
.entry-form {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 20px;
}

.entry-form.inline { padding: 0; border: none; background: none; margin: 12px 0 0; }

.entry-form label {
  display: flex;
  flex-direction: column;
  font-size: 0.8rem;
  color: var(--muted);
  gap: 4px;
}

.entry-form fieldset {
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex;
  gap: 12px;
}

.entry-form fieldset legend {
  font-size: 0.75rem;
  color: var(--muted);
  padding: 0 6px;
}

/* ---------------- Charts ---------------- */
.chart-container {
  position: relative;
  height: 240px;
  margin-bottom: 20px;
}

.chart-container-small {
  height: 80px;
  margin-top: 6px;
}

/* ---------------- Water ---------------- */
.progress {
  background: var(--bg);
  border-radius: 999px;
  height: 12px;
  overflow: hidden;
  margin: 8px 0;
}

.progress-fill { background: var(--accent); height: 100%; }

.quick-add { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }

/* ---------------- Settings ---------------- */
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.setting-row:last-child { border-bottom: none; }

/* ---------------- Tables ---------------- */
.history-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  font-size: 0.85rem;
}

.history-table th, .history-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}

.history-table tr:last-child td { border-bottom: none; }

.member-list { list-style: none; padding: 0; margin: 0; }
.member-list li { padding: 6px 0; border-bottom: 1px solid var(--border); }
.member-list li:last-child { border-bottom: none; }
