/* Samåkning – ChatGPT/OpenAI-inspirerad: ren, minimal, mycket vitrymd. */

:root {
  --bg:        #F7F7F7;   /* sidans bakgrund */
  --surface:   #ffffff;
  --text:      #525252;
  --muted:     #8B8A8F;   /* sekundär text (beskrivningar m.m.) */
  --border:    #D4D4D4;
  --hairline:  rgba(60,60,67,.16);
  --accent:    #44756B;   /* grundfärg (grön) */
  --accent-ink:#ffffff;
  --danger:    #ff3b30;   /* iOS systemRed */
  --radius:    18px;
  --radius-sm: 13px;
  --fill:      #f4f4f4;   /* grå kort/fält */
  --fill-border:#EDECF1;  /* ram på grå kort */
  --shadow:    0 1px 2px rgba(0,0,0,.04), 0 6px 20px rgba(0,0,0,.05);
  --maxw:      720px;
  --font:      -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", "Inter", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  font-weight: 400;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation; /* stänger av dubbeltryck-zoom (behåller nyp-zoom) */
  text-rendering: optimizeLegibility;
  accent-color: var(--accent);
}

a { color: var(--accent); text-decoration: underline; }
a:hover { text-decoration: none; }
/* Strukturella länkar (knappar, kort, flikar, nav) ska aldrig understrykas */
.btn, .card-link, .tabbar .tab, .navlink, a.userlink, .list-row, .topbtn, .back-fab, .gs-item-btn,
.gs-create, .add-note, .backlink, .offer-extra > summary { text-decoration: none; }
/* Länk-liknande klickbar text utan ikon följer samma regel som gröna länkar */
.edit-link, .child-edit-toggle { text-decoration: underline; }
.edit-link:hover, .child-edit-toggle:hover { text-decoration: none; }

