/* Klubbfarger hentet fra malvik-fotball.no: rødt og sort */
:root {
  --red: #e32d32;
  --red-dark: #aa1616;
  --red-soft: #fdecec;
  --black: #141414;
  --bg: #f5f5f4;
  --panel: #ffffff;
  --ink: #1b1b1b;
  --muted: #6f6f6f;
  --line: #e4e3e1;
  --closed: #efeeec;
  --p1: #1f9d55;
  --p1-soft: #dcf3e5;
  --p1-ink: #11663a;
  --p2: #e8b100;
  --p2-soft: #fff3c4;
  --p2-ink: #7a5b00;
  --over: #d62828;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 6px 20px rgba(0, 0, 0, .05);
}

* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--red-dark); }
h1 { font-size: 1.9rem; line-height: 1.2; margin: 0 0 .4rem; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; margin: 0 0 .6rem; }
h3 { font-size: .95rem; margin: 0 0 .4rem; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: .85rem; margin: .25rem 0; }
.lead { color: var(--muted); margin: 0; }
.center { text-align: center; }
.bad-text { color: var(--over); font-weight: 600; }
[hidden] { display: none !important; }

/* ---------- Toppmeny ---------- */
.topbar { background: var(--black); color: #fff; position: sticky; top: 0; z-index: 30; border-bottom: 4px solid var(--red); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; padding: 0 20px; max-width: 1400px; margin: 0 auto; }
body.admin .topbar-inner { max-width: none; }
.brand { display: flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; font-weight: 800; font-size: 1.05rem; letter-spacing: .02em; text-transform: uppercase; }
.brand em { font-style: normal; font-weight: 500; text-transform: none; opacity: .75; margin-left: 6px; letter-spacing: 0; }
.topbar-pill { color: #fff; text-decoration: none; font-size: .88rem; font-weight: 600; padding: 6px 14px; border-radius: 99px; border: 1px solid rgba(255, 255, 255, .3); }
.topbar-pill:hover { border-color: var(--red); background: rgba(255, 255, 255, .06); }

.wrap { max-width: 1400px; margin: 0 auto; padding: 24px 20px 48px; }
.footer { text-align: center; margin-top: 24px; }
.adminlink { color: var(--muted); font-size: .85rem; text-decoration: none; }

/* ---------- Kort, knapper og skjema ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow); margin-bottom: 18px; }
.card-title { font-size: 1.05rem; margin: 0 0 12px; }
.btn { background: var(--red); color: #fff; border: 0; border-radius: 10px; padding: 11px 20px; font: inherit; font-weight: 700; cursor: pointer; }
.btn:hover { background: var(--red-dark); }
.btn:disabled { background: #bbb; cursor: not-allowed; }
.btn-block { width: 100%; }
.linkbtn { background: none; border: 0; color: var(--red-dark); font: inherit; font-weight: 600; cursor: pointer; text-decoration: underline; padding: 0 4px; }
.form { display: grid; gap: 14px; }
.form.narrow { max-width: 620px; }
label { display: grid; gap: 4px; font-weight: 600; font-size: .9rem; }
input[type=number], input[type=password], input:not([type]), select {
  font: inherit; padding: 9px 11px; border: 1px solid #cfcdca; border-radius: var(--radius-sm); background: #fff; font-weight: 500;
}
input:focus, select:focus { outline: 2px solid var(--red); outline-offset: 1px; border-color: transparent; }
label.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; margin: 0; }
legend { font-weight: 700; font-size: .9rem; padding: 0 4px; }
.row { display: flex; gap: 16px; flex-wrap: wrap; }
.row label { flex: 1; min-width: 200px; }
.alert { padding: 10px 14px; border-radius: var(--radius-sm); margin: 0 0 14px; font-size: .92rem; }
.alert.error { background: var(--red-soft); color: var(--red-dark); }
.alert.ok { background: var(--p1-soft); color: var(--p1-ink); }
.alert.warn { background: var(--p2-soft); color: var(--p2-ink); }
.login-card { max-width: 380px; margin: 40px auto; }

.badge { display: inline-block; padding: 4px 11px; border-radius: 99px; font-size: .8rem; font-weight: 700; background: #ecebea; color: #444; }
.badge.ok, .badge.status-levert { background: var(--p1-soft); color: var(--p1-ink); }
.badge.warn, .badge.status-endret { background: var(--p2-soft); color: var(--p2-ink); }
.badge.bad { background: var(--red-soft); color: var(--over); }

.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: #cfcdca; flex-shrink: 0; }
.dot.status-levert { background: var(--p1); }
.dot.status-endret { background: var(--p2); }
.dot.status-utkast { background: #8fb7e8; }

.legend { display: flex; gap: 18px; flex-wrap: wrap; font-size: .82rem; color: var(--muted); margin: 10px 0; align-items: center; }
.legend.center { justify-content: center; }
.legend > span { display: inline-flex; align-items: center; gap: 6px; }
.sw { display: inline-block; width: 14px; height: 14px; border-radius: 4px; }
.sw-p1 { background: var(--p1); }
.sw-p2 { background: var(--p2); }
.sw-other { background: #e6e4e1; border: 1px solid #cfcdca; }
.sw-over { background: var(--over); }

.chip { display: inline-block; padding: 2px 7px; border-radius: 6px; font-size: .75rem; font-weight: 700; line-height: 1.35; }
.chip.p1 { background: var(--p1); color: #fff; }
.chip.p2 { background: var(--p2); color: #2b2100; }

/* ---------- Forside ---------- */
.hero { text-align: center; padding: 10px 0 26px; }
.hero img { margin: 0 auto 10px; display: block; }
.hero .lead { max-width: 560px; margin: 0 auto; }
.team-groups { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; max-width: 980px; margin: 0 auto; }
.team-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.team-tile { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; text-decoration: none; color: var(--ink); font-weight: 700; background: #fff; }
.team-tile:hover { border-color: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }
@media (max-width: 760px) { .team-groups { grid-template-columns: 1fr; } }

/* ---------- Kalender ---------- */
.calendar { --time-col: 58px; display: grid; grid-template-columns: var(--time-col) repeat(var(--cols, 7), minmax(0, 1fr)); gap: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; box-shadow: var(--shadow); }
.cal-day { text-align: center; font-weight: 700; font-size: .85rem; padding: 6px 0; border-bottom: 3px solid var(--black); }
.cal-day.weekend { border-color: var(--red); }
.cal-day .short { display: none; }
.cal-time { font-size: .8rem; font-weight: 700; text-align: right; padding: 6px 6px 0 0; color: var(--ink); }
.cal-time span { display: block; font-weight: 400; color: var(--muted); font-size: .72rem; }
.cal-cell { min-height: 64px; border-radius: var(--radius-sm); background: #faf9f8; border: 1px solid var(--line); padding: 5px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-cell.closed { background: repeating-linear-gradient(135deg, var(--closed) 0 6px, #f6f5f3 6px 12px); border-color: transparent; }
.cal-cell.clickable { cursor: pointer; }
.cal-cell.clickable:hover { border-color: var(--red); box-shadow: 0 0 0 2px var(--red-soft); }

/* Lagsiden */
.team-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.crumbs { margin: 0; color: var(--muted); font-weight: 600; }
.team-facts { display: flex; gap: 24px; align-items: end; flex-wrap: wrap; }
.team-facts label { min-width: 200px; }
.fact { display: grid; gap: 4px; padding-bottom: 8px; }
.fact strong { font-size: 1.05rem; }
.booking { display: grid; grid-template-columns: 300px 1fr; gap: 18px; align-items: start; }
.sessions-panel { position: sticky; top: 80px; }
.session { margin: 14px 0; }
.wish-row { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; padding: 9px 12px; border-radius: 10px; border: 2px solid var(--line); margin-bottom: 6px; cursor: pointer; background: #fff; position: relative; }
.wish-row .wish-label { font-size: .75rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; grid-column: 1; }
.wish-row.p1 .wish-label { color: var(--p1-ink); }
.wish-row.p2 .wish-label { color: var(--p2-ink); }
.wish-row .wish-value { grid-column: 1; font-size: .9rem; font-weight: 600; }
.wish-row .wish-value small { font-weight: 500; color: var(--muted); }
.wish-row .x { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
.wish-row.filled.p1 { background: var(--p1-soft); border-color: transparent; }
.wish-row.filled.p2 { background: var(--p2-soft); border-color: transparent; }
.wish-row.active { border-color: var(--black); box-shadow: 0 0 0 3px rgba(0, 0, 0, .08); }
.x { background: none; border: 0; font-size: 1.3rem; line-height: 1; color: var(--muted); cursor: pointer; padding: 2px 6px; border-radius: 6px; }
.x:hover { background: rgba(0, 0, 0, .06); color: var(--ink); }
.submit-box { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 8px; }

.team-cal .cal-cell.mine { background: #fff; }
.team-cal .chip { display: block; }
.occ-row { display: flex; flex-wrap: wrap; gap: 3px; margin-top: auto; }
.occ { font-size: .7rem; font-weight: 700; padding: 1px 5px; border-radius: 5px; background: #e6e4e1; color: #555; }
.occ.full { background: var(--red-soft); color: var(--over); }

.picker { position: absolute; z-index: 40; width: 340px; max-width: calc(100vw - 24px); background: #fff; border-radius: var(--radius); box-shadow: 0 10px 40px rgba(0, 0, 0, .2); border: 1px solid var(--line); padding: 12px; }
.picker-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.picker-head .x { margin-left: auto; }
.field-opt { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; width: 100%; text-align: left; background: #faf9f8; border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; margin-bottom: 6px; cursor: pointer; font: inherit; }
.field-opt:hover { border-color: var(--red); background: #fff; }
.field-opt.current { border: 2px solid var(--black); }
.field-name { font-weight: 700; }
.fit { font-size: .72rem; font-weight: 800; text-transform: uppercase; padding: 2px 7px; border-radius: 5px; align-self: start; }
.fit.ok { background: var(--p1-soft); color: var(--p1-ink); }
.fit.tight { background: var(--red-soft); color: var(--over); }
.who { grid-column: 1 / -1; font-size: .8rem; }

.modal { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal-card { max-width: 440px; text-align: center; }
.modal-card img { margin: 0 auto 8px; display: block; }

@media (max-width: 1000px) {
  .booking { grid-template-columns: 1fr; }
  .sessions-panel { position: static; }
}
@media (max-width: 700px) {
  .calendar { --time-col: 40px; gap: 2px; padding: 6px; }
  .cal-day .long { display: none; }
  .cal-day .short { display: inline; }
  .cal-time { font-size: .68rem; padding-right: 3px; }
  .cal-time span { display: none; }
  .cal-cell { min-height: 52px; padding: 2px; }
  .team-cal .chip { font-size: .6rem; padding: 1px 3px; }
  .occ { font-size: .6rem; padding: 0 3px; }
}

/* ---------- Admin ---------- */
.shell { display: grid; grid-template-columns: 230px 1fr; min-height: calc(100vh - 64px); }
.sidebar { background: #fbfbfa; border-right: 1px solid var(--line); padding: 14px 10px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 64px; height: calc(100vh - 64px); overflow-y: auto; }
.sidebar-nav { display: grid; gap: 2px; }
.sidebar-nav a, .sidebar-logout { display: block; padding: 8px 12px; border-radius: 8px; color: var(--ink); text-decoration: none; font-weight: 600; background: none; border: 0; width: 100%; text-align: left; font: inherit; cursor: pointer; }
.sidebar-nav a:hover, .sidebar-logout:hover { background: #efeeec; }
.sidebar-nav a.active { background: #fff; box-shadow: var(--shadow); border-left: 3px solid var(--red); }
.sidebar-logout { color: var(--muted); font-weight: 500; }
.sidebar-heading { font-size: .72rem; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: 16px 12px 4px; display: flex; justify-content: space-between; }
.sidebar-heading .hint { font-size: .72rem; text-transform: none; letter-spacing: 0; margin: 0; }
.sidebar-bottom { margin-top: auto; padding-top: 10px; }
.team-list-grp { font-size: .72rem; font-weight: 700; color: var(--muted); margin: 10px 12px 2px; }
.team-item { display: grid; grid-template-columns: auto 1fr; gap: 0 9px; align-items: center; width: 100%; background: none; border: 0; text-align: left; padding: 5px 12px; border-radius: 8px; cursor: pointer; font: inherit; }
.team-item:hover { background: #efeeec; }
.team-item.pinned { background: var(--black); color: #fff; }
.team-item.pinned .team-item-meta { color: #bbb; }
.team-item-name { font-weight: 700; font-size: .9rem; }
.team-item-meta { grid-column: 2; font-size: .72rem; color: var(--muted); }
.content { padding: 24px 28px 48px; min-width: 0; }
.admin-page { max-width: 760px; }

.admin-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.seg button { border: 0; background: none; padding: 7px 12px; font: inherit; font-size: .85rem; font-weight: 600; cursor: pointer; border-right: 1px solid var(--line); }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--black); color: #fff; }
.admin-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; align-items: start; }
.detail { position: sticky; top: 80px; max-height: calc(100vh - 100px); overflow-y: auto; }
.detail ul { list-style: none; padding: 0; margin: 6px 0 0; display: grid; gap: 6px; font-size: .88rem; }
.detail-field { border-top: 1px solid var(--line); padding: 10px 0; }
.detail-field-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.mode-banner { font-size: .85rem; color: var(--muted); margin-bottom: 8px; min-height: 22px; }
.mode-banner.team { color: var(--ink); }

.admin-cal .cal-cell { min-height: 78px; cursor: pointer; }
.admin-cal .cal-cell:hover, .admin-cal .cal-cell.pinned { border-color: var(--black); box-shadow: 0 0 0 2px rgba(0, 0, 0, .08); }
.admin-cal .cal-cell.heat-over { background: #fff4f4; }
.admin-cal .cal-cell.dim { opacity: .45; }
.admin-cal .cal-cell.focus { background: #fff; }
.admin-cal .chip { display: block; font-weight: 500; }
.chip-note { display: block; font-size: .68rem; opacity: .9; }
.chip-note.bad { font-weight: 800; }
.bar-row { display: grid; grid-template-columns: 12px 1fr 14px; gap: 4px; align-items: center; font-size: .68rem; font-weight: 700; color: var(--muted); }
.bar { position: relative; height: 8px; border-radius: 4px; background: #eceae7; display: flex; overflow: hidden; }
.bar .seg-p1 { background: var(--p1); }
.bar .seg-p2 { background: var(--p2); opacity: .75; }
.bar.full .seg-p1 { background: #178044; }
.bar.over .seg-p1 { background: var(--over); }
.bar .cap { position: absolute; top: -1px; bottom: -1px; width: 2px; background: var(--black); }
.bar-num { text-align: right; color: var(--ink); }

@media (max-width: 1200px) {
  .admin-grid { grid-template-columns: 1fr; }
  .detail { position: static; max-height: none; }
}
@media (max-width: 800px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .team-list { display: flex; flex-wrap: wrap; gap: 4px; }
  .team-list-grp { width: 100%; }
  .team-item { width: auto; border: 1px solid var(--line); }
  .team-item-meta { display: none; }
  .content { padding: 16px; }
}

/* ---------- Visning av én bane ---------- */
.cal-toolbar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 10px; }
.cal-toolbar .hint { margin: 0; }
.single-head { display: grid; grid-template-columns: 1fr auto; gap: 6px; align-items: center; font-size: .72rem; font-weight: 700; }
.names { display: flex; flex-wrap: wrap; gap: 3px; }
.name-chip { font-size: .7rem; font-weight: 700; padding: 1px 6px; border-radius: 5px; border-left: 3px solid; background: #f1f0ee; line-height: 1.4; }
.name-chip small { font-weight: 500; color: var(--muted); }
.name-chip.p1 { border-color: var(--p1); }
.name-chip.p2 { border-color: var(--p2); }
.chip.ghost { background: #fff; border: 1.5px dashed; font-weight: 600; }
.chip.ghost.p1 { color: var(--p1-ink); border-color: var(--p1); }
.chip.ghost.p2 { color: var(--p2-ink); border-color: var(--p2); }
.cal-cell.single { gap: 4px; }
@media (max-width: 700px) {
  .seg { flex-wrap: wrap; }
  .seg button { padding: 6px 9px; font-size: .78rem; }
  .name-chip { font-size: .58rem; padding: 0 3px; }
  .name-chip small { display: none; }
}
.bar-num.bad-text { color: var(--over); }

/* ---------- Bookinggrad ---------- */
.grade { display: inline-flex; align-items: center; gap: 2px; font-size: .68rem; font-weight: 800; white-space: nowrap; line-height: 1; font-variant-numeric: tabular-nums; }
.grade > span { font-size: .8rem; }
.g-free { color: var(--muted); }
.g-some { color: var(--p1-ink); }
.g-full, b.g-full { color: #b86e00; }
.g-over, b.g-over { color: var(--over); }
.legend b { font-weight: 700; margin-left: 4px; }
.bar-row { grid-template-columns: 12px 1fr auto; }
.occ { display: inline-flex; align-items: center; gap: 3px; background: #f1f0ee; }
.occ .grade { font-size: .65rem; }
.single-head .grade { justify-self: end; }
@media (max-width: 700px) {
  .occ .grade > span { display: none; }
  .grade { font-size: .58rem; }
}
/* Smale celler: prosenten sier det samme som stolpen, så stolpen tas bort */
.admin-cal .cal-cell { container-type: inline-size; }
@container (max-width: 120px) {
  .bar-row { grid-template-columns: 12px 1fr; }
  .bar-row .bar { display: none; }
  .bar-row .grade { justify-self: end; }
}

/* ---------- Sperret bolk og beskjeder ---------- */
.team-cal .cal-cell.blocked { cursor: not-allowed; background: repeating-linear-gradient(135deg, #fff 0 6px, #f7f1f1 6px 12px); }
.team-cal .cal-cell.blocked:hover { border-color: #d9b8b8; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60; background: var(--black); color: #fff; padding: 11px 18px; border-radius: 10px; font-weight: 600; font-size: .9rem; box-shadow: 0 8px 30px rgba(0, 0, 0, .25); max-width: calc(100vw - 32px); }
.field-opt.taken { cursor: not-allowed; opacity: .6; background: repeating-linear-gradient(135deg, #fff 0 6px, #f4f3f1 6px 12px); }
.field-opt.taken:hover { border-color: var(--line); }
.fit.used { background: #e6e4e1; color: #555; }

/* ---------- Adminside for lag ---------- */
.admin-page:has(.team-form) { max-width: 980px; }
.team-form-row { display: grid; grid-template-columns: 1.2fr .8fr 1.6fr 90px auto; gap: 10px; align-items: end; }
.team-edit { padding: 8px 0; border-top: 1px solid var(--line); }
.team-edit input, .team-edit select { padding: 7px 9px; }
.team-edit-actions { display: flex; gap: 6px; align-items: center; }
.btn-small { padding: 7px 14px; font-size: .88rem; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.card-wide { grid-column: 1 / -1; }
input[type=email] { font: inherit; padding: 9px 11px; border: 1px solid #cfcdca; border-radius: var(--radius-sm); background: #fff; font-weight: 500; }
@media (max-width: 760px) { .team-form-row { grid-template-columns: 1fr; } }

/* ---------- Visningsknapper og krympede rader ---------- */
.cal-toolbar { gap: 10px; margin-bottom: 6px; }
.view-hint { margin: 0 0 10px; }
.seg.views button { display: inline-flex; align-items: center; gap: 6px; }
.vcount { font-size: .72rem; font-weight: 800; background: #e6e4e1; color: #333; border-radius: 99px; padding: 1px 7px; min-width: 20px; text-align: center; }
.vcount.zero { opacity: .5; }
.vmine { font-size: .7rem; font-weight: 800; background: var(--p1); color: #fff; border-radius: 99px; padding: 1px 6px; }
.seg button.on .vcount { background: rgba(255, 255, 255, .22); color: #fff; }
.cal-cell.compact, .admin-cal .cal-cell.compact { min-height: 26px; padding: 2px 5px; }
.cal-time.compact { padding-top: 3px; color: var(--muted); font-weight: 600; }
.cal-time.compact span { display: none; }
.calendar.few-days .cal-cell { padding: 7px 9px; }
.calendar.few-days .names { gap: 4px; }
.calendar.few-days .name-chip { font-size: .78rem; }

/* ---------- Regler ---------- */
.rules-page { max-width: 980px; }
.team-checks { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 4px 16px; margin: 6px 0; }
.team-checks-grp .hint { font-weight: 700; margin: 4px 0; }
label.check.small { font-size: .88rem; padding: 1px 0; }
.access-field { margin-bottom: 4px; }
.access-teams { margin-top: 6px; }
textarea { font: inherit; padding: 9px 11px; border: 1px solid #cfcdca; border-radius: var(--radius-sm); resize: vertical; font-weight: 500; }
.reservation { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 14px; margin-bottom: 10px; }
.reservation summary { cursor: pointer; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.reservation form { margin-top: 12px; }
.slot-table { border-collapse: collapse; font-size: .82rem; }
.slot-table th { font-weight: 700; padding: 2px 8px; text-align: center; }
.slot-table td { text-align: center; padding: 2px 6px; }
.row-actions { display: flex; gap: 12px; align-items: center; margin-top: 10px; }
.prio-list { list-style: none; counter-reset: prio; padding: 0; margin: 0 0 8px; max-width: 520px; }
.prio-list li { counter-increment: prio; display: grid; grid-template-columns: 26px 18px 1fr auto auto; gap: 8px; align-items: center; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 4px; background: #fff; cursor: grab; }
.prio-list li::before { content: counter(prio); font-weight: 800; color: var(--muted); font-size: .8rem; text-align: right; }
.prio-list li.dragging { opacity: .4; }
.grip { color: var(--muted); letter-spacing: -2px; }
.prio-name { font-weight: 700; }
.prio-move .x { font-size: .95rem; }

/* ---------- Størrelse per ønske, betaling og plan ---------- */
.wish-size { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.wish-size select { padding: 4px 8px; font-size: .82rem; }
.wish-size small { font-size: .72rem; }
.pay-note { grid-column: 1 / -1; font-size: .75rem; color: var(--p2-ink); background: var(--p2-soft); border-radius: 6px; padding: 4px 7px; margin-top: 4px; }
.plan-list { list-style: none; padding: 0; margin: 0 0 8px; display: grid; gap: 6px; }
.plan-list li { display: grid; grid-template-columns: 60px 1fr auto auto; gap: 10px; align-items: center; padding: 9px 12px; border-radius: 10px; background: var(--p1-soft); }
.plan-list li.open { background: var(--red-soft); }
.plan-list li.choosing { outline: 2px solid var(--black); }
.free { font-size: .68rem; font-weight: 700; padding: 1px 5px; border-radius: 5px; }
.free.yes { background: var(--p1-soft); color: var(--p1-ink); }
.free.full { background: #e6e4e1; color: #777; }
.free.no { background: #f3eded; color: #a88; text-decoration: line-through; }
.picker-size { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: .85rem; }
@media (max-width: 700px) { .plan-list li { grid-template-columns: 1fr auto; } }

/* ---------- Tildeling i admin ---------- */
.admin-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; margin-bottom: 12px; box-shadow: var(--shadow); }
.admin-actions .hint { margin: 0; }
.phase { font-weight: 800; font-size: .88rem; padding: 4px 10px; border-radius: 99px; background: #ecebea; }
.phase.ok { background: var(--p1-soft); color: var(--p1-ink); }
.phase.warn { background: var(--p2-soft); color: var(--p2-ink); }
.publish-box { display: inline-flex; align-items: end; gap: 8px; margin-left: auto; }
.publish-box label { font-size: .78rem; }
.publish-box input { font: inherit; padding: 5px 8px; border: 1px solid #cfcdca; border-radius: 8px; }
.toolbar { margin-bottom: 10px; }
.btn.ghost { background: #fff; color: var(--ink); border: 1px solid #cfcdca; }
.btn.ghost:hover { background: #f4f3f1; }
.alloc-row { display: grid; grid-template-columns: 12px 1fr; gap: 4px; align-items: start; font-size: .68rem; }
.alloc-row .bar-label { font-weight: 700; color: var(--muted); padding-top: 2px; }
.alloc-chips { display: flex; flex-wrap: wrap; gap: 2px; }
.pchip { font-size: .66rem; padding: 1px 5px; border-radius: 5px; border-left: 3px solid; background: #f1f0ee; line-height: 1.4; white-space: nowrap; }
.pchip b { font-weight: 800; }
.s-p1 { border-color: var(--p1); }
.s-p2 { border-color: var(--p2); }
.s-admin { border-color: #3764e0; }
.s-team { border-color: #8a4fd1; }
.pchip.bad, .pbox.bad { outline: 2px solid var(--over); outline-offset: -1px; }
.badge.s-p1 { background: var(--p1-soft); color: var(--p1-ink); }
.badge.s-p2 { background: var(--p2-soft); color: var(--p2-ink); }
.badge.s-admin { background: #e5ecfd; color: #2445a8; }
.badge.s-team { background: #f0e6fb; color: #5f2ea0; }
.badge.s-unresolved { background: var(--red-soft); color: var(--over); }
.pitch { display: grid; gap: 3px; height: 100%; }
.pitch.q4 { grid-template-columns: 1fr 1fr; }
.pitch.q2 { grid-template-columns: 1fr 1fr; }
.pbox { border-radius: 5px; padding: 3px 5px; font-size: .68rem; background: #f1f0ee; border-left: 3px solid transparent; min-height: 26px; display: flex; flex-direction: column; }
.pbox > span { font-size: .6rem; color: var(--muted); font-weight: 700; }
.pbox b { font-weight: 800; line-height: 1.25; }
.pbox.empty { background: repeating-linear-gradient(135deg, #fafaf9 0 5px, #f3f2f0 5px 10px); }
.pbox.s-p1 { background: var(--p1-soft); }
.pbox.s-p2 { background: var(--p2-soft); }
.pbox.s-admin { background: #e5ecfd; }
.pbox.s-team { background: #f0e6fb; }
.admin-cal .cal-cell.target { cursor: crosshair; }
.admin-cal .cal-cell.target:hover { border-color: #3764e0; box-shadow: 0 0 0 3px #e5ecfd; }
.alloc-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 6px; }
.alloc-line { margin: 4px 0; font-weight: 600; }
.part-name { display: inline-block; min-width: 26px; }
.small { font-size: .8rem; margin: 2px 0; }
.move-card { text-align: left; display: grid; gap: 10px; min-width: min(420px, 100%); }
.move-card h2 { font-size: 1.05rem; }
.pitch.q4, .pitch.q2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.pbox { min-width: 0; overflow: hidden; }
.pbox b { overflow-wrap: anywhere; }
.sw-admin { background: #3764e0; }
.sw-team { background: #8a4fd1; }
.sw-bad { background: #fff; outline: 2px solid var(--over); outline-offset: -2px; }

/* ---------- Tydelig markering av lagets bolker i admin ---------- */
.admin-cal .cal-cell.dim { opacity: .35; }
.admin-cal .cal-cell.focus { background: #fff; border: 3px solid var(--black); box-shadow: 0 2px 10px rgba(0, 0, 0, .12); }
.admin-cal .cal-cell.focus.has-p1 { border-color: var(--p1); background: #f4fbf7; }
.admin-cal .cal-cell.focus.has-p2 { border-color: var(--p2); background: #fffbeb; }
.admin-cal .cal-cell.focus.has-p1.has-p2 { border-color: var(--p1); box-shadow: inset 0 0 0 3px var(--p2), 0 2px 10px rgba(0, 0, 0, .12); }
.admin-cal .cal-cell.focus.has-alloc { border-color: var(--black); background: #fff; }
.admin-cal .cal-cell.ghost-only { background: #fff; border: 2px dashed #bdbab5; }
.admin-cal .chip.ghost { display: block; width: 100%; text-align: left; font: inherit; font-size: .7rem; font-weight: 700; cursor: pointer; margin-top: 3px; }
.admin-cal .chip.ghost:hover { background: #f4f3f1; }
.goto { cursor: pointer; }
li.goto:hover, span.goto:hover, p.goto:hover { color: var(--red-dark); text-decoration: underline; }
.admin-cal .cal-cell.flash { animation: flash 1.6s ease-out; }
@keyframes flash { 0%, 40% { box-shadow: 0 0 0 5px var(--red); } 100% { box-shadow: none; } }
.goto-card { max-width: 460px; }
.center-actions { justify-content: center; flex-wrap: wrap; }
@media (prefers-reduced-motion: reduce) { .admin-cal .cal-cell.flash { animation: none; outline: 3px solid var(--red); } }

/* ---------- Løst eller ikke løst i sidepanelet ---------- */
.detail-field.session-box { border: 1px solid; border-radius: 10px; padding: 10px 12px; margin: 8px 0; }
.session-box.solved { background: #eef8f2; border-color: #bfe3cd; }
.session-box.unsolved { background: #fdeeee; border-color: #f2c4c4; }
.solve-state { font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .03em; margin-left: auto; margin-right: 8px; }
.solved .solve-state { color: var(--p1-ink); }
.unsolved .solve-state { color: var(--over); }
.unsolved .badge.s-unresolved { display: none; }
.card.narrow { max-width: 620px; }
.danger-zone { border-color: #f2c4c4; }
a.btn { display: inline-block; text-decoration: none; }
.export-link { margin-left: auto; }
.publish-box + .export-link { margin-left: 0; }
.active-dot { font-size: .68rem; font-weight: 800; text-transform: uppercase; color: var(--p1-ink); background: var(--p1-soft); border-radius: 99px; padding: 2px 7px; }

/* Laglista krymper med vinduet og brytes over to linjer når kortet er smalt */
.team-form, .team-edit-list { container-type: inline-size; }
.team-form-row { grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr) minmax(0, 1.6fr) minmax(56px, 70px) auto; }
.team-form-row input, .team-form-row select { width: 100%; min-width: 0; }
.team-edit-actions { white-space: nowrap; }
@container (max-width: 640px) {
  .team-form-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 64px;
    grid-template-areas: "name grp age" "email actions actions"; }
  .team-form-row > :nth-child(1) { grid-area: name; }
  .team-form-row > :nth-child(2) { grid-area: grp; }
  .team-form-row > :nth-child(3) { grid-area: email; }
  .team-form-row > :nth-child(4) { grid-area: age; }
  .team-form-row > :nth-child(5) { grid-area: actions; }
  .team-edit-actions { flex-wrap: wrap; justify-content: flex-end; }
}
/* Merket vises på alle lag så kolonnene står på linje, grått når laget ikke har ønsker eller økter */
.active-dot.idle { color: #9a9894; background: #efeeec; }
.team-form-row { grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr) minmax(0, 1.6fr) minmax(56px, 70px) 190px; }
.team-edit-actions { justify-content: flex-start; }
@container (max-width: 640px) { .team-form-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 64px; } }
.field-opt.ruled { background: #f6f5f3; }
.field-opt.ruled .field-name { color: #666; }
.rule-note { grid-column: 1 / -1; font-size: .78rem; font-weight: 700; color: #5c5a56; }

/* ---------- Enklere for nye lagledere ---------- */
.sig { display: inline-block; font-size: .72rem; font-weight: 800; padding: 2px 8px; border-radius: 99px; margin-top: auto; align-self: flex-start; }
.sig.ok { background: var(--p1-soft); color: var(--p1-ink); }
.sig.tight { background: var(--p2-soft); color: var(--p2-ink); }
.sig.full { background: var(--red-soft); color: var(--over); }
.small-link { font-size: .78rem; font-weight: 600; padding: 0; text-align: left; }
.wish-size { flex-wrap: wrap; }
.index-legend { margin: 0 0 16px; }

.step-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 35; background: var(--black); color: #fff; display: flex; align-items: center; gap: 12px; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); box-shadow: 0 -4px 20px rgba(0, 0, 0, .25); }
.step-bar p { margin: 0; flex: 1; font-size: .88rem; line-height: 1.35; }
.step-bar small { opacity: .75; }
.step-bar .linkbtn { color: #fff; font-size: .85rem; }
.step-bar .btn.ghost { background: transparent; color: #fff; border: 1px solid rgba(255, 255, 255, .5); }
body.has-step-bar { padding-bottom: 84px; }
body.has-step-bar .toast { bottom: 96px; }
@media (min-width: 1001px) { .step-bar { display: none !important; } body.has-step-bar { padding-bottom: 0; } body.has-step-bar .toast { bottom: 24px; } }

/* Mobilmenyen skal ikke brekke */
.topbar-pill { white-space: nowrap; }
@media (max-width: 520px) {
  .brand em { display: none; }
  .brand { font-size: .95rem; gap: 8px; }
  .topbar-inner { padding: 0 12px; }
}

/* ---------- Stegindikator for admin ---------- */
.stepper-wrap { margin-bottom: 10px; }
.stepper { list-style: none; display: flex; gap: 6px; padding: 0; margin: 0 0 6px; flex-wrap: wrap; }
.stepper li { display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border-radius: 99px; background: #ecebea; color: #77746f; font-weight: 700; font-size: .85rem; }
.step-no { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: #fff; font-size: .75rem; }
.stepper li.done { background: var(--p1-soft); color: var(--p1-ink); }
.stepper li.done .step-no { background: var(--p1); color: #fff; }
.stepper li.current { background: var(--black); color: #fff; }
.stepper li.current .step-no { background: var(--red); color: #fff; }
.step-hint { margin: 0; font-size: .9rem; font-weight: 600; }
.step-bar p { display: grid; gap: 1px; }
.step-bar p small { font-size: .74rem; }
.step-bar p .linkbtn { font-size: .74rem; padding: 0; }
.step-bar .btn { flex-shrink: 0; }
/* Enkel visning: hele bolken farges, så signalet synes også i smale celler på mobil */
.team-cal .cal-cell.sig-ok { background: #f1faf4; border-color: #cfe9d9; }
.team-cal .cal-cell.sig-tight { background: #fffaea; border-color: #f1e1a6; }
.team-cal .cal-cell.sig-full { background: #fdf0f0; border-color: #f0caca; }
@media (max-width: 700px) {
  .team-cal .sig { display: none; }
  .team-cal .cal-cell { min-height: 44px; }
}
/* Mobil: banevelgeren er et panel nederst, over linja med fremdrift */
@media (max-width: 700px) {
  .picker { position: fixed; left: 8px !important; right: 8px; top: auto !important; bottom: 8px; width: auto; max-height: 72vh; overflow-y: auto; z-index: 45; box-shadow: 0 -8px 40px rgba(0, 0, 0, .3); }
  body.has-step-bar .picker { bottom: 88px; max-height: calc(100vh - 170px); }
}
/* Brikkene i Tildelt skal aldri gjøre cellene bredere enn kolonnen */
.pchip { white-space: normal; overflow-wrap: anywhere; min-width: 0; max-width: 100%; }
.alloc-row, .alloc-chips { min-width: 0; }
.admin-cal .cal-cell { overflow: hidden; }

/* ---------- Ønsker til uløste økter i Tildelt ---------- */
.wishmark { display: block; width: 100%; text-align: left; font: inherit; font-size: .68rem; border-radius: 6px; padding: 3px 6px; margin-bottom: 3px; cursor: pointer; border: 2px dashed; background: #fff; }
.wishmark span { display: block; font-weight: 700; color: var(--ink); }
.wishmark b { font-weight: 800; }
.wishmark.fits { border-color: var(--p1); }
.wishmark.fits b { color: var(--p1-ink); }
.wishmark.full { border-color: var(--over); }
.wishmark.full b { color: var(--over); }
.wishmark:hover { background: #f4f3f1; }
.admin-cal .cal-cell.focus.has-wish { border-color: var(--over); border-style: dashed; background: #fff; }
.cap-line { font-weight: 700; font-size: .8rem; }
.cap-line.fits { color: var(--p1-ink); }
.cap-line.full { color: var(--over); }

/* ---------- Velg annen tid: kapasitet for alle lag ---------- */
.room { display: inline-block; font-size: .66rem; font-weight: 800; padding: 1px 6px; border-radius: 99px; margin-bottom: 3px; align-self: flex-start; }
.room.ok { background: var(--p1); color: #fff; }
.room.full { background: var(--red-soft); color: var(--over); }
.room.clash { background: var(--black); color: #fff; }
.admin-cal .cal-cell.has-room { background: #f4fbf7; }
.admin-cal .cal-cell.no-room { background: #fbf6f6; }
.admin-cal .cal-cell.own-clash { box-shadow: inset 0 0 0 2px var(--black); }
.pchip.own { outline: 2px solid var(--black); outline-offset: -1px; font-weight: 700; }
.room { border-radius: 6px; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Overstyrt og godkjent, og endringer som ikke er sendt ---------- */
.pchip.approved, .pbox.approved { outline: 2px dashed #9a9894; outline-offset: -1px; }
.badge.approved { background: #ecebea; color: #444; }
.pending-box { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px; background: var(--p2-soft); color: var(--p2-ink); border-radius: 10px; padding: 8px 12px; font-size: .88rem; }
.pending-text { color: var(--p2-ink); }
.add-session { margin-top: 10px; }

/* ---------- Overstyrt og godkjent, og endringer som ikke er sendt ---------- */
.pchip.approved, .pbox.approved { outline: 2px dashed #9a9894; outline-offset: -1px; }
.badge.approved { background: #ecebea; color: #444; }
.pending-box { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px; background: var(--p2-soft); color: var(--p2-ink); border-radius: 10px; padding: 8px 12px; font-size: .88rem; }
.pending-text { color: var(--p2-ink); }
.add-session { margin-top: 10px; }
.sw-approved { background: #fff; outline: 2px dashed #9a9894; outline-offset: -2px; }

/* ---------- Demo ---------- */
.demo-btn { margin-top: 16px; display: inline-flex; gap: 8px; align-items: center; }
.demo-head { text-align: center; margin: 8px auto 20px; max-width: 680px; }
.demo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; max-width: 1200px; margin: 0 auto 20px; }
.demo-card-item video { width: 100%; aspect-ratio: 16 / 10; border-radius: 10px; background: #141414; display: block; margin-top: 10px; }
@media (max-width: 900px) { .demo-grid { grid-template-columns: 1fr; } }

/* ---------- Statistikk ---------- */
.stats-page { max-width: 1100px; }
.stats-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.seg a { border: 0; padding: 7px 12px; font-size: .85rem; font-weight: 600; border-right: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.seg a:last-child { border-right: 0; }
.seg a.on { background: var(--black); color: #fff; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: grid; gap: 2px; box-shadow: var(--shadow); }
.kpi-label { font-size: .8rem; font-weight: 700; color: var(--muted); }
.kpi strong { font-size: 1.8rem; line-height: 1.2; }
.kpi .hint { margin: 0; font-size: .75rem; }
.bars { width: 100%; height: 180px; display: block; }
.bars .axis { stroke: #cfcdca; stroke-width: 1; vector-effect: non-scaling-stroke; }
.bars .mark { fill: var(--red); }
.bars .hit { fill: transparent; }
.bars .bar:hover .mark { fill: var(--red-dark); }
.bars .bar:hover .hit { fill: rgba(0, 0, 0, .04); }
.bars-axis { display: flex; justify-content: space-between; font-size: .78rem; color: var(--muted); margin-top: 4px; }
.stat-table { width: 100%; border-collapse: collapse; font-size: .9rem; margin-top: 8px; }
.stat-table th { text-align: left; font-size: .78rem; color: var(--muted); font-weight: 700; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.stat-table td { padding: 7px 8px; border-bottom: 1px solid var(--line); }
.stats-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.plain { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.demo-plays { margin-top: 14px; }
@media (max-width: 800px) { .stats-cols { grid-template-columns: 1fr; } .stat-table.teams { font-size: .8rem; } }
