:root {
  color-scheme: light;
  --bg: #f7f7f4;
  --panel: #ffffff;
  --ink: #1f2926;
  --muted: #68746f;
  --line: #dde4df;
  --primary: #17766b;
  --primary-soft: #e7f3ef;
  --warn: #b7442e;
  --warn-soft: #fff0ed;
  --shadow: 0 18px 45px rgba(31, 41, 38, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.app-shell {
  width: min(960px, 100%);
  margin: 0 auto;
  padding: 28px;
}

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

.topbar h1 {
  margin: 2px 0 0;
  font-size: 34px;
  line-height: 1.1;
}

.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0;
}

.icon-button {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--panel);
  box-shadow: var(--shadow);
  color: var(--primary);
  font-weight: 800;
}

.topbar-actions {
  display: flex;
  gap: 10px;
}

.install-hint {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffef9;
  color: var(--muted);
  font-size: 14px;
}

.install-hint button {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: #eef4f1;
  color: var(--primary);
  font-weight: 800;
}

.empty-state,
.hero-panel,
.metric-panel,
.quick-log,
.form-panel,
.list-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.empty-state {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 22px;
  padding: 30px;
}

.empty-state h2 {
  margin: 8px 0;
  font-size: 28px;
}

.empty-state p:last-child,
.empty-copy {
  color: var(--muted);
  line-height: 1.6;
}

.dashboard {
  display: grid;
  gap: 18px;
}

.hero-panel {
  min-height: 176px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 30px;
  background: linear-gradient(135deg, #fffef9 0%, #e6f5f0 100%);
}

.aligner-number {
  margin-top: 8px;
  font-size: 44px;
  font-weight: 750;
  line-height: 1;
}

.status-badge {
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 13px;
}

.status-badge.overdue {
  background: var(--warn-soft);
  color: var(--warn);
}

.metric-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 16px;
}

.metric-panel {
  padding: 22px;
}

.metric-panel p {
  margin: 0 0 10px;
  color: var(--muted);
}

.metric-panel strong {
  display: block;
  font-size: 30px;
  line-height: 1.2;
}

.metric-panel.large strong {
  font-size: 32px;
}

.metric-panel span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
}

.quick-log,
.form-panel,
.list-panel {
  padding: 22px;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.section-head h2 {
  margin: 0;
  font-size: 22px;
}

.section-head span {
  color: var(--muted);
}

.quick-buttons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 14px;
}

.quick-buttons button {
  height: 42px;
  border-radius: 8px;
  background: #f1f5f2;
  color: var(--ink);
  font-weight: 650;
}

.field {
  display: grid;
  grid-template-columns: 160px 1fr;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid #edf0ec;
}

.field:last-of-type {
  border-bottom: 0;
}

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

.field input {
  width: 100%;
  min-width: 0;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
  background: #fff;
}

.primary-button,
.secondary-button {
  min-height: 44px;
  border-radius: 8px;
  padding: 0 18px;
  font-weight: 700;
}

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

.secondary-button {
  background: var(--primary-soft);
  color: var(--primary);
}

.quick-log .secondary-button,
.form-panel .primary-button,
.form-panel .secondary-button {
  width: 100%;
  margin-top: 18px;
}

.action-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin: 24px 0 18px;
}

.tabs button {
  height: 42px;
  border-radius: 8px;
  background: #e9eeeb;
  color: var(--muted);
  font-weight: 700;
}

.tabs button.active {
  background: var(--ink);
  color: #fff;
}

.tab-panel {
  margin-top: 16px;
}

.form-panel.compact {
  margin-bottom: 16px;
}

.list-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid #edf0ec;
}

.list-item:last-child {
  border-bottom: 0;
}

.list-item strong {
  display: block;
  margin-bottom: 5px;
}

.list-item span {
  color: var(--muted);
}

.hidden {
  display: none !important;
}

@media (max-width: 720px) {
  .app-shell {
    padding: 18px;
  }

  .empty-state,
  .hero-panel,
  .action-row {
    display: grid;
  }

  .metric-grid {
    grid-template-columns: 1fr 1fr;
  }

  .metric-panel.large {
    grid-column: 1 / -1;
  }

  .field {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}
