@font-face {
  font-family: "DM Sans";
  src: url("fonts/dm-sans-latin.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}
:root {
  color-scheme: dark;
  --ground: #14181F;
  --card: #20262F;
  --card-2: #1A1F27;
  --line: #2A313C;
  --edge: #343C48;
  --ink: #EEF1F5;
  --muted: #A9B1BE;
  --accent: #F2B84B;
  --accent-ink: #14181F;
  --warn: #F4A094;
  --warn-soft: #3A2326;
  --radius: 14px;
  --font: "DM Sans", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--ground); }
body { margin: 0; background: var(--ground); color: var(--ink); font: 15px/1.4 var(--font); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.main { padding: max(24px, env(safe-area-inset-top)) 20px calc(112px + env(safe-area-inset-bottom)); max-width: 1100px; margin: 0 auto; }
.loading { color: var(--muted); }

/* Meny: botten på mobil med plusknapp i mitten, sidopanel på dator */
.nav { position: fixed; z-index: 20; left: 0; right: 0; bottom: 0; background: var(--card-2); border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: start; padding: 8px 4px calc(8px + env(safe-area-inset-bottom)); }
.nav a { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 4px 2px; font-size: 11px; font-weight: 600;
  color: var(--muted); text-decoration: none; border-radius: 12px; min-height: 48px; justify-content: center; }
.nav a[aria-current="page"] { color: var(--accent); font-weight: 700; }
.nav svg { width: 24px; height: 24px; }
.nav .plus { justify-self: center; margin-top: -26px; width: 60px; height: 60px; border-radius: 30px; border: 4px solid var(--ground); background: var(--accent);
  color: var(--accent-ink); display: flex; align-items: center; justify-content: center; box-shadow: 0 6px 18px rgba(0,0,0,.4); }
.nav .plus svg { width: 28px; height: 28px; }
.nav .plus .lbl, .nav .brand { display: none; }

/* Rubriker */
.top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 14px; }
.eyebrow { font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: .3px; text-transform: uppercase; }
h1 { white-space: nowrap; margin: 0; font-size: 28px; font-weight: 700; letter-spacing: -.6px; line-height: 1.15; }
h2 { margin: 0; font-size: 13px; font-weight: 700; color: var(--muted); letter-spacing: .3px; text-transform: uppercase; }
.range { font-size: 14px; color: var(--muted); }
.back { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; text-decoration: none; font-size: 14px; min-height: 44px; }
.headbtns { display: flex; gap: 6px; align-items: center; }
.iconbtn { width: 40px; height: 40px; border-radius: 20px; border: 0; background: var(--card); display: inline-flex; align-items: center; justify-content: center; color: var(--ink); }
.iconbtn.text { width: auto; padding: 0 14px; font-weight: 700; font-size: 13px; }

/* Snabbfältet */
.quick { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.quick .box { display: flex; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--edge); border-radius: 16px; padding: 6px 6px 6px 14px; }
.quick .box:focus-within { border-color: var(--accent); }
.quick input { flex: 1; min-width: 0; height: 40px; border: 0; background: transparent; font-size: 16px; outline: none; }
.quick input::placeholder { color: #7C8595; }
.quick .go { width: 44px; height: 44px; border-radius: 12px; border: 0; background: var(--accent); color: var(--accent-ink); display: flex; align-items: center; justify-content: center; flex: none; }
.quick .go:disabled { background: var(--edge); color: var(--muted); cursor: default; }
.quick .preview { font-size: 13px; color: var(--muted); min-height: 18px; }
.quick .preview strong { color: var(--ink); font-weight: 600; }
.quick .preview button { border: 0; background: none; color: var(--accent); font-weight: 700; padding: 0 0 0 6px; font-size: 13px; }

/* Filter och vy */
.controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.chip { flex: none; height: 34px; padding: 0 13px; border-radius: 17px; border: 1px solid var(--edge); background: transparent; font-size: 13px; font-weight: 700;
  display: inline-flex; align-items: center; gap: 7px; color: var(--muted); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--ground); }
.dot { width: 8px; height: 8px; border-radius: 4px; flex: none; }
.seg { display: inline-flex; background: var(--card); border-radius: 12px; padding: 3px; gap: 2px; }
.seg button, .seg label { border: 0; background: transparent; padding: 6px 12px; border-radius: 9px; font-size: 13px; font-weight: 700; color: var(--muted); cursor: pointer; min-height: 32px; display: inline-flex; align-items: center; }
.seg button[aria-pressed="true"], .seg label:has(input:checked) { background: var(--edge); color: var(--ink); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.spacer { flex: 1; }
@media (max-width: 899px) {
  .controls .chips { width: 100%; }
  .controls .spacer { display: none; }
  .seg button, .seg label { padding: 6px 10px; font-size: 12px; }
}

/* Veckoremsa */
.strip { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; margin-bottom: 18px; }
.strip button { height: 62px; border: 0; border-radius: 14px; background: var(--card); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--ink); }
.strip button.past { background: transparent; color: var(--muted); }
.strip button .wd { font-size: 11px; color: var(--muted); }
.strip button .dn { font-size: 16px; font-weight: 600; }
.strip button.today { background: var(--accent); color: var(--accent-ink); }
.strip button.today .wd { color: var(--accent-ink); }
.strip button[aria-pressed="true"]:not(.today) { box-shadow: inset 0 0 0 2px var(--accent); }
.strip .dots, .mcell .dots { display: flex; gap: 3px; height: 6px; }
.strip .dots i, .mcell .dots i { width: 6px; height: 6px; border-radius: 3px; }

/* Dagar och rader */
.days { display: flex; flex-direction: column; gap: 16px; }
.day { display: flex; flex-direction: column; gap: 8px; }
.day.today > h2 { color: var(--accent); }
.rows { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; align-items: center; gap: 12px; background: var(--card); border-radius: var(--radius); padding: 12px 14px; border: 0; width: 100%; text-align: left;
  min-height: 52px; color: var(--ink); text-decoration: none; }
.row.new { box-shadow: inset 0 0 0 1px var(--accent); }
.row .time { width: 46px; flex: none; font-size: 14px; font-weight: 700; }
.row .time.lbl { font-size: 12px; color: var(--muted); }
.row .body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.row .t { font-size: 15px; }
.row .s { font-size: 13px; color: var(--muted); }
.row.past { opacity: .5; }
.row.done .t { text-decoration: line-through; color: var(--muted); }
.row input[type="checkbox"] { width: 22px; height: 22px; margin: 0; accent-color: var(--accent); flex: none; }
.check { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; margin: -10px -8px -10px -10px; flex: none; }
.badge { font-size: 12px; font-weight: 700; color: var(--accent-ink); border-radius: 8px; padding: 3px 8px; flex: none; max-width: 92px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge.all { background: var(--edge); color: var(--ink); }
.tag { font-size: 12px; font-weight: 700; border-radius: 8px; padding: 3px 8px; background: var(--edge); color: var(--muted); flex: none; }
.tag.late { background: var(--warn-soft); color: var(--warn); }
.empty { color: var(--muted); font-size: 14px; padding: 4px 0; }
.emptycard { background: var(--card); border-radius: var(--radius); padding: 16px; color: var(--muted); }

/* Sida vid sida */
.split { display: grid; gap: 8px; }
.split .colhead { font-size: 13px; font-weight: 700; display: flex; align-items: center; gap: 6px; padding: 0 2px; }
.split .col { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.split .row { padding: 10px; gap: 8px; align-items: flex-start; flex-direction: column; }
.split .row .time { width: auto; }
.split .col .badge { display: none; }
.split .none { color: #6B7482; font-size: 13px; padding: 10px 2px; }

/* Månad */
.month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.month .wdh { text-align: center; font-size: 11px; color: var(--muted); padding-bottom: 4px; }
.mcell { aspect-ratio: 1 / 1.05; border: 0; border-radius: 12px; background: var(--card); color: var(--ink); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 44px; }
.mcell.out { background: transparent; color: #5C6574; }
.mcell.today { background: var(--accent); color: var(--accent-ink); }
.mcell .dn { font-size: 15px; font-weight: 600; }

/* Barn och info */
.kids { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.kid { display: flex; align-items: center; gap: 14px; background: var(--card); border-radius: var(--radius); padding: 16px; text-decoration: none; color: inherit; }
.avatar { width: 48px; height: 48px; border-radius: 24px; display: flex; align-items: center; justify-content: center; color: var(--accent-ink); font-size: 19px; font-weight: 700; flex: none; }
.kid .t { font-size: 17px; font-weight: 700; }
.kid .s { font-size: 13px; color: var(--muted); }
.cols { display: flex; flex-direction: column; gap: 18px; }
.col { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.section { display: flex; flex-direction: column; gap: 8px; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.linkbtn { font-size: 14px; font-weight: 700; text-decoration: none; background: none; border: 0; color: var(--accent); padding: 8px 0; min-height: 36px; }
.card { background: var(--card); border-radius: var(--radius); padding: 2px 14px; }
.fact { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); min-height: 50px; }
.fact:last-child { border-bottom: 0; }
.fact .k { font-size: 13px; color: var(--muted); }
.fact .v { font-size: 15px; font-weight: 600; text-align: right; overflow-wrap: anywhere; }
.item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border: 0; border-bottom: 1px solid var(--line); background: none; width: 100%; text-align: left; min-height: 52px; color: var(--ink); text-decoration: none; }
.item:last-child { border-bottom: 0; }
.item .body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.item .t { font-size: 15px; font-weight: 600; }
.item .s { font-size: 13px; color: var(--muted); }
.item .time { width: 46px; flex: none; font-size: 14px; font-weight: 700; }
.pnr { font-variant-numeric: tabular-nums; letter-spacing: .3px; }
.pnr-actions { display: flex; gap: 4px; justify-content: flex-end; margin-top: 4px; }
.small-btn { border: 1px solid var(--edge); background: transparent; border-radius: 10px; padding: 6px 12px; font-size: 13px; font-weight: 700; min-height: 36px; color: var(--ink); text-decoration: none; display: inline-flex; align-items: center; }
.alert { background: var(--warn-soft); color: var(--warn); border-radius: var(--radius); padding: 12px 14px; font-weight: 600; white-space: pre-line; }
.prose { white-space: pre-line; padding: 12px 0; }
.sched summary { cursor: pointer; list-style: none; }
.sched summary::-webkit-details-marker { display: none; }
.sched summary .time { color: var(--accent); }
.sched[open] summary { border-bottom: 1px solid var(--line); }
.sched .lesson { padding-left: 18px; min-height: 46px; }
.infokid { display: flex; flex-direction: column; gap: 10px; }
.infokid h3 { margin: 0; display: flex; align-items: center; gap: 10px; font-size: 17px; }

/* Blad (formulär) */
.backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.55); display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--ground); width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto; border-radius: 22px 22px 0 0; border: 1px solid var(--line); border-bottom: 0;
  padding: 16px 20px calc(24px + env(safe-area-inset-bottom)); }
.sheet-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.sheet-head h2 { font-size: 20px; color: var(--ink); text-transform: none; letter-spacing: -.3px; }
.choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
.choice { background: var(--card); border: 0; border-radius: var(--radius); padding: 14px; display: flex; align-items: center; gap: 10px; font-weight: 700; text-align: left; color: var(--ink); min-height: 56px; }
.choice svg { width: 22px; height: 22px; color: var(--accent); flex: none; }
form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > .lbl { font-size: 13px; font-weight: 600; color: var(--muted); }
.field input:not([type="checkbox"]):not([type="radio"]), .field select, .field textarea {
  width: 100%; min-height: 48px; border: 1px solid var(--edge); border-radius: 12px; background: var(--card); padding: 10px 12px; font-size: 16px; }
.field textarea { min-height: 84px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.field input::placeholder, .field textarea::placeholder { color: #7C8595; }
input[type="file"] { border-style: dashed !important; }
.pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.wdays { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.wdays label { text-align: center; padding: 10px 0; border-radius: 10px; background: var(--card); border: 1px solid var(--edge); font-weight: 700; font-size: 14px; cursor: pointer; }
.wdays input { position: absolute; opacity: 0; pointer-events: none; }
.wdays label:has(input:checked) { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.wdays label:has(input:focus-visible), .swatches label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatches label { width: 40px; height: 40px; border-radius: 20px; cursor: pointer; }
.swatches input { position: absolute; opacity: 0; pointer-events: none; }
.swatches label:has(input:checked) { box-shadow: 0 0 0 3px var(--ground), 0 0 0 5px var(--ink); }
.inline-check { display: flex; align-items: center; gap: 10px; font-weight: 600; min-height: 44px; }
.inline-check input { width: 22px; height: 22px; accent-color: var(--accent); }
.actions { display: flex; gap: 10px; margin-top: 4px; }
.btn { flex: 1; min-height: 50px; border-radius: 14px; border: 0; background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 16px; }
.btn:disabled { opacity: .6; }
.btn.secondary { background: var(--card); color: var(--ink); border: 1px solid var(--edge); flex: 0 0 auto; padding: 0 18px; }
.btn.danger { background: transparent; color: var(--warn); border: 1px solid #5A3A3E; flex: 0 0 auto; padding: 0 18px; }
.btn.danger.armed { background: var(--warn); color: var(--accent-ink); }
.sheet:has(.actions.sticky) { padding-bottom: 0; }
.actions.sticky { position: sticky; bottom: 0; z-index: 1; background: var(--ground); padding: 12px 0 calc(16px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.btn.danger:disabled { opacity: .45; }
.err { background: var(--warn-soft); color: var(--warn); border-radius: 12px; padding: 10px 12px; font-weight: 600; font-size: 14px; }
.hint { font-size: 12px; color: var(--muted); }
.pick { display: flex; flex-direction: column; gap: 8px; }

.login { max-width: 380px; margin: 10vh auto 0; display: flex; flex-direction: column; gap: 14px; }
.login img { border-radius: 14px; }

#toast { position: fixed; z-index: 50; left: 50%; bottom: calc(104px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: var(--ground);
  padding: 10px 16px; border-radius: 12px; font-weight: 700; font-size: 14px; opacity: 0; transition: opacity .2s; pointer-events: none; max-width: calc(100% - 40px); }
#toast.show { opacity: 1; }

@media (min-width: 900px) {
  .nav { top: 0; right: auto; bottom: 0; width: 220px; display: flex; flex-direction: column; align-items: stretch; gap: 4px; padding: 26px 14px; border-top: 0; border-right: 1px solid var(--line); }
  .nav .brand { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 700; color: var(--ink); padding: 0 10px 18px; }
  .nav .brand img { width: 30px; height: 30px; border-radius: 8px; }
  .nav a { flex-direction: row; justify-content: flex-start; gap: 12px; font-size: 15px; padding: 8px 12px; min-height: 44px; }
  .nav a[aria-current="page"] { background: var(--card); }
  .nav .plus { order: 1; margin: 0 0 14px; width: auto; height: 46px; border-radius: 12px; border: 0; gap: 8px; font-weight: 700; font-size: 15px; justify-content: center; }
  .nav .plus .lbl { display: inline; }
  .nav .plus svg { width: 20px; height: 20px; }
  .nav .brand { order: 0; }
  .nav a:not(.plus) { order: 2; }
  .main { margin-left: 220px; padding: 36px 40px 60px; }
  .cols { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); align-items: start; }
  .backdrop { align-items: center; }
  .sheet { border-radius: 22px; border-bottom: 1px solid var(--line); padding: 22px; }
  .choices { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  #toast { bottom: 40px; }
  .split .row { flex-direction: row; align-items: center; }
  .mcell { aspect-ratio: 1.6 / 1; }
}
.strip .today .dots i, .mcell.today .dots i { box-shadow: 0 0 0 1.5px var(--accent-ink); }
.nav[hidden] + .main { margin-left: auto; }

/* Lov och lediga dagar */
.row.off { background: transparent; box-shadow: inset 0 0 0 1px var(--edge); }
.row.off .time { color: var(--accent); }
.strip .dots i.ring, .mcell .dots i.ring { background: transparent; box-shadow: inset 0 0 0 1.5px currentColor; }
