:root {
  --ink: #1d1914;
  --muted: #655e55;
  --line: #e3d8c8;
  --paper: #f3ecdf;
  --card: #fffdf8;
  --accent: #1e4d3a;
  --accent-dark: #16392b;
  --danger: #8d2b2b;
  --gold: #9a7340;
  --soft: #f7f1e6;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font: 16px/1.5 "Segoe UI", "Helvetica Neue", sans-serif;
}

.wrap {
  width: min(840px, calc(100% - 32px));
  margin: 0 auto;
}

.top {
  background: #1b3d31;
  color: #f7f2e8;
  padding: 28px 0 22px;
}

.top-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
}

.top a,
.top-logout {
  color: #f4e7d0;
  font-weight: 600;
  text-decoration: none;
  margin-bottom: 8px;
}

.top-logout {
  border-color: rgba(255, 255, 255, 0.35);
  background: transparent;
}

.login-form { padding-bottom: 18px; }
.login-form .primary { margin-top: 4px; }

.eyebrow {
  margin: 0 0 6px;
  color: #e0ccaa;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 40px;
  font-weight: 500;
  letter-spacing: -0.02em;
}

main.wrap { padding: 22px 0 56px; }

.lead {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 17px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px 20px 6px;
  margin: 0 0 14px;
}

h2 {
  display: flex;
  gap: 10px;
  align-items: baseline;
  margin: 0 0 16px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 24px;
  font-weight: 500;
}

fieldset.field {
  border: 0;
  margin: 0 0 16px;
  padding: 0;
  min-width: 0;
}

legend,
.lbl > span {
  font-weight: 600;
  color: var(--ink);
}

legend { padding: 0 0 8px; }

.lbl {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0 0 12px;
  color: var(--ink);
  font-size: 14px;
}

.req { color: var(--danger); font-style: normal; }

.hint,
.quiet {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 13px;
}

input,
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d9cdb8;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: 16px/1.4 "Segoe UI", "Helvetica Neue", sans-serif;
}

textarea { min-height: 110px; resize: vertical; }

input:focus-visible,
select:focus-visible,
textarea:focus-visible,
button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.grid-2,
.grid-3 {
  display: grid;
  gap: 12px;
}

.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: 1fr 1fr 1fr; }

.choices { display: flex; flex-wrap: wrap; gap: 8px; }

.choice {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-weight: 600;
}

.choice input { width: auto; }

.entry {
  margin: 0 0 12px;
  padding: 12px 12px 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--soft);
}

.entry-head,
.sub-summary,
.toolbar,
.submit-row,
.row-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.submit-row { margin-bottom: 16px; }

.entry-head { margin-bottom: 8px; }

.add-btn,
.text-btn,
.ghost {
  border: 1px solid #d9cdb8;
  border-radius: 8px;
  background: #fff;
  color: var(--accent);
  font: 600 14px/1 "Segoe UI", sans-serif;
  padding: 10px 12px;
  cursor: pointer;
  text-decoration: none;
}

.text-btn {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  padding: 4px 6px;
}

.text-btn:hover,
.danger:hover { color: var(--danger); }

.add-btn { margin: 0 0 16px; }

.primary {
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  font: 600 16px/1 "Segoe UI", sans-serif;
  padding: 13px 18px;
  cursor: pointer;
}

.primary:hover { background: var(--accent-dark); }
.primary:disabled { opacity: 0.65; cursor: wait; }

.check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 4px 0 14px;
  font-weight: 600;
}

.check input { width: 18px; height: 18px; margin-top: 3px; }

.file-list { margin: 0 0 14px; padding: 0; list-style: none; }

.file-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
}

.banner {
  margin: 0 0 14px;
  padding: 12px 14px;
  border: 1px solid #f0c4c4;
  border-radius: 10px;
  background: #fdeeee;
  color: #6d1f1f;
}

.success { padding: 48px 22px 36px; text-align: center; }

.success-mark {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  font-size: 28px;
}

.success h2 { display: block; margin-bottom: 8px; }
.success p { color: var(--muted); }
.ref { color: var(--ink); font-family: Consolas, "Courier New", monospace; }

.toolbar { margin-bottom: 12px; flex-wrap: wrap; }
.toolbar input[type="search"] { flex: 1 1 240px; width: auto; }
.toolbar .add-btn { margin: 0; }

.sub-card {
  margin: 0 0 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
}

.meta { color: var(--muted); font-size: 13px; }

.pair {
  display: grid;
  grid-template-columns: minmax(160px, 230px) 1fr;
  gap: 8px 14px;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
}

.k { color: var(--muted); font-size: 13px; }
.v { white-space: pre-wrap; }

.detail h3 {
  margin: 16px 0 4px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 18px;
  font-weight: 500;
}

.mini {
  margin: 8px 0;
  padding: 4px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--soft);
}

.detail a { color: var(--accent); }

.empty {
  padding: 28px 8px;
  color: var(--muted);
}

.gate {
  max-width: 460px;
  padding: 8px 0 20px;
}

.top .top-logout {
  color: #f4e7d0;
  border-color: rgba(255, 255, 255, 0.35);
  background: transparent;
}

@media (max-width: 720px) {
  h1 { font-size: 32px; }
  .grid-2, .grid-3, .pair { grid-template-columns: 1fr; }
  .submit-row, .sub-summary, .top-row { align-items: stretch; flex-direction: column; }
}
