/* Parenting Calendar | Ziggi Lab */
:root {
  --plum: #4b152d;
  --terra: #ae4b2e;
  --gold: #ab7b22;
  --sage: #466255;
  --bg: #faf6f1;
  --surface: #ffffff;
  --surface2: #f4ebe4;
  --line: #eadfd6;
  --text: #2a1b22;
  --muted: #6f5f65;
  --primary: #4b152d;
  --on-primary: #ffffff;
  --danger: #9e3b22;
  --ok: #3d5a4c;
  --shadow: 0 1px 2px rgba(42, 27, 34, .06), 0 6px 20px rgba(42, 27, 34, .06);
  --ring: #2a1b22;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1a1215;
    --surface: #241a1e;
    --surface2: #2f2328;
    --line: #3e3036;
    --text: #f4ebe4;
    --muted: #bcaab0;
    --primary: #9a3f25;
    --on-primary: #ffffff;
    --danger: #e0846b;
    --ok: #9cc3ae;
    --shadow: none;
    --ring: #f4ebe4;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1a1215;
  --surface: #241a1e;
  --surface2: #2f2328;
  --line: #3e3036;
  --text: #f4ebe4;
  --muted: #bcaab0;
  --primary: #9a3f25;
  --on-primary: #ffffff;
  --danger: #e0846b;
  --ok: #9cc3ae;
  --shadow: none;
  --ring: #f4ebe4;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overflow-x: hidden;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: calc(12px + env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) calc(24px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}

.banner {
  background: var(--gold);
  color: #1f1408;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
}

.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 0 12px; }
.eyebrow, .label, .dow span, .legend, .chip {
  font-family: "Josefin Sans", system-ui, sans-serif;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.eyebrow { font-size: 12px; color: var(--muted); font-weight: 600; }
h1 {
  font-family: Fraunces, Georgia, "Times New Roman", serif;
  font-weight: 700;
  font-size: 28px;
  line-height: 1.1;
  margin: 2px 0 0;
  color: var(--text);
}
h2, h3 { margin: 0; }
.h2 { font-family: Fraunces, Georgia, serif; font-size: 20px; font-weight: 600; margin-bottom: 8px; }

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

.icon-btn {
  width: 44px; height: 44px;
  display: inline-grid; place-items: center;
  border: 1px solid var(--line);
  background: var(--surface2);
  border-radius: 12px;
  font-size: 24px; line-height: 1;
  flex: none;
}
.chip {
  border: 1px solid var(--line);
  background: var(--surface2);
  border-radius: 999px;
  height: 36px;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 600;
}

/* Today card */
.today-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.pill {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 999px;
  font-family: Fraunces, Georgia, serif;
  font-weight: 600;
  font-size: 19px;
  line-height: 1.25;
}
.unset { font-family: Fraunces, Georgia, serif; font-size: 18px; font-weight: 600; }
.today-line .date { color: var(--muted); font-weight: 500; }
.sub { margin: 10px 0 0; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 4px; vertical-align: -1px; margin-right: 6px; }

/* Calendar */
.cal-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.month-title {
  flex: 1;
  text-align: center;
  font-family: Fraunces, Georgia, serif;
  font-size: 22px;
  font-weight: 600;
  min-width: 0;
}
.dow, .grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.dow span { text-align: center; font-size: 11px; font-weight: 600; color: var(--muted); padding: 4px 0; }
.grid { touch-action: pan-y; }
.day {
  position: relative;
  aspect-ratio: 1 / 1;
  min-height: 40px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface2);
  padding: 0;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
}
.day .num { font-weight: 600; font-size: 15px; padding: 4px 0 0 6px; }
.day.set { border-color: transparent; }
.day.out { opacity: .5; }
.day.today { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--ring); z-index: 1; }
.day .dot {
  position: absolute;
  right: 5px; bottom: 5px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, .25);
}
.day:active { transform: scale(.97); }

.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 12px 2px 4px; font-size: 13px; font-weight: 600; }
.legend span { display: inline-flex; align-items: center; }

