/* IGRAB-färger, samma som igrab.se */
:root {
  --bg: #f2f7fb;        /* igrab-paper */
  --panel: #ffffff;
  --ink: #243f5e;       /* igrab-ink */
  --ink-deep: #15314f;
  --muted: #5d7089;
  --line: #dce5ee;      /* igrab-line */
  --brand: #0072bc;     /* igrab-blue */
  --brand-dark: #005a96;
  --brand-light: #e5f1fa;
  --brand-ink: #ffffff;
  --approve: #15803d;
  --yellow-bg: #fff4c2;
  --yellow-line: #e0b400;
  --yellow-ink: #6b5200;
  --red-bg: #fde3e1;
  --red-line: #c62828;
  --red-ink: #8e1b1b;
  --ok: #2e7d32;
  --focus: #0072bc;
  --radius: 10px;
  --font: "Schibsted Grotesk", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font: 18px/1.4 var(--font); }
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.2; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.15rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.error { color: var(--red-ink); font-weight: 600; min-height: 1.4em; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

input:not([type]), input[type=text], input[type=email], input[type=date], input[type=password], input[type=search], input[type=number], textarea {
  font: inherit; width: 100%; padding: .55rem .7rem; border: 2px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink);
}
input:focus, textarea:focus { border-color: var(--focus); outline: none; }

