:root {
  color-scheme: light;
  --bg: #f4f7f8;
  --surface: #ffffff;
  --ink: #17242a;
  --muted: #627177;
  --line: #d7e0e4;
  --accent: #0d5c7d;
  --accent-dark: #084861;
  --accent-soft: #d7edf5;
  --warn: #c26a1d;
  --warn-soft: #fbedd8;
  --danger: #b24e3f;
  --danger-soft: #f8e3df;
  --ok: #1a8b63;
  --ok-soft: #d8f1e7;
  --shadow: 0 12px 28px rgba(26, 44, 50, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, #fbfdfd 0%, var(--bg) 100%);
  color: var(--ink);
  font-family: "Avenir Next", "Hiragino Sans", "Yu Gothic", sans-serif;
  line-height: 1.5;
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  background: rgba(251, 253, 253, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--accent-dark);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: 1.42rem;
  line-height: 1.15;
}

main {
  width: min(820px, 100%);
  margin: 0 auto;
  padding: 14px 12px 36px;
}

.hero-panel,
.panel {
  margin-bottom: 12px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.hero-panel {
  display: grid;
  gap: 12px;
  background: linear-gradient(135deg, rgba(13, 92, 125, 0.08), rgba(215, 237, 245, 0.62)), var(--surface);
}

.hero-panel h2 {
  margin-bottom: 5px;
  font-size: 1.45rem;
}

.hero-panel p {
  margin-bottom: 0;
  color: var(--muted);
}

.hero-badges,
.action-row,
.shopping-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.badge,
.pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 0.8rem;
  font-weight: 900;
}

.badge.warning,
.pill.warning {
  background: var(--warn-soft);
  color: var(--warn);
}

.feedback-bar {
  padding: 11px 12px;
  border-radius: 8px;
  background: var(--ok-soft);
  color: var(--ok);
  font-weight: 900;
}

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

.section-heading h2 {
  margin-bottom: 0;
  font-size: 1.16rem;
}

.fold-button {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  color: var(--ink);
  font: inherit;
  font-weight: 900;
  text-align: left;
}

.fold-body {
  margin-top: 12px;
}

.small-button,
.primary-button {
  min-height: 42px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  font-weight: 900;
}

.primary-button {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

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

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

.task-card {
  grid-template-columns: 1fr auto;
  align-items: start;
}

.task-card .action-row {
  grid-column: 1 / -1;
}

.task-card.warn {
  border-color: #efcc9b;
  background: #fff8ec;
}

.meta,
.helper-text {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

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

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

input,
textarea {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  color: var(--ink);
}

textarea {
  min-height: 110px;
  resize: vertical;
}

.wide {
  grid-column: 1 / -1;
}

.quality-alert {
  margin-top: 12px;
  padding: 12px;
  border-radius: 8px;
  font-weight: 900;
}

.quality-alert.ok {
  background: var(--ok-soft);
  color: var(--ok);
}

.quality-alert.warn {
  background: var(--warn-soft);
  color: var(--warn);
}

.quality-alert.danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.link-card {
  flex: 1 1 140px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-weight: 900;
  text-decoration: none;
}

.mini-link {
  flex: 0 1 110px;
  min-height: 42px;
}

.photo-input input {
  padding: 8px 0;
  border: none;
  background: transparent;
}

.photo-preview-shell {
  display: grid;
  place-items: center;
  min-height: 140px;
  margin-top: 12px;
  padding: 10px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.photo-preview-shell img,
.log-card img {
  width: 100%;
  max-height: 300px;
  object-fit: contain;
  border-radius: 8px;
}

.empty {
  margin-bottom: 0;
  padding: 18px 0;
  color: var(--muted);
  text-align: center;
}

.days-line {
  margin: 6px 0 2px;
  font-size: 0.95rem;
  font-weight: 800;
}

.days-line.none {
  color: var(--warn);
  font-size: 0.86rem;
}

.days-count {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--accent);
  color: #ffffff;
  font-size: 1.05rem;
}

.inline-editor {
  grid-column: 1 / -1;
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.inline-editor[hidden] {
  display: none;
}

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

.buy-note {
  grid-column: 1 / -1;
  margin-top: -4px;
}

.app-footer {
  padding: 0 0 28px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-align: center;
}

@media (max-width: 640px) {
  .input-grid,
  .log-form {
    grid-template-columns: 1fr;
  }

  .task-card {
    grid-template-columns: 1fr;
  }
}
