:root {
  --green: #1f5b3a;
  --green-dark: #143d27;
  --green-light: #e8f2ec;
  --red: #b3261e;
  --amber: #b26a00;
  --bg: #f6f7f5;
  --card: #ffffff;
  --text: #1d2420;
  --muted: #5d6a62;
  --border: #d8ded9;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(0,0,0,.06), 0 2px 8px rgba(0,0,0,.04);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); line-height: 1.45; }
a { color: var(--green); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
small, .muted { color: var(--muted); }

header.top {
  background: var(--green); color: #fff; padding: 14px 20px;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
header.top .brand { font-weight: 700; font-size: 1.1rem; display: flex; align-items: center; gap: 8px; }
header.top nav { display: flex; gap: 4px; flex-wrap: wrap; }
header.top nav button {
  background: transparent; color: #dfeee5; border: 0; padding: 8px 12px; border-radius: 6px;
  font: inherit; cursor: pointer;
}
header.top nav button.active, header.top nav button:hover { background: var(--green-dark); color: #fff; }
header.top .spacer { flex: 1; }
header.top select { max-width: 220px; }

main { max-width: 1200px; margin: 0 auto; padding: 20px; }
main.narrow { max-width: 680px; }

.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); margin-bottom: 16px; }
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid.kpi { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.kpi .card { margin: 0; }
.kpi .value { font-size: 1.8rem; font-weight: 700; color: var(--green); }
.kpi .label { color: var(--muted); font-size: .9rem; }

form .row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 10px; }
label .hint { font-weight: 400; color: var(--muted); }
input, select, textarea {
  display: block; width: 100%; margin-top: 4px; padding: 9px 10px; font: inherit;
  border: 1px solid var(--border); border-radius: 7px; background: #fff; color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--green); outline-offset: 0; border-color: var(--green); }
textarea { min-height: 70px; resize: vertical; }
label.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; }
label.check input { width: auto; margin-top: 3px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

button, .btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 9px 14px; font: inherit; font-weight: 600;
  border-radius: 7px; border: 1px solid var(--green); background: var(--green); color: #fff; cursor: pointer;
  text-decoration: none;
}
button:hover, .btn:hover { background: var(--green-dark); }
button.secondary, .btn.secondary { background: #fff; color: var(--green); }
button.secondary:hover { background: var(--green-light); }
button.danger { background: #fff; color: var(--red); border-color: var(--red); }
button.danger:hover { background: #fbeceb; }
button.small { padding: 5px 9px; font-size: .85rem; }
button:disabled { opacity: .5; cursor: not-allowed; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 12px; }
.toolbar label { margin: 0; min-width: 140px; }
.toolbar input[type=search] { min-width: 220px; }

table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: 8px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); background: #fafbfa; position: sticky; top: 0; }
tbody tr:hover { background: #fafcfb; }
td.num, th.num { text-align: right; }
.table-wrap { overflow-x: auto; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.badge.ny { background: #e7eefc; color: #1d4ea8; }
.badge.planerad { background: #fff3d6; color: var(--amber); }
.badge.hamtad { background: var(--green-light); color: var(--green); }
.badge.ej_hittad { background: #fbeceb; color: var(--red); }
.badge.avbokad { background: #eee; color: #666; }
.badge.paid { background: var(--green-light); color: var(--green); }
.badge.unpaid { background: #f3f3f3; color: #777; }
.badge.warn { background: #fff3d6; color: var(--amber); }

.alert { padding: 12px 14px; border-radius: 8px; margin-bottom: 14px; }
.alert.error { background: #fbeceb; color: var(--red); border: 1px solid #f1c4c1; }
.alert.ok { background: var(--green-light); color: var(--green-dark); border: 1px solid #bcd9c7; }
.alert.info { background: #fff8e6; color: #6b4a00; border: 1px solid #f0dca8; }

.hero { background: linear-gradient(135deg, var(--green) 0%, var(--green-dark) 100%); color: #fff; padding: 36px 20px 30px; text-align: center; }
.hero h1 { font-size: 2rem; }
.hero p { max-width: 560px; margin: 0 auto; color: #dbeee2; }
.hero .tree { font-size: 2.6rem; }
.logo-wrap { display: inline-flex; align-items: center; justify-content: center; background: #fff; border-radius: 14px; padding: 10px; }
.logo-wrap img { display: block; max-width: 100%; }
.hero .logo-wrap { margin-bottom: 12px; }
.hero .logo-wrap img { height: 110px; width: auto; max-width: 240px; object-fit: contain; }
.hero .hero-club { font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: #dbeee2; font-size: .9rem; margin-bottom: 4px; }
.logo-wrap.small { padding: 3px; border-radius: 8px; }
.logo-wrap.small img { height: 30px; width: auto; max-width: 90px; object-fit: contain; }
header.top .brand-club { font-weight: 400; color: #cfe5d7; font-size: .95rem; }
.logo-preview { min-height: 90px; display: flex; align-items: center; gap: 16px; margin-bottom: 12px; }
.logo-preview .logo-wrap { border: 1px solid var(--border); }
.logo-preview img { height: 90px; width: auto; max-width: 220px; object-fit: contain; }

.dates { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { background: var(--green-light); color: var(--green-dark); border-radius: 999px; padding: 4px 12px; font-weight: 600; font-size: .9rem; display: inline-flex; gap: 6px; align-items: center; }
.chip button { padding: 0 4px; background: none; border: 0; color: inherit; font-size: 1rem; }

dialog { border: 0; border-radius: 12px; padding: 0; width: min(720px, calc(100vw - 24px)); box-shadow: 0 10px 40px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(0,0,0,.35); }
dialog .dlg-head { padding: 16px 18px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
dialog .dlg-body { padding: 18px; max-height: 70vh; overflow: auto; }
dialog .dlg-foot { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

.bar { height: 8px; background: #eef1ef; border-radius: 4px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--green); }

.stop { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); align-items: center; }
.stop .n { width: 28px; height: 28px; border-radius: 50%; background: var(--green-light); color: var(--green-dark); display: grid; place-items: center; font-weight: 700; font-size: .85rem; }
.stop .move { display: flex; flex-direction: column; gap: 2px; }

/* Driver view */
.driver .stop-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; border-left: 5px solid var(--amber); }
.driver .stop-card.hamtad { border-left-color: var(--green); opacity: .75; }
.driver .stop-card.ej_hittad { border-left-color: var(--red); opacity: .75; }
.driver .addr { font-size: 1.15rem; font-weight: 700; }
.driver .btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.driver .btns button { justify-content: center; padding: 12px; }
.progress { position: sticky; top: 0; background: var(--bg); padding: 10px 0; z-index: 2; }

.hidden { display: none !important; }
.print-only { display: none; }

@media print {
  header.top, .no-print, .toolbar, button { display: none !important; }
  .print-only { display: block; }
  body { background: #fff; }
  main { padding: 0; max-width: none; }
  .card { box-shadow: none; border: 0; padding: 0; }
  table { font-size: 10pt; }
  tr { break-inside: avoid; }
}

/* Swish payment */
.swish { text-align: center; border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin: 16px 0; }
.swish-qr { width: 240px; max-width: 100%; margin: 8px auto; }
.swish-qr svg { display: block; width: 100%; height: auto; }
.swish .btn { justify-content: center; margin: 4px 0 12px; }
.swish-details { display: grid; grid-template-columns: auto auto; gap: 4px 12px; justify-content: center; text-align: left; margin: 0; }
.swish-details dt { color: var(--muted); }
.swish-details dd { margin: 0; font-weight: 600; }

/* Home page and sign-up */
.club-list { display: grid; gap: 8px; margin-top: 12px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.club-item { display: grid; grid-template-columns: 44px 1fr auto; gap: 10px; align-items: center; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: var(--radius); text-decoration: none; color: inherit; background: #fff; }
.club-item:hover { border-color: var(--green); background: var(--green-light); }
.club-item img { width: 44px; height: 44px; object-fit: contain; }
.club-item .club-icon { font-size: 1.8rem; text-align: center; }
.features { padding-left: 20px; margin: 0 0 12px; }
.features li { margin-bottom: 6px; }
.slug-row { display: flex; align-items: center; margin-top: 4px; border: 1px solid var(--border); border-radius: 7px; background: #fff; overflow: hidden; }
.slug-row:focus-within { outline: 2px solid var(--green); }
.slug-prefix { padding: 9px 0 9px 10px; color: var(--muted); font-weight: 400; white-space: nowrap; }
.slug-row input { border: 0; margin: 0; padding-left: 2px; outline: none; min-width: 0; }

/* Getting-started guide */
.guide { border-color: #bcd9c7; background: linear-gradient(180deg, #f4faf6 0%, #fff 60%); }
.guide-steps { list-style: none; margin: 0; padding: 0; }
.guide-steps li { display: grid; grid-template-columns: 28px 1fr auto; gap: 10px; align-items: start; padding: 10px 0;
  border-top: 1px solid var(--border); cursor: pointer; }
.guide-steps li .check { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--border); display: grid;
  place-items: center; font-weight: 700; font-size: .85rem; color: #fff; background: #fff; margin-top: 1px; }
.guide-steps li.done .check { background: var(--green); border-color: var(--green); }
.guide-steps li.done strong { color: var(--muted); text-decoration: line-through; text-decoration-color: #b9c4bd; }
.guide-steps li.next .check { border-color: var(--green); }
.guide-steps li p { margin: 4px 0 0; font-size: .9rem; }
.guide-steps li .badge { margin-left: 6px; }
.guide-steps li .actions { flex-wrap: nowrap; }
.guide-steps li.done button[data-guide=go] { display: none; }
@media (max-width: 640px) {
  .guide-steps li { grid-template-columns: 28px 1fr; }
  .guide-steps li .actions { grid-column: 2; }
}
.welcome-steps { list-style: none; padding: 0; margin: 12px 0; display: grid; gap: 12px; }
.welcome-steps li { display: grid; grid-template-columns: 36px 1fr; gap: 10px; align-items: start; }
.welcome-steps li > span { font-size: 1.5rem; line-height: 1.2; }
.highlight { animation: highlight 2.6s ease-out; }
@keyframes highlight {
  0%, 30% { box-shadow: 0 0 0 4px rgba(31, 91, 58, .45); }
  100% { box-shadow: 0 0 0 4px rgba(31, 91, 58, 0); }
}
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