/* Knappar */
.btn {
  font: inherit; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .55rem 1rem; border-radius: 8px; border: 2px solid var(--line); background: #fff; color: var(--ink); cursor: pointer; min-height: 44px;
}
.btn:hover { border-color: #aab2ad; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-big { font-size: 1.1rem; padding: .75rem 1.4rem; min-height: 56px; }
.btn-small { font-size: .9rem; padding: .3rem .7rem; min-height: 36px; }
.btn-block { width: 100%; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn:not(.btn-primary):not(.btn-approve):not(.btn-quiet):hover { border-color: var(--brand); color: var(--brand); }
.btn-approve:hover { background: #166534; border-color: #166534; }
.btn-approve { background: var(--approve); border-color: var(--approve); color: #fff; min-width: 12rem; }
.btn-quiet { border-color: transparent; background: transparent; }
.btn-danger-quiet { color: var(--red-ink); }

/* Inloggning */
.login { min-height: 100%; display: grid; place-items: center; padding: 16px; }
.login-box { background: var(--panel); padding: 2rem; border-radius: var(--radius); width: min(460px, 100%); display: grid; gap: 1rem; box-shadow: 0 2px 12px rgba(0,0,0,.06); }
.login-users { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: .5rem; }
.login-users .btn[aria-pressed=true] { background: var(--brand); color: #fff; border-color: var(--brand); }

/* Ramverk */
.app {
  height: 100%; display: grid;
  grid-template-columns: 320px 1fr; grid-template-rows: auto 1fr auto;
  grid-template-areas: "top top" "inbox work" "inbox bar";
}
.topbar { grid-area: top; display: flex; align-items: center; gap: 1rem; padding: .55rem 1rem; background: var(--bg); color: var(--ink); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: .75rem; font-weight: 700; font-size: 1.25rem; color: var(--ink); }
.brand img { height: 36px; width: auto; display: block; }
.spacer { flex: 1; }
.who { font-weight: 600; }
.topbar .btn-quiet { color: var(--brand); }
.badge { font-size: .85rem; font-weight: 600; padding: .2rem .7rem; border-radius: 99px; background: var(--brand-light); color: var(--brand-dark); }
.badge.off { background: var(--yellow-bg); color: var(--yellow-ink); }

.inbox { grid-area: inbox; background: var(--panel); border-right: 1px solid var(--line); padding: 1rem; overflow-y: auto; }
.inbox-head { display: flex; justify-content: space-between; align-items: baseline; margin: 1.2rem 0 .5rem; }
.inline-check { font-size: .85rem; color: var(--muted); display: flex; gap: .3rem; align-items: center; }
.inbox-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.inbox-list button {
  width: 100%; text-align: left; font: inherit; background: #fff; border: 2px solid var(--line); border-radius: 8px; padding: .6rem .75rem; cursor: pointer; display: grid; gap: .15rem;
}
.inbox-list button[aria-current=true] { border-color: var(--brand); background: var(--brand-light); }
.inbox-list .subj { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inbox-list .meta { font-size: .85rem; color: var(--muted); display: flex; gap: .5rem; flex-wrap: wrap; }
.pill { font-size: .78rem; font-weight: 700; padding: .05rem .5rem; border-radius: 99px; background: var(--line); }
.pill.ny { background: var(--brand-light); color: var(--brand-dark); }
.pill.utkast { background: #ece6ff; color: #3d2a87; }
.pill.hanterad, .pill.godkänd { background: #dcefdf; color: #1d5b27; }
.pill.avvisad { background: #eee; color: #555; }
.pill.red { background: var(--red-bg); color: var(--red-ink); }
.pill.yellow { background: var(--yellow-bg); color: var(--yellow-ink); }
.empty { color: var(--muted); padding: .5rem 0; }

.work { grid-area: work; overflow: hidden; display: flex; min-height: 0; }

/* Ny order */
.intake { padding: 1.5rem; max-width: 900px; width: 100%; overflow-y: auto; }
.hint { color: var(--muted); margin-top: 0; }
.dropzone { position: relative; }
.dropzone textarea { min-height: 300px; resize: vertical; font-size: 1rem; }
.drop-overlay { display: none; position: absolute; inset: 0; border: 3px dashed var(--brand); border-radius: 8px; background: rgba(0,114,188,.08); place-items: center; font-size: 1.4rem; font-weight: 700; color: var(--brand); }
.dropzone.drag .drop-overlay { display: grid; }
.intake-row { margin-top: .75rem; }
.intake-buttons { display: flex; gap: .75rem; margin-top: 1rem; flex-wrap: wrap; }
.status { font-weight: 600; min-height: 1.5em; }
.status.busy::before { content: ""; display: inline-block; width: 1em; height: 1em; margin-right: .5em; vertical-align: -.15em; border: 3px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Ordervy */
.order-view { display: grid; grid-template-columns: minmax(280px, 38%) 1fr; width: 100%; min-height: 0; }
.original { border-right: 1px solid var(--line); background: #f8fbfd; display: flex; flex-direction: column; min-height: 0; }
.pane-title { font-size: .8rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: .9rem 1rem .4rem; }
.original-meta { padding: 0 1rem .5rem; font-size: .9rem; color: var(--muted); border-bottom: 1px solid var(--line); }
.original-meta strong { color: var(--ink); }
.original-text { margin: 0; padding: 1rem; white-space: pre-wrap; word-break: break-word; font: 1rem/1.5 var(--font); overflow-y: auto; flex: 1; }
.original-pdf { border: 0; width: 100%; flex: 2; min-height: 300px; }

.order { overflow-y: auto; padding-bottom: 2rem; min-height: 0; }
.banner { margin: 1rem 1rem 0; padding: .8rem 1rem; border-radius: 8px; font-weight: 600; }
.banner.done { background: #dcefdf; color: #1d5b27; }
.banner.rejected { background: #eee; color: #444; }
.banner.info { background: var(--brand-light); color: var(--brand-dark); }

.fields { display: grid; grid-template-columns: repeat(3, 1fr); gap: .8rem 1rem; padding: 0 1rem 1rem; border-bottom: 1px solid var(--line); }
.field label { display: block; font-size: .85rem; font-weight: 700; color: var(--muted); margin-bottom: .2rem; }
.field-wide { grid-column: span 3; }
.field.flag-yellow input, .field.flag-yellow .customer-box { border-color: var(--yellow-line); background: var(--yellow-bg); }
.field.flag-red input, .field.flag-red .customer-box { border-color: var(--red-line); background: var(--red-bg); }
.customer-box { display: flex; gap: .5rem; align-items: center; border: 2px solid var(--line); border-radius: 8px; padding: .35rem .5rem .35rem .7rem; background: #fff; }
.customer-name { flex: 1; font-weight: 700; font-size: 1.1rem; }
.seg { display: flex; }
.seg button { font: inherit; font-weight: 600; flex: 1; padding: .55rem .5rem; border: 2px solid var(--line); background: #fff; cursor: pointer; min-height: 44px; }
.seg button:first-child { border-radius: 8px 0 0 8px; }
.seg button:last-child { border-radius: 0 8px 8px 0; border-left: 0; }
.seg button[aria-pressed=true] { background: var(--brand); color: #fff; border-color: var(--brand); }

.lines-head { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1rem .5rem; }
.lines { display: grid; gap: .6rem; padding: 0 1rem; }
.line { border: 2px solid var(--line); border-left-width: 8px; border-radius: 8px; background: #fff; padding: .7rem .8rem; display: grid; gap: .45rem; }
.line.ok { border-left-color: var(--ok); }
.line.yellow { border-color: var(--yellow-line); background: var(--yellow-bg); }
.line.red { border-color: var(--red-line); background: var(--red-bg); }
.line-main { display: grid; grid-template-columns: 1fr 7.5rem 6.5rem 7.5rem; gap: .8rem; align-items: center; }
.line-art .artnr { font-size: .9rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.line-art .name { font-weight: 600; }
.line-art .size { font-size: 1.5rem; font-weight: 800; line-height: 1.1; }
.line-art .noart { font-weight: 700; color: var(--red-ink); }
.line-qty input { text-align: right; font-size: 1.15rem; font-weight: 700; }
.line-qty .unit { font-size: .85rem; color: var(--muted); text-align: right; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.num .big { font-weight: 700; }
.line-source { font-size: .88rem; color: var(--muted); }
.line-source q { font-style: italic; }
.line-flags { display: flex; flex-wrap: wrap; gap: .35rem; }
.flag { font-size: .85rem; font-weight: 700; padding: .15rem .55rem; border-radius: 6px; }
.flag.red { background: var(--red-line); color: #fff; }
.flag.yellow { background: var(--yellow-line); color: #2b2100; }
.flag.checked { background: #dcefdf; color: #1d5b27; }
.line-actions { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }
.line-actions .alt-label { font-size: .85rem; color: var(--muted); margin-left: .4rem; }
.certainty { font-size: .8rem; color: var(--muted); }

.notes { margin: 1rem; padding: .7rem 1rem; background: var(--brand-light); border-radius: 8px; font-size: .95rem; }
.notes:empty { display: none; }
.history { margin: 0 1rem; color: var(--muted); font-size: .9rem; }
.history ul { padding-left: 1.2rem; }

/* Knappraden */
.actionbar { grid-area: bar; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .75rem 1rem; background: var(--panel); border-top: 2px solid var(--line); flex-wrap: wrap; }
.totals { display: flex; gap: 1.5rem; align-items: baseline; flex-wrap: wrap; font-size: 1.1rem; }
.warn { font-weight: 700; }
.warn.red { color: var(--red-ink); }
.warn.yellow { color: var(--yellow-ink); }
.warn.ok { color: var(--ok); }
.actions { display: flex; gap: .75rem; }

/* Dialoger */
dialog { border: 0; border-radius: var(--radius); padding: 0; box-shadow: 0 10px 40px rgba(0,0,0,.25); max-width: calc(100vw - 32px); }
dialog::backdrop { background: rgba(21,49,79,.55); }
.picker { width: 860px; height: min(86vh, 900px); }
.picker-inner { display: flex; flex-direction: column; height: 100%; padding: 1.2rem; gap: .7rem; }
.picker-head { display: flex; justify-content: space-between; align-items: center; }
.picker-head h2 { margin: 0; }
.picker-results { overflow-y: auto; display: grid; gap: .5rem; align-content: start; flex: 1; }
.result { border: 2px solid var(--line); border-radius: 8px; padding: .7rem .9rem; display: grid; grid-template-columns: 1fr auto; gap: .2rem 1rem; align-items: center; }
.result.dead { background: #f3f3f3; }
.result .r-size { font-size: 1.4rem; font-weight: 800; }
.result .r-name { font-weight: 600; }
.result .r-meta { font-size: .88rem; color: var(--muted); display: flex; gap: .8rem; flex-wrap: wrap; }
.result .r-meta .old { background: var(--yellow-bg); color: var(--yellow-ink); padding: 0 .3rem; border-radius: 4px; font-weight: 700; }
.result .r-meta .veryold, .result .r-meta .dead { background: var(--red-bg); color: var(--red-ink); padding: 0 .3rem; border-radius: 4px; font-weight: 700; }
.result .r-side { grid-row: span 3; display: grid; gap: .3rem; justify-items: end; }
.result .r-price { font-size: 1.2rem; font-weight: 800; }
.confirm { width: 480px; }
.confirm form { padding: 1.5rem; display: grid; gap: .8rem; }
.confirm .actions { justify-content: flex-end; }

.toast { position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%); background: var(--ink-deep); color: #fff; padding: .8rem 1.3rem; border-radius: 8px; font-weight: 600; z-index: 10; max-width: calc(100vw - 32px); }
.toast.err { background: var(--red-line); }

/* Surfplatta och mindre */
@media (max-width: 1180px) {
  .app { grid-template-columns: 1fr; grid-template-rows: auto auto 1fr auto; grid-template-areas: "top" "inbox" "work" "bar"; height: auto; min-height: 100%; }
  .inbox { border-right: 0; border-bottom: 1px solid var(--line); max-height: 260px; }
  .work { overflow: visible; }
  .order-view { grid-template-columns: 1fr; }
  .original { border-right: 0; border-bottom: 1px solid var(--line); max-height: 45vh; }
  .order { overflow: visible; }
  .actionbar { position: sticky; bottom: 0; }
}
@media (max-width: 700px) {
  body { font-size: 17px; }
  .fields { grid-template-columns: 1fr; }
  .field-wide { grid-column: span 1; }
  .line-main { grid-template-columns: 1fr 6rem; }
  .line-main .num { grid-column: span 1; }
  .actions { width: 100%; }
  .actions .btn { flex: 1; min-width: 0; padding-inline: .5rem; }
  .btn-approve { min-width: 0; }
  .topbar .who { display: none; }
}

.login-brand { display: flex; align-items: center; gap: .8rem; color: var(--ink); }
.login-brand img { height: 44px; width: auto; }
.login-box { border: 1px solid var(--line); }

/* Offert */
.order-head { display: flex; align-items: center; gap: .8rem; padding: .9rem 1rem .6rem; flex-wrap: wrap; }
.type-seg { width: 16rem; }
.type-seg button { font-size: 1.05rem; }
.field-wide2 { grid-column: span 3; }
.app[data-type="offert"] .order-only, .app[data-type="order"] .quote-only { display: none; }
#f-customer-name { margin-top: .4rem; }
.pill.offert { background: var(--brand); color: #fff; }
.pill.skickad, .pill.offert-skickad { background: var(--brand-light); color: var(--brand-dark); }
.pill.expired { background: var(--yellow-bg); color: var(--yellow-ink); }
.send { width: 640px; }
.send .field label { display: block; font-size: .85rem; font-weight: 700; color: var(--muted); margin-bottom: .2rem; }
.send .actions { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.send textarea { font-size: 1rem; }
.big-check { font-size: 1rem; color: var(--ink); }
.big-check input { width: 1.2rem; height: 1.2rem; }
a.btn { text-decoration: none; }
@media (max-width: 700px) { .field-wide2 { grid-column: span 1; } .type-seg { width: 100%; } }

/* Verktygsflikar i toppen – samma plats på alla sidor */
.tools { display: flex; gap: .25rem; margin-left: .5rem; }
.tools a { font-weight: 700; font-size: 1.05rem; color: var(--ink); text-decoration: none; padding: .45rem .9rem; border-radius: 8px; border: 2px solid transparent; }
.tools a:hover { border-color: var(--line); background: #fff; }
.tools a[aria-current=page] { background: var(--brand); color: #fff; }
select { font: inherit; width: 100%; padding: .5rem .6rem; border: 2px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); }
select:focus { border-color: var(--focus); outline: none; }

/* Inköp */
.po-view { width: 100%; overflow-y: auto; padding-bottom: 2rem; }
.po-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; padding: 1rem; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.po-supplier { font-size: 1.7rem; margin: .1rem 0 .3rem; }
.po-contact { color: var(--muted); font-size: .95rem; display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }
.po-contact a { color: var(--brand); font-weight: 600; }
.po-contact .flagtext { color: var(--yellow-ink); font-weight: 700; }
.po-head-actions { display: flex; gap: .5rem; align-items: center; min-width: 14rem; }
#po-ordered-fields { padding-top: 1rem; }
.po-note { padding: 1rem; }
.banner.late { background: var(--red-bg); color: var(--red-ink); }
.warn .info { color: var(--brand-dark); font-weight: 600; }
.pill.levererad { background: #dcefdf; color: #1d5b27; }
.pill.makulerad { background: #eee; color: #555; }
.map-fields { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem 1rem; margin-bottom: 1rem; }
.map-fields .field.flag-red select { border-color: var(--red-line); background: var(--red-bg); }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; background: #fff; margin-bottom: 1.2rem; }
.sample { border-collapse: collapse; font-size: .85rem; width: 100%; }
.sample th, .sample td { padding: .35rem .6rem; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.sample th { background: var(--bg); }
.group-list { list-style: none; padding: 0; margin: .5rem 0; display: grid; gap: .4rem; }
.group-list li { background: #fff; border: 2px solid var(--line); border-radius: 8px; padding: .5rem .8rem; display: flex; gap: 1rem; align-items: baseline; flex-wrap: wrap; }
.group-list li.unknown { border-color: var(--red-line); }
.group-list li span { color: var(--muted); }
#import h3 { margin-top: 1.5rem; }
.steps { padding-left: 1.3rem; display: grid; gap: 1rem; margin: 0; }
.steps li::marker { font-weight: 800; color: var(--brand); }
.shop-list { background: var(--bg); border-radius: 8px; padding: .6rem .8rem; max-height: 10rem; overflow: auto; font-size: .9rem; margin: .5rem 0 0; }
.fields-2 { grid-template-columns: 1fr 1fr; padding: .5rem 0 0; border: 0; }
#supplier .fields-2 { padding: 0; }
#supplier .field label, #shop .field label { display: block; font-size: .85rem; font-weight: 700; color: var(--muted); margin-bottom: .2rem; }
@media (max-width: 700px) {
  .map-fields, .fields-2 { grid-template-columns: 1fr; }
  .tools a { padding: .4rem .5rem; font-size: .95rem; }
  .brand img { height: 28px; }
}
/* Knapparna står still: texten till vänster får radbryta, knapparna flyttar inte. */
@media (min-width: 701px) {
  .actionbar { flex-wrap: nowrap; }
  .totals { flex: 1; min-width: 0; row-gap: .2rem; }
  .actions { flex-shrink: 0; }
}

/* ---------- Register ---------- */
.reg .work { padding: 1.25rem 1.5rem 3rem; overflow: auto; }
.reg-view h2 { margin: 0; }
.reg-head { display: flex; align-items: baseline; gap: 1rem; margin-bottom: .75rem; }
.reg-head .spacer { flex: 1; }
.reg-filters { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: .5rem 0 .75rem; }
.reg-filters input[type=search] { flex: 1; min-width: 260px; padding: .6rem .75rem; border: 1px solid var(--line); border-radius: var(--radius); font: inherit; }
.reg-filters select { padding: .55rem .6rem; border: 1px solid var(--line); border-radius: var(--radius); font: inherit; background: var(--panel); }
.reg-table-wrap { max-height: none; }
.reg-table { width: 100%; border-collapse: collapse; background: var(--panel); font-size: .95rem; }
.reg-table th { position: sticky; top: 0; background: var(--bg); text-align: left; font-weight: 600; color: var(--muted); font-size: .82rem; text-transform: uppercase; letter-spacing: .02em; }
.reg-table th, .reg-table td { padding: .5rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.reg-table tbody tr[data-artnr], .reg-table tbody tr[data-kundnr], .reg-table tbody tr[data-id] { cursor: pointer; }
.reg-table tbody tr[data-artnr]:hover, .reg-table tbody tr[data-kundnr]:hover, .reg-table tbody tr[data-id]:hover { background: var(--brand-light); }
.reg-table tr.dead td { color: var(--muted); }
.reg-table tr.yellow td { background: var(--yellow-bg); }
.reg-table tr.red td { background: var(--red-bg); }
.reg-table .r, .reg-table th.r { text-align: right; white-space: nowrap; }
.reg-table .flag { display: inline-block; margin: .15rem .25rem 0 0; }
.mono { font-variant-numeric: tabular-nums; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .9em; }
.reg-step { margin: 1.25rem 0; padding: 1rem 1.25rem; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.reg-step h3 { margin-top: 0; }
.reg-drop { min-height: 120px; display: grid; place-items: center; border: 2px dashed var(--line); border-radius: var(--radius); background: var(--bg); }
.reg-drop-text { color: var(--muted); }
.reg-drop.drag { border-color: var(--brand); background: var(--brand-light); }
.rule-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; }
.rule-grid fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: .75rem 1rem; margin: 0; }
.rule-grid legend { font-weight: 600; padding: 0 .3rem; }
.rule-grid .field { margin: .35rem 0 .6rem 1.8rem; }
.rule-grid .field input, .rule-grid .field select { width: 100%; }
.reg-tabs { margin: .5rem 0; flex-wrap: wrap; }
.reg-tabs button strong { margin-left: .25rem; }
.reg-dialog { width: min(900px, 96vw); }
.reg-dialog .fields-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .5rem 1rem; }
.reg-dialog .field-wide { grid-column: 1 / -1; }
.reg-dialog textarea { width: 100%; }
.reg-static { padding: .55rem 0; font-weight: 600; }
.empty-hint { margin-top: 1rem; }
.reg-filters select { width: auto; flex: 0 0 auto; }
.reg-filters input[type=search] { flex: 1 1 300px; width: auto; }
.reg-table td:nth-last-child(2), .reg-table .nowrap { white-space: nowrap; }
.reg-inline { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .5rem 1rem; }
.reg-step .field input, .reg-step .field select, .reg-step .field textarea { width: 100%; }
.reg-step textarea { font: inherit; padding: .5rem .6rem; border: 1px solid var(--line); border-radius: var(--radius); }

/* ---------- Butik & lager ---------- */
.app.butik { grid-template-columns: 1fr; grid-template-areas: "top" "work" "bar"; }
.butik-work { padding: 1rem 1.5rem 3rem; overflow: auto; max-width: 1200px; width: 100%; margin: 0 auto; }
.butik-modes { display: grid; grid-template-columns: repeat(4, 1fr); gap: .75rem; margin-bottom: 1.25rem; }
.butik-modes button { display: flex; flex-direction: column; align-items: flex-start; gap: .2rem; padding: 1rem 1.2rem; border: 2px solid var(--line); border-radius: var(--radius); background: var(--panel); color: var(--ink); font: inherit; cursor: pointer; text-align: left; }
.butik-modes button .big { font-size: 1.6rem; font-weight: 800; display: flex; gap: .5rem; align-items: center; }
.butik-modes button[aria-pressed=true] { border-color: var(--brand); background: var(--brand); color: var(--brand-ink); }
.butik-modes button[aria-pressed=true] .pill { background: #fff; }
.butik-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: .75rem 1rem; margin-bottom: .75rem; }
.scanbox { margin: .75rem 0; }
.scanbox label { display: block; font-weight: 700; color: var(--muted); font-size: .9rem; margin-bottom: .3rem; }
input.scan { font-size: 1.5rem; padding: .75rem 1rem; border-width: 3px; }
input.scan:focus { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-light); }
.butik-cart input.qty, .reg-table input.qty { width: 5.5rem; text-align: right; padding: .35rem .5rem; }
.butik-total { display: flex; align-items: baseline; justify-content: flex-end; gap: .75rem; margin: .75rem 0; font-size: 1.1rem; }
.butik-total strong { font-size: 2rem; }
.butik-history { margin-top: 1.5rem; }
.butik-history summary { cursor: pointer; font-weight: 600; }
.butik-polist button { width: 100%; }
@media (max-width: 800px) { .butik-modes { grid-template-columns: 1fr 1fr; } }
.butik-work { display: block; }

/* ---- Hyllor (påfyllning hos kund) ---- */
.small { font-size: .85rem; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; }
.hy-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .75rem; }
.hy-card { display: flex; flex-direction: column; align-items: flex-start; gap: .25rem; padding: .9rem 1rem; border: 2px solid var(--line); border-radius: var(--radius); background: var(--panel); color: var(--ink); font: inherit; text-align: left; }
button.hy-card { cursor: pointer; }
button.hy-card:hover { border-color: var(--brand); }
.hy-card strong { font-size: 1.2rem; }
.hy-card.dead { opacity: .6; }
.hy-visit .btn { margin-top: .4rem; }
.hy-flagged { margin: .4rem 0 0; padding-left: 1rem; font-size: .9rem; display: grid; gap: .25rem; }
.hy-round-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.hy-round-head h2 { margin: 0; }
.hy-progress { font-size: 1.1rem; }
.hy-progress strong { font-size: 1.6rem; }
.hy-sticky { position: sticky; top: 0; z-index: 2; background: var(--bg); padding: .5rem 0; }
.hy-positions { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.hy-pos { display: grid; grid-template-columns: 1fr 9rem; grid-template-areas: "main count" "actions actions"; gap: .3rem .9rem; padding: .8rem 1rem; border: 2px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.hy-pos.done { border-color: #b7e0c3; background: #f3faf5; }
.hy-pos.missed { border-color: var(--yellow-line); background: var(--yellow-bg); }
.hy-pos:focus-within { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-light); }
.hy-pos-main { grid-area: main; min-width: 0; }
.hy-pos-name { font-weight: 700; font-size: 1.05rem; }
.hy-pos-count { grid-area: count; text-align: center; }
.hy-pos-count label { display: block; }
input.hy-qty { font-size: 1.6rem; font-weight: 700; text-align: center; padding: .45rem .3rem; border-width: 3px; }
.hy-refill { margin-top: .2rem; font-size: .95rem; min-height: 1.3em; }
.hy-refill strong { font-size: 1.2rem; color: var(--brand-dark); }
.hy-pos-actions { grid-area: actions; display: flex; gap: .5rem; flex-wrap: wrap; }
.hy-pos-actions .btn { min-height: 36px; padding: .2rem .6rem; }
.hy-missed-text { color: var(--yellow-ink); font-weight: 700; }
.hy-bottom { position: sticky; bottom: 0; background: var(--bg); padding: .75rem 0; border-top: 1px solid var(--line); }
.hy-banner { margin: 0 0 1rem; }
.hy-finish { display: grid; gap: .6rem; }
.hy-finish .btn { display: flex; flex-direction: column; align-items: flex-start; text-align: left; gap: .15rem; min-width: 0; }
.hy-finish .btn span { font-size: .9rem; font-weight: 400; }
.hyllor select { font: inherit; width: 100%; padding: .55rem .7rem; border: 2px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); }
@media (max-width: 700px) {
  .hyllor .butik-work { padding: .75rem 1rem 2rem; }
  .hyllor .butik-modes { gap: .5rem; }
  .hyllor .butik-modes button { padding: .6rem .7rem; }
  .hyllor .butik-modes button .big { font-size: 1.15rem; }
  .hyllor .butik-modes button > span:not(.big) { display: none; }
  .hy-pos { grid-template-columns: 1fr 6.5rem; padding: .7rem .75rem; }
  .hy-bottom .btn-big { padding: .6rem 1rem; }
}
@media (max-width: 700px) {
  .topbar { flex-wrap: wrap; gap: .4rem .75rem; }
  .topbar .tools { order: 3; width: 100%; margin-left: 0; overflow-x: auto; }
}
dialog[open] { max-height: calc(100dvh - 24px); overflow-y: auto; }
.hyllor dialog .actions { position: sticky; bottom: 0; background: var(--panel); padding-top: .5rem; }
@media (max-width: 700px) {
  .hyllor .reg-dialog .fields-2 { grid-template-columns: 1fr 1fr; }
  .hyllor .reg-dialog .field-wide { grid-column: 1 / -1; }
  .hyllor dialog form { padding: 1rem; gap: .6rem; }
}
.hyllor dialog.confirm:not(.reg-dialog) { width: min(480px, calc(100vw - 32px)); }

/* ---- Försäljning: kedjan ---- */
.chain-steps { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0; margin-bottom: 1.1rem; counter-reset: step; }
.chain-steps button { position: relative; display: grid; grid-template-columns: auto 1fr; grid-template-areas: "n t" "n d"; column-gap: .65rem; align-items: center; text-align: left;
  padding: .75rem 1.4rem .75rem 1rem; border: 2px solid var(--line); border-right-width: 0; background: var(--panel); color: var(--ink); font: inherit; cursor: pointer; min-height: 64px; }
.chain-steps button:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.chain-steps button:last-child { border-right-width: 2px; border-radius: 0 var(--radius) var(--radius) 0; }
.chain-steps button:not(:last-child)::after { content: ""; position: absolute; right: -9px; top: 50%; width: 16px; height: 16px; background: inherit; border: 2px solid var(--line); border-left: 0; border-bottom: 0; transform: translateY(-50%) rotate(45deg); z-index: 1; }
.chain-steps .n { grid-area: n; min-width: 2.1rem; height: 2.1rem; border-radius: 99px; display: grid; place-items: center; font-weight: 800; background: var(--bg); color: var(--muted); padding: 0 .4rem; }
.chain-steps .n.has { background: var(--brand-light); color: var(--brand-dark); }
.chain-steps .n.warn { background: var(--red-bg); color: var(--red-ink); }
.chain-steps .t { grid-area: t; font-weight: 800; font-size: 1.1rem; }
.chain-steps .d { grid-area: d; font-size: .82rem; color: var(--muted); }
.chain-steps button[aria-pressed=true] { background: var(--brand); color: #fff; border-color: var(--brand); }
.chain-steps button[aria-pressed=true]::after { border-color: var(--brand); }
.chain-steps button[aria-pressed=true] .d { color: rgba(255,255,255,.85); }
.chain-steps button[aria-pressed=true] .n { background: #fff; color: var(--brand); }
.fs-banner { margin: 0 0 1rem; }
.fs-layout { display: grid; grid-template-columns: minmax(280px, 380px) 1fr; gap: 1.25rem; align-items: start; }
.fs-list { display: grid; gap: .5rem; }
.fs-filter input { width: 100%; }
#list { display: grid; gap: .5rem; }
.fs-row { display: grid; gap: .2rem; width: 100%; text-align: left; font: inherit; color: var(--ink); text-decoration: none; background: var(--panel); border: 2px solid var(--line); border-radius: 8px; padding: .6rem .75rem; cursor: pointer; }
.fs-row:hover { border-color: var(--brand); }
.fs-row.open { border-color: var(--brand); background: var(--brand-light); }
.fs-row .top, .fs-group > .top { display: flex; justify-content: space-between; gap: .75rem; }
.fs-row .meta { font-size: .85rem; color: var(--muted); }
.fs-group { display: grid; gap: .45rem; padding: .7rem; border: 2px solid var(--line); border-radius: var(--radius); background: #f8fbfd; }
.fs-group .fs-row { background: #fff; }
.chips { display: flex; gap: .4rem; flex-wrap: wrap; }
.chip { font: inherit; font-size: .9rem; padding: .3rem .8rem; border-radius: 99px; border: 2px solid var(--line); background: #fff; color: var(--ink); cursor: pointer; }
.chip[aria-pressed=true] { background: var(--ink-deep); border-color: var(--ink-deep); color: #fff; }
.fs-detail { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.25rem 1.4rem; min-height: 320px; }
.fs-head { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: .9rem; }
.fs-head h2 { margin: .1rem 0; }
.fs-stage { display: flex; gap: .3rem; align-items: flex-start; flex-wrap: wrap; }
.fs-lines input.qty { width: 5.5rem; }
.fs-h3 { margin: 1.4rem 0 .5rem; font-size: 1rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.fs-chain { list-style: none; margin: 0; padding: 0 0 0 1.1rem; border-left: 3px solid var(--brand-light); display: grid; gap: .55rem; }
.fs-chain li { position: relative; font-size: .95rem; }
.fs-chain li::before { content: ""; position: absolute; left: -1.55rem; top: .35rem; width: .7rem; height: .7rem; border-radius: 50%; background: var(--brand); border: 2px solid #fff; }
.fs-chain li.dead { color: var(--muted); text-decoration: line-through; }
.fs-chain .doc { display: inline-block; min-width: 5.5rem; font-weight: 700; }
.linkish { font: inherit; background: none; border: 0; padding: 0; color: var(--brand); text-decoration: underline; cursor: pointer; }
.fs-fields { padding: 0; border: 0; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .5rem 1rem; margin-bottom: .75rem; }
.fs-totals { display: grid; gap: .25rem; justify-content: end; margin: .5rem 0 1rem; }
.fs-totals div { display: flex; justify-content: space-between; gap: 2rem; }
.fs-totals .sum { font-size: 1.25rem; border-top: 2px solid var(--line); padding-top: .3rem; }
.reg-static { padding: .55rem 0; font-weight: 600; }
.fortnox-box { margin-top: .75rem; padding: .8rem 1rem; border: 2px solid var(--line); border-radius: var(--radius); background: #f8fbfd; }
.fortnox-box .intake-buttons { margin-top: .5rem; }
@media (max-width: 1000px) {
  .fs-layout { grid-template-columns: 1fr; }
  .chain-steps { grid-template-columns: 1fr 1fr; gap: .4rem; }
  .chain-steps button, .chain-steps button:first-child, .chain-steps button:last-child { border-width: 2px; border-radius: var(--radius); padding-right: 1rem; }
  .chain-steps button::after { display: none; }
  .chain-steps button:last-child { grid-column: span 2; }
}
@media (max-width: 700px) { .chain-steps .d { display: none; } .fs-detail { padding: .9rem; } }
.fs-fields { display: grid; }
.fs-fields .reg-static { padding: .2rem 0 .3rem; }
@media (max-width: 1000px) { .fs-detail.is-empty { display: none; } }

/* =====================================================================================
   Utseende 2: gemensamt skal (meny, sök eller fråga), översikt och lugnare former.
   Läggs sist och skriver över det äldre där det behövs. Färgerna är IGRAB:s egna.
   ===================================================================================== */
:root {
  --line-strong: #cbd8e4;
  --panel-soft: #f7fafd;
  --shadow-sm: 0 1px 2px rgba(21, 49, 79, .06), 0 1px 1px rgba(21, 49, 79, .04);
  --shadow-md: 0 8px 28px rgba(21, 49, 79, .12);
  --shadow-lg: 0 24px 64px rgba(21, 49, 79, .22);
  --radius: 12px;
  --rail: 84px;
  --tabbar: 62px;
}
body { font-size: 16px; line-height: 1.45; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
h2 { font-size: 1.25rem; letter-spacing: -.01em; }
h3 { font-size: 1.05rem; }
kbd { font: 600 .72rem/1 var(--font); padding: .2rem .4rem; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 6px; background: #fff; color: var(--muted); }

/* Fält och knappar */
input:not([type]), input[type=text], input[type=email], input[type=date], input[type=password], input[type=search], input[type=number], textarea, select, .hyllor select {
  border: 1.5px solid var(--line-strong); border-radius: 10px; transition: border-color .12s, box-shadow .12s;
}
input:focus, textarea:focus, select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(0, 114, 188, .16); }
input.scan { border-width: 2px; border-radius: 12px; }
input.scan:focus { box-shadow: 0 0 0 4px rgba(0, 114, 188, .18); }
::placeholder { color: #8a9bb0; }
.btn { border-width: 1.5px; border-color: var(--line-strong); border-radius: 10px; transition: background .12s, border-color .12s, box-shadow .12s, transform .06s; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn-primary { box-shadow: 0 1px 2px rgba(0, 90, 150, .35); }
.btn-approve { box-shadow: 0 1px 2px rgba(21, 128, 61, .35); }
.btn-quiet { border-color: transparent; box-shadow: none; }
.btn-big { border-radius: 12px; }
.pill { font-size: .75rem; padding: .14rem .55rem; letter-spacing: .01em; white-space: nowrap; }
.banner { border-radius: 12px; }
.table-wrap { border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.reg-table th { background: var(--panel-soft); }
.reg-table tbody tr:last-child td { border-bottom: 0; }
dialog { border-radius: 16px; box-shadow: var(--shadow-lg); }
dialog::backdrop { background: rgba(21, 49, 79, .45); backdrop-filter: blur(3px); }
.toast { border-radius: 12px; bottom: 28px; box-shadow: var(--shadow-md); animation: toast-in .2s ease-out; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } }

/* Kort som går att trycka på */
.inbox-list button, .fs-row, .hy-card, .reg-nav button, .result { border-width: 1px; border-color: var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); transition: border-color .12s, box-shadow .12s, background .12s; }
.inbox-list button:hover, .fs-row:hover, button.hy-card:hover, .reg-nav button:hover { border-color: var(--brand); box-shadow: var(--shadow-md); }
.inbox-list button[aria-current=true], .fs-row.open, .reg-nav button[aria-current=true] { border-color: var(--brand); background: var(--brand-light); box-shadow: inset 3px 0 0 var(--brand); }
.butik-modes button { border-width: 1px; border-radius: 14px; box-shadow: var(--shadow-sm); transition: border-color .12s, box-shadow .12s; }
.butik-modes button:hover { border-color: var(--brand); box-shadow: var(--shadow-md); }
.butik-modes button .big { font-size: 1.35rem; }
.butik-modes button[aria-pressed=true] { box-shadow: 0 6px 18px rgba(0, 114, 188, .32); }
.fs-detail, .fs-group, .hy-pos, .fortnox-box { border-width: 1px; border-radius: 14px; }
.fs-detail { box-shadow: var(--shadow-sm); }
.chain-steps button { border-width: 1px; border-color: var(--line-strong); }
.chain-steps button:not(:last-child)::after { border-width: 1px; border-color: var(--line-strong); right: -8px; }
.chain-steps button:last-child { border-right-width: 1px; }

/* ---------- Skalet ---------- */
.app { grid-template-columns: 320px minmax(0, 1fr); }
.work, .inbox { min-width: 0; }
.topbar { background: #fff; padding: .5rem 1.25rem; min-height: 60px; gap: .9rem; position: relative; z-index: 3; }
.shell-logo img { height: 30px; width: auto; display: block; }
.shell-title { font-size: 1.12rem; font-weight: 800; margin: 0; letter-spacing: -.01em; white-space: nowrap; }
.shell-search { display: flex; align-items: center; gap: .55rem; margin-left: 1rem; flex: 0 1 430px; min-width: 0; padding: .5rem .7rem; font: inherit; color: var(--muted); background: var(--bg); border: 1.5px solid transparent; border-radius: 10px; cursor: pointer; text-align: left; }
.shell-search span { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shell-search:hover { border-color: var(--brand); background: #fff; color: var(--ink); }
.shell-search svg { width: 18px; height: 18px; flex: none; }
.topbar .who { font-weight: 600; font-size: .95rem; }
.topbar .badge { font-size: .78rem; }

.rail { position: fixed; z-index: 5; left: 0; top: 0; bottom: 0; width: var(--rail); background: var(--brand); display: flex; flex-direction: column; align-items: stretch; gap: .25rem; padding: .7rem .5rem; }
.rail a, .rail button { position: relative; display: flex; flex-direction: column; align-items: center; gap: .2rem; padding: .55rem .2rem .45rem; border: 0; border-radius: 12px; background: transparent; color: rgba(255, 255, 255, .88); font: 600 .7rem/1.1 var(--font); text-decoration: none; cursor: pointer; transition: background .12s, color .12s; }
.rail a:hover, .rail button:hover { background: rgba(255, 255, 255, .14); color: #fff; }
.rail a[aria-current=page] { background: #fff; color: var(--brand); box-shadow: 0 4px 14px rgba(0, 40, 80, .25); }
.rail .dot { position: absolute; top: .3rem; right: .55rem; min-width: 1.2rem; height: 1.2rem; padding: 0 .3rem; border-radius: 99px; background: #fff; color: var(--brand-dark); font: 800 .68rem/1.2rem var(--font); text-align: center; box-shadow: 0 0 0 2px var(--brand); }
.rail a[aria-current=page] .dot { background: var(--brand); color: #fff; box-shadow: 0 0 0 2px #fff; }
.rail-more { display: none !important; }
.rail-sheet { display: none; }
body.has-shell { padding-left: var(--rail); }

/* ---------- Sök eller fråga ---------- */
.palette { width: min(680px, calc(100vw - 24px)); margin-top: 9vh; padding: 0; overflow: hidden; }
.palette[open] { animation: pal-in .16s ease-out; max-height: min(78vh, 720px); display: flex; }
@keyframes pal-in { from { opacity: 0; transform: translateY(-8px) scale(.985); } }
.pal-box { display: flex; flex-direction: column; min-height: 0; width: 100%; }
.pal-input { display: flex; align-items: center; gap: .6rem; padding: .85rem 1rem; border-bottom: 1px solid var(--line); color: var(--muted); }
.pal-input input { border: 0 !important; box-shadow: none !important; padding: .2rem 0; font-size: 1.1rem; background: transparent; }
.pal-close { font: 600 .72rem var(--font); color: var(--muted); border: 1px solid var(--line-strong); border-radius: 6px; background: #fff; padding: .25rem .45rem; cursor: pointer; }
.pal-body { overflow-y: auto; padding: .4rem; min-height: 120px; flex: 1; }
.pal-group { font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); padding: .7rem .7rem .3rem; }
.pal-row { display: grid; grid-template-columns: auto 1fr; column-gap: .55rem; width: 100%; text-align: left; font: inherit; color: var(--ink); background: transparent; border: 0; border-radius: 10px; padding: .5rem .7rem; cursor: pointer; }
.pal-row .t { grid-column: 2; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pal-row .m { grid-column: 2; font-size: .84rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pal-row svg { grid-row: span 2; align-self: center; color: var(--brand); width: 20px; height: 20px; }
.pal-row:hover, .pal-row[aria-selected=true] { background: var(--brand-light); }
.pal-row.ask .t { color: var(--brand-dark); }
.pal-empty { padding: 1.5rem .8rem; color: var(--muted); }
.pal-foot { display: flex; gap: 1.1rem; padding: .55rem 1rem; border-top: 1px solid var(--line); background: var(--panel-soft); font-size: .78rem; color: var(--muted); }
.pal-foot kbd { margin-right: .25rem; }
.pal-chat { display: grid; gap: .7rem; padding: .6rem .5rem; }
.msg { max-width: 92%; padding: .65rem .9rem; border-radius: 14px; line-height: 1.5; }
.msg.me { justify-self: end; background: var(--brand); color: #fff; border-bottom-right-radius: 4px; font-weight: 500; }
.msg.ai { background: var(--panel-soft); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg.ai.err { background: var(--red-bg); border-color: transparent; color: var(--red-ink); }
.msg.ai p { margin: 0 0 .45rem; } .msg.ai p:last-child { margin: 0; }
.msg.ai ul { margin: .2rem 0 .5rem; padding-left: 1.15rem; display: grid; gap: .2rem; }
.msg.ai a { color: var(--brand-dark); font-weight: 600; }
.pal-chat-foot { display: flex; justify-content: space-between; gap: 1rem; align-items: baseline; padding: 0 .3rem; }
.dots { display: inline-flex; gap: 3px; margin-right: .4rem; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--brand); animation: dot 1s infinite ease-in-out; }
.dots i:nth-child(2) { animation-delay: .15s; } .dots i:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

/* ---------- Översikt ---------- */
.ov { max-width: 1240px; }
.ov-hero { display: grid; grid-template-columns: 1fr minmax(320px, 460px); gap: 1.5rem 2.5rem; align-items: end; padding: 1.6rem 1.8rem; border-radius: 18px; color: #fff; background: var(--brand); background-image: radial-gradient(120% 140% at 100% 0%, rgba(92, 179, 234, .55) 0%, rgba(0, 114, 188, 0) 55%), linear-gradient(135deg, #0072bc 0%, #005a96 100%); box-shadow: 0 14px 40px rgba(0, 90, 150, .28); margin-bottom: 1.25rem; }
.ov-date { margin: 0 0 .2rem; font-weight: 600; opacity: .85; text-transform: capitalize; }
.ov-hello { font-size: clamp(1.6rem, 3.2vw, 2.3rem); font-weight: 800; letter-spacing: -.02em; margin: 0; }
.ov-sub { margin: .35rem 0 0; font-size: 1.05rem; opacity: .92; }
.ov-ask label { display: block; font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; opacity: .85; margin-bottom: .35rem; }
.ov-ask-row { display: flex; gap: .5rem; }
.ov-ask-row input { border: 0 !important; height: 48px; font-size: 1.02rem; box-shadow: 0 2px 10px rgba(0, 40, 80, .2); }
.ov-ask-row .btn { background: #fff; color: var(--brand); border-color: #fff; min-height: 48px; padding-inline: 1.2rem; box-shadow: 0 2px 10px rgba(0, 40, 80, .2); }
.ov-ask-row .btn:hover { background: var(--brand-light); border-color: var(--brand-light); color: var(--brand-dark); }
.ov-examples { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .6rem; }
.ov-examples .chip { background: rgba(255, 255, 255, .16); border-color: rgba(255, 255, 255, .35); color: #fff; font-size: .82rem; border-width: 1px; }
.ov-examples .chip:hover { background: rgba(255, 255, 255, .28); }
.ov-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr); gap: 1.25rem; align-items: start; }
.ov-card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 1.1rem 1.2rem 1.2rem; box-shadow: var(--shadow-sm); }
.ov-card h3 { font-size: .78rem; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin-bottom: .8rem; }
.ov-side { display: grid; gap: 1.25rem; }
.ov-activity { grid-column: 1; }
#ov-todo { display: grid; gap: .5rem; }
.ov-task { display: grid; grid-template-columns: auto 1fr auto; gap: .9rem; align-items: center; padding: .75rem .9rem; border: 1px solid var(--line); border-radius: 12px; text-decoration: none; color: var(--ink); background: #fff; transition: border-color .12s, box-shadow .12s, transform .12s; animation: rise .35s both; animation-delay: calc(var(--i) * 45ms); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.ov-task:hover { border-color: var(--brand); box-shadow: var(--shadow-md); transform: translateX(2px); }
.ov-task .n { min-width: 2.6rem; height: 2.6rem; padding: 0 .5rem; border-radius: 12px; display: grid; place-items: center; font-size: 1.25rem; font-weight: 800; background: var(--brand-light); color: var(--brand-dark); }
.ov-task.red .n { background: var(--red-bg); color: var(--red-ink); }
.ov-task.yellow .n { background: var(--yellow-bg); color: var(--yellow-ink); }
.ov-task.muted .n { background: var(--bg); color: var(--muted); }
.ov-task .txt { display: grid; gap: .1rem; min-width: 0; }
.ov-task .txt strong::first-letter { text-transform: uppercase; }
.ov-task .txt span { font-size: .88rem; color: var(--muted); }
.ov-task .go { font-size: 1.2rem; color: var(--brand); opacity: .5; transition: opacity .12s; }
.ov-task:hover .go { opacity: 1; }
.ov-done { display: grid; gap: .25rem; padding: 1.6rem 1rem; text-align: center; border: 1px dashed var(--line-strong); border-radius: 12px; color: var(--muted); }
.ov-done strong { color: var(--approve); font-size: 1.15rem; }
.ov-quick { display: grid; grid-template-columns: 1fr 1fr; gap: .45rem; }
.ov-quick a { padding: .6rem .7rem; border: 1px solid var(--line); border-radius: 10px; text-decoration: none; color: var(--ink); font-weight: 600; font-size: .92rem; background: var(--panel-soft); transition: border-color .12s, background .12s, color .12s; }
.ov-quick a:hover { border-color: var(--brand); background: var(--brand-light); color: var(--brand-dark); }
.ov-stats { margin: 0; display: grid; gap: .1rem; }
.ov-stats div { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; padding: .5rem 0; border-bottom: 1px solid var(--line); }
.ov-stats div:last-child { border-bottom: 0; padding-bottom: 0; }
.ov-stats dt { color: var(--muted); font-size: .92rem; }
.ov-stats dd { margin: 0; font-weight: 800; text-align: right; }
.ov-stats dd span { display: block; font-weight: 500; font-size: .8rem; color: var(--muted); }
#ov-activity { list-style: none; margin: 0; padding: 0; display: grid; }
#ov-activity li { display: flex; flex-wrap: wrap; gap: .15rem .4rem; align-items: baseline; padding: .5rem 0; border-bottom: 1px solid var(--line); font-size: .93rem; }
#ov-activity li:last-child { border-bottom: 0; }
#ov-activity .who { font-weight: 700; }
#ov-activity .act a { color: var(--brand-dark); text-decoration: none; font-weight: 600; }
#ov-activity .act a:hover { text-decoration: underline; }
#ov-activity .what { color: var(--muted); }
#ov-activity time { margin-left: auto; color: var(--muted); font-size: .82rem; white-space: nowrap; }

/* ---------- Inloggning ---------- */
.login { background: linear-gradient(112deg, var(--brand) 0 44%, var(--bg) 44.1%); }
.login-box { border: 0; border-radius: 20px; box-shadow: var(--shadow-lg); padding: 2.2rem; }
.login-users .btn { min-height: 52px; }

/* ---------- Surfplatta och telefon ---------- */
@media (max-width: 1180px) { .app { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 1000px) {
  .ov-hero { grid-template-columns: 1fr; padding: 1.3rem 1.2rem; }
  .ov-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  body.has-shell { padding-left: 0; padding-bottom: calc(var(--tabbar) + env(safe-area-inset-bottom)); }
  .rail { top: auto; right: 0; width: auto; height: calc(var(--tabbar) + env(safe-area-inset-bottom)); padding: .3rem .4rem calc(.3rem + env(safe-area-inset-bottom)); flex-direction: row; justify-content: space-around; gap: .15rem; box-shadow: 0 -6px 20px rgba(0, 40, 80, .18); }
  .rail a, .rail button { flex: 1; padding: .35rem .1rem .3rem; font-size: .66rem; }
  .rail a.phone-hide { display: none; }
  .rail-more { display: flex !important; }
  .rail .dot { right: calc(50% - 1.5rem); top: .1rem; }
  .rail-sheet:not([hidden]) { display: grid; gap: .25rem; position: fixed; z-index: 6; right: .6rem; bottom: calc(var(--tabbar) + env(safe-area-inset-bottom) + .5rem); width: min(260px, calc(100vw - 1.2rem)); padding: .5rem; background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg); animation: pal-in .14s ease-out; }
  .rail-sheet a, .rail-sheet button { display: flex; align-items: center; gap: .7rem; padding: .7rem .8rem; border: 0; border-radius: 10px; background: transparent; color: var(--ink); font: 600 1rem var(--font); text-decoration: none; text-align: left; cursor: pointer; position: relative; }
  .rail-sheet a .lbl { flex: 1; }
  .rail-sheet a svg { color: var(--brand); }
  .rail-sheet .dot { margin-left: auto; min-width: 1.4rem; padding: 0 .35rem; border-radius: 99px; background: var(--brand-light); color: var(--brand-dark); font-weight: 800; font-size: .8rem; text-align: center; }
  .rail-sheet button { color: var(--red-ink); border-top: 1px solid var(--line); border-radius: 0 0 10px 10px; }
  .topbar { flex-wrap: nowrap; padding: .45rem .9rem; min-height: 54px; gap: .6rem; }
  .topbar .who, .topbar #logout, .shell-search span, .shell-search kbd { display: none; }
  .shell-search { flex: none; margin-left: auto; padding: .5rem; order: 5; }
  .topbar .spacer { display: none; }
  .shell-logo img { height: 26px; }
  .actionbar, .hy-bottom { bottom: calc(var(--tabbar) + env(safe-area-inset-bottom)); }
  .toast { bottom: calc(var(--tabbar) + 20px); }
  .palette { margin-top: 12px; }
  .palette[open] { max-height: calc(100dvh - 24px); }
  .pal-foot { display: none; }
  .login { background: linear-gradient(180deg, var(--brand) 0 32%, var(--bg) 32.1%); }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
.ov-side { grid-column: 2; grid-row: 1 / span 2; }
.ov-date { text-transform: none; }
.ov-date::first-letter { text-transform: uppercase; }
@media (max-width: 1000px) { .ov-side { grid-column: 1; grid-row: auto; } }
@media (max-width: 900px) { .topbar .badge { display: none; } .shell-title { overflow: hidden; text-overflow: ellipsis; } }

/* ---------- Hitta ny vara ---------- */
.src-form { display: grid; grid-template-columns: 1fr auto; gap: .6rem; align-items: start; max-width: 900px; }
.src-form textarea { width: 100%; font: inherit; padding: .6rem .75rem; resize: vertical; }
.src-options { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: .75rem; }
.src-option { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: .9rem 1rem; box-shadow: var(--shadow-sm); display: grid; gap: .3rem; align-content: start; }
.src-option .top { display: flex; justify-content: space-between; gap: 1rem; }
.src-option .top span { white-space: nowrap; font-weight: 700; }
.src-option p { margin: .2rem 0; font-size: .93rem; }
.src-option .intake-buttons { margin-top: .4rem; }
@media (max-width: 700px) { .src-form { grid-template-columns: 1fr; } }

/* ---------- Kameran i rundan ---------- */
#cam-open { margin-bottom: .6rem; }
.cam { width: min(560px, 100vw); max-width: 100vw; margin: auto; padding: 0; overflow: hidden; }
.cam[open] { max-height: 100dvh; }
.cam-box { display: grid; grid-template-rows: auto auto; }
.cam-view { position: relative; background: #0b1b2b; aspect-ratio: 4 / 3; max-height: 46dvh; overflow: hidden; }
.cam-view video { width: 100%; height: 100%; object-fit: cover; display: block; }
.cam-frame { position: absolute; inset: 14% 22%; border: 3px solid rgba(255, 255, 255, .9); border-radius: 18px; box-shadow: 0 0 0 100vmax rgba(11, 27, 43, .35); }
.cam-panel { padding: 1rem 1.1rem 1.1rem; display: grid; gap: .5rem; }
.cam-hint { margin: .4rem 0; font-size: 1.1rem; font-weight: 600; text-align: center; }
.cam-name { font-size: 1.2rem; font-weight: 800; }
.cam-row { display: grid; grid-template-columns: 1fr 7rem auto; gap: .6rem; align-items: center; margin-top: .5rem; }
.cam-row label { font-weight: 700; }
.cam-row .btn-approve { min-width: 0; }
.cam-result { min-height: 1.4em; margin: 0; font-weight: 700; }
.cam-result.ok { color: var(--approve); } .cam-result.err { color: var(--red-ink); }
.cam-foot { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
@media (max-width: 900px) { .cam { width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; } .cam-box { height: 100%; grid-template-rows: auto 1fr; } }
.manual-new { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-top: 1.2rem; padding-top: 1rem; border-top: 1px solid var(--line); }

/* ---------- Flikar inom en del (Order: Inkorg | Leverera och fakturera) ---------- */
.shell-tabs { display: flex; gap: .2rem; margin-left: .4rem; padding: .2rem; background: var(--bg); border-radius: 10px; }
.shell-tabs a { position: relative; padding: .35rem .8rem; border-radius: 8px; font-weight: 700; font-size: .92rem; color: var(--muted); text-decoration: none; white-space: nowrap; }
.shell-tabs a:hover { color: var(--ink); }
.shell-tabs a[aria-current=page] { background: #fff; color: var(--brand-dark); box-shadow: var(--shadow-sm); }
.shell-tabs .dot { display: inline-block; margin-left: .4rem; min-width: 1.15rem; padding: 0 .3rem; border-radius: 99px; background: var(--brand); color: #fff; font: 800 .68rem/1.15rem var(--font); text-align: center; vertical-align: 1px; }
@media (max-width: 1100px) { .shell-title { display: none; } .shell-tabs { margin-left: 0; } }
@media (max-width: 900px) {
  .rail a.phone-hide { display: flex; }
  .topbar { flex-wrap: wrap; }
  .shell-title { display: block; }
  .shell-tabs { order: 9; width: 100%; }
  .shell-tabs a { flex: 1; text-align: center; padding: .4rem .3rem; font-size: .85rem; }
}
.topbar .badge, .topbar #logout, .topbar .who { white-space: nowrap; flex: none; }
.shell-search { flex: 1 1 200px; max-width: 430px; }

/* Import: släppyta och förhandsvisning som följer kolumnvalen */
.drop-overlay { pointer-events: none; z-index: 2; }
.reg-drop.drag { border-style: solid; }
.sample th.used { background: var(--brand-light); }
.sample td.used { color: var(--ink, inherit); font-weight: 500; }
.sample th.unused, .sample td.unused { color: var(--muted); opacity: .55; }
.sample .sample-use th { border-bottom: 0; padding-bottom: .1rem; font-weight: 500; font-size: .78rem; }
.sample .calc { background: #eef8f0; border-left: 0; }
.sample th.calc:first-of-type, .sample td.calc:first-of-type { border-left: 2px solid #9bd0a6; }
.sample .num { text-align: right; font-variant-numeric: tabular-nums; }
