:root {
  color-scheme: light;
  --bg: #f7f8fa;
  --panel: #ffffff;
  --text: #18202a;
  --muted: #667085;
  --line: #d9dee7;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --danger: #b42318;
  --ok: #087443;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
  min-height: 38px;
  padding: 0 14px;
  cursor: pointer;
}

button:hover:not(:disabled) {
  border-color: var(--accent);
}

button:disabled,
input:disabled,
select:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.shell {
  width: min(1060px, calc(100% - 32px));
  margin: 28px auto;
}

.topbar,
.toolbar,
.summary,
.checks,
.log-section {
  margin-bottom: 18px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.05;
}

.topbar p,
.section-title p,
.log-meta {
  color: var(--muted);
}

.mode {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  padding: 8px 12px;
  white-space: nowrap;
}

.mode.write {
  border-color: #9cd2b2;
  color: var(--ok);
}

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

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

.goal,
.checks,
.log-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.goal {
  padding: 18px;
}

.goal-header,
.section-title,
.log-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.goal h2,
.log-section h2 {
  font-size: 18px;
}

progress {
  width: 100%;
  height: 14px;
  margin: 18px 0;
  accent-color: var(--accent);
}

.goal button,
.manual-entry button {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.goal button:hover:not(:disabled),
.manual-entry button:hover:not(:disabled) {
  background: var(--accent-dark);
}

.checks {
  display: flex;
  gap: 22px;
  padding: 16px 18px;
}

.checks label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.checks input {
  width: 18px;
  height: 18px;
}

.log-section {
  padding: 18px;
}

.manual-entry {
  display: grid;
  grid-template-columns: 150px 160px 110px minmax(180px, 1fr) 90px;
  gap: 8px;
  margin: 16px 0;
}

.manual-entry input,
.manual-entry select {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  background: #fff;
}

.log-list {
  display: grid;
  gap: 8px;
}

.log-item {
  border-top: 1px solid var(--line);
  padding: 12px 0 4px;
}

.log-title {
  text-transform: capitalize;
}

.delete-button {
  color: var(--danger);
}

@media (max-width: 760px) {
  .topbar,
  .summary,
  .checks {
    align-items: stretch;
    flex-direction: column;
  }

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

  .manual-entry {
    grid-template-columns: 1fr;
  }

  .goal-header,
  .section-title,
  .log-item {
    align-items: flex-start;
    flex-direction: column;
  }
}
