:root {
  color-scheme: light;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  --ink: #172026;
  --muted: #68747d;
  --line: #dfe6e9;
  --paper: #f7f9f8;
  --panel: #ffffff;
  --primary: #08605f;
  --primary-dark: #064d4c;
  --accent: #eeb868;
  --danger: #b13b3b;
  --ok: #2f7d4f;
  --shadow: 0 18px 60px rgba(25, 35, 40, 0.11);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
}

button,
select,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 24px;
  background: #102227;
  color: #f5fbfa;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 54px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: var(--accent);
  color: #182325;
  font-weight: 800;
}

.brand small,
.storage-note span,
.field-label {
  color: rgba(245, 251, 250, 0.68);
}

.field-label {
  margin-bottom: -10px;
  font-size: 0.82rem;
}

select,
input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

select,
input {
  min-height: 42px;
  padding: 0 12px;
}

textarea {
  min-height: 230px;
  padding: 14px;
  resize: vertical;
}

.side-actions {
  display: grid;
  gap: 10px;
}

.nav-tabs {
  display: grid;
  gap: 8px;
  margin-top: 6px;
}

.nav-tabs button {
  min-height: 42px;
  border-radius: 8px;
  padding: 0 12px;
  background: transparent;
  color: rgba(245, 251, 250, 0.82);
  text-align: left;
}

.nav-tabs button.active,
.nav-tabs button:hover {
  background: rgba(255, 255, 255, 0.11);
  color: #fff;
}

.storage-note {
  margin-top: auto;
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
}

.workspace {
  min-width: 0;
  padding: 28px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  margin-bottom: 26px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.8rem, 4vw, 3rem);
}

h2 {
  margin-bottom: 0;
  font-size: 1.05rem;
}

.topbar-actions,
.import-actions,
.dialog-actions,
.period-controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.primary,
.secondary,
.ghost,
.icon-button {
  min-height: 40px;
  border-radius: 8px;
  padding: 0 14px;
  font-weight: 700;
}

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

.primary:hover {
  background: var(--primary-dark);
}

.secondary {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.ghost {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
}

.icon-button {
  width: 40px;
  padding: 0;
  background: var(--accent);
  color: #172026;
  font-size: 1.25rem;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.metric {
  display: grid;
  gap: 8px;
  padding: 18px;
}

.metric span,
.panel-heading span,
.helper-text,
td small {
  color: var(--muted);
}

.metric strong {
  font-size: 1.55rem;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(280px, 0.8fr);
  gap: 18px;
}

.finance-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.85fr) minmax(0, 1.15fr);
  gap: 18px;
  margin-bottom: 18px;
}

.panel {
  padding: 18px;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.chart-panel {
  min-height: 420px;
}

canvas {
  width: 100%;
  max-height: 330px;
}

.entry-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.entry-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.entry-form button {
  grid-column: 1 / -1;
}

.period-controls select {
  min-width: 130px;
}

.daily-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(74px, 1fr));
  gap: 8px;
}

.day-card {
  min-height: 92px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.day-card.empty {
  background: #f1f5f4;
  color: var(--muted);
}

.day-card strong,
.day-card span {
  display: block;
}

.day-card strong {
  margin-bottom: 8px;
}

.day-card span {
  font-size: 0.78rem;
  line-height: 1.45;
}

.day-card .positive {
  color: var(--ok);
}

.day-card .negative {
  color: var(--danger);
}

.task-list,
.task-board {
  display: grid;
  gap: 10px;
}

.task-card {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.task-card.done {
  opacity: 0.64;
}

.task-card header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.task-card strong {
  line-height: 1.3;
}

.task-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pill {
  border-radius: 999px;
  padding: 4px 9px;
  background: #edf4f3;
  color: var(--primary-dark);
  font-size: 0.78rem;
  font-weight: 700;
}

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

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

th {
  color: var(--muted);
  font-size: 0.82rem;
}

td input,
td select {
  min-width: 130px;
}

.row-actions {
  display: flex;
  justify-content: flex-end;
}

.delete-button {
  min-width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #f8e8e8;
  color: var(--danger);
  font-weight: 800;
}

.import-panel {
  max-width: 880px;
}

dialog {
  width: min(460px, calc(100vw - 32px));
  border: 0;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(16, 34, 39, 0.52);
}

.dialog-card {
  display: grid;
  gap: 16px;
}

.dialog-card label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-weight: 700;
}

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

  .sidebar {
    min-height: auto;
  }

  .storage-note {
    margin-top: 0;
  }

  .metrics-grid,
  .dashboard-grid,
  .finance-layout {
    grid-template-columns: 1fr 1fr;
  }

  .daily-grid {
    grid-template-columns: repeat(4, minmax(74px, 1fr));
  }
}

@media (max-width: 680px) {
  .workspace {
    padding: 18px;
  }

  .topbar,
  .panel-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .metrics-grid,
  .dashboard-grid,
  .finance-layout,
  .entry-form {
    grid-template-columns: 1fr;
  }

  .topbar-actions,
  .import-actions,
  .dialog-actions,
  .period-controls {
    display: grid;
  }

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