@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,600;9..144,700&family=IBM+Plex+Sans:wght@400;500;600;700&family=IBM+Plex+Mono:wght@500;600&display=swap');

:root{
  --bg:#F6F1E6; --surface:#FDFAF3; --surface-2:#F0E9DA;
  --text:#241F18; --text-muted:#6E6252; --border:#E3D8C4;
  --accent:#C1552C; --accent-ink:#FFFFFF;
  --structure:#2F4437; --structure-ink:#F3EFE4;
  --ok:#3E7A5B; --ok-bg:#E4EFE6;
  --warn:#9C6B22; --warn-bg:#F3E7D2;
  --danger:#A23E33; --danger-bg:#F3E0DB;
  --tint-1:#E4C9A6; --tint-2:#BFD8CE; --tint-3:#E8B7A4; --tint-4:#C9CBE0; --tint-5:#D7CBA5;
  --tint-ink:#241F18;
  --shadow:0 1px 2px rgba(36,31,24,.06), 0 6px 20px -8px rgba(36,31,24,.18);
}
@media (prefers-color-scheme: dark){
  :root{
    --bg:#14170F; --surface:#1D2118; --surface-2:#262B20;
    --text:#F0EBDD; --text-muted:#A79C89; --border:#333829;
    --accent:#E1804A; --accent-ink:#1B1204;
    --structure:#B9CCB9; --structure-ink:#17231A;
    --ok:#6FBB92; --ok-bg:#1E2E24;
    --warn:#D7A64C; --warn-bg:#332A15;
    --danger:#E08171; --danger-bg:#34211D;
    --tint-1:#5C4A2C; --tint-2:#2E4A3E; --tint-3:#5C3A30; --tint-4:#383A56; --tint-5:#4A4128;
    --tint-ink:#F0EBDD;
    --shadow:0 1px 2px rgba(0,0,0,.3), 0 10px 28px -10px rgba(0,0,0,.55);
  }
}
*{ box-sizing:border-box; }
body{
  margin:0; background:var(--bg); color:var(--text);
  font-family:"IBM Plex Sans", ui-sans-serif, system-ui, sans-serif;
  display:flex; justify-content:center;
}
a{ color:inherit; }
.app{ width:100%; max-width:480px; min-height:100vh; background:var(--surface);
  border-left:1px solid var(--border); border-right:1px solid var(--border);
  display:flex; flex-direction:column; }

.topbar{ background:var(--structure); color:var(--structure-ink); padding:16px 20px; }
.topbar-row{ display:flex; align-items:baseline; justify-content:space-between; gap:12px; }
.wordmark{ font-family:"Fraunces", Georgia, serif; font-weight:700; font-size:21px; }
.assoc{ font-size:12px; opacity:.72; margin-top:2px; }
.topbar a.acct{ font-size:12px; color:var(--structure-ink); opacity:.85; text-decoration:none; }
.topbar a.acct:hover{ text-decoration:underline; }

.flashes{ padding:0 16px; margin-top:12px; display:flex; flex-direction:column; gap:8px; }
.flash{ border-radius:12px; padding:11px 13px; font-size:13.5px; line-height:1.5; }
.flash.success{ background:var(--ok-bg); color:var(--ok); }
.flash.error{ background:var(--danger-bg); color:var(--danger); }

.content{ flex:1; padding:16px 16px 40px; }
.section-title{ font-family:"Fraunces", Georgia, serif; font-weight:700; font-size:18px; margin:2px 0 12px;
  display:flex; align-items:baseline; justify-content:space-between; gap:10px; }
.section-title .sub{ font-family:"IBM Plex Sans"; font-weight:500; font-size:12px; color:var(--text-muted); }
.section-note{ font-size:12.5px; color:var(--text-muted); margin:-6px 0 14px; line-height:1.5; }

