:root {
  --bg: #eef2ed;
  --ink: #1f2a26;
  --card: #fafaf8;
  --line: #d0dacd;
  --primary: #156f69;
  --accent: #c2711f;
  --warn: #ab4b2e;
  --muted: #66756f;
  --positive: #0d8047;
  --negative: #a52f32;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Space Grotesk', sans-serif;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
}

.backdrop {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 8% 12%, rgba(21, 111, 105, 0.2), transparent 35%),
    radial-gradient(circle at 91% 14%, rgba(194, 113, 31, 0.17), transparent 36%),
    linear-gradient(160deg, #edf4ef 0%, #ede3d2 100%);
  z-index: -1;
}

.page-shell {
  width: min(1300px, 95vw);
  margin: 0 auto;
  padding: 26px 0 40px;
}

.hero {
  margin-bottom: 16px;
  background: rgba(250, 250, 248, 0.9);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 22px;
  backdrop-filter: blur(3px);
}

.hero h1 {
  margin: 4px 0 8px;
  font-size: clamp(1.6rem, 2.8vw, 2.4rem);
  font-family: 'Literata', serif;
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-size: 0.75rem;
  color: var(--muted);
}

.subtitle {
  margin: 0;
  color: #44534d;
}

.portal-screen {
  display: block;
}

.hidden {
  display: none !important;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--card);
  padding: 16px;
  box-shadow: 0 8px 20px rgba(20, 33, 22, 0.08);
}

.panel.wide {
  width: 100%;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.panel h2 {
  margin: 0;
  font-size: 1.25rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid var(--line);
  padding: 3px 10px;
  font-size: 0.75rem;
  font-weight: 700;
}

.pill.neutral {
  background: #f1f1ed;
  color: #6c7771;
}

.pill.good {
  background: #e4f4ec;
  color: #176844;
  border-color: #a4dec1;
}

.message {
  min-height: 36px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  display: flex;
  align-items: center;
  padding: 8px 10px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 0.89rem;
}

.message.error {
  color: #8b2c1f;
  border-color: #d79d8f;
  background: #fff0ec;
}

.message.good {
  color: #1d6844;
  border-color: #9fd8b6;
  background: #ebf8f1;
}

.stack {
  display: grid;
  gap: 12px;
}

.field {
  display: grid;
  gap: 6px;
  font-size: 0.88rem;
}

.field span {
  color: #41514a;
}

.field input,
.field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 11px;
  font: inherit;
  background: #fffdf8;
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: #6cb2ab;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.inline-group,
.inline-fields,
.toolbar,
.action-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.inline-fields .field {
  min-width: 175px;
  flex: 1 1 175px;
}

.btn {
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 9px 13px;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
}

.btn:disabled {
  opacity: 0.56;
  cursor: not-allowed;
}

.btn.primary {
  background: var(--primary);
  color: #f2f9f6;
}

.btn.accent {
  background: #efc596;
  border-color: #c2711f;
  color: #4f3115;
}

.btn.warn {
  background: var(--warn);
  color: #fff1ea;
}

.btn.ghost {
  border-color: var(--line);
  color: #3d4b45;
  background: #f4f2eb;
}

.btn.active {
  box-shadow: 0 0 0 3px rgba(21, 111, 105, 0.2);
}

.chooser {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin: 8px 0 20px;
}

.chooser-btn {
  min-width: 220px;
  min-height: 56px;
  font-size: 1rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.stat {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  display: grid;
  gap: 3px;
}

.stat span {
  font-size: 0.75rem;
  color: var(--muted);
}

.stat strong {
  font-size: 0.95rem;
}

.timer-card {
  border: 1px solid #b4cbc8;
  border-radius: 14px;
  padding: 12px;
  background: linear-gradient(138deg, #edf8f6, #f9f2e5);
}

.timer-card p {
  margin: 0;
  color: #3f5954;
}

.timer-card h3 {
  margin: 7px 0 10px;
  font-size: clamp(1.45rem, 2.7vw, 2.1rem);
  letter-spacing: 0.05em;
}

.mini-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.8rem;
}

.summary-card {
  border: 1px solid #b7d3c9;
  border-radius: 13px;
  padding: 12px;
  background: #f4faf7;
}

.summary-card h4 {
  margin: 0 0 8px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.summary-grid div {
  background: #fff;
  border: 1px solid #d8e8df;
  border-radius: 10px;
  padding: 8px;
  display: grid;
  gap: 2px;
}

.summary-grid span {
  font-size: 0.72rem;
  color: var(--muted);
}

.summary-grid strong {
  font-size: 0.9rem;
}

.balance-positive {
  color: var(--positive);
  font-weight: 700;
}

.balance-negative {
  color: var(--negative);
  font-weight: 700;
  background: #ffecee;
  border-radius: 6px;
  padding: 1px 5px;
}

.balance-neutral {
  color: #495a53;
  font-weight: 700;
}

.subpanel {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  background: #fffdf8;
}

.subpanel h4 {
  margin: 0 0 10px;
  font-size: 1rem;
}

.calendar-grid {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 7px;
}

.calendar-day {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px;
  background: #fff;
  min-height: 92px;
  display: grid;
  gap: 6px;
}

.calendar-day small {
  color: var(--muted);
}

.calendar-day.working {
  border-color: #a9d8be;
  background: #f0faf3;
}

.calendar-day.offday {
  border-color: #e5b5b5;
  background: #fff3f3;
}

.calendar-day .tiny-btns {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

.tiny-btn {
  font-size: 0.7rem;
  border-radius: 7px;
  padding: 3px 7px;
  border: 1px solid var(--line);
  background: #f7f4ee;
  cursor: pointer;
}

.table-wrap {
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: auto;
  background: #fff;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 650px;
}

th,
td {
  text-align: left;
  padding: 9px 10px;
  border-bottom: 1px solid #ece6d9;
  font-size: 0.82rem;
}

th {
  background: #f6f3ea;
  color: #4f5a55;
  position: sticky;
  top: 0;
}

.muted {
  color: var(--muted);
}

@media (max-width: 980px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .calendar-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
