:root {
  --bg: #f6f1e9;
  --card: #fffdf9;
  --ink: #23201b;
  --muted: #7a7266;
  --line: #e7dfd2;
  --accent: #2f6b4f;
  --accent-ink: #fff;
  --warn: #b5532f;
  --soft: #efe8dc;
  --c-Wil: #3f7cac;
  --c-Sophie: #c0587e;
  --c-Eli: #2f6b4f;
  --c-Sharky: #c98a2b;
  --radius: 18px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1a17; --card: #262420; --ink: #f1ece3; --muted: #a39b8e;
    --line: #38352f; --accent: #5fae86; --accent-ink: #10140f; --warn: #e07a55; --soft: #302d28;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body {
  font: 16px/1.4 ui-rounded, system-ui, -apple-system, "Segoe UI", sans-serif;
  padding: calc(env(safe-area-inset-top) + 12px) 16px calc(env(safe-area-inset-bottom) + 32px);
  max-width: 520px; margin: 0 auto;
}
h1 { font-size: 22px; margin: 0; letter-spacing: -0.01em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
[hidden] { display: none !important; }

.top { display: flex; align-items: center; justify-content: space-between; margin: 4px 2px 14px; }
.me-chip {
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  border-radius: 999px; padding: 6px 12px 6px 6px; font: inherit; font-size: 14px;
  display: inline-flex; align-items: center; gap: 8px;
}

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin-bottom: 14px;
}
.label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 8px; }
.big { font-size: 28px; font-weight: 750; letter-spacing: -0.02em; display: flex; align-items: center; gap: 10px; }
.sub { color: var(--muted); margin-top: 4px; font-size: 15px; }

.dot { width: 28px; height: 28px; border-radius: 50%; display: inline-grid; place-items: center;
  color: #fff; font-size: 13px; font-weight: 700; flex: none; }
.dot.lg { width: 40px; height: 40px; font-size: 17px; }
.dot.sm { width: 20px; height: 20px; font-size: 10px; }

.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.btn {
  appearance: none; border: 0; border-radius: 12px; padding: 13px 16px; font: inherit; font-weight: 650;
  background: var(--soft); color: var(--ink); cursor: pointer;
}
.btn.primary { background: var(--accent); color: var(--accent-ink); flex: 1 1 auto; }
.btn.warn { background: var(--warn); color: #fff; flex: 1 1 auto; }
.btn.ghost { background: transparent; border: 1px solid var(--line); }
.btn.small { padding: 8px 12px; font-size: 14px; border-radius: 10px; }
.btn:disabled { opacity: .55; }
.link { background: none; border: 0; color: var(--accent); font: inherit; font-weight: 600; padding: 0; cursor: pointer; }

.queue { display: flex; align-items: center; gap: 6px; margin-top: 12px; font-size: 14px; color: var(--muted); }
.history { list-style: none; padding: 0; margin: 14px 0 0; border-top: 1px solid var(--line); }
.history li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; font-size: 14px; border-bottom: 1px solid var(--line); }
.history li:last-child { border-bottom: 0; }
.history .when { color: var(--muted); white-space: nowrap; }

.req { border: 1px solid var(--line); border-radius: 14px; padding: 12px; margin-top: 12px; background: var(--bg); }
.req.mine-to-decide { border-color: var(--accent); }
.req .who { font-weight: 650; display: flex; align-items: center; gap: 8px; }
.req .when { font-size: 14px; margin-top: 4px; }
.req .why { font-size: 14px; color: var(--muted); margin-top: 2px; }
.pill { font-size: 12px; font-weight: 700; border-radius: 999px; padding: 2px 8px; margin-left: auto; text-transform: capitalize; }
.pill.pending { background: #f3e2b9; color: #6b4c07; }
.pill.approved { background: #cfe8d9; color: #1f4d36; }
.pill.denied { background: #f2d0c4; color: #7a2d14; }

.weeks { list-style: none; margin: 0; padding: 0; }
.weeks > li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.weeks > li:last-child { border-bottom: 0; }
.week-head { display: flex; align-items: center; gap: 10px; }
.week-head .dates { flex: 1; }
.week-head .owner { font-weight: 650; }
.tag { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); margin-left: 6px; }
.week.me .owner { color: var(--accent); }
.borrow { font-size: 13px; color: var(--muted); margin: 6px 0 0 38px; display: flex; align-items: center; gap: 6px; }
.borrow.pending { opacity: .7; font-style: italic; }

.cal-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.cal-nav .btn.small { min-width: 40px; font-size: 18px; line-height: 1; padding: 6px 12px; }
.cal-title { font-size: 17px; }
.cal-back { text-align: center; margin: 0 0 8px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-grid > span { font-size: 11px; font-weight: 700; color: var(--muted); text-align: center; padding-bottom: 2px; }
.cal-day {
  position: relative; aspect-ratio: 1; min-width: 0; border-radius: 9px; padding: 4px;
  background: color-mix(in srgb, var(--own, var(--line)) 16%, var(--bg));
  font-size: 13px; font-weight: 650;
}
.cal-day.blank { background: none; }
.cal-day.today { outline: 2px solid var(--ink); outline-offset: -2px; }
.bdot {
  position: absolute; right: 3px; bottom: 3px; width: 18px; height: 18px; border-radius: 50%;
  color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center;
}
.bdot.pending { opacity: .5; border: 2px dashed #fff; }
.cal-key { display: flex; flex-wrap: wrap; gap: 10px 14px; margin-top: 12px; font-size: 13px; }
.cal-key span { display: inline-flex; align-items: center; gap: 6px; }
.cal-legend { margin: 8px 0 0; }

form label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-top: 10px; }
form input {
  display: block; width: 100%; margin-top: 4px; font: inherit; font-size: 16px; color: var(--ink);
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px; min-height: 44px;
}
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.picker { min-height: 80vh; display: flex; flex-direction: column; justify-content: center; text-align: center; }
.picker h1 { font-size: 30px; }
.picker-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 24px; }
.picker-grid button {
  border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: var(--radius);
  padding: 22px 10px; font: inherit; font-size: 18px; font-weight: 700; display: flex; flex-direction: column; align-items: center; gap: 10px;
}

.toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 20px); transform: translate(-50%, 20px);
  background: var(--ink); color: var(--bg); padding: 12px 16px; border-radius: 12px; font-size: 15px;
  max-width: calc(100% - 32px); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--warn); color: #fff; }