.topbar {
  position: static;
  background: transparent;
  border-bottom: 0;
  padding-top: env(safe-area-inset-top);
}
.topbar-inner {
  max-width: var(--maxw); margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  padding: 10px 18px;
}
.toplogout { font-size: 15px; font-weight: 500; color: var(--accent); white-space: nowrap; flex: 0 0 auto; }
.toplogout:hover { text-decoration: none; opacity: .8; }
.brand { font-weight: 600; letter-spacing: -.01em; font-size: 16px; display: flex; align-items: center; gap: 10px; min-width: 0; flex: 0 1 auto; }
.brand > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.brand .brand-text { display: flex; flex-direction: column; justify-content: center; line-height: 1.12; min-width: 0; }
.brand .brand-beta { font-size: 10px; font-weight: 700; letter-spacing: .14em; color: var(--muted); text-transform: uppercase; }
.brand .brand-name { font-size: 17px; font-weight: 700; letter-spacing: -.02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.brand small { color: var(--muted); font-weight: 400; }
.brand-logo { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; display: block; flex: 0 0 auto; }
.brand-logo-fallback { display: flex; align-items: center; justify-content: center; background: color-mix(in srgb, var(--accent) 14%, #fff); color: var(--accent); font-weight: 700; font-size: 15px; }
.topbtn {
  flex: 0 0 auto; width: 38px; height: 38px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(120,120,128,.12); color: var(--text);
}
.topbtn svg { width: 20px; height: 20px; }
.topbtn:hover { background: rgba(120,120,128,.2); text-decoration: none; }
.topbtn:active { transform: scale(.92); }

/* Toppnavigering */
.nav { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.navtoggle { display: none; background: none; border: 0; cursor: pointer;
  font-size: 22px; line-height: 1; color: var(--text); padding: 6px 8px; border-radius: 8px; }
.navtoggle:hover { background: #f0f0f3; }
.navlink {
  font-size: 14px; font-weight: 540; color: var(--accent);
  padding: 6px 4px; margin: 0 6px; border-bottom: 2px solid transparent;
}
.navlink:hover { color: var(--accent); filter: brightness(.9); border-bottom-color: color-mix(in srgb, var(--accent) 50%, transparent); text-decoration: none; }
.navlink.active { color: var(--accent); border-bottom-color: var(--accent); }
.userbox {
  display: flex; align-items: center; gap: 8px; margin-left: 10px;
  padding: 4px 6px 4px 6px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 999px;
}
.userbox .uname { font-size: 14px; color: var(--text); }
.userlink { display: flex; align-items: center; gap: 8px; padding: 2px 14px 2px 2px;
  border-radius: 999px; color: inherit; text-decoration: none; }
a.userlink:hover { background: #f0f0f3; text-decoration: none; }
a.userlink.active .uname { font-weight: 600; }
a.userlink.active .avatar { box-shadow: 0 0 0 2px var(--accent); }
/* Mobil: kollapsa menyn till hamburgare */
@media (max-width: 640px) {
  .topbar-inner { flex-wrap: wrap; }
  .navtoggle { display: block; }
  .nav {
    display: none; order: 3; width: 100%;
    flex-direction: column; align-items: stretch; gap: 2px;
    padding: 8px 0 4px;
  }
  .nav.open { display: flex; }
  .navlink { margin: 0; padding: 12px 6px; border-bottom: 1px solid var(--border); }
  .navlink.active { border-bottom-color: var(--accent); }
  .userbox {
    width: 100%; justify-content: space-between; margin-top: 12px;
  }
  .userbox .uname { display: inline; }
}

.container { max-width: var(--maxw); margin: 0 auto; padding: 18px 18px 24px; }

h1 { font-size: 26px; font-weight: 600; letter-spacing: -.02em; margin: 6px 0 4px; }
h2 { font-size: 18px; font-weight: 600; letter-spacing: -.01em; margin: 0 0 12px; }
.sub { color: var(--muted); margin: 0 0 22px; }

.card {
  background: var(--surface);
  border: 0;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 18px;
  border-radius: 12px;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 12px;
}

/* Klickbart kort (länk) – tydlig affordans */
.card-link { display: block; color: inherit; text-decoration: none; cursor: pointer;
  transition: background .15s, transform .04s; }
.card-link:hover { text-decoration: none; }
.card-link:active { transform: translateY(1px); }
.card-link-body { display: flex; align-items: center; gap: 14px; }
.card-link-body > .grow { flex: 1 1 auto; }
.chev { color: var(--muted); font-size: 28px; line-height: 1; flex: 0 0 auto; margin-left: 4px; transition: transform .15s, color .15s; }
.card-link:hover .chev { transform: translateX(4px); color: var(--text); }

/* Sträck-block på schemakortet (Dit/Hem som egen grå box) */
.legs { margin-top: 18px; display: flex; flex-direction: column; gap: 18px; }
.leg-block { background: var(--fill); border: 1px solid #eaeaea; border-radius: 8px; padding: 16px; }
.leg-block.has-driver { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, var(--surface)); }
.leg-block.has-driver .avstack .avatar { box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 7%, var(--surface)); }
.leg-block.has-driver .ride-table td { border-top-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.leg-title {
  display: inline-block; font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; color: var(--text); background: #e7e7ec;
  padding: 3px 9px; border-radius: 5px; vertical-align: middle;
}
.leg-block .chip { vertical-align: middle; margin-left: 4px; }
.ride-table { width: 100%; border-collapse: collapse; margin-top: 12px; }
.ride-table th {
  text-align: left; font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .03em; color: var(--muted); padding: 0 12px 5px 0;
}
.ride-table td { padding: 7px 12px 7px 0; vertical-align: middle; border-top: 1px solid #e2e2e7; font-size: 13.5px; }
.ride-table th:last-child, .ride-table td:last-child { padding-right: 0; }
.ride-table td.note-row { border-top: 0; padding: 0 0 8px; }

.chip { display: inline-block; font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 5px; background: #f0f0f3; color: var(--muted); }
.chip-warn   { background: #fbeecd; color: #8a5a00; }
.chip-danger { background: #fbeaea; color: #c0392b; }

.avstack { display: inline-flex; }
.avstack .avatar { margin-left: -7px; box-shadow: 0 0 0 2px var(--surface); }
.avstack .avatar:first-child { margin-left: 0; }
/* I de grå sträck-boxarna ska separationsringen matcha den grå bakgrunden */
.leg-block .avstack .avatar { box-shadow: 0 0 0 2px #f6f6f8; }

/* Hopfällbar "erbjud en till bil" när någon redan kör */
.offer-extra { margin-top: 18px; }
.offer-extra > summary {
  cursor: pointer; color: var(--accent); font-size: 14px; font-weight: 600;
  list-style: none; padding: 2px 0;
}
.offer-extra > summary::-webkit-details-marker { display: none; }
.offer-extra > summary:hover { opacity: .8; }
.offer-extra > summary::before { content: "＋ "; }
.offer-extra[open] > summary::before { content: "− "; }
.offer-extra[open] > summary { margin-bottom: 4px; }

/* Redigera-kommentar (penna till höger om bubblan) – bara för ägaren */
.note-edit { margin-top: 24px; }
.note-summary { display: flex; align-items: flex-start; gap: 8px; cursor: pointer; list-style: none; }
.note-summary::-webkit-details-marker { display: none; }
.note-summary::marker { content: ""; }
.note-summary .bubble { margin-top: 9px; align-self: flex-start; }
.pencil {
  flex: 0 0 auto; font-size: 15px; line-height: 1; opacity: 1; margin-top: 9px;
  width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px; transition: background .15s;
}
.note-summary:hover .pencil, .note-edit[open] .pencil { background: #ececf1; }
/* Grå "ride"-box på tillfälle-sidan – samma känsla som korten på startsidan */
.ride-box { background: var(--fill); border-radius: 8px; padding: 16px; margin-bottom: 10px; border: 1px solid #eaeaea; }
.ride-box .spread { align-items: flex-start; }
.ride-box .spread .btn.danger { margin: -4px -6px 0 0; }
.ride-box .person { min-width: 0; }
.ride-box .meta { min-width: 0; flex: 1 1 auto; }

/* Namn + badge i linje, med avklippning av långa namn */
.name-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.name-row .name-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.name-row .badge { flex: 0 0 auto; }

/* Kontaktrader med riktiga ikoner; långa mejl klipps av */
.contacts { display: flex; flex-direction: column; gap: 4px; margin-top: 5px; min-width: 0; }
.contact { display: inline-flex; align-items: center; gap: 7px; max-width: 100%; min-width: 0; font-size: 13.5px; }
.contact .contact-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.contact-ico { flex: 0 0 auto; width: 15px; height: 15px; color: var(--accent); }
.edit-link { flex: 0 0 auto; align-self: flex-start; margin-top: 16px; color: var(--accent); font-size: 14px; font-weight: 600; cursor: pointer; }
.note-summary:hover .edit-link { opacity: .8; }
/* Apple-chevron i passagerar-boxen */
.pax-chev { flex: 0 0 auto; width: 17px; height: 17px; color: #A3A3A3; transition: transform .2s, color .2s; }
.pax[open] .pax-chev { transform: rotate(180deg); color: var(--accent); }
/* Barn-rad som expanderar till redigeringsläge (i egen grå box) */
.child-edit { background: var(--fill); border: 0; border-radius: 8px; padding: 14px; margin-bottom: 10px; }
.child-summary { display: flex; align-items: center; gap: 12px; cursor: pointer; list-style: none; }
.child-summary::-webkit-details-marker { display: none; }
.child-summary .name { flex: 1 1 auto; font-weight: 540; }
.child-edit-toggle { color: var(--accent); font-size: 14px; font-weight: 600; }
.child-summary:hover .child-edit-toggle { opacity: .8; }
.child-edit[open] .child-edit-toggle { color: var(--muted); }

.backlink { color: var(--accent); font-size: 14px; font-weight: 600; display: inline-block; }
.backlink:hover { opacity: .8; text-decoration: none; }

/* Flytande rund tillbaka-pil (iOS) */
.back-fab { position: fixed; top: calc(5px + env(safe-area-inset-top)); left: max(18px, calc(50% - 324px)); z-index: 20; display: inline-flex; align-items: center; justify-content: flex-start; width: 40px; height: 40px; background: transparent; color: var(--text); }
.back-fab svg { width: 21px; height: 21px; margin-left: -1px; }
.back-fab:hover { text-decoration: none; }

/* iOS large-title navbar: blur + centrerad liten titel som tonas in vid scroll */
.navbar { position: fixed; top: 0; left: 0; right: 0; height: calc(50px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 60px 0; z-index: 15; display: flex; align-items: center; justify-content: center; pointer-events: none; }
/* EN enda topp-bakgrund: solid högst upp (täcker ön) → tonar mjukt till genomskinlig strax under lilla rubriken. Alltid närvarande, ingen hård kant. */
body::before {
  content: ""; position: fixed; top: 0; left: 0; right: 0; z-index: 14; pointer-events: none;
  height: calc(env(safe-area-inset-top) + 60px);
  background: linear-gradient(to bottom, var(--bg) 0, var(--bg) 5px, rgba(247, 247, 247, 0) 100%);
}
/* Ingen separat scroll-gradient – titeln nedan ligger ovanpå body::before-faden */
.navbar::before { display: none; }
.navbar-title { position: relative; font-size: 16px; font-weight: 600; letter-spacing: -.01em; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; opacity: 0; transform: translateY(4px); transition: opacity .25s, transform .25s; }
body.scrolled .navbar::before { opacity: 1; }
/* Undersidor (tillfälle/admin): liten titel + pil syns direkt och sitter fast */
body.subpage .navbar-title { opacity: 1; transform: none; }
body.subpage::before { height: calc(env(safe-area-inset-top) + 64px); background: linear-gradient(to bottom, var(--bg) 0, var(--bg) calc(env(safe-area-inset-top) + 38px), rgba(247,247,247,0) 100%); }
body.subpage .container { padding-top: calc(72px + env(safe-area-inset-top)); }
body.nav-scrolled .navbar-title { opacity: 1; transform: none; }
body.nav-scrolled .back-fab { background: transparent; box-shadow: none; }
/* Tillfälle-sidans rubrikblock (utan kort) */
.occasion-head { margin: 0 0 32px; }
.occasion-head .page-title { margin: 0; }
.occasion-sub { font-size: 15px; color: var(--muted); margin: 6px 0 0; }
.info-label { font-size: 12px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; color: var(--muted); margin: 40px 0 6px; }
/* Erbjud-skjuts: ett fält per rad */
.offer-form { display: flex; flex-direction: column; gap: 24px; }
.offer-form .field { margin: 0; }
.offer-form .field label { display: block; margin-bottom: 6px; font-size: 13.5px; font-weight: 600; }
.offer-form .field input { border-radius: 8px; }
.offer-form .btn { margin-top: 24px; border-radius: 8px; }
.occasion-info { font-size: 14px; line-height: 1.5; white-space: pre-line; color: #525252; }
.occasion-when { font-size: 15px; font-weight: 500; color: var(--text); }
.occasion-meta { display: flex; flex-wrap: wrap; gap: 14px 18px; }
.occasion-meta-item { flex: 1 1 auto; display: flex; align-items: center; gap: 9px; min-width: max-content; font-size: 15px; font-weight: 500; color: var(--text); text-decoration: none; }
a.occasion-meta-item span { text-decoration: underline; }
a.occasion-meta-item:hover span { text-decoration: none; }
.occasion-meta-item svg { flex: 0 0 auto; width: 19px; height: 19px; color: var(--accent); }
/* Mobil: lägg delarna på var sin rad under varandra */
@media (max-width: 560px) {
  .occasion-meta { flex-direction: column; gap: 12px; }
  .occasion-meta-item { width: 100%; }
}
.add-note { color: var(--accent); font-size: 14px; font-weight: 600; }
.note-summary:hover .add-note { opacity: .8; }

/* Statusrad – prickar, inte knappar (rött och grönt lika vikt) */
.statuses { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 12px; }
.status { font-size: 13.5px; color: var(--muted); font-weight: 500; display: inline-flex; align-items: center; gap: 7px; }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: 0 0 auto; }
.status.ok   { color: #0c7a5d; }
.status.warn { color: #c0392b; }

/* Typ-chip – platt, ingen ram, egen färg per typ */
.tag { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600;
  letter-spacing: .02em; padding: 4px 11px; border-radius: 5px; border: 0; }
.tag.match     { background: #eaf1fb; color: #2f5bd0; }
.tag.traning   { background: #fdf3e7; color: #b9722a; }
.tag.turnering { background: #f3eefb; color: #7a4fc0; }
.tag.futsal    { background: #eafaf4; color: #0c7a5d; }
.tag.cancelled { background: #fbeaea; color: #c0392b; }
.tag.changed   { background: #fbeecd; color: #8a5a00; }

/* Avatarer – runda genomgående */
.avatar {
  --s: 40px;
  width: var(--s); height: var(--s);
  border-radius: 50%;
  object-fit: cover;
  display: inline-flex; align-items: center; justify-content: center;
  background: #ececf1; color: var(--muted);
  font-size: calc(var(--s) * .4); font-weight: 600;
  flex: 0 0 auto; overflow: hidden;
  border: 0;
}
.avatar.lg { --s: 64px; }
.avatar.sm { --s: 30px; }

.person { display: flex; align-items: center; gap: 12px; }
.person .meta { min-width: 0; }
.person .name { font-weight: 540; }
.person .note { color: var(--muted); font-size: 13px; }

/* Medlemsbox – samlar allt om en förälder/ett barn i en grå ruta */
.member { background: var(--fill); border: 0; border-radius: 8px; padding: 14px 16px; margin-bottom: 10px; }
.member-head { display: flex; align-items: center; gap: 12px; }
.member-head > .grow { flex: 1 1 auto; min-width: 0; }

.row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0; border-top: 1px solid var(--border);
}
.row:first-child { border-top: 0; }
.row .grow { flex: 1 1 auto; min-width: 0; }

.badge {
  display: inline-block; font-size: 12px; font-weight: 600;
  padding: 3px 9px; border-radius: 5px; border: 0;
  background: color-mix(in srgb, var(--accent) 12%, #fff); color: var(--accent);
}
.badge.gray { background: #f0f0f3; color: var(--muted); }
.badge.amber { background: #FDF0D5; color: #9A6700; }

/* Knappar */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font: inherit; font-weight: 600; cursor: pointer;
  padding: 11px 16px; border-radius: 12px; white-space: nowrap;
  border: 1px solid #D4D4D4; background: var(--surface); color: var(--text);
  box-shadow: 0 1px 2px rgba(0,0,0,.05);
  transition: background .15s, border-color .15s, transform .04s;
}
.btn:hover { background: #f5f5f5; border-color: #BDBDBD; text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(0.93); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--accent); padding: 8px 10px; box-shadow: none; }
.btn.ghost:hover { background: #f0f0f3; }
.btn.danger { color: var(--danger); border-color: transparent; background: transparent; padding: 8px 10px; box-shadow: none; }
.btn.danger:hover { background: transparent; opacity: .6; }
/* Knappstorlekar: S (.sm), M (bas-.btn, t.ex. vid inputfält), L (.lg, fristående utanför boxar) */
.btn.sm { padding: 8px 14px; font-size: 14px; min-height: 36px; box-sizing: border-box; }
.btn.lg { padding: 15px 22px; font-size: 16px; min-height: 52px; box-sizing: border-box; }
.btn:disabled, .btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn.danger-solid { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn.danger-solid:hover { filter: brightness(0.93); background: var(--danger); }

/* Bekräftelse-dialog */
dialog.confirm { border: 0; border-radius: 16px; padding: 0; max-width: 380px; width: calc(100% - 32px); box-shadow: var(--shadow); }
dialog.confirm::backdrop { background: rgba(0,0,0,.35); }
.confirm-box { padding: 20px; }
.confirm-msg { margin: 0 0 18px; font-size: 15px; line-height: 1.5; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 10px; }
.btn.block { width: 100%; justify-content: center; }

/* Formulär */
label { display: block; font-size: 14px; font-weight: 540; margin: 0 0 6px; color: #404040; }
.field > label { font-size: 13px; font-weight: 500; color: #404040; }
.field { margin-bottom: 24px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=tel], input[type=search], input[type=url], input[type=date], input[type=time], select {
  width: 100%; font: inherit; color: var(--text);
  padding: 12px 14px; border: 1px solid #D4D4D4; border-radius: 18px;
  background: var(--surface); outline: none;
  box-shadow: 0 1px 2px rgba(0,0,0,.05);
  transition: border-color .15s, box-shadow .15s, background .15s;
}
input[type=text]:hover, input[type=email]:hover, input[type=password]:hover,
input[type=number]:hover, input[type=tel]:hover, input[type=search]:hover, input[type=url]:hover, input[type=date]:hover, input[type=time]:hover, select:hover {
  border-color: #BDBDBD;
}
input:focus, select:focus { background-color: var(--surface); border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); }
/* Fält & knappar inuti en box (vit .card eller grå box) får mindre rundning */
.card input, .card select, .card textarea, .card .btn,
.ride-box input, .ride-box select, .ride-box .btn,
.member input, .member select, .member .btn,
.pax-info input, .pax-info select, .pax-info .btn { border-radius: 8px; }
/* Fält inuti en grå ride-box: vit bakgrund + synlig ram (annars smälter de in) */

/* Egen, konsekvent select med tydlig pil */
select {
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  padding-right: 38px; cursor: pointer;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="%23A3A3A3" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9"/></svg>');
  background-repeat: no-repeat;
  background-position: right 13px center;
  background-size: 16px;
}
select::-ms-expand { display: none; }
.help { color: var(--muted); font-size: 13px; margin-top: 5px; font-style: italic; }
.inline-form { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.inline-form .field { margin-bottom: 0; flex: 1 1 160px; }
/* Knappar i inline-formulär ska vara lika höga som inmatningsfälten */
.inline-form .btn { min-height: 49px; }

/* Flash */
/* In-content-notis (t.ex. inställt tillfälle) – inte längre en topp-alert. */
.flash { border-radius: 12px; padding: 13px 16px; font-size: 14px; font-weight: 500; margin-bottom: 16px; }
.flash.success { background: #eef9f4; color: #0c7a5d; border: 1px solid #cdeede; }
.flash.error   { background: #fbeaea; color: #a32; border: 1px solid #f1cccc; }
.flash.info    { background: #eef1f9; color: #335; border: 1px solid #d3dbf0; }
.flash code { word-break: break-all; }

/* iOS-toast längst ner – flytande bekräftelse vid bokning/avbokning. */
.toast-wrap {
  position: fixed; left: 0; right: 0; z-index: 70;
  bottom: calc(88px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 0 16px; pointer-events: none;
}
.toast {
  pointer-events: auto; display: inline-flex; align-items: center; gap: 10px;
  max-width: min(92vw, 420px);
  background: rgba(28,28,30,0.92);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  color: #fff; font-size: 15px; font-weight: 500; line-height: 1.3;
  padding: 12px 18px 12px 13px; border-radius: 999px;
  box-shadow: 0 8px 30px rgba(0,0,0,.30), 0 2px 8px rgba(0,0,0,.18);
  transform: translateY(160%); opacity: 0;
  transition: transform .42s cubic-bezier(.22,1,.36,1), opacity .3s ease;
}
.toast.toast-in  { transform: translateY(0); opacity: 1; }
.toast.toast-out { transform: translateY(160%); opacity: 0; }
.toast-ico { flex: 0 0 auto; display: inline-flex; }
.toast-ico svg { display: block; width: 22px; height: 22px; }
.toast-msg { min-width: 0; }

.empty { text-align: center; color: var(--muted); padding: 28px 10px; }

.center-page { min-height: 86vh; display: flex; align-items: center; justify-content: center; }
.auth-card { width: 100%; max-width: 380px; }

/* Filuppladdning – döljer den engelska native-knappen, egen svensk knapp */
.file { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; max-width: 100%; }
.file input[type=file] {
  position: absolute; width: 1px; height: 1px;
  opacity: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
.file-name { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Passagerare som går att fälla ut för kontaktuppgifter */
.pax { display: inline-block; }
.pax[open] { flex: 1 1 100%; }
.pax-sum { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; list-style: none;
  background: var(--surface); border: 1px solid #E5E5E5; border-radius: 999px; padding: 4px 11px 4px 4px; font-size: 14px; font-weight: 500; }
.pax-sum::-webkit-details-marker { display: none; }
/* Utfälld passagerar-info som iOS grouped-list (rader + hårfina avdelare) */
.pax-info { margin-top: 8px; background: var(--surface); border-radius: 8px; padding: 2px 14px; font-size: 14px; border: 1px solid #E5E5E5; }
.pax-info > * { padding: 12px 0; margin: 0; }
.pax-info > * + * { border-top: 1px solid #F4F4F4; }
.pax-parent { display: flex; align-items: center; gap: 10px; }
.pax-parent-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; min-width: 0; }
.pax-parent-name { font-weight: 500; }
.pax-cancel { margin-left: -10px; }

/* Pratbubbla för förarens kommentar (iOS-stil, svans mot avataren) */
.bubble {
  position: relative; display: inline-block; margin-top: 6px;
  background: #D5D5D5; color: #000;
  font-size: 12.5px; line-height: 1.4;
  padding: 7px 11px; border-radius: 14px; max-width: 100%;
}
.bubble::before {
  content: ""; position: absolute; left: -6px; top: 10px;
  border-style: solid; border-width: 6px 8px 6px 0;
  border-color: transparent #D5D5D5 transparent transparent;
}
/* Variant med svans uppåt (mot profilbilden ovanför) */
.bubble.up { margin-top: 9px; }
.bubble.up::before {
  left: 13px; top: -5px;
  border-width: 0 6px 6px 6px;
  border-color: transparent transparent #D5D5D5 transparent;
}

.muted { color: var(--muted); }
.stack > * + * { margin-top: 10px; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
hr.soft { border: 0; border-top: 1px solid #F4F4F4; margin: 20px 0; }

/* ============================================================
   iOS-känsla: bottenflikar, large title, mjuka kort och fält
   ============================================================ */

/* Flytande glas-flikrad (iOS 26 Liquid Glass) */
.tabbar {
  position: fixed; z-index: 20;
  left: 50%; transform: translateX(-50%);
  bottom: calc(env(safe-area-inset-bottom) + 12px); /* webbläsare: ovanför browser-UI */
  width: min(calc(100% - 32px), 430px); max-width: 210px;
  display: flex; align-items: stretch;
  background: rgba(255,255,255,.74);
  -webkit-backdrop-filter: saturate(180%) blur(30px);
  backdrop-filter: saturate(180%) blur(30px);
  border: .5px solid rgba(0,0,0,.04);
  border-radius: 999px;
  box-shadow: 0 12px 40px rgba(0,0,0,.14);
  padding: 5px;
}
/* Hemskärms-app: menyns inställda läge (efter bas-regeln så den vinner) */
@media (display-mode: standalone) {
  .tabbar { bottom: calc(env(safe-area-inset-bottom) - 11px); }
}
.tabbar .tab {
  flex: 1 1 0; display: flex; align-items: center; justify-content: center;
  padding: 11px 4px; color: var(--muted); text-decoration: none;
  border-radius: 999px;
  transition: color .15s, background .15s, transform .08s;
}
.tabbar .tab svg { width: 24px; height: 24px; display: block; }
.tabbar .tab .avatar { --s: 24px; font-size: 10px; }
.tabbar .tab.active { color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, transparent); }
.tabbar .tab:hover { text-decoration: none; }
.tabbar .tab:active { transform: scale(.92); }

/* Plats ovanför den flytande tab-baren */
.page-end { padding-bottom: calc(96px + env(safe-area-inset-bottom)) !important; }

/* iOS-tryckkänsla */
a.card-link { transition: transform .08s ease; }
a.card-link:active { transform: scale(.985); }
.btn { transition: background .15s, border-color .15s, transform .08s, filter .15s; }
.btn:active { transform: scale(.97); }

/* Large-title à la iOS – stort, fett */
h1 { font-size: 34px; font-weight: 500; letter-spacing: -.03em; line-height: 1.08; margin: 2px 0 6px; }
h2 { font-size: 17px; font-weight: 600; letter-spacing: -.01em; margin: 0 0 14px; }
/* Alla rubriker i mörkgrå */
h1, h2, h3, .page-title, .navbar-title { color: #404040; }
.sub { font-size: 14px; margin: 14px 0 20px; }
/* Sekundär text (beskrivningar, tid/plats m.m.) i ljusgrå */
.note { color: var(--muted); }
/* Enhetlig titel→undertext-marginal oavsett sektion */
.page-title { margin: 0; }
/* Sidor utan page-head (bara rubrik): lika mycket luft under som över */
.container > .page-title { margin-bottom: 32px; }
/* Titel på tillfälle-korten (Match/Träning) – ändra här för att styra alla */
.sched-title { font-size: 17px; font-weight: 600; color: #404040; }

/* Kantlösa, luftiga kort med mjuk skugga (Apple-stil) */
.card {
  border: 1px solid #E5E5E5;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 18px;
  box-shadow: none;
}
.container { padding-top: calc(56px + env(safe-area-inset-top)); }
.sub + .card, h1 + .card { margin-top: 4px; }

/* Färgad ikon-ruta (Inställningar/App Store-stil) */
.icon-badge {
  flex: 0 0 auto; width: 40px; height: 40px; border-radius: 11px;
  display: flex; align-items: center; justify-content: center; font-size: 21px;
  background: color-mix(in srgb, var(--accent) 14%, #fff);
}
/* Kort grå förklartext bredvid pilen (Apple "värde"-text) */
.card-hint { flex: 0 0 auto; color: var(--muted); font-size: 15px; white-space: nowrap; }
/* Körning dit/hem – Apple "tile" (ikon-ruta + rubrik + undertext) */
.leg-head { display: flex; align-items: center; gap: 12px; }
.leg-badge { position: relative; flex: 0 0 auto; width: 40px; height: 40px; border-radius: 8px; display: flex; align-items: center; justify-content: center; background: color-mix(in srgb, var(--accent) 20%, #fff); color: var(--accent); }
.leg-badge svg { width: 20px; height: 20px; stroke-width: 2.5; }
.leg-badge.flip svg { transform: scaleX(-1); }
.leg-dot { position: absolute; top: -3px; left: -3px; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--fill); }
.leg-dot.ok { background: #34C759; }
.leg-dot.wait { background: #FF9500; }
.leg-dot.danger { background: var(--danger); }
.leg-name { font-size: 14px; font-weight: 600; color: var(--text); }
.leg-status { color: var(--muted); font-size: 14px; margin-top: 1px; }
.leg-status .danger { color: inherit; font-weight: 600; }
.leg-note { position: relative; display: inline-block; margin-top: 14px; background: #D5D5D5; color: #000; border-radius: 16px; padding: 8px 13px; font-size: 13.5px; line-height: 1.4; max-width: 100%; }
.leg-note::before { content: ""; position: absolute; left: 52px; top: -5px; border-style: solid; border-width: 0 6px 6px 6px; border-color: transparent transparent #D5D5D5 transparent; }
.leg-pax { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.pax-pill { display: inline-flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid #E5E5E5; border-radius: 999px; padding: 4px 13px 4px 4px; font-size: 14px; font-weight: 500; }

/* Grupp-väljare på Körningar (expanderbar) */
.group-switcher { display: block; margin: 0 0 22px; background: var(--surface); border: 1px solid #E5E5E5; border-radius: 12px; overflow: hidden; }
.group-switcher > summary { display: flex; align-items: center; gap: 14px; padding: 16px; cursor: pointer; list-style: none; }
.group-switcher > summary::-webkit-details-marker { display: none; }
.group-switcher:not([open]) > summary:hover .gs-chev { transform: translateY(2px); }
.gs-logo { flex: 0 0 auto; width: 44px; height: 44px; border-radius: 50%; background: #fff; border: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; font-weight: 700; font-size: 15px; color: var(--accent); }
.gs-logo img { width: 100%; height: 100%; object-fit: contain; padding: 3px; box-sizing: border-box; }
.gs-meta { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.gs-name { font-size: 16px; font-weight: 600; letter-spacing: -.01em; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gs-sub { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 1px; }
.gs-chev { flex: 0 0 auto; width: 20px; height: 20px; color: #A3A3A3; transition: transform .2s; }
.group-switcher[open] .gs-chev { transform: rotate(180deg); }
.gs-panel { padding: 2px 8px 10px; border-top: 1px solid color-mix(in srgb, var(--accent) 12%, var(--surface)); }
.gs-item { margin: 0; }
.gs-item-btn { width: 100%; display: flex; align-items: center; gap: 12px; padding: 9px 8px; background: none; border: 0; cursor: pointer; text-align: left; border-radius: 10px; font: inherit; }
.gs-item-btn:hover { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.gs-item .gs-logo { width: 36px; height: 36px; font-size: 13px; }
.gs-empty { color: var(--muted); font-size: 14px; margin: 10px 8px; }
.gs-create { display: inline-flex; align-items: center; gap: 7px; margin: 8px 8px 2px; font-weight: 600; font-size: 14px; color: var(--accent); }

/* Schema: Dit + Hem tätt ihop – platta hörn mot varandra, 4px mellan */
.sched-item .legs { gap: 4px; }
.sched-item .leg-block:not(:last-child) { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.sched-item .leg-block:not(:first-child) { border-top-left-radius: 0; border-top-right-radius: 0; }

/* Apple-chevron: tunn, ljusgrå (iOS systemGray3) */
.chev {
  flex: 0 0 auto; width: 8px; height: 14px; margin-left: 6px; font-size: 0;
  background: no-repeat center / contain
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 20'%3E%3Cpath d='M2.5 2.5L9.5 10l-7 7.5' fill='none' stroke='%23A3A3A3' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

/* Sidhuvud (stor titel + ev. gruppnamn + logga/åtgärd till höger) */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 2px 0 32px; }
.page-head .grow { min-width: 0; }
.page-head h1 { margin: 0; }
.beta-kicker { font-size: 11px; font-weight: 700; letter-spacing: .16em; color: var(--muted); text-transform: uppercase; margin-bottom: 1px; }
.page-head-sub-row { display: flex; align-items: center; gap: 8px; min-width: 0; margin-top: 2px; }
.page-head-sub { font-size: 24px; font-weight: 600; letter-spacing: -.02em; color: #88878D; line-height: 1.12; margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

/* Beta-pill (Apple-blå, vit text) – bredvid rubriken */
.beta-tag {
  display: inline-block; vertical-align: middle; white-space: nowrap;
  font-size: 12px; font-weight: 600; letter-spacing: .01em; margin-left: 8px;
  position: relative; top: -2px;
  color: var(--accent-ink); background: var(--accent); padding: 3px 10px; border-radius: 999px;
}
.page-logo { height: 52px; flex: 0 0 auto; }
.page-logo.sm { height: 40px; }
/* Uppladdad logga: visas som den är (ej beskuren cirkel), lätt rundade hörn. */
img.page-logo { width: auto; max-width: 120px; border-radius: 10px; object-fit: contain; display: block; }
/* Fallback (ingen bild): rund cirkel med initialer. */
.page-logo-fallback { width: 52px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: color-mix(in srgb, var(--accent) 14%, #fff); color: var(--accent); font-weight: 700; font-size: 18px; }
.page-logo-fallback.sm { width: 40px; font-size: 15px; }

/* Segmenterad kontroll (iOS) */
.segment { display: flex; background: var(--fill); border-radius: 12px; padding: 3px; gap: 3px; }
.segment label { flex: 1 1 0; margin: 0; }
.segment label input { position: absolute; opacity: 0; pointer-events: none; }
.segment label span {
  display: block; text-align: center; padding: 9px 10px; border-radius: 9px;
  font-size: 14px; font-weight: 600; color: var(--text); cursor: pointer;
  transition: background .15s, box-shadow .15s;
}
.segment label:has(input:checked) span { background: var(--surface); box-shadow: 0 1px 3px rgba(0,0,0,.14); }

/* iOS-toggle */
.switch { display: inline-flex; align-items: center; flex: 0 0 auto; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track {
  width: 51px; height: 31px; border-radius: 999px; background: #e4e4ea;
  position: relative; transition: background .2s; flex: 0 0 auto;
}
.switch .track::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .2s;
}
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(20px); }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.switch-row .switch-label { font-size: 15px; }

/* Grupperad lista i Apple Store-stil */
.list { background: var(--surface); border-radius: 12px; box-shadow: none; overflow: hidden; margin-bottom: 18px; }
.list-row { display: flex; align-items: center; gap: 14px; padding: 14px 18px; position: relative; color: inherit; text-decoration: none; }
a.list-row:active { background: rgba(0,0,0,.03); }
.list-row + .list-row::before { content: ""; position: absolute; top: 0; left: 64px; right: 0; height: 1px; background: var(--hairline); }
.list-row .lead { flex: 0 0 auto; display: flex; align-items: center; justify-content: center; }
.list-row .body { flex: 1 1 auto; min-width: 0; }
.list-row .list-title { font-weight: 600; letter-spacing: -.01em; }
.list-row .list-sub { color: var(--muted); font-size: 13.5px; margin-top: 1px; }
.list-row .list-chev { flex: 0 0 auto; color: #c4c4cc; font-size: 22px; line-height: 1; }
/* Grupprubrik ovanför en lista (Inställningar-stil) */
.list-header { font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; margin: 6px 4px 8px; }

/* iOS-fält: rundat och 16px (hindrar auto-zoom vid fokus på iPhone) */
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=tel], input[type=search], input[type=url], input[type=date],
input[type=time], select, textarea {
  font-size: 16px;
}
