/* Social: mobile first. One font, one accent, 12px radius, 44px tap targets. */
:root {
  --bg: #f6f5f2;
  --panel: #ffffff;
  --ink: #1a1a19;
  --muted: #5c5c57;
  --line: #d9d8d2;
  --accent: #0e7c6b;
  --accent-ink: #ffffff;
  --danger: #b42318;
  --danger-bg: #fdf1f0;
  --radius: 12px;
  --gap: 16px;
  --tap: 44px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #161715;
    --panel: #20211f;
    --ink: #f3f2ee;
    --muted: #b5b4ad;
    --line: #3a3b37;
    --danger-bg: #3a1d1b;
  }
}

:root[data-theme="dark"] {
  --bg: #161715;
  --panel: #20211f;
  --ink: #f3f2ee;
  --muted: #b5b4ad;
  --line: #3a3b37;
  --danger-bg: #3a1d1b;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  overflow-x: hidden;
  padding-bottom: calc(var(--tap) + 32px);
}

h1, h2, h3 { line-height: 1.25; margin: 0 0 8px; }
h1 { font-size: 24px; }
h2 { font-size: 20px; }
h3 { font-size: 18px; }
p { margin: 0 0 8px; }
small, .muted { color: var(--muted); font-size: 16px; }

.wrap {
  max-width: 560px;
  margin: 0 auto;
  padding: var(--gap);
}

.top {
  padding: var(--gap) var(--gap) 4px;
  max-width: 560px;
  margin: 0 auto;
}

/* Toast: a short message at the top. */
.toast {
  position: fixed;
  top: 12px;
  left: 12px;
  right: 12px;
  max-width: 536px;
  margin: 0 auto;
  z-index: 10;
  background: var(--ink);
  color: var(--bg);
  padding: 12px 16px;
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
  overflow-wrap: anywhere;
}
.toast.hidden { display: none; }

/* Bottom tabs: 4 equal, 44px tall. */
.tabs {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: var(--panel);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabs button {
  min-height: var(--tap);
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}
.tabs button[aria-selected="true"] {
  color: var(--accent);
  box-shadow: inset 0 3px 0 var(--accent);
}

.hidden { display: none !important; }

.view { display: none; }
.view.active { display: block; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--gap);
  margin-bottom: var(--gap);
}

.field { display: block; margin-bottom: var(--gap); }
.field > span, .label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
}

input[type="text"],
input[type="number"],
input[type="datetime-local"],
input[type="password"],
textarea,
select {
  width: 100%;
  min-height: var(--tap);
  padding: 10px 12px;
  font: inherit;
  font-size: 16px;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
textarea { min-height: 96px; resize: vertical; }

button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap);
  padding: 10px 16px;
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
}
button:disabled { opacity: 0.45; cursor: default; }
button.primary, .button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
button.wide, .button.wide { width: 100%; }
.row { display: flex; flex-wrap: wrap; gap: 8px; }
.row > * { flex: 1 1 140px; }

/* Brand picker */
.brands { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: var(--gap); }
.brands button { flex: 1 1 140px; }
.brands button[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

/* File drop zone */
.drop {
  display: block;
  text-align: center;
  padding: 28px 16px;
  border: 2px dashed var(--accent);
  border-radius: var(--radius);
  background: var(--panel);
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 8px;
}
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop:focus-within { outline: 3px solid var(--accent); outline-offset: 2px; }

.chosen { margin: 0 0 var(--gap); }

.status-line { min-height: 24px; font-weight: 600; color: var(--accent); }

/* Draft cards */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--gap);
  margin-bottom: var(--gap);
}
.card .thumb {
  display: block;
  width: 100%;
  max-height: 160px;
  object-fit: cover;
  border-radius: var(--radius);
  background: var(--line);
  margin-bottom: 12px;
}
.card .meta { color: var(--muted); margin-bottom: 4px; }
.card .caption { white-space: pre-wrap; overflow-wrap: anywhere; margin: 8px 0; }
.card .tags { color: var(--muted); overflow-wrap: anywhere; margin-bottom: 8px; }
.card .goes { font-weight: 600; margin-bottom: 12px; }
.card .error { color: var(--danger); font-weight: 600; margin-bottom: 12px; overflow-wrap: anywhere; }
.card .actions { display: flex; flex-wrap: wrap; gap: 8px; }
.card .actions > * { flex: 1 1 120px; }
.card .edit-box { margin-top: 8px; }

.dead {
  border: 2px solid var(--danger);
  background: var(--danger-bg);
  border-radius: var(--radius);
  padding: var(--gap);
  margin-bottom: var(--gap);
}
.dead .error { color: var(--danger); overflow-wrap: anywhere; }

.item {
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
}
.item:last-child { border-bottom: 0; }
.item .meta { color: var(--muted); }
.item a { color: var(--accent); font-weight: 600; }

/* Settings */
.day-row {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}
.day-row span { font-weight: 600; }

.check {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--tap);
  margin-bottom: 4px;
  font-size: 16px;
}
.check input { width: 22px; height: 22px; accent-color: var(--accent); }
.check .mark { font-weight: 600; color: var(--muted); }
.check .mark.ok { color: var(--accent); }

.radio-line {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-height: var(--tap);
  margin-bottom: 8px;
}
.radio-line input { width: 22px; height: 22px; margin-top: 2px; accent-color: var(--accent); }

.minutes { display: flex; align-items: center; gap: 8px; margin: 8px 0 0 32px; flex-wrap: wrap; }
.minutes input { max-width: 120px; }

.pages .page { border-top: 1px solid var(--line); padding: 12px 0; }
.pages .page:first-child { border-top: 0; }

.spacer { height: var(--gap); }

@media (min-width: 600px) {
  .card .thumb { max-height: 160px; }
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}