.back-link{ display:inline-flex; align-items:center; gap:4px; border:0; background:transparent; color:var(--text-muted);
  font-size:12.5px; font-weight:600; padding:0 0 12px; cursor:pointer; text-decoration:none; }

nav.bottomnav{ position:sticky; bottom:0; display:flex; border-top:1px solid var(--border); background:var(--surface);
  max-width:480px; margin:0 auto; width:100%; }
.navbtn{ flex:1; text-align:center; padding:10px 4px 12px; text-decoration:none; color:var(--text-muted);
  font-size:12px; font-weight:500; display:flex; flex-direction:column; align-items:center; gap:3px; }
.navbtn .ic{ font-size:18px; line-height:1; }
.navbtn.active{ color:var(--accent); font-weight:700; }

/* buttons + forms */
.btn{ display:inline-block; padding:12px 16px; border-radius:12px; border:0; background:var(--accent);
  color:var(--accent-ink); font-size:14px; font-weight:700; cursor:pointer; text-decoration:none; text-align:center; }
.btn.full{ width:100%; }
.btn.ghost{ background:transparent; border:1px solid var(--border); color:var(--text); }
.btn.danger{ background:var(--danger); color:#fff; }
.btn.small{ padding:8px 12px; font-size:12.5px; border-radius:9px; }
.btn:disabled{ background:var(--surface-2); color:var(--text-muted); cursor:not-allowed; }

.field{ display:flex; flex-direction:column; gap:4px; margin-bottom:12px; }
.field label{ font-size:11.5px; color:var(--text-muted); font-weight:600; }
.field input, .field textarea, .field select{
  border:1px solid var(--border); border-radius:10px; padding:10px 12px; font-size:14px;
  background:var(--surface); color:var(--text); font-family:inherit; width:100%;
}
.field-row{ display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.checkbox-row{ display:flex; align-items:flex-start; gap:10px; margin-bottom:14px; font-size:13.5px; line-height:1.5; }
.checkbox-row input{ width:18px; height:18px; margin-top:2px; accent-color:var(--accent); flex:0 0 auto; }

/* cards */
.card{ border:1px solid var(--border); border-radius:14px; background:var(--surface); box-shadow:var(--shadow);
  padding:13px 14px; margin-bottom:10px; }

/* slot list (day view) */
.slot-list{ display:flex; flex-direction:column; gap:8px; }
.slot{ display:flex; align-items:center; gap:12px; padding:11px 12px; border-radius:13px; border:1px solid var(--border);
  background:var(--surface); box-shadow:var(--shadow); text-decoration:none; color:var(--text); }
.slot.past{ opacity:.45; }
.slot-time{ font-family:"IBM Plex Mono", monospace; font-weight:600; font-size:14px; width:46px; flex:0 0 auto; }
.slot-mid{ flex:1; min-width:0; }
.slot-names{ font-size:11.5px; color:var(--text-muted); margin-top:2px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.slot-empty-txt{ font-size:13px; color:var(--text-muted); }
.pill{ font-size:10.5px; font-weight:700; letter-spacing:.02em; padding:3px 8px; border-radius:100px; }
.pill.ok{ background:var(--ok-bg); color:var(--ok); }
.pill.warn{ background:var(--warn-bg); color:var(--warn); }
.pill.danger{ background:var(--danger-bg); color:var(--danger); }
.slot-right{ flex:0 0 auto; text-align:right; }
.cap{ display:block; font-size:11px; color:var(--text-muted); margin-top:3px; }

.legend{ display:flex; flex-wrap:wrap; gap:10px 16px; margin:14px 2px 4px; }
.legend-item{ display:flex; align-items:center; gap:6px; font-size:11.5px; color:var(--text-muted); }
.legend-dot{ width:8px; height:8px; border-radius:50%; }

/* date strip */
.date-strip{ display:flex; gap:8px; overflow-x:auto; padding:0 0 16px; }
.date-chip{ flex:0 0 auto; width:50px; padding:7px 0 8px; border-radius:12px; border:1px solid var(--border);
  background:var(--surface); text-align:center; text-decoration:none; color:var(--text); }
.date-chip .dow{ display:block; font-size:10px; text-transform:uppercase; color:var(--text-muted); }
.date-chip .dom{ display:block; font-family:"IBM Plex Mono", monospace; font-size:15px; font-weight:600; margin-top:2px; }
.date-chip.today .dom{ color:var(--accent); }
.date-chip.selected{ background:var(--structure); border-color:var(--structure); }
.date-chip.selected .dow, .date-chip.selected .dom{ color:var(--structure-ink); }

/* month overview */
.month-block{ margin-bottom:22px; }
.month-title{ font-family:"Fraunces", Georgia, serif; font-weight:700; font-size:15px; margin-bottom:8px; text-transform:capitalize; }
.month-grid{ display:grid; grid-template-columns:26px repeat(7,1fr); gap:5px; }
.month-dow{ font-size:9.5px; text-transform:uppercase; color:var(--text-muted); text-align:center; padding-bottom:2px; }
.week-num-head{ opacity:.6; }
.week-num{ display:flex; align-items:center; justify-content:center; font-size:10px; font-weight:600;
  color:var(--text-muted); font-variant-numeric:tabular-nums; }
.day-cell{ aspect-ratio:1; border-radius:9px; display:flex; flex-direction:column; align-items:center; justify-content:center;
  gap:2px; font-size:11.5px; text-decoration:none; border:1px solid transparent; background:var(--surface-2); color:var(--text); }
.day-cell.out{ visibility:hidden; }
.day-cell.past{ opacity:.4; }
.day-cell.today{ border-color:var(--accent); font-weight:700; }
.day-cell.selected{ background:var(--structure); color:var(--structure-ink); }
.day-dot{ width:5px; height:5px; border-radius:50%; background:transparent; }
.day-cell.lvl-some .day-dot{ background:var(--ok); }
.day-cell.lvl-busy .day-dot{ background:var(--warn); }
.day-cell.lvl-full{ background:var(--danger-bg); }
.day-cell.lvl-full .day-dot{ background:var(--danger); }
.day-cell.selected .day-dot{ background:var(--structure-ink); }

/* roster / avatars */
.avatar{ width:34px; height:34px; border-radius:50%; display:inline-flex; align-items:center; justify-content:center;
  font-size:12.5px; font-weight:700; color:var(--tint-ink); flex:0 0 auto; }
.avatar.lg{ width:48px; height:48px; font-size:16px; }
.tint-1{ background:var(--tint-1); } .tint-2{ background:var(--tint-2); } .tint-3{ background:var(--tint-3); }
.tint-4{ background:var(--tint-4); } .tint-5{ background:var(--tint-5); }
.roster-row{ display:flex; align-items:center; gap:10px; padding:8px 0; border-bottom:1px solid var(--border);
  text-decoration:none; color:var(--text); }
.roster-row:last-child{ border-bottom:0; }
.roster-name{ flex:1; font-size:13.5px; }
.roster-name .g{ display:block; font-size:11px; color:var(--text-muted); font-weight:400; }
.roster-chevron{ color:var(--text-muted); }

.cap-bar{ height:7px; border-radius:4px; background:var(--surface-2); overflow:hidden; margin-bottom:6px; }
.cap-bar-fill{ height:100%; background:var(--accent); border-radius:4px; }
.cap-row{ display:flex; justify-content:space-between; align-items:center; margin-bottom:16px; font-size:12.5px; color:var(--text-muted); }

.notice{ border-radius:12px; padding:11px 13px; font-size:13px; margin-bottom:14px; }
.notice.danger{ background:var(--danger-bg); color:var(--danger); }
.notice.warn{ background:var(--warn-bg); color:var(--warn); }
.notice.info{ background:var(--surface-2); color:var(--text-muted); }

/* mina bokningar */
.mybook-card{ display:flex; flex-direction:column; gap:10px; }
.mybook-top{ display:flex; align-items:center; gap:12px; }
.mybook-top form{ flex:0 0 auto; margin:0; }
.mybook-date{ font-family:"IBM Plex Mono", monospace; font-size:12px; color:var(--text-muted); width:52px; line-height:1.3; flex:0 0 auto; }
.mybook-date b{ display:block; color:var(--text); font-size:15px; }
.mybook-mid{ flex:1; min-width:0; }
.mybook-mid .t{ font-weight:700; font-size:14px; }
.mybook-mid .d{ font-size:12px; color:var(--text-muted); margin-top:2px; }
.report-link{ border:1px dashed var(--border); background:var(--surface-2); color:var(--text-muted); border-radius:9px;
  padding:8px 10px; font-size:11.5px; font-weight:600; text-align:left; text-decoration:none; line-height:1.4; }

/* contact card */
.contact-head{ display:flex; align-items:center; gap:14px; margin-bottom:16px; }
.contact-name{ font-family:"Fraunces", Georgia, serif; font-weight:700; font-size:18px; }
.contact-badge{ font-size:10.5px; color:var(--text-muted); margin-top:2px; }
.contact-detail{ display:flex; flex-direction:column; gap:2px; padding:10px 0; border-bottom:1px solid var(--border); }
.contact-detail:last-of-type{ border-bottom:0; }
.contact-detail .k{ font-size:10.5px; text-transform:uppercase; letter-spacing:.05em; color:var(--text-muted); }
.contact-detail .v{ font-size:14px; }
.contact-limited{ font-size:12.5px; color:var(--text-muted); background:var(--surface-2); border-radius:10px; padding:10px 12px; margin:2px 0 16px; line-height:1.5; }
.contact-actions{ display:flex; gap:10px; margin:16px 0; }
.contact-actions a{ flex:1; text-align:center; padding:12px; border-radius:12px; font-size:13.5px; font-weight:700; text-decoration:none; }
.contact-actions .call{ background:var(--accent); color:var(--accent-ink); }
.contact-actions .sms{ border:1px solid var(--border); color:var(--text); }

/* admin */
.admin-section-title{ font-weight:700; font-size:14px; margin:22px 0 4px; }
.queue-meta{ font-size:12px; color:var(--text-muted); margin-top:3px; line-height:1.6; }
.queue-meta strong{ color:var(--text); }
.queue-note{ font-size:12px; color:var(--text-muted); margin-top:6px; font-style:italic; }
.queue-actions{ display:flex; gap:8px; margin-top:10px; }
.member-row{ display:flex; align-items:center; gap:11px; padding:9px 4px; border-bottom:1px solid var(--border); }
.member-row:last-child{ border-bottom:0; }
.member-row-mid{ flex:1; min-width:0; text-decoration:none; color:var(--text); }
.member-row-mid .n{ font-size:13.5px; font-weight:700; }
.member-row-mid .n .badge{ font-size:10px; font-weight:700; color:var(--accent); margin-left:6px; }
.member-row-mid .m{ font-size:11.5px; color:var(--text-muted); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.search-field{ margin-bottom:12px; }

.empty-state{ text-align:center; padding:40px 20px; color:var(--text-muted); }

.confirm-page{ text-align:center; padding-top:20px; }
.confirm-title{ font-family:"Fraunces", Georgia, serif; font-weight:700; font-size:19px; margin-bottom:10px; }
.confirm-body{ font-size:13.5px; line-height:1.6; color:var(--text-muted); margin-bottom:20px; text-align:left; }
.confirm-body strong{ color:var(--text); }
.confirm-actions{ display:flex; flex-direction:column; gap:10px; }

.photo-preview{ margin:10px 0; border-radius:12px; overflow:hidden; border:1px solid var(--border); }
.photo-preview img{ display:block; width:100%; max-height:220px; object-fit:cover; }
