:root {
  --bg: #f6f3ee;
  --panel: #ffffff;
  --text: #211f1d;
  --muted: #6e675f;
  --line: #e2d9cf;
  --accent: #2f5d50;
  --accent-2: #eef7f2;
  --danger: #a63d3d;
  --warning: #a87721;
  --shadow: 0 18px 55px rgba(45, 38, 28, .08);
  --radius: 22px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: radial-gradient(circle at top left, #fffaf2 0, var(--bg) 38%, #eee8df 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.45;
}

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

.update-banner {
  margin: 16px clamp(16px, 4vw, 56px) 0;
  background: #fff7e6;
  border: 1px solid #e7c982;
  color: #4b3510;
  border-radius: 18px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  box-shadow: var(--shadow);
}
.update-banner[hidden] { display: none; }
.update-banner div { display: grid; gap: 2px; }
.update-banner span { color: #6f531d; }
.version-line {
  margin-top: 12px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: .92rem;
}
.version-line strong { color: var(--accent); }
#updateStatus { margin-left: 8px; }


.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 32px clamp(16px, 4vw, 56px) 18px;
}

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

h1 { font-size: clamp(2rem, 5vw, 4rem); line-height: .95; letter-spacing: -0.055em; margin-bottom: 12px; }
h2 { font-size: 1.2rem; margin-bottom: 6px; }
h3 { margin-bottom: 8px; }

.eyebrow { text-transform: uppercase; letter-spacing: .16em; color: var(--accent); font-weight: 800; font-size: .78rem; margin-bottom: 10px; }
.subtle { color: var(--muted); margin-bottom: 0; }

.top-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }

.layout {
  padding: 14px clamp(16px, 4vw, 56px) 34px;
  display: grid;
  gap: 18px;
}

.grid { display: grid; gap: 16px; }
.cards { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.wide-left { grid-template-columns: minmax(0, 1.4fr) minmax(280px, .6fr); }

.card {
  background: rgba(255,255,255,.86);
  border: 1px solid rgba(226,217,207,.95);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  backdrop-filter: blur(12px);
}

.metric span { color: var(--muted); display: block; margin-bottom: 8px; }
.metric strong { font-size: clamp(1.7rem, 4vw, 2.4rem); letter-spacing: -.04em; }

.section-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 16px; }

.form { display: grid; gap: 12px; }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
label { display: grid; gap: 6px; color: var(--muted); font-weight: 700; font-size: .92rem; }
input, select, textarea {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 11px 12px;
  background: #fff;
  color: var(--text);
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(47,93,80,.12); }
textarea { resize: vertical; }

button, .file-label {
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: white;
  padding: 11px 16px;
  cursor: pointer;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
}
button:hover, .file-label:hover { filter: brightness(.96); }
.secondary { background: #fff; color: var(--accent); border: 1px solid var(--line); }
.danger { background: var(--danger); color: #fff; }
.search { min-width: min(250px, 100%); }

.list { display: grid; gap: 10px; }
.list-item {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  background: #fff;
  display: grid;
  gap: 10px;
}
.item-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; }
.item-title { font-weight: 900; font-size: 1rem; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: .78rem;
  font-weight: 800;
  background: var(--accent-2);
  color: var(--accent);
}
.pill.warning { background: #fff3d8; color: var(--warning); }
.pill.danger { background: #ffe9e9; color: var(--danger); }
.item-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.item-actions button { min-height: unset; padding: 8px 11px; font-size: .86rem; }
.notes { width: 100%; min-height: 318px; }
.empty { border: 1px dashed var(--line); border-radius: 18px; padding: 18px; color: var(--muted); background: rgba(255,255,255,.48); }

footer { padding: 0 clamp(16px, 4vw, 56px) 34px; color: var(--muted); }

#confirmDialog { border: 0; border-radius: 24px; padding: 0; box-shadow: var(--shadow); max-width: 440px; }
#confirmDialog::backdrop { background: rgba(0,0,0,.35); }
.dialog-card { padding: 22px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

@media (max-width: 940px) {
  .topbar { flex-direction: column; }
  .top-actions { justify-content: flex-start; }
  .cards, .two-col, .wide-left { grid-template-columns: 1fr; }
  .section-title { flex-direction: column; }
  .search { width: 100%; }
}

@media (max-width: 560px) {
  .update-banner { align-items: stretch; flex-direction: column; }
  .field-row { grid-template-columns: 1fr; }
  .card { padding: 16px; }
  .top-actions button, .top-actions .file-label { width: 100%; }
}