.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.actions .btn { flex: 1 1 auto; }
.btn {
  min-height: 46px;
  padding: 0 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface2);
  font-weight: 600;
}
.btn.primary { background: var(--primary); color: var(--on-primary); border-color: transparent; }
.btn.danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn.wide { width: 100%; margin-top: 8px; }

/* Lists */
.list { list-style: none; margin: 0; padding: 0; }
.list .empty { color: var(--muted); padding: 8px 2px; }
.entry { display: flex; gap: 8px; align-items: stretch; border-top: 1px solid var(--line); }
.entry:first-child { border-top: 0; }
.entry-btn {
  flex: 1; min-width: 0;
  text-align: left;
  background: none; border: 0;
  padding: 10px 2px;
  display: flex; gap: 10px; align-items: flex-start;
}
.entry-btn .bar { width: 6px; align-self: stretch; border-radius: 3px; flex: none; background: var(--line); }
.entry-btn .txt { min-width: 0; }
.e-top { display: block; font-weight: 600; }
.e-loc, .e-notes { display: block; color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.e-notes { white-space: pre-wrap; }
.entry.past .e-top { color: var(--muted); font-weight: 500; }
.e-del { background: none; border: 0; color: var(--danger); font-weight: 600; font-size: 14px; padding: 0 6px; min-width: 64px; }

/* Sheets */
dialog.sheet {
  border: 0;
  padding: 16px max(16px, env(safe-area-inset-right)) calc(20px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  margin: auto auto 0;
  width: 100%;
  max-width: 560px;
  max-height: 92vh;
  overflow: auto;
  border-radius: 22px 22px 0 0;
  background: var(--surface);
  color: var(--text);
}
dialog.sheet::backdrop { background: rgba(20, 10, 14, .55); }
@media (min-width: 720px) {
  dialog.sheet { margin: auto; border-radius: 22px; }
}
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.sheet-head h2 { font-family: Fraunces, Georgia, serif; font-size: 22px; font-weight: 600; }
.label { font-size: 12px; font-weight: 600; color: var(--muted); margin: 16px 0 8px; }
.seg3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.big {
  min-height: 56px;
  border-radius: 14px;
  border: 2px solid transparent;
  font-weight: 700;
  padding: 6px;
  overflow-wrap: anywhere;
}
.big.ghost { background: var(--surface2); border-color: var(--line); }
.big[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--ring); }

.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row2 > * { min-width: 0; }
.color-row { grid-template-columns: 1fr 88px; }
.field { display: block; font-size: 14px; font-weight: 600; margin-top: 10px; }
.field input, .field select, .field textarea {
  display: block;
  width: 100%;
  margin-top: 4px;
  min-height: 46px;
  padding: 10px 12px;
  font-size: 16px;
  font-weight: 400;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
}
.field input[type="color"] { padding: 4px; }
.field input[type="file"] { padding: 9px 8px; }
textarea { resize: vertical; }
textarea.code {
  width: 100%;
  font: 13px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  background: var(--bg);
  color: var(--text);
}
.err { color: var(--danger); font-weight: 600; margin: 10px 0 0; }
.ok { color: var(--ok); font-weight: 600; margin: 12px 0 0; }
.preview { margin: 12px 0 0; font-weight: 600; }
.confirm { margin-top: 12px; padding: 12px; border-radius: 14px; background: var(--surface2); border: 1px solid var(--line); }
.confirm p { margin: 0 0 4px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  max-width: calc(100% - 32px);
  background: var(--text);
  color: var(--bg);
  padding: 10px 16px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 14px;
  z-index: 50;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .25);
}

.foot { text-align: center; color: var(--muted); font-size: 14px; padding: 8px 0 16px; }
.foot p { margin: 4px 0; }
.foot a { font-weight: 600; }

@media (max-width: 380px) {
  .card { padding: 12px 10px; }
  .dow, .grid { gap: 3px; }
  .day .num { font-size: 14px; padding: 3px 0 0 5px; }
  h1 { font-size: 25px; }
}
@media (prefers-reduced-motion: reduce) {
  .day:active { transform: none; }
}
