/* Schema – Fridaskolans designsystem: Frida Röd, Frida Blå, Frida Beige, Poppins + Source Sans. */
:root {
  --rod: #e5004b; --bla: #16355a; --beige: #fcf8f4; --vit: #fff;
  --lila: #a84d97; --klarbla: #006399; --cyan: #009cb4; --gron: #00a96c; --gul: #ffcd1c; --orange: #f39200;
  --ink: var(--bla); --muted: #5a6b82; --line: rgba(22, 53, 90, .16); --line2: rgba(22, 53, 90, .3);
  --r-sm: 8px; --r-md: 16px; --r-lg: 32px;
  --f-head: "Poppins", Arial, sans-serif; --f-ui: "Source Sans 3", "Source Sans Pro", Arial, sans-serif;
  --shadow: 0 10px 30px rgba(22, 53, 90, .14);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--f-ui); color: var(--ink); background: var(--beige); font-size: 15px; }
h1, h2, h3, h4 { font-family: var(--f-head); margin: 0 0 .4em; line-height: 1.2; }
h2 { font-size: 24px; } h3 { font-size: 16px; font-weight: 600; } h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; font-weight: 700; margin: 14px 0 6px; }
a { color: var(--klarbla); }
.muted { color: var(--muted); } .small { font-size: 13px; } .nowrap { white-space: nowrap; }
kbd { font-family: var(--f-ui); background: #fff; border: 1px solid var(--line2); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; font-size: 12px; }
code { background: #fff; padding: 1px 5px; border-radius: 4px; }
[hidden] { display: none !important; }

/* ---------- Knappar och fält ---------- */
.btn { font: 600 14px var(--f-ui); color: var(--bla); background: #fff; border: 1.5px solid var(--line2); border-radius: var(--r-sm); padding: 7px 13px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; text-decoration: none; white-space: nowrap; transition: background .12s, border-color .12s; }
.btn:hover:not(:disabled) { border-color: var(--bla); background: #f3f6fa; }
.btn:focus-visible, .inp:focus, .sel:focus, .tog:focus-visible { outline: 3px solid rgba(229, 0, 75, .35); outline-offset: 1px; }
.btn:disabled { opacity: .4; cursor: default; }
.btn.primary { background: var(--rod); border-color: var(--rod); color: #fff; }
.btn.primary:hover:not(:disabled) { background: #c70041; border-color: #c70041; }
.btn.danger { color: #b0003a; } .btn.danger:hover:not(:disabled) { border-color: #b0003a; background: #fff0f4; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover:not(:disabled) { background: rgba(22, 53, 90, .07); border-color: transparent; }
.btn.sm { font-size: 13px; padding: 5px 9px; }
.btn.big { font-size: 16px; padding: 12px 20px; width: 100%; justify-content: center; }
.inp, .sel { font: 15px var(--f-ui); color: var(--bla); background: #fff; border: 1.5px solid var(--line2); border-radius: var(--r-sm); padding: 7px 10px; width: 100%; }
.inp.sm, .sel.sm { font-size: 13px; padding: 4px 7px; }
.inp.big { font: 600 18px var(--f-head); }
textarea.inp { resize: vertical; line-height: 1.35; }
input[type=color] { width: 40px; height: 32px; border: 1.5px solid var(--line2); border-radius: var(--r-sm); padding: 2px; background: #fff; cursor: pointer; }
.f { display: block; margin: 0 0 12px; }
.f > span, .f label > span { display: block; font-weight: 600; font-size: 13px; margin-bottom: 4px; }
.f em { font-style: normal; font-weight: 400; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; cursor: pointer; margin-right: 12px; }
.check input { width: 16px; height: 16px; accent-color: var(--rod); }
.checks { display: flex; flex-wrap: wrap; gap: 4px 0; } .checks.col { flex-direction: column; }
.seg { display: inline-flex; background: #fff; border: 1.5px solid var(--line2); border-radius: var(--r-sm); overflow: hidden; }
.seg button { font: 600 14px var(--f-ui); color: var(--bla); background: none; border: 0; padding: 7px 12px; cursor: pointer; border-right: 1px solid var(--line); }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--bla); color: #fff; }
.seg.sm button { font-size: 12.5px; padding: 5px 8px; }
.toggles { display: flex; flex-wrap: wrap; gap: 5px; }
.tog { font: 600 13px var(--f-ui); color: var(--bla); background: #fff; border: 1.5px solid var(--line2); border-radius: 999px; padding: 4px 11px; cursor: pointer; position: relative; display: inline-flex; align-items: center; gap: 5px; }
.tog input { display: none; }
.tog.on { background: var(--bla); color: #fff; border-color: var(--bla); }
.tog.busy::after { content: ""; position: absolute; top: -3px; right: -3px; width: 10px; height: 10px; border-radius: 50%; background: var(--rod); border: 2px solid #fff; }
.alert { background: #fff0f4; border: 1.5px solid var(--rod); border-radius: var(--r-sm); padding: 9px 11px; margin: 0 0 12px; font-size: 13.5px; display: grid; gap: 6px; }
.alert.soft { background: #fff8e1; border-color: var(--orange); }

/* ---------- Inloggning ---------- */
body.auth { display: grid; place-items: center; min-height: 100vh; padding: 24px; background: var(--beige) radial-gradient(circle at 90% 10%, rgba(229, 0, 75, .08) 0 220px, transparent 221px); }
.authcard { background: #fff; border-radius: var(--r-lg); border-top-left-radius: 0; padding: 36px 36px 28px; width: min(460px, 100%); box-shadow: var(--shadow); }
.authlogo { height: 74px; margin-bottom: 12px; }
.authcard h1 { font-size: 30px; font-weight: 800; color: var(--rod); }
.err { color: #b0003a; font-weight: 600; }
.or { text-align: center; color: var(--muted); font-size: 13px; margin: 14px 0; border-top: 1px solid var(--line); line-height: 0; } .or span { background: #fff; padding: 0 8px; }
.gbtn { display: flex; justify-content: center; margin: 10px 0; }

/* ---------- Appens ram ---------- */
body.app { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }
.top { display: flex; align-items: center; gap: 10px; background: #fff; padding: 8px 16px; border-bottom: 3px solid var(--rod); flex: none; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--bla); margin-right: 8px; }
.brand img { height: 38px; }
.brand.empty { display: none; }
.brand span { display: flex; flex-direction: column; line-height: 1.1; }
.brand b { font: 800 20px var(--f-head); color: var(--rod); }
.brand small { font-size: 12px; color: var(--muted); }
.grades { display: flex; gap: 4px; flex-wrap: wrap; }
.gtab { font: 600 15px var(--f-head); color: var(--bla); background: transparent; border: 0; border-radius: var(--r-sm) var(--r-sm) 0 0; padding: 8px 16px; cursor: pointer; position: relative; }
.gtab:hover { background: var(--beige); }
.gtab.on { background: var(--bla); color: #fff; }
.grow { flex: 1; }
.savestate { font-size: 13px; font-weight: 600; padding: 4px 10px; border-radius: 999px; }
.savestate.ok { color: var(--gron); } .savestate.busy { color: var(--muted); } .savestate.err { color: #fff; background: var(--rod); } .savestate.ro { color: var(--muted); background: #eef1f5; }
.schedbar { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: var(--beige); border-bottom: 1px solid var(--line); flex: none; flex-wrap: wrap; }
.schedpick { display: grid; grid-template-columns: auto auto; grid-template-areas: "k i" "b i" "s i"; align-items: center; column-gap: 12px; text-align: left; background: #fff; border: 1.5px solid var(--line2); border-radius: var(--r-md); border-bottom-left-radius: 0; padding: 6px 14px; cursor: pointer; color: var(--bla); font-family: var(--f-ui); }
.schedpick:hover { border-color: var(--bla); }
.schedpick .sp-k { grid-area: k; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--rod); font-weight: 700; }
.schedpick b { grid-area: b; font: 700 18px var(--f-head); }
.schedpick small { grid-area: s; color: var(--muted); font-size: 12.5px; }
.schedpick i { grid-area: i; font-style: normal; font-size: 13px; }
.weeknav { display: flex; }
.weeknav .btn { font-size: 20px; padding: 2px 10px; }
.confchip { font: 700 14px var(--f-ui); border-radius: 999px; padding: 7px 14px; cursor: pointer; border: 1.5px solid; }
.confchip.good { color: #007a4e; background: #e8f8f1; border-color: #9fdcc3; }
.confchip.bad { color: #fff; background: var(--rod); border-color: var(--rod); animation: pulse 2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 5px rgba(229, 0, 75, .18); } }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 7px 16px; background: #fff; border-bottom: 1px solid var(--line); flex: none; }
.tg { display: flex; gap: 4px; align-items: center; padding-right: 8px; border-right: 1px solid var(--line); }
.tg:last-child { border-right: 0; }
.tg.zoom { margin-left: auto; } .tg.zoom span { font-size: 13px; min-width: 42px; text-align: center; }
.tb-info { color: var(--muted); font-size: 14px; }
.hl { font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 5px; }
.hl .sel { width: auto; }
#viewTarget { width: auto; min-width: 220px; max-width: 360px; }
.work { flex: 1; display: grid; grid-template-columns: 190px minmax(0, 1fr) 330px; min-height: 0; }
.palette { background: #fff; border-right: 1px solid var(--line); padding: 10px 12px 30px; overflow-y: auto; }
.pal-help { font-size: 13px; color: var(--muted); background: var(--beige); border-radius: var(--r-sm); padding: 8px 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip { --c: #fff; --cf: var(--bla); font: 600 13px var(--f-ui); background: var(--c); color: var(--cf); border: 1.5px solid var(--line2); border-radius: var(--r-sm); padding: 4px 9px; cursor: grab; touch-action: none; user-select: none; }
.chip:hover { border-color: var(--bla); transform: translateY(-1px); }
.chipghost { position: fixed; z-index: 1000; pointer-events: none; box-shadow: var(--shadow); transform: rotate(-3deg); }
.legend { display: grid; gap: 4px; font-size: 13px; }
.legend span { display: inline-block; width: 14px; height: 14px; border-radius: 4px; border: 1px solid var(--line2); vertical-align: middle; margin-right: 6px; }
.stage { overflow: auto; position: relative; padding: 14px; }
.side { background: #fff; border-left: 1px solid var(--line); overflow-y: auto; padding: 12px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px; margin-bottom: 12px; }
.side .card:first-child { border-top-right-radius: 0; }
.row-btns { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; } .row-btns.col { flex-direction: column; align-items: stretch; }
.banner { padding: 9px 14px; border-radius: var(--r-sm); margin-bottom: 10px; display: flex; gap: 10px; align-items: center; font-weight: 600; }
.banner.warn { background: #fff8e1; border: 1.5px solid var(--orange); }
.banner.note { background: #fff; border-left: 6px solid var(--rod); }
body.in-admin .schedbar, body.in-admin .toolbar, body.in-admin .work { display: none; }
.adminview { display: none; flex: 1; overflow: auto; }
body.in-admin .adminview { display: block; }
body.dragging, body.dragging * { cursor: grabbing !important; user-select: none; }
.empty { color: var(--muted); padding: 30px; text-align: center; }
.empty.big { max-width: 520px; margin: 60px auto; background: #fff; border-radius: var(--r-lg); }

/* ---------- Sidopanel ---------- */
.props-head { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 10px; }
.props-head h3 { margin: 0; }
.props-head .close { margin-left: auto; }
.swatch { flex: none; width: 42px; height: 42px; border-radius: var(--r-sm); display: grid; place-items: center; font: 700 13px var(--f-head); border: 1px solid var(--line2); }
.props fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.props.ro .tog { cursor: default; }
details.more { border-top: 1px solid var(--line); margin: 6px 0 10px; padding-top: 8px; }
details.more summary { cursor: pointer; font: 600 14px var(--f-head); padding: 4px 0 8px; }
.colorrow { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sw { display: flex; gap: 3px; flex-wrap: wrap; }
.sw button { width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--line2); cursor: pointer; padding: 0; }
.conf-item { display: grid; gap: 2px; width: 100%; text-align: left; background: #fff0f4; border: 1px solid #f5b8cb; border-radius: var(--r-sm); padding: 8px 10px; margin-top: 6px; cursor: pointer; font: 13px var(--f-ui); color: var(--bla); }
.conf-item:hover { border-color: var(--rod); }
.counts { width: 100%; border-collapse: collapse; font-size: 14px; }
.counts th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--line); padding: 4px; }
.counts td { padding: 5px 4px; border-bottom: 1px solid var(--line); }
.counts tr[data-t] { cursor: pointer; } .counts tr[data-t]:hover { background: var(--beige); }
.tips ul { margin: 0; padding-left: 18px; font-size: 13.5px; line-height: 1.5; }
.selist { list-style: none; padding: 0; margin: 10px 0 0; font-size: 13.5px; }
.selist li { padding: 4px 0; border-bottom: 1px solid var(--line); }
.dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; border: 1px solid var(--line2); margin-right: 6px; vertical-align: -1px; }

/* ---------- Schemat (rutnätet) ---------- */
.canvas { --z: 1; }
.sheet {
  --row-normal: calc(86px * var(--z)); --row-smal: calc(24px * var(--z)); --row-hog: calc(130px * var(--z)); --timecol: calc(96px * var(--z));
  display: grid; position: relative; background: #fff; border: 2px solid var(--bla); font-size: calc(13px * var(--z)); min-width: calc(980px * var(--z));
  color: var(--bla); user-select: none;
}
.sh-corner { background: var(--bla); color: #fff; font: 700 1.05em var(--f-head); display: grid; place-items: center; padding: 6px; }
.sh-day { background: var(--bla); color: #fff; font: 700 1.1em var(--f-head); text-align: center; padding: .45em 4px; border-left: 2px solid #fff; position: relative; z-index: 2; }
.sh-date { display: block; font: 400 .78em var(--f-ui); opacity: .85; }
.sh-time { grid-column: 1; background: var(--beige); border-bottom: 1px solid var(--line2); border-right: 2px solid var(--bla); padding: 3px 6px; display: flex; flex-direction: column; justify-content: center; font-size: .92em; line-height: 1.15; }
.sh-time .sh-t { font-weight: 700; }
.sh-time .sh-lab { font-size: .85em; color: var(--muted); }
.sh-time .sh-ex { font-size: .82em; color: var(--rod); font-weight: 600; }
.sh-time.h-smal { flex-direction: row; gap: 5px; align-items: center; font-size: .8em; overflow: hidden; white-space: nowrap; }
.sh-time.h-smal .sh-lab { overflow: hidden; text-overflow: ellipsis; }
.sh-time.h-smal .sh-ex { display: none; }
.cell { border-bottom: 1px solid var(--line); background: #fff; }
.cell.k-rast, .cell.k-lunch { background: #f6f6f6; }
.cell.k-ovrigt { background: #fbfbfb; }
.cell.daystart { border-left: 2px solid var(--bla); }
.editable .cell:hover { background: #fff3f6; cursor: crosshair; }
.blk { position: relative; z-index: 2; background: var(--bg, #fff); color: var(--fg, var(--bla)); border: 1px solid rgba(22, 53, 90, .45); display: flex; align-items: center; justify-content: center; overflow: hidden; min-width: 0; min-height: 0; }
.blk.daystart { border-left: 2px solid var(--bla); }
.editable .blk { cursor: grab; }
.blk-in { width: 100%; padding: .2em .3em; text-align: center; line-height: 1.17; overflow-wrap: normal; word-break: normal; }
.blk .l-body { overflow-wrap: anywhere; }
.al-left .blk-in { text-align: left; padding-left: .55em; }
.blk .l-group { font-weight: 700; font-size: 1.05em; }
.blk .l-subj { font-weight: 700; }
.blk .l-title { font-weight: 700; font-size: 1.08em; }
.blk .l-body { white-space: pre-line; font-size: .93em; margin: .15em 0; }
.blk .l-room, .blk .l-teach { font-size: .96em; }
.blk .l-time { font-size: .85em; opacity: .85; }
.blk .l-group + .l-subj, .blk .l-subj + .l-room, .blk .l-room + .l-teach, .blk .l-subj + .l-teach { margin-top: .25em; }
.blk.t-rast .blk-in, .blk.t-lunch .blk-in, .blk.t-text .blk-in { font-size: .9em; }
.blk.t-rast .l-title, .blk.t-lunch .l-title, .blk.t-text .l-title { font-weight: 600; font-size: 1em; }
.blk.t-aktivitet.sz-auto .blk-in { font-size: 1.05em; }
.blk.narrow .blk-in { padding: .2em .1em; }
.sz-xs .blk-in { font-size: .72em; } .sz-s .blk-in { font-size: .86em; } .sz-m .blk-in { font-size: 1.05em; } .sz-l .blk-in { font-size: 1.35em; } .sz-xl .blk-in { font-size: 1.9em; }
.blk.bold .blk-in { font-weight: 700; }
.blk.vertical .blk-in { writing-mode: vertical-rl; transform: rotate(180deg); height: 100%; display: flex; flex-direction: column; justify-content: center; align-items: center; }
.blk.pat-rand { border-width: 3px; border-color: var(--bla); }
.blk.pat-streckad { border: 2px dashed var(--bla); }
.blk.pat-prickar { background-image: radial-gradient(rgba(22, 53, 90, .22) 1px, transparent 1.3px); background-size: 8px 8px; }
.blk.barmode { box-shadow: inset 7px 0 0 var(--bar, transparent); }
.blk.barmode .blk-in { padding-left: .7em; }
.blk.sel { outline: 3px solid var(--rod); outline-offset: -1px; z-index: 4; }
.blk.insel { outline: 2px dashed var(--rod); outline-offset: -2px; }
.blk.conf { box-shadow: inset 0 0 0 3px #d4002a; }
.blk.conf.barmode { box-shadow: inset 7px 0 0 var(--bar), inset 0 0 0 3px #d4002a; }
.blk .badge, .tl-item .badge { position: absolute; top: 2px; right: 2px; width: 18px; height: 18px; border-radius: 50%; background: #d4002a; color: #fff; font: 800 12px/18px var(--f-head); text-align: center; }
.blk .notedot { position: absolute; bottom: 1px; right: 3px; font-size: 11px; opacity: .6; }
.blk.dim { opacity: .28; filter: grayscale(.6); }
.banner.hl { background: #fff0f4; border: 1.5px solid var(--rod); }
.blk.lifting { opacity: .35; }
.blk.droptarget, .cell.droptarget { outline: 3px solid var(--gron); outline-offset: -3px; z-index: 6; }
.hd { position: absolute; background: var(--rod); z-index: 6; border: 2px solid #fff; border-radius: 6px; }
.hd-e { right: -2px; top: 50%; width: 10px; height: 30px; margin-top: -15px; cursor: ew-resize; }
.hd-w { left: -2px; top: 50%; width: 10px; height: 30px; margin-top: -15px; cursor: ew-resize; }
.hd-s { bottom: -2px; left: 50%; width: 30px; height: 10px; margin-left: -15px; cursor: ns-resize; }
.hd-n { top: -2px; left: 50%; width: 30px; height: 10px; margin-left: -15px; cursor: ns-resize; }
.dropghost { z-index: 7; pointer-events: none; border: 3px dashed var(--gron); background: rgba(0, 169, 108, .14); position: relative; }
.dropghost.bad { border-color: var(--rod); background: rgba(229, 0, 75, .14); }
.dropghost.swap { border-color: var(--orange); background: rgba(243, 146, 0, .16); }
.dropghost::after { content: attr(data-label); position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); font: 700 12px var(--f-ui); color: var(--bla); background: #fff; padding: 2px 6px; border-radius: 5px; white-space: nowrap; }
.dropghost[data-label=""]::after { display: none; }
.rectsel { z-index: 3; pointer-events: none; background: rgba(229, 0, 75, .07); border: 2px solid var(--rod); }
.floatbar { position: absolute; z-index: 20; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; background: #fff; border-radius: var(--r-sm); padding: 7px 9px; box-shadow: var(--shadow); border: 1.5px solid var(--bla); max-width: 720px; }
.fb-t { font-weight: 700; font-size: 13px; margin-right: 4px; }

/* ---------- Tidslinje (lärare, sal, grupp) ---------- */
.tl-wrap { background: #fff; border-radius: var(--r-md); padding: 16px; border: 1px solid var(--line); }
.tl-title { font-size: 22px; } .tl-title small { font: 400 14px var(--f-ui); color: var(--muted); margin-left: 8px; }
.tl-host { height: max(560px, calc(100vh - 290px)); }
.tl { display: flex; flex-direction: column; height: 100%; --tl-axis: 52px; }
.tl-head { display: grid; grid-template-columns: var(--tl-axis) repeat(5, minmax(0, 1fr)); }
.tl-dayh { background: var(--bla); color: #fff; font: 700 15px var(--f-head); text-align: center; padding: 6px; border-left: 2px solid #fff; }
.tl-body { flex: 1; min-height: 0; display: grid; grid-template-columns: var(--tl-axis) repeat(5, minmax(0, 1fr)); border: 2px solid var(--bla); border-top: 0; }
.tl-axis { position: relative; background: var(--beige); border-right: 2px solid var(--bla); }
.tl-tick { position: absolute; left: 0; right: 0; font-size: 12px; font-weight: 600; }
.tl-tick span { position: absolute; top: -8px; right: 6px; }
.tl-tick:first-child span { top: 0; }
.tl-day { position: relative; border-left: 1px solid var(--line2); }
.tl-line { position: absolute; left: 0; right: 0; border-top: 1px dashed var(--line); }
.tl-item { position: absolute; background: var(--bg); color: var(--fg); border: 1px solid rgba(22, 53, 90, .45); border-radius: 6px; padding: 3px 6px; overflow: hidden; font-size: 12.5px; line-height: 1.2; cursor: pointer; }
.tl-item.barmode { box-shadow: inset 6px 0 0 var(--bar); padding-left: 11px; }
.tl-item.conf { box-shadow: inset 0 0 0 3px #d4002a; }
.tl-item:hover { z-index: 3; box-shadow: var(--shadow); }
.ti-time { font-size: .85em; font-weight: 600; opacity: .85; }
.ti-title { font-weight: 700; font-size: 1.05em; }
.ti-meta { font-size: .92em; }

/* ---------- Meny, dialog, toast ---------- */
.popover { position: fixed; z-index: 500; background: #fff; border-radius: var(--r-md); border-top-left-radius: 0; box-shadow: var(--shadow); border: 1px solid var(--line2); min-width: 280px; overflow-y: auto; }
.menu { padding: 6px; display: flex; flex-direction: column; }
.mh { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; color: var(--rod); padding: 10px 10px 4px; }
.mi { display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; text-align: left; font: 15px var(--f-ui); color: var(--bla); background: none; border: 0; border-radius: var(--r-sm); padding: 7px 10px; cursor: pointer; text-decoration: none; }
.mi:hover { background: var(--beige); }
.mi.on { background: var(--bla); color: #fff; } .mi.on small, .mi.on em { color: #dbe4ef; }
.mi small { width: 100%; color: var(--muted); font-size: 12.5px; }
.mi em { font-style: normal; font-size: 11.5px; font-weight: 700; }
.mi em.now { color: var(--gron); } .mi em.star { color: var(--orange); }
.mi.act { font-weight: 600; } .mi.danger { color: #b0003a; }
.msep { border-top: 1px solid var(--line); margin: 6px 0; }
.modal-back { position: fixed; inset: 0; z-index: 800; background: rgba(22, 53, 90, .45); display: grid; place-items: center; padding: 20px; }
.modal { background: #fff; border-radius: var(--r-lg); border-top-left-radius: 0; width: min(520px, 100%); max-height: calc(100vh - 40px); display: flex; flex-direction: column; box-shadow: 0 30px 80px rgba(0, 0, 0, .3); }
.modal.wide { width: min(1100px, 100%); }
.modal header { display: flex; align-items: center; padding: 20px 24px 8px; }
.modal header h2 { margin: 0; font-size: 21px; flex: 1; }
.modal-body { padding: 8px 24px; overflow-y: auto; }
.modal footer { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 24px 20px; flex-wrap: wrap; }
.choice { display: grid; gap: 8px; margin-bottom: 12px; } .choice label { display: flex; gap: 8px; align-items: center; cursor: pointer; }
.rowsT { width: 100%; border-collapse: collapse; font-size: 14px; }
.rowsT th { text-align: left; font-size: 12px; color: var(--muted); padding: 4px; }
.rowsT td { padding: 3px 4px; border-top: 1px solid var(--line); }
.rowsT td.num { font-weight: 700; color: var(--muted); }
.rowsT .exrow td { border-top: 0; background: var(--beige); }
.exdays { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; padding: 6px 0; }
.exdays label { display: flex; gap: 4px; align-items: center; font-size: 13px; }
.exdays .inp { width: 100px; }
.histwrap { display: grid; grid-template-columns: 220px 1fr; gap: 14px; min-height: 420px; }
.histlist { list-style: none; padding: 0; margin: 0; max-height: 60vh; overflow-y: auto; }
.histlist button { width: 100%; display: grid; text-align: left; border: 0; background: none; padding: 7px 9px; border-radius: var(--r-sm); cursor: pointer; font: 14px var(--f-ui); color: var(--bla); }
.histlist button.on { background: var(--bla); color: #fff; }
.histprev { overflow: auto; --z: .62; }
.histprev .sheet { --z: .62; }
.helpgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 6px 24px; }
.helpgrid ul { padding-left: 18px; line-height: 1.55; margin-top: 0; }
.helpgrid h3 { color: var(--rod); margin-top: 8px; }
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 900; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--bla); color: #fff; padding: 10px 18px; border-radius: var(--r-sm); font-weight: 600; box-shadow: var(--shadow); max-width: 640px; transition: opacity .3s, transform .3s; }
.toast.warn { background: #fff8e1; color: var(--bla); border: 2px solid var(--orange); }
.toast.err { background: var(--rod); }
.toast.out { opacity: 0; transform: translateY(10px); }

/* ---------- Administration ---------- */
.admin { display: grid; grid-template-columns: 250px 1fr; min-height: 100%; }
.atabs { background: #fff; border-right: 1px solid var(--line); padding: 18px 12px; display: flex; flex-direction: column; gap: 2px; }
.atabs a { text-decoration: none; color: var(--bla); padding: 10px 14px; border-radius: var(--r-sm); font: 600 15px var(--f-head); }
.atabs a:hover { background: var(--beige); }
.atabs a.on { background: var(--rod); color: #fff; }
.atabs a.back { margin-top: 18px; font-family: var(--f-ui); color: var(--muted); }
.apane { padding: 26px 32px 60px; max-width: 1150px; }
.apane .intro { max-width: 760px; line-height: 1.5; background: #fff; border-left: 6px solid var(--rod); padding: 10px 14px; border-radius: 0 var(--r-sm) var(--r-sm) 0; }
.atable { width: 100%; border-collapse: separate; border-spacing: 0; background: #fff; border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--line); margin: 14px 0; }
.atable th { text-align: left; font-size: 12.5px; color: var(--muted); padding: 9px 8px; background: #fafbfc; border-bottom: 1px solid var(--line); }
.atable th small { font-weight: 400; }
.atable td { padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.atable tr:last-child td { border-bottom: 0; }
.atable tr.saved td { background: #e8f8f1; transition: background .3s; }
.atable.sm td { padding: 4px 6px; }
.preview { display: inline-block; padding: 6px 14px; border-radius: 6px; font-weight: 700; border: 1px solid var(--line2); min-width: 56px; text-align: center; }
.gcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 16px; margin: 16px 0; }
.gcard { background: #fff; border-radius: var(--r-md); padding: 14px; border: 1px solid var(--line); }
.gc-head { display: flex; gap: 4px; align-items: center; }
.formcard { background: #fff; border-radius: var(--r-md); padding: 18px 20px; margin: 16px 0; border: 1px solid var(--line); max-width: 760px; }
.logorow { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; } .logorow img { height: 56px; background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 4px; }

@media (max-width: 1250px) {
  .work { grid-template-columns: 170px minmax(0, 1fr) 300px; }
}
@media (max-width: 980px) {
  body.app { height: auto; overflow: auto; }
  .work { grid-template-columns: 1fr; }
  .palette, .side { border: 0; }
  .admin { grid-template-columns: 1fr; }
}

/* ---------- Bakgrundsbilder ---------- */
.blk.has-img, .tl-item.has-img { background-image: var(--ovl), var(--img); background-size: cover, cover; background-position: center; }
.ov-mork { --ovl: linear-gradient(rgba(10, 20, 35, .42), rgba(10, 20, 35, .42)); }
.ov-ljus { --ovl: linear-gradient(rgba(255, 255, 255, .62), rgba(255, 255, 255, .62)); }
.ov-ingen { --ovl: linear-gradient(transparent, transparent); }
.blk.has-img.ov-mork .blk-in, .blk.has-img.ov-ingen .blk-in, .tl-item.has-img.ov-mork, .tl-item.has-img.ov-ingen { text-shadow: 0 1px 3px rgba(0, 0, 0, .65), 0 0 2px rgba(0, 0, 0, .5); }
.imgpick { display: grid; gap: 12px; }
.imgpick .searchrow { display: flex; gap: 6px; }
.imgpick .extrow { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.imggrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; max-height: 340px; overflow-y: auto; padding: 2px; }
.imggrid button { position: relative; border: 2px solid transparent; border-radius: var(--r-sm); padding: 0; height: 96px; background: #eef1f5 center/cover no-repeat; cursor: pointer; overflow: hidden; }
.imggrid button:hover { border-color: var(--rod); }
.imggrid button span { position: absolute; left: 0; right: 0; bottom: 0; font-size: 10.5px; background: rgba(22, 53, 90, .78); color: #fff; padding: 2px 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: left; }
.imggrid .busy { opacity: .4; }
.imggrid > p { grid-column: 1 / -1; margin: 6px 2px; }
.dropzone { border: 2.5px dashed var(--line2); border-radius: var(--r-md); padding: 18px; text-align: center; color: var(--muted); background: var(--beige); transition: background .15s, border-color .15s; }
.dropzone.over { border-color: var(--gron); background: #e8f8f1; color: var(--bla); }
.dropzone b { color: var(--bla); }
.imgcur { display: flex; gap: 10px; align-items: center; }
.imgcur .thumb { width: 120px; height: 70px; border-radius: var(--r-sm); background: #eef1f5 center/cover no-repeat; border: 1px solid var(--line2); flex: none; display: grid; place-items: center; font-size: 12px; color: var(--muted); }
.subjimg { width: 64px; height: 36px; border-radius: 6px; border: 1px solid var(--line2); background: #f3f3f3 center/cover no-repeat; cursor: pointer; display: grid; place-items: center; font-size: 11px; color: var(--muted); }
/* Årskurs-märken */
.gchips { display: flex; flex-wrap: nowrap; gap: 3px; align-items: center; }
.gchip { font: 700 11.5px var(--f-ui); min-width: 26px; padding: 3px 6px; border-radius: 6px; border: 1.5px solid var(--line2); background: #fff; color: var(--bla); cursor: pointer; }
.gchip.on { background: var(--bla); border-color: var(--bla); color: #fff; }
.gchip:disabled { cursor: default; }
.gchip-all { font-size: 12px; color: var(--muted); margin-left: 4px; align-self: center; }
.gtab.mine::after { content: ""; position: absolute; top: 6px; right: 5px; width: 7px; height: 7px; border-radius: 50%; background: var(--rod); }
.gtab.on.mine::after { background: #fff; }
.grades .gtab { padding: 8px 12px; font-size: 14px; }
.pal-add { font: 600 12.5px var(--f-ui); color: var(--rod); background: none; border: 1.5px dashed var(--line2); border-radius: var(--r-sm); padding: 4px 9px; cursor: pointer; }
.pal-add:hover { border-color: var(--rod); background: #fff0f4; }
.palette details > summary, .props details.others > summary { cursor: pointer; font-size: 12.5px; color: var(--muted); margin: 6px 0 4px; }
/* Första gången: välj årskurs */
.onboard .gradepick { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin: 8px 0 14px; }
.onboard .gradepick button { font: 700 17px var(--f-head); color: var(--bla); background: #fff; border: 2px solid var(--line2); border-radius: var(--r-md); padding: 14px 4px; cursor: pointer; }
.onboard .gradepick button small { display: block; font: 400 11.5px var(--f-ui); color: var(--muted); }
.onboard .gradepick button.on { background: var(--rod); border-color: var(--rod); color: #fff; }
.onboard .gradepick button.on small { color: #ffe1ea; }
.onboard .gradepick button:disabled { cursor: default; opacity: .55; }
.onboard .gradepick button.on:disabled { opacity: 1; }
.onboard .lead { font-size: 16px; }

.pwlogin { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 12px; }
.pwlogin summary { cursor: pointer; color: var(--muted); font-size: 14px; margin-bottom: 10px; }
.gbtn { min-height: 44px; margin: 18px 0; }

.showbox { margin-top: 7px; font-size: 13.5px; }
.hint { font-size: 12.5px; background: #fff8e1; border-left: 4px solid var(--orange); padding: 5px 8px; border-radius: 0 6px 6px 0; margin-top: 5px; }

/* Tiderna i vänsterkolumnen centreras */
.sh-time { align-items: center; text-align: center; }
.sh-time.h-smal { justify-content: center; }

/* ---------- Nyheter ---------- */
.newsmodal .modal { width: min(620px, 100%); border-top: 8px solid var(--rod); }
.newslist { display: grid; gap: 16px; }
.newsitem { background: var(--beige); border-radius: var(--r-md); border-top-left-radius: 0; padding: 14px 18px; }
.newshead { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.newshead h3 { margin: 0; font-size: 18px; }
.newsbadge { background: var(--rod); color: #fff; font: 700 11px var(--f-head); text-transform: uppercase; letter-spacing: .06em; padding: 3px 8px; border-radius: 999px; }
.newsitem ul { margin: 10px 0 2px; padding-left: 20px; line-height: 1.55; font-size: 15px; }
.newsitem li { margin-bottom: 6px; }
.newsitem li.adm { color: var(--muted); }
.admtag { font-style: normal; font-size: 11px; background: #eef1f5; padding: 1px 6px; border-radius: 4px; }
.newsedit .nwitems { padding-left: 22px; margin: 0 0 10px; display: grid; gap: 10px; }
.newsedit .nwitems li { padding-left: 4px; }
.nwctl { display: flex; gap: 4px; align-items: center; margin-top: 4px; }
.nwctl .sel { width: auto; }
.publist { display: grid; gap: 8px; max-width: 760px; }
.pubrow { display: flex; justify-content: space-between; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px 14px; }

.vertag { display: inline-block; margin: 12px 0 0; font: 700 12px var(--f-head); color: var(--bla); background: #fff; border: 1.5px solid var(--line2); border-radius: 999px; padding: 2px 10px; }
.vertag + ul { margin-top: 6px; }
.vlab { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; color: var(--muted); margin-right: 6px; }
.vlab .inp { width: 64px; }
.mver { font-size: 12px; color: var(--muted); padding: 0 10px 6px; }

.counts small.akt { display: block; font-size: 11px; color: var(--muted); line-height: 1.1; }
.notcounted { margin-top: 12px; background: #fff8e1; border-left: 4px solid var(--orange); border-radius: 0 var(--r-sm) var(--r-sm) 0; padding: 8px 10px; display: grid; gap: 4px; font-size: 13px; }
.linkbtn { text-align: left; background: none; border: 0; padding: 2px 0; color: var(--klarbla); font: 600 13px var(--f-ui); cursor: pointer; text-decoration: underline; }

/* ---------- Import ---------- */
.importdlg .modal { width: min(1300px, 100%); }
.dropzone.big { padding: 40px 20px; font-size: 16px; }
.imhelp { margin-top: 14px; } .imhelp summary { cursor: pointer; font-weight: 600; } .imhelp ul { line-height: 1.6; }
.imtop { display: grid; grid-template-columns: 1fr 160px 1fr; gap: 12px; }
.imgrid { display: grid; grid-template-columns: 300px 1fr; gap: 16px; }
.imsheets { display: grid; gap: 6px; max-height: 52vh; overflow-y: auto; }
.imsheet { display: flex; gap: 8px; align-items: flex-start; border: 1.5px solid var(--line); border-radius: var(--r-sm); padding: 8px; cursor: pointer; background: #fff; }
.imsheet.on { border-color: var(--rod); background: #fff8fa; }
.imsheet.bad { opacity: .65; cursor: default; }
.imsheet input[type=checkbox] { margin-top: 6px; width: 17px; height: 17px; accent-color: var(--rod); }
.imsh-main { flex: 1; min-width: 0; display: grid; gap: 5px; }
.imsh-meta { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 13px; }
.imsh-meta .sel { width: auto; } .imsh-meta input[type=number] { width: 58px; }
.exists { font-size: 11px; font-weight: 700; color: #9a5b00; background: #fff3d6; border-radius: 4px; padding: 1px 6px; }
.imnew { margin-top: 12px; font-size: 13.5px; display: grid; gap: 4px; background: var(--beige); border-radius: var(--r-sm); padding: 10px; }
.imnew:empty { display: none; }
.imprev { overflow: auto; max-height: 56vh; border: 1px solid var(--line); border-radius: var(--r-sm); }
.imprev .sheet { --z: .62; }
.imwarn { font-size: 13px; margin-top: 8px; } .imwarn summary { cursor: pointer; color: #9a5b00; font-weight: 600; }

.followtg { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; margin-left: 10px; padding: 4px 10px; border-radius: 999px; border: 1.5px solid var(--line); cursor: pointer; white-space: nowrap; }
.followtg:has(input:checked) { border-color: var(--rod); background: #fff1f4; color: var(--rod); }
.followtg input { accent-color: var(--rod); }

.exdays { gap: 8px 14px; }
.exday { display: flex; gap: 4px; align-items: center; font-size: 13px; }
.exday b { width: 30px; }
.exdays .exlab { width: 150px; }
.sh-ex i { font-style: normal; font-weight: 700; }

.sh-exmark { display: none; color: var(--rod); font-weight: 800; }
.sh-time.h-smal .sh-exmark { display: inline; }

.pastweeks { margin-top: 6px; border-top: 1px solid var(--line2); }
.pastweeks summary { cursor: pointer; list-style: none; padding: 10px 12px 6px; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.pastweeks summary::-webkit-details-marker { display: none; }
.pastweeks summary::before { content: '▸ '; }
.pastweeks[open] summary::before { content: '▾ '; }
.pastweeks .mi { opacity: .85; width: 100%; box-sizing: border-box; }
.pastweeks .mi.on { opacity: 1; }

.onlyclass { margin-top: 8px; font-size: 13.5px; }

/* ---------- Symboler i rutorna (fotboll, iPad) ---------- */
.bic { display: inline-flex; width: 1em; height: 1em; flex: none; }
.bic svg { width: 100%; height: 100%; display: block; }
.bics-inline { display: inline-flex; gap: .25em; margin-left: .35em; vertical-align: -.14em; white-space: nowrap; }
.l-subj .bics-inline, .l-title .bics-inline { font-size: .92em; }
.icontogs .tog { display: inline-flex; align-items: center; gap: 6px; }
.icontogs .tog svg { width: 17px; height: 17px; }

/* ---------- Resurs & planering (personalens lager) ---------- */
.layerseg { margin-left: 8px; }
.layerseg button[data-layer="personal"].on { background: #0f6b5c; border-color: #0f6b5c; color: #fff; }
.layerseg em { font-style: normal; font-size: 11px; background: rgba(255,255,255,.25); border-radius: 8px; padding: 0 6px; margin-left: 4px; }
.layerseg button:not(.on) em { background: var(--line2); }
.blk.t-resurs { border: 1.5px dashed rgba(15, 107, 92, .7); }
.blk.t-planering { border: 1.5px dashed rgba(110, 80, 160, .65); background-image: repeating-linear-gradient(135deg, transparent 0 8px, rgba(110, 80, 160, .07) 8px 16px); }
.blk .l-kind { font-size: .78em; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; opacity: .8; }
.ghostblk { position: relative; z-index: 1; pointer-events: none; background: var(--bg); color: var(--fg); opacity: .22; filter: saturate(.6); display: flex; align-items: center; justify-content: center; text-align: center; font-size: .78em; line-height: 1.15; border: 1px solid rgba(22, 53, 90, .3); overflow: hidden; }
.ghostblk span { padding: 2px; }
.stafflayer .sheet { box-shadow: 0 0 0 3px #0f6b5c; }
.stafflayer .cell { background: #f7fbfa; }
.staffnote { font-size: 12.5px; background: #e6f4f1; color: #0f5a4d; border-radius: var(--r-sm); padding: 6px 10px; margin-bottom: 10px; font-weight: 600; }
.chip.stype { font-weight: 700; }
.chip.st-resurs { --c: #d9efe9; border-style: dashed; border-color: #0f6b5c; color: #0f5a4d; background: #d9efe9; }
.chip.st-planering { --c: #ece6f5; border-style: dashed; border-color: #6e50a0; color: #4a3570; background: #ece6f5; }
.staffhelp { background: #e6f4f1; color: #0f5a4d; }
.tl-item.t-resurs, .tl-item.t-planering { border-style: dashed; }
