/* ============================================================
   Betygsimport wizard (ported from legacy index_v1.html <style>)
   Renders inside .view-inner. Buttons/inputs/cards/badges/toasts/
   modals/loadDiamonds come from components.css - not redefined here.
   ============================================================ */

/* ---------- stepper ---------- */
.stepper { display: flex; align-items: center; justify-content: center; gap: 0; margin-bottom: 38px; user-select: none; }
.step { display: flex; align-items: center; gap: 10px; }
.step .dot {
  width: 38px; height: 38px; border-radius: 50%; background: #DDE9EE; color: #7D949D;
  font-weight: 700; display: flex; align-items: center; justify-content: center;
  transition: all .4s cubic-bezier(.4, 0, .2, 1); font-size: 15px;
}
.step .dot .icon { --i: 18px; }
.step .lbl { font-size: 14px; font-weight: 600; color: #7D949D; transition: color .4s; }
.step.active .dot { background: var(--cyan); color: #fff; box-shadow: 0 0 0 6px rgba(0, 189, 250, .18); transform: scale(1.08); }
.step.active .lbl { color: var(--ink); }
.step.done .dot { background: var(--ok); color: #fff; }
.step.done .lbl { color: var(--ok); }
.step-line { width: 90px; height: 3px; background: #DDE9EE; margin: 0 14px; border-radius: 2px; position: relative; overflow: hidden; }
.step-line::after { content: ""; position: absolute; inset: 0; background: var(--ok); transform: translateX(-101%); transition: transform .6s ease; }
.step-line.fill::after { transform: translateX(0); }

/* ---------- panels ---------- */
.panel { display: none; animation: impSlideUp .45s cubic-bezier(.22, 1, .36, 1); }
.panel.show { display: block; }
@keyframes impSlideUp { from { opacity: 0; transform: translateY(22px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- dropzone ---------- */
.dropzone {
  border: 2.5px dashed #B9D9E6; border-radius: var(--r-md); padding: 56px 24px; text-align: center;
  cursor: pointer; transition: all .25s ease; position: relative;
  background: linear-gradient(180deg, #FBFEFF, #F3FAFD);
}
.dropzone:hover, .dropzone.drag { border-color: var(--cyan); background: #EEFAFF; box-shadow: 0 0 0 6px rgba(0, 189, 250, .08); }
.dropzone.drag { transform: scale(1.012); }
.dz-icon { width: 74px; height: 74px; margin: 0 auto 18px; position: relative; }
.dz-icon .d1, .dz-icon .d2 {
  position: absolute; inset: 8px; background: var(--cyan); transform: rotate(45deg);
  border-radius: 10px; opacity: .16; animation: pulseD 2.4s ease-in-out infinite;
}
.dz-icon .d2 { animation-delay: -1.2s; inset: 16px; opacity: .32; }
.dz-icon .icon { position: absolute; inset: 0; margin: auto; z-index: 2; color: var(--cyan-deep); }
@keyframes pulseD { 0%, 100% { transform: rotate(45deg) scale(1); } 50% { transform: rotate(45deg) scale(1.14); } }
.dropzone h2 { font-size: 20px; margin-bottom: 6px; }
.dropzone p { color: var(--muted); font-size: 14px; }
.dropzone .types { margin-top: 16px; display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.chip { background: var(--cyan-100); color: var(--cyan-deep); font-size: 12px; font-weight: 700; padding: 4px 12px; border-radius: var(--r-full); }
.folderpick { margin-top: 16px; text-align: center; }
.folderpick .hint { display: block; margin-top: 8px; font-size: 12.5px; color: var(--muted); }

/* ---------- läsår selector ---------- */
.yearrow { display: flex; gap: 8px; align-items: flex-end; margin-top: 22px; flex-wrap: wrap; }
.yearrow .field { flex: 1; min-width: 240px; max-width: 420px; }
.yearrow .btn-icon { border: 1.5px solid #CFE2EA; }

/* ---------- loader ---------- */
.loader { display: none; text-align: center; padding: 48px 0; }
.loader.show { display: block; animation: impSlideUp .3s ease; }
.loader .loadDiamonds { margin-bottom: 20px; }
.loader p { color: var(--muted); font-weight: 600; }

/* ---------- summary cards ---------- */
.sumgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 20px; }
.sumcard { background: var(--card); border-radius: var(--r-md); box-shadow: var(--shadow); padding: 16px 18px; position: relative; overflow: hidden; }
.sumcard::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--cyan); }
.sumcard.warn::before { background: var(--warn); }
.sumcard.bad::before { background: var(--bad); }
.sumcard.ok::before { background: var(--ok); }
.sumcard.dup::before { background: var(--bad); }
.sumcard .num { font-size: 26px; font-weight: 800; }
.sumcard .cap { font-size: 12.5px; color: var(--muted); font-weight: 600; margin-top: 2px; }
.sumcard.clickable { cursor: pointer; transition: box-shadow var(--t-fast); }
.sumcard.clickable:hover { box-shadow: var(--shadow-lg); }

/* ---------- toolbar ---------- */
.toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .grow, .importbar .grow { flex: 1; }
.toolbar .searchwrap { min-width: 260px; }
.toggle { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; color: var(--muted); cursor: pointer; }
.toggle input { accent-color: var(--cyan); width: 16px; height: 16px; }

/* ---------- review table ---------- */
.tablewrap { background: var(--card); border-radius: var(--r-md); box-shadow: var(--shadow); overflow: auto; max-height: 60vh; }
.tablewrap table { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 13px; }
.tablewrap thead th {
  position: sticky; top: 0; background: var(--head); color: #CFE7F0; font-weight: 700;
  padding: 9px 8px; font-size: 12px; text-align: left; white-space: nowrap; z-index: 2;
}
.tablewrap thead th .icon { --i: 13px; color: #F5C76A; vertical-align: -2px; }
.tablewrap thead th.sub { text-align: center; min-width: 40px; }
.tablewrap tbody td { border-bottom: 1px solid #EDF4F7; padding: 4px 6px; white-space: nowrap; }
.tablewrap tbody tr { transition: background .12s; }
.tablewrap tbody tr:hover { background: #F2FBFF; }
.tablewrap tbody tr.excluded { opacity: .38; }
.tablewrap tbody tr.haswarn { background: #FFF9EC; }
.tablewrap tbody tr.haswarn:hover { background: #FDF3DA; }
.tablewrap td input {
  border: 1px solid transparent; border-radius: 6px; padding: 5px 6px; font-size: 13px;
  font-family: inherit; background: transparent; transition: all .12s; color: var(--ink);
}
.tablewrap td input:hover { border-color: #CFE2EA; background: #fff; }
.tablewrap td input:focus { outline: none; border-color: var(--cyan); background: #fff; box-shadow: 0 0 0 3px rgba(0, 189, 250, .15); }
.tablewrap td input.gr { width: 38px; text-align: center; font-weight: 700; }
.tablewrap td input.pnr { width: 105px; }
.tablewrap td input.nm { width: 110px; }
.tablewrap td input.kl { width: 64px; }
.tablewrap td input.sk { width: 130px; }
.tablewrap td input.special { color: var(--grey); }
.tablewrap td input.invalid { background: var(--bad-100); border-color: var(--bad); color: var(--bad); }
.tablewrap td .warnflag { cursor: help; display: inline-flex; }
.tablewrap td .warnflag .icon { color: var(--warn); }
.rowchk { accent-color: var(--cyan); width: 15px; height: 15px; cursor: pointer; }
#btnToggleRemoved .icon { transition: transform var(--t-fast); }
#btnToggleRemoved.open .icon { transform: rotate(180deg); }

/* ---------- import bar ---------- */
.importbar {
  display: flex; gap: 18px; align-items: center; margin-top: 20px; flex-wrap: wrap;
  background: var(--card); border-radius: var(--r-md); box-shadow: var(--shadow); padding: 18px 22px;
}
.importbar .modes { display: flex; gap: 14px; flex-wrap: wrap; }
.mode { display: flex; align-items: center; gap: 7px; font-size: 13.5px; font-weight: 600; cursor: pointer; color: var(--muted); }
.mode input { accent-color: var(--cyan); }
.mode.sel { color: var(--ink); }
.modeinfo { display: inline-flex; color: var(--grey); cursor: help; }
#btnReview { border-color: var(--warn); color: #8A6100; background: var(--warn-100); }

/* ---------- legend / footer ---------- */
.legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 10px; font-size: 12.5px; color: var(--muted); }
.legend b { font-weight: 700; }
.legend .icon { --i: 13px; color: var(--warn); vertical-align: -2px; }
.lg { display: inline-block; width: 13px; height: 13px; border-radius: 4px; vertical-align: -2px; margin-right: 5px; }
#ocrHint { gap: 8px; align-items: flex-start; margin-top: 14px; }
#ocrHint .icon { --i: 15px; flex: none; margin-top: 2px; }
.legend kbd { background: #EEF5F8; border: 1px solid #D5E4EA; border-radius: 5px; padding: 1px 7px; font-size: 12px; font-family: inherit; }
.footer-hint { text-align: center; color: var(--grey); font-size: 12.5px; margin-top: 34px; }

/* ---------- success screen ---------- */
.successwrap { text-align: center; padding: 30px 0 10px; }
.bigcheck {
  width: 110px; height: 110px; margin: 0 auto 22px; border-radius: 50%; background: var(--ok);
  position: relative; animation: bigPop .5s cubic-bezier(.34, 1.56, .64, 1);
  box-shadow: 0 10px 40px rgba(25, 184, 119, .4);
}
.bigcheck svg { position: absolute; inset: 0; margin: auto; }
.bigcheck path { stroke-dasharray: 60; stroke-dashoffset: 60; animation: drawCheck .5s .3s ease forwards; }
@keyframes bigPop { from { transform: scale(0); } to { transform: scale(1); } }
@keyframes drawCheck { to { stroke-dashoffset: 0; } }
.successwrap h2 { font-size: 26px; margin-bottom: 8px; }
.successwrap .sub { color: var(--muted); margin-bottom: 26px; }
.repgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 14px; max-width: 820px; margin: 0 auto 26px; }
.backupnote { font-size: 13px; color: var(--muted); margin-bottom: 26px; }
.donebtns { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.rowsdetail { max-width: 860px; margin: 0 auto; text-align: left; }

/* ---------- skola saknas (importen kräver en skola per elev) ---------- */
.sch-panel {
  background: #FFF9EC; border: 1.5px solid #F0D9A0; border-left: 4px solid var(--warn);
  border-radius: var(--r-md); padding: 14px 16px; box-shadow: var(--shadow);
}
.sch-head { font-weight: 700; color: #8A6100; font-size: 13.5px; margin-bottom: 12px; line-height: 1.5; }
.sch-head .icon { --i: 15px; color: #8A6100; vertical-align: -3px; }
.sch-apply { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.sch-input { width: 280px; }
.sch-apply .btn .icon { --i: 14px; }
.sch-hint { font-size: 12.5px; color: var(--muted); flex-basis: 100%; }
.sch-hint.ok { color: #0E7A50; font-weight: 600; }
.sch-files { display: flex; flex-direction: column; gap: 6px; }
.sch-file {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--card);
  border: 1px solid #EEDFB8; border-radius: 10px; padding: 8px 12px; font-size: 13px;
}
.sch-file label { display: flex; align-items: center; gap: 8px; cursor: pointer; min-width: 0; }
.sch-chk { accent-color: var(--cyan); width: 15px; height: 15px; flex: none; }
.sch-fname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 440px; }
.sch-sugg { display: inline-flex; align-items: center; gap: 8px; margin-left: auto; color: var(--muted); font-size: 12.5px; }
.sch-sugg b { color: var(--ink); }
.sch-sugg .btn .icon { --i: 13px; }

/* ---------- confetti ---------- */
.confetti { position: fixed; top: -12px; z-index: 500; pointer-events: none; border-radius: 3px; animation: confFall linear forwards; }
@keyframes confFall { to { transform: translateY(105vh) rotate(720deg); opacity: .9; } }

/* ---------- tutorial + fix overlays ---------- */
.tut-overlay {
  position: fixed; inset: 0; background: rgba(8, 26, 34, .62); z-index: 800; display: none;
  align-items: center; justify-content: center; backdrop-filter: blur(3px);
}
.tut-overlay.show { display: flex; animation: fadeIn .3s ease; }
.tut-card {
  background: var(--card); border-radius: 18px; max-width: 520px; width: 92%; padding: 34px 36px;
  box-shadow: var(--shadow-lg); position: relative; animation: popCard .4s cubic-bezier(.34, 1.56, .64, 1);
}
@keyframes popCard { from { transform: scale(.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.tut-card .art { height: 120px; display: flex; align-items: center; justify-content: center; margin-bottom: 18px; }
.tut-card h3 { font-size: 21px; margin-bottom: 10px; }
.tut-card p { color: var(--muted); font-size: 14.5px; line-height: 1.65; }
.tut-card .tsteps { display: flex; gap: 7px; justify-content: center; margin: 22px 0 18px; }
.tut-card .tsteps i { width: 9px; height: 9px; border-radius: 50%; background: #D7E6EC; transition: all .3s; }
.tut-card .tsteps i.on { background: var(--cyan); width: 26px; border-radius: 5px; }
.tut-nav { display: flex; gap: 12px; justify-content: space-between; }
.tut-close {
  position: absolute; top: 14px; right: 18px; border: 0; background: none; cursor: pointer;
  color: var(--grey); padding: 2px; display: inline-flex;
}
.tut-close:hover { color: var(--ink); }
.tart-diamond {
  width: 64px; height: 64px; background: var(--cyan); transform: rotate(45deg); border-radius: 12px;
  display: flex; align-items: center; justify-content: center; box-shadow: 0 8px 30px rgba(0, 189, 250, .4);
}
.tart-diamond .icon { transform: rotate(-45deg); color: #fff; }

/* ---------- issue correction wizard ---------- */
.fix-card { max-width: 640px; }
.fix-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; padding-right: 26px; }
.fix-count { font-size: 13px; font-weight: 700; color: var(--muted); }
.fix-type { font-size: 12px; font-weight: 800; color: var(--bad); background: var(--bad-100); padding: 3px 10px; border-radius: var(--r-full); }
.fix-type.advisory { color: #8A6100; background: var(--warn-100); }
.fix-progress { height: 4px; background: var(--line); border-radius: 2px; margin: 8px 0 14px; overflow: hidden; }
.fix-progress i { display: block; height: 100%; background: var(--cyan); border-radius: 2px; transition: width .3s; width: 0; }
.fix-student { font-size: 14px; font-weight: 600; margin-bottom: 14px; color: var(--ink); }
.fix-student small { color: var(--muted); font-weight: 500; display: block; margin-top: 2px; }
.fix-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 18px; }
.fix-cols h4 { font-size: 12.5px; color: var(--muted); margin-bottom: 8px; text-transform: uppercase; letter-spacing: .4px; }
.fix-read { background: #F6FAFC; border: 1px solid #E0EDF2; border-radius: 10px; padding: 12px; font-size: 13.5px; min-height: 84px; }
.fix-raw { font-size: 24px; font-weight: 800; color: var(--bad); }
.fix-warntext { color: #8A6100; font-size: 13px; margin-top: 6px; white-space: pre-line; }
.fix-src { color: var(--muted); font-size: 12px; margin-top: 8px; }
#fixInput .input, #fixInput .select { margin-bottom: 8px; }
#fixInput .hint { font-size: 12.5px; color: var(--muted); }
.fix-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 6px; max-height: 180px; overflow: auto; margin-bottom: 8px; }
.fix-grid label { font-size: 11px; font-weight: 700; color: var(--muted); display: block; text-align: center; margin-bottom: 2px; }
.fix-grid input {
  width: 100%; text-align: center; font-weight: 700; padding: 6px 2px;
  border: 1.5px solid #CFE2EA; border-radius: 8px; background: var(--card); color: var(--ink);
}
.fix-grid input:focus { outline: 2px solid var(--cyan); border-color: transparent; }
.fix-grid input.invalid { background: var(--bad-100); border-color: var(--bad); color: var(--bad); }
.fix-grid input.special { color: var(--grey); }
.fix-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-bottom: 12px; }

/* ---------- duplicate-personnummer conflicts ---------- */
.cf-group {
  background: #FFF6F6; border: 1.5px solid #F3B3B6; border-left: 4px solid var(--bad);
  border-radius: var(--r-md); padding: 14px 16px; margin-bottom: 12px; box-shadow: var(--shadow);
}
.cf-head { font-weight: 700; color: #9A2A2E; font-size: 13.5px; margin-bottom: 10px; }
.cf-head .icon { --i: 14px; color: #9A2A2E; vertical-align: -2px; }
.cf-cand {
  display: flex; align-items: center; gap: 14px; padding: 10px 12px; background: var(--card);
  border: 1px solid #ECC; border-radius: 10px; margin-top: 8px;
}
.cf-info { flex: 1; min-width: 0; }
.cf-file { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.cf-grades { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 5px; }
.cf-g { font-size: 11.5px; background: #EEF5F8; border-radius: 5px; padding: 1px 6px; color: var(--muted); }
.cf-g.hot { background: var(--bad-100); color: #9A2A2E; font-weight: 700; }
.cf-pick { padding: 8px 16px; font-size: 13px; white-space: nowrap; flex: none; }

/* The unresolved-issues confirm passes a multi-line body; render its
   newlines (additive tweak - shared modal bodies are single-line). */
.modal-body p { white-space: pre-line; }

/* ---------- responsive ---------- */
@media (max-width: 760px) {
  .step .lbl { display: none; }
  .step-line { width: 40px; }
}
@media (max-width: 640px) {
  .fix-cols { grid-template-columns: 1fr; }
}
