/* Struktur-CSS för bokföringsprogrammet. Tema (typsnitt, färg, form) sätts via CSS-variabler. */
:root {
  --font: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-head: var(--font);
  --font-mono: ui-monospace, Menlo, Consolas, monospace;
  --r: 16px; --r-sm: 9px; --r-chip: 999px;
  --ink: #16161d; --muted: #6c6c78; --faint: #9a9aa6; --line: #ececef;
  --bg: #ffffff; --rail: #f7f7f9; --agent: #5457d6; --agent-soft: #f1f1fd;
  --ok: #128a4e; --ok-soft: #eaf6ef; --warn: #b47500; --warn-soft: #fbf3e2;
  --red: #c23c3c; --red-soft: #fdeceb; --card: #ffffff;
  --shadow: none; --nav-weight: 550;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; line-height: 1.5; }
.app { display: flex; min-height: 100vh; }

.rail { width: 236px; flex: 0 0 236px; background: var(--rail); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 22px 14px 16px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-head); font-size: 22px; font-weight: 800; padding: 0 8px 6px; letter-spacing: -0.01em; }
.brand-mark { width: 22px; height: 22px; border-radius: 50%; background: var(--agent); position: relative; flex: 0 0 auto; }
.brand-mark::after { content: ""; position: absolute; width: 8px; height: 8px; border-radius: 50%; background: #26c281; right: -1px; bottom: -1px; border: 2px solid var(--rail); }
.nav { margin-top: 20px; display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: var(--r-sm); color: #3a3a45; text-decoration: none; font-size: 14.5px; font-weight: var(--nav-weight); cursor: pointer; }
.nav a:hover { background: rgba(0,0,0,.05); }
.nav a.active { background: #fff; color: var(--ink); font-weight: 700; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.ic { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }
.rail-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.who { width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, var(--agent) 0 50%, #26c281 50%); flex: 0 0 auto; }
.who-name { font-size: 14px; font-weight: 700; }
.who-sub { font-size: 12.5px; color: var(--faint); }

.main { flex: 1; padding: 40px 40px 72px; }
.wrap { max-width: 940px; margin: 0 auto; }
.view { display: none; }
.view.active { display: block; }
.head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 28px; }
h1 { font-family: var(--font-head); font-size: 28px; font-weight: 800; letter-spacing: -0.02em; margin: 0; }
.period { color: var(--faint); font-size: 14px; margin-top: 2px; }

.hero { background: var(--agent-soft); border-radius: var(--r); padding: 34px 34px 28px; margin-bottom: 30px; }
.hero h2 { font-family: var(--font-head); font-size: 26px; font-weight: 800; letter-spacing: -0.02em; margin: 0 0 10px; }
.hero p { font-size: 16px; color: #4a4a57; margin: 0 0 22px; max-width: 60ch; }
.stats { display: flex; gap: 30px; flex-wrap: wrap; }
.stat .n { font-family: var(--font-mono); font-size: 26px; font-weight: 800; letter-spacing: -0.02em; }
.stat .l { font-size: 13.5px; color: var(--muted); display: flex; align-items: center; gap: 7px; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }
.dot.ok { background: var(--ok); } .dot.warn { background: var(--warn); } .dot.agent { background: var(--agent); } .dot.red { background: var(--red); }

.callout { display: flex; align-items: center; justify-content: space-between; gap: 16px; border: 1px solid var(--warn-soft); background: var(--warn-soft); border-radius: 12px; padding: 14px 18px; margin-bottom: 30px; }
.callout .c-text { font-size: 14.5px; color: #6a4e12; }
.callout a { font-size: 14px; font-weight: 700; color: var(--warn); text-decoration: none; white-space: nowrap; cursor: pointer; }

.section-title { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--faint); margin: 0 0 14px; }
.block { margin-bottom: 38px; }

.engines { display: flex; gap: 14px; flex-wrap: wrap; }
.engine { display: flex; align-items: center; gap: 12px; border: 1px solid var(--line); border-radius: 12px; padding: 14px 18px; background: var(--card); min-width: 210px; box-shadow: var(--shadow); }
.engine .glyph { width: 34px; height: 34px; border-radius: var(--r-sm); background: #f2f2f6; display: flex; align-items: center; justify-content: center; color: #444; flex: 0 0 auto; }
.engine .e-name { font-size: 15px; font-weight: 700; }
.engine .e-sub { font-size: 12.5px; color: var(--faint); display: flex; align-items: center; gap: 6px; }
.engine.add { border-style: dashed; color: var(--muted); cursor: pointer; font-weight: 600; justify-content: center; box-shadow: none; }
.engine.add:hover { background: #fafafb; }

.panel { border: 1px solid var(--line); border-radius: var(--r); background: var(--card); overflow: hidden; box-shadow: var(--shadow); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: #fff; color: var(--muted); font-size: 13px; font-weight: 600; padding: 6px 13px; border-radius: var(--r-chip); cursor: pointer; }
.chip.active { background: var(--ink); color: #fff; border-color: var(--ink); }

.txn { display: flex; align-items: center; gap: 16px; padding: 16px 22px; border-top: 1px solid var(--line); }
.txn:first-child { border-top: 0; }
.txn .avatar-a { width: 30px; height: 30px; border-radius: var(--r-sm); background: var(--agent-soft); color: var(--agent); display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.txn .body { flex: 1; min-width: 0; }
.txn .t-main { font-size: 15px; font-weight: 650; }
.txn .t-sub { font-size: 13px; color: var(--faint); margin-top: 2px; }
.txn .konto { font-family: var(--font-mono); font-size: 12px; color: var(--muted); background: #f5f5f8; padding: 2px 7px; border-radius: 5px; }
.txn .amount { font-family: var(--font-mono); font-size: 15px; font-weight: 700; white-space: nowrap; }
.txn .flag { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.txn .flag.ok { color: var(--ok); } .txn .flag.warn { color: var(--warn); } .txn .flag.red { color: var(--red); }
.txn .look { font-size: 13px; font-weight: 600; color: var(--agent); text-decoration: none; white-space: nowrap; cursor: pointer; }
.txn .look:hover { text-decoration: underline; }
.txn .right { display: flex; align-items: center; gap: 18px; }
.panel-foot { padding: 14px 22px; text-align: center; }
.panel-foot a { font-size: 14px; font-weight: 600; color: var(--agent); text-decoration: none; cursor: pointer; }
.panel-foot a:hover { text-decoration: underline; }

.drop { border: 1.5px dashed #d3d3db; border-radius: var(--r); padding: 34px; text-align: center; background: #fcfcfd; margin-bottom: 30px; }
.drop .big { font-size: 17px; font-weight: 700; margin-bottom: 6px; }
.drop p { color: var(--muted); font-size: 14px; margin: 0 auto 18px; max-width: 56ch; }
.btn { display: inline-block; border: 0; background: var(--ink); color: #fff; font-size: 14.5px; font-weight: 650; padding: 11px 22px; border-radius: var(--r-sm); cursor: pointer; text-decoration: none; }
.btn:hover { filter: brightness(.92); }
.btn.ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn.ghost:hover { background: #f7f7f9; filter: none; }
.u-status { display: flex; gap: 26px; margin-top: 16px; flex-wrap: wrap; justify-content: center; }
.u-status .u { font-size: 13.5px; color: var(--muted); display: flex; align-items: center; gap: 8px; }

.mailbox { border: 1px solid var(--line); border-radius: var(--r); background: var(--card); padding: 22px; margin-bottom: 24px; box-shadow: var(--shadow); }
.mb-title { font-weight: 700; font-size: 16px; }
.mb-desc { font-size: 13.5px; color: var(--muted); margin-top: 4px; max-width: 64ch; }
.mb-addr { display: flex; align-items: center; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.mb-addr code { font-family: var(--font-mono); font-size: 14px; background: var(--agent-soft); color: var(--agent); padding: 9px 14px; border-radius: var(--r-sm); }

.agent-card { display: flex; gap: 16px; align-items: flex-start; border: 1px solid #e2e2f7; border-radius: var(--r); padding: 22px; background: var(--agent-soft); margin-bottom: 24px; }
.agent-card .a-glyph { width: 42px; height: 42px; border-radius: 11px; background: #fff; color: var(--agent); display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.agent-card h3 { font-family: var(--font-head); margin: 0 0 5px; font-size: 17px; }
.agent-card p { margin: 0; font-size: 14.5px; color: #4a4a57; }

.flagrow { display: flex; align-items: flex-start; gap: 14px; padding: 18px 22px; border-top: 1px solid var(--line); }
.flagrow:first-child { border-top: 0; }
.sev { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 4px 9px; border-radius: 6px; white-space: nowrap; flex: 0 0 auto; margin-top: 1px; }
.sev.warn { background: var(--warn-soft); color: var(--warn); }
.sev.red { background: var(--red-soft); color: var(--red); }
.sev.info { background: var(--agent-soft); color: var(--agent); }
.flagrow .f-body { flex: 1; }
.flagrow .f-main { font-size: 15px; font-weight: 650; }
.flagrow .f-sub { font-size: 13.5px; color: var(--muted); margin-top: 3px; }
.flagrow .f-act { font-size: 13.5px; font-weight: 650; color: var(--agent); text-decoration: none; white-space: nowrap; cursor: pointer; }

.set-block { border: 1px solid var(--line); border-radius: var(--r); padding: 8px 22px; margin-bottom: 24px; background: var(--card); }
.set-row { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 18px 0; border-top: 1px solid var(--line); }
.set-row:first-child { border-top: 0; }
.s-title { font-weight: 650; font-size: 15px; }
.s-desc { font-size: 13.5px; color: var(--muted); margin-top: 3px; max-width: 60ch; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; flex: 0 0 auto; }
.seg button { border: 0; background: #fff; padding: 9px 15px; font: inherit; font-size: 13.5px; font-weight: 600; color: var(--muted); cursor: pointer; }
.seg button.active { background: var(--ink); color: #fff; }
.seg button + button { border-left: 1px solid var(--line); }
.switch { position: relative; width: 44px; height: 26px; flex: 0 0 auto; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track { position: absolute; inset: 0; background: #d5d5dd; border-radius: 999px; cursor: pointer; transition: .15s; }
.switch .track::before { content: ""; position: absolute; width: 20px; height: 20px; border-radius: 50%; background: #fff; top: 3px; left: 3px; transition: .15s; box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.switch input:checked + .track { background: var(--agent); }
.switch input:checked + .track::before { transform: translateX(18px); }

.backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.28); opacity: 0; visibility: hidden; transition: .15s; z-index: 40; }
.backdrop.open { opacity: 1; visibility: visible; }
.drawer { position: fixed; top: 0; right: 0; height: 100vh; width: 440px; max-width: 92vw; background: #fff; box-shadow: -8px 0 30px rgba(0,0,0,.12); transform: translateX(100%); transition: transform .2s ease; z-index: 50; padding: 24px 26px 40px; overflow-y: auto; }
.drawer.open { transform: none; }
.drawer .d-close { border: 0; background: none; font-size: 22px; color: var(--muted); cursor: pointer; float: right; line-height: 1; }
.drawer h3 { font-family: var(--font-head); font-size: 19px; margin: 4px 0 2px; }
.drawer .d-amount { font-family: var(--font-mono); font-size: 24px; font-weight: 800; margin: 8px 0 2px; }
.drawer .d-meta { font-size: 13.5px; color: var(--faint); margin-bottom: 20px; }
.d-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); margin: 22px 0 8px; }
.d-reason { font-size: 14.5px; color: #3a3a45; background: #f7f7f9; border-radius: var(--r-sm); padding: 14px 16px; }
.conf { height: 8px; border-radius: 999px; background: #eee; overflow: hidden; margin-top: 8px; }
.conf i { display: block; height: 100%; background: var(--agent); }
.conf-num { font-size: 13px; color: var(--muted); margin-top: 6px; }
.d-actions { display: flex; gap: 10px; margin-top: 26px; }
.d-actions .btn { flex: 1; text-align: center; }

@media (max-width: 900px) { .main { padding: 28px 20px 56px; } .txn .right { gap: 12px; } }
@media (max-width: 720px) { .rail { display: none; } .txn { flex-wrap: wrap; } .txn .konto { display: none; } .set-row { flex-direction: column; align-items: flex-start; } }
