:root {
  color-scheme: light;
  --ink: #17211d;
  --muted: #607069;
  --paper: #fffdf8;
  --canvas: #f4f0e8;
  --green: #173c33;
  --green-2: #275a4b;
  --line: #d8d2c6;
  --gold: #c8933d;
  --danger: #a33d34;
  --shadow: 0 10px 28px rgba(23, 60, 51, .09);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 100% 0, rgba(200, 147, 61, .15), transparent 28rem),
    var(--canvas);
}

button, input, textarea { font: inherit; }

button {
  min-height: 44px;
  padding: .72rem 1rem;
  border: 0;
  border-radius: .8rem;
  color: #fff;
  background: var(--green);
  font-weight: 700;
  cursor: pointer;
}

.button-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: .72rem 1rem;
  border-radius: .8rem;
  color: #fff;
  background: var(--green);
  font-weight: 700;
  text-decoration: none;
}

button:disabled { cursor: not-allowed; opacity: .55; }
button.secondary { color: var(--green); background: #e4ede8; }
button.ghost { color: var(--danger); background: transparent; border: 1px solid #d8aaa5; }
button.danger { color: var(--danger); }

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: max(1.1rem, env(safe-area-inset-top)) 1.1rem 1rem;
  color: #fff;
  background: var(--green);
}

h1, h2, p { margin-top: 0; }
h1 { margin-bottom: .2rem; font-family: Georgia, "Songti SC", serif; }
h2 { margin-bottom: 0; font-family: Georgia, "Songti SC", serif; }

.eyebrow {
  margin-bottom: .25rem;
  color: var(--gold);
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.status-pill {
  flex: none;
  padding: .4rem .65rem;
  border-radius: 999px;
  color: #173c33;
  background: #dbe9e2;
  font-size: .8rem;
  font-weight: 800;
}

.status-pill.offline { color: #fff; background: #9e4d42; }

main { width: min(840px, 100%); margin: 0 auto; padding: 1rem; }

.banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .8rem;
  margin-bottom: .8rem;
  padding: .85rem;
  border: 1px solid #e0c58f;
  border-radius: .9rem;
  background: #fff4d9;
}

.banner.subtle { border-color: var(--line); background: rgba(255,255,255,.7); }

.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .35rem;
  margin-bottom: 1rem;
  padding: .3rem;
  border-radius: 1rem;
  background: #dfe5df;
}

.tab { color: var(--muted); background: transparent; }
.tab.active { color: #fff; background: var(--green); }

.view {
  padding: 1rem;
  border: 1px solid rgba(216, 210, 198, .8);
  border-radius: 1.1rem;
  background: var(--paper);
  box-shadow: var(--shadow);
}

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

form, fieldset { display: grid; gap: .85rem; }
fieldset { margin: .4rem 0; padding: 1rem; border: 1px solid var(--line); border-radius: 1rem; }
legend { padding: 0 .4rem; font-weight: 800; }

label { display: grid; gap: .35rem; color: #33433c; font-weight: 700; }

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

input:focus, textarea:focus {
  outline: 3px solid rgba(200, 147, 61, .25);
  border-color: var(--gold);
}

input[readonly] { color: var(--muted); background: #f1f0ec; }
textarea { resize: vertical; }

.meta-grid, .two-column { display: grid; gap: .8rem; }
.meta-grid { grid-template-columns: 2fr 1fr 1.5fr; }
.two-column { grid-template-columns: 1fr 1fr; }

.hint { color: var(--muted); font-size: .88rem; line-height: 1.5; }

.image-actions, .form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
}

.file-button {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: .72rem 1rem;
  border-radius: .8rem;
  color: #fff;
  background: var(--green-2);
}

.file-button input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

.cover-area {
  display: grid;
  place-items: center;
  min-height: 180px;
  overflow: hidden;
  border: 1px dashed #a9b3ad;
  border-radius: .9rem;
  background: #f3f4f0;
}

.cover-area img { display: block; max-width: 100%; max-height: 360px; object-fit: contain; }
.cover-area p { margin: 0; color: var(--muted); }

.message { min-height: 1.35rem; margin: 0; color: var(--green-2); font-weight: 700; }
.message.error { color: var(--danger); }

.card-list, .check-list { display: grid; gap: .7rem; }

.draft-card, .check-row {
  padding: .9rem;
  border: 1px solid var(--line);
  border-radius: .9rem;
  background: #fff;
}

.draft-card h3 { margin: 0 0 .35rem; }
.draft-card p { margin: .2rem 0; color: var(--muted); }
.card-actions { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: .8rem; }

.check-row {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
}

.check-row input { width: 22px; height: 22px; flex: none; }
.check-row strong, .check-row small { display: block; }
.check-row small { margin-top: .2rem; color: var(--muted); }

.confirm-box {
  margin-top: 1rem;
  padding: 1rem;
  border: 1px solid #e0c58f;
  border-radius: .9rem;
  background: #fff4d9;
}

footer {
  width: min(840px, 100%);
  margin: 0 auto;
  padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom));
  color: var(--muted);
  font-size: .8rem;
  line-height: 1.5;
}

.diagnostics {
  margin-top: .8rem;
  padding: .8rem;
  border: 1px solid var(--line);
  border-radius: .9rem;
  background: rgba(255, 253, 248, .75);
}

.diagnostics summary {
  min-height: 44px;
  padding: .7rem 0;
  color: var(--green);
  font-size: .95rem;
  font-weight: 800;
  cursor: pointer;
}

.diagnostics-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .55rem;
  margin: .7rem 0;
}

.diagnostics-grid div {
  padding: .65rem;
  border-radius: .7rem;
  background: #f0f2ed;
}

.diagnostics-grid dt { color: var(--muted); font-size: .75rem; }
.diagnostics-grid dd { margin: .2rem 0 0; color: var(--ink); font-weight: 800; word-break: break-word; }

.hidden { display: none !important; }

.offline-page { display: grid; place-items: center; padding: 1rem; }
.offline-page section { max-width: 30rem; padding: 2rem; border-radius: 1rem; background: var(--paper); box-shadow: var(--shadow); }

@media (max-width: 640px) {
  .meta-grid, .two-column { grid-template-columns: 1fr; }
  .app-header { align-items: flex-start; }
  .view { padding: .85rem; }
  .banner { align-items: flex-start; flex-direction: column; }
  .diagnostics-grid { grid-template-columns: 1fr; }
}
