:root {
  color-scheme: light;
  --paper: #f6f3ee;
  --surface: #fffdfa;
  --ink: #22201c;
  --muted: #716a61;
  --line: #ded6cc;
  --accent: #0f766e;
  --accent-strong: #0b5c56;
  --tomato: #c2410c;
  --sky: #2563eb;
  --shadow: 0 10px 26px rgba(39, 34, 28, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

[hidden] {
  display: none !important;
}

.lock-screen {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: max(18px, env(safe-area-inset-top)) 16px max(28px, env(safe-area-inset-bottom));
}

.lock-card {
  width: min(430px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 22px;
}

.lock-card h1 {
  margin-bottom: 10px;
  font-size: 1.8rem;
}

.lock-card p {
  margin: 0 0 16px;
  color: var(--muted);
  line-height: 1.6;
}

.lock-error {
  min-height: 1.4rem;
  color: var(--tomato) !important;
  font-size: 0.9rem;
  font-weight: 700;
}

.app-shell {
  width: min(920px, 100%);
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 16px max(28px, env(safe-area-inset-bottom));
}

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

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(1.9rem, 9vw, 3rem);
  line-height: 1.05;
}

h2 {
  font-size: 1.1rem;
}

.icon-button,
.delete-button,
.text-button,
.primary-button {
  border: 0;
  cursor: pointer;
}

.icon-button {
  display: grid;
  place-items: center;
  flex: 0 0 46px;
  width: 46px;
  height: 46px;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.icon-button svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: var(--ink);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

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

.metric-card {
  min-width: 0;
  padding: 12px;
}

.metric-card span,
.metric-card small {
  display: block;
  color: var(--muted);
}

.metric-card span {
  font-size: 0.78rem;
}

.metric-card strong {
  display: block;
  margin: 7px 0 4px;
  font-size: clamp(1.25rem, 6vw, 2rem);
  line-height: 1;
  white-space: nowrap;
}

.metric-card small {
  min-height: 1.1rem;
  font-size: 0.72rem;
}

.entry-form,
.panel {
  padding: 14px;
  margin-top: 14px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

label {
  display: grid;
  gap: 7px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

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

input {
  min-height: 46px;
  padding: 0 12px;
}

textarea {
  resize: vertical;
  min-height: 76px;
  padding: 11px 12px;
}

input:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}

.primary-button {
  width: 100%;
  min-height: 50px;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  font-weight: 800;
}

.primary-button:active {
  background: var(--accent-strong);
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.section-title span {
  color: var(--muted);
  font-size: 0.82rem;
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.text-button {
  padding: 8px 10px;
  border-radius: 8px;
  background: #f2ede6;
  color: var(--tomato);
  font-size: 0.85rem;
  font-weight: 800;
}

.entry-list {
  display: grid;
  gap: 10px;
}

.empty-state {
  margin: 0;
  padding: 20px 8px;
  color: var(--muted);
  text-align: center;
}

.entry-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.entry-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.entry-head time {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
}

.entry-head strong {
  display: block;
  margin-top: 3px;
  font-size: 1.2rem;
}

.delete-button {
  align-self: start;
  padding: 7px 9px;
  border-radius: 8px;
  background: #fff1eb;
  color: var(--tomato);
  font-size: 0.8rem;
  font-weight: 800;
}

dl {
  display: grid;
  gap: 7px;
  margin: 0;
}

.entry-line {
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 10px;
  color: var(--ink);
  font-size: 0.9rem;
}

dt {
  color: var(--muted);
  font-weight: 700;
}

dd {
  margin: 0;
  white-space: pre-wrap;
}

@media (max-width: 620px) {
  .summary-grid,
  .form-row {
    grid-template-columns: 1fr;
  }

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

  .summary-grid .metric-card:first-child {
    grid-column: 1 / -1;
  }

  .entry-line {
    grid-template-columns: 64px 1fr;
  }
}
