/* Dark is the default theme; :root[data-theme="light"] below is the
   override a viewer opts into via the toggle (see theme.js). Note that
   --mint-dark/--peach-ink are "whichever shade of that color has
   enough contrast against --paper in THIS theme" - not literally
   darker in both themes, since dark-on-dark would be unreadable. */
:root {
  --ink: #eef1ee;
  --ink-soft: #a7b1aa;
  --paper: #121b17;
  --card: #1b2622;
  --line: #2b3a33;
  --mint: #35c79a;
  --mint-dark: #8fe9cb;
  --mint-pale: #17352b;
  --peach: #f2a65d;
  --peach-pale: #3a2a18;
  --peach-ink: #ffd9ac;
  --berry: #e8788c;
  --berry-pale: #3a1d22;
  --grey-pale: #28332e;
  --hover-tint: rgba(255, 255, 255, 0.04);
  --topbar-bg: #0c1613;
  --topbar-fg: #ffffff;
  --toast-bg: #0c1613;
  --toast-fg: #ffffff;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 8px 24px rgba(0, 0, 0, 0.45);
  --radius: 16px;
}

:root[data-theme="light"] {
  --ink: #1c2521;
  --ink-soft: #55645c;
  --paper: #fbfaf6;
  --card: #ffffff;
  --line: #e4e1d6;
  --mint: #1f8a70;
  --mint-dark: #136654;
  --mint-pale: #e4f5ef;
  --peach: #f4a35a;
  --peach-pale: #fef0e2;
  --peach-ink: #8a5520;
  --berry: #c0455b;
  --berry-pale: #fbe8ea;
  --grey-pale: #eceae2;
  --hover-tint: rgba(0, 0, 0, 0.03);
  --topbar-bg: #1c2521;
  --topbar-fg: #ffffff;
  --toast-bg: #1c2521;
  --toast-fg: #ffffff;
  --shadow: 0 1px 2px rgba(28, 37, 33, 0.06), 0 8px 24px rgba(28, 37, 33, 0.06);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Segoe UI", Avenir, -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--mint-dark); text-decoration: none; }

.wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 20px 16px 72px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--topbar-bg);
  color: var(--topbar-fg);
}
.topbar .brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.01em;
}
.topbar .brand .mark { font-size: 1.25rem; }
.topbar nav { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.topbar nav a { color: #d9ded9; font-size: 0.92rem; }
.topbar nav a.active, .topbar nav a:hover { color: #fff; }
.topbar form { margin: 0; }
.topbar button.link {
  color: #d9ded9; font-size: 0.9rem;
}

h1 { font-size: 1.5rem; margin: 0 0 4px; }
h2 { font-size: 1.15rem; margin: 28px 0 10px; }
p.sub { color: var(--ink-soft); margin: 0 0 20px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 16px;
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 560px) {
  .grid-3 { grid-template-columns: 1fr 1fr; }
}

.stat {
  background: var(--mint-pale);
  border-radius: 12px;
  padding: 14px;
}
.stat .n { font-size: 1.6rem; font-weight: 700; color: var(--mint-dark); }
.stat .l { font-size: 0.82rem; color: var(--ink-soft); }

label { display: block; font-size: 0.85rem; color: var(--ink-soft); margin: 14px 0 6px; font-weight: 600; }
input[type=text], input[type=date], input[type=number], input[type=email], input[type=password], select, textarea {
  width: 100%;
  padding: 11px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--card);
  font-size: 1rem;
  color: var(--ink);
}
select { appearance: none; }
textarea { resize: vertical; }

.choice-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 8px; }
@media (min-width: 480px) {
  .choice-grid.mode { grid-template-columns: repeat(3, 1fr); }
}

.tile {
  display: block;
  padding: 20px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--card);
  text-align: center;
  font-weight: 700;
  color: var(--ink);
  box-shadow: var(--shadow);
}
.tile .emoji { display: block; font-size: 1.8rem; margin-bottom: 6px; }
.tile.mint { background: var(--mint-pale); border-color: var(--mint); color: var(--mint-dark); }
.tile.peach { background: var(--peach-pale); border-color: var(--peach); color: var(--peach-ink); }
.tile.berry { background: var(--berry-pale); border-color: var(--berry); color: var(--berry); }

button, .btn {
  display: inline-block;
  padding: 11px 18px;
  border-radius: 10px;
  border: none;
  background: var(--mint);
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
}
button.secondary, .btn.secondary { background: var(--card); color: var(--ink); border: 1px solid var(--line); }
button.danger { background: var(--berry); }
button.full, .btn.full { width: 100%; text-align: center; }
button:disabled { opacity: 0.5; cursor: not-allowed; }
button.link {
  background: none; border: none; cursor: pointer; padding: 0;
  font: inherit; font-weight: 400;
}

.stepper { display: flex; align-items: center; gap: 10px; }
.stepper button { width: 42px; height: 42px; border-radius: 50%; font-size: 1.2rem; padding: 0; line-height: 1; }
.stepper .val { min-width: 54px; text-align: center; font-size: 1.15rem; font-weight: 700; }

.entry-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0; border-bottom: 1px solid var(--line);
}
.entry-row:last-child { border-bottom: none; }
.entry-row .meta { font-size: 0.85rem; color: var(--ink-soft); }
.entry-row .remove { color: var(--berry); background: none; border: none; font-weight: 700; cursor: pointer; }

table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
th { color: var(--ink-soft); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; }
tr:hover td { background: var(--hover-tint); }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 0.75rem; font-weight: 700; }
.badge.mint { background: var(--mint-pale); color: var(--mint-dark); }
.badge.peach { background: var(--peach-pale); color: var(--peach-ink); }
.badge.berry { background: var(--berry-pale); color: var(--berry); }
.badge.grey { background: var(--grey-pale); color: var(--ink-soft); }

.bar-row { display: grid; grid-template-columns: 140px 1fr 70px; align-items: center; gap: 10px; padding: 8px 0; }
.bar-track { height: 10px; background: var(--grey-pale); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: var(--mint); }
.bar-fill.urgent { background: var(--berry); }
.bar-fill.warn { background: var(--peach); }

.searchbox { position: relative; }
.searchbox .results {
  position: absolute; left: 0; right: 0; top: 100%; z-index: 20;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  max-height: 220px; overflow-y: auto; box-shadow: var(--shadow); margin-top: 4px;
}
.searchbox .results div { padding: 10px 12px; cursor: pointer; }
.searchbox .results div:hover { background: var(--mint-pale); }
.searchbox .results.empty { display: none; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--toast-bg); color: var(--toast-fg); padding: 10px 18px; border-radius: 999px;
  font-size: 0.9rem; opacity: 0; transition: opacity 0.2s; pointer-events: none;
  box-shadow: var(--shadow);
}
.toast.show { opacity: 1; }

.warn-banner {
  background: var(--peach-pale); color: var(--peach-ink); border-radius: 10px;
  padding: 10px 14px; font-size: 0.88rem; margin-bottom: 14px;
}

footer.app { text-align: center; color: var(--ink-soft); font-size: 0.78rem; margin-top: 36px; }
