/* Solver AI — Solvers visuelle profil (jf. advokatsolver.no)
   Mørk navy #12253c, off-white #FEFFFD, IfSans-typografi */

@font-face {
    font-family: "IfSans";
    src: url("/static/IfSans-Regular.woff2") format("woff2");
    font-weight: 400;
}
@font-face {
    font-family: "IfSans";
    src: url("/static/IfSans-Medium.woff2") format("woff2");
    font-weight: 500;
}
@font-face {
    font-family: "IfSans";
    src: url("/static/IfSans-Bold.woff2") format("woff2");
    font-weight: 700;
}

:root {
    --navy: #12253c;
    --navy-light: #1e3a5c;
    --bg: #FEFFFD;
    --muted: #5a6b7f;
    --border: #dde3ea;
    --accent: #b3915c;
}

* { box-sizing: border-box; margin: 0; }

body {
    font-family: "IfSans", system-ui, sans-serif;
    font-weight: 400;
    background: var(--bg);
    color: var(--navy);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.site-header {
    background: var(--navy);
    color: var(--bg);
    padding: 1rem 2rem;
    display: flex;
    align-items: baseline;
    gap: 1rem;
}

.logo {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--bg);
    text-decoration: none;
    letter-spacing: 0.02em;
}

.logo-sub {
    font-size: 0.9rem;
    color: var(--accent);
    font-weight: 500;
}

/* --- Bruker-badge øverst til høyre i header --- */
.user-badge {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 1rem;
}
.user-name {
    font-size: 0.9rem;
    color: var(--bg);
    opacity: 0.85;
}
.user-badge form.inline { display: inline; }
button.logout {
    margin: 0;
    padding: 0.35rem 0.9rem;
    background: transparent;
    color: var(--bg);
    border: 1px solid rgba(254, 255, 253, 0.4);
    border-radius: 6px;
    font-size: 0.85rem;
}
button.logout:hover {
    background: rgba(254, 255, 253, 0.1);
    border-color: var(--bg);
}

main {
    flex: 1;
    width: min(960px, 100%);
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

h1 { font-weight: 500; font-size: 1.8rem; margin-bottom: 0.5rem; }
h2 { font-weight: 500; font-size: 1.2rem; margin-bottom: 0.5rem; }

.lede {
    color: var(--muted);
    font-size: 1.1rem;
    margin-bottom: 2rem;
}

.card {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.25rem 1.5rem;
    background: #fff;
}

/* --- Navigasjon --- */
.site-nav {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 0.75rem 1.5rem;
    border-bottom: 1px solid var(--border);
    font-weight: 500;
    background: #fff;
}
.site-nav a { color: var(--navy); text-decoration: none; }
.site-nav a:hover { text-decoration: underline; }

/* --- Skjema --- */
.form { max-width: 420px; display: flex; flex-direction: column; gap: 0.5rem; }
.form label { font-weight: 500; margin-top: 0.5rem; }
.form input, .form select {
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font: inherit;
    background: var(--bg);
    color: var(--navy);
}
.form input:focus, .form select:focus {
    outline: 2px solid var(--navy-light);
    outline-offset: 1px;
}
button, .button {
    display: inline-block;
    margin-top: 1rem;
    padding: 0.6rem 1.4rem;
    background: var(--navy);
    color: var(--bg);
    border: none;
    border-radius: 6px;
    font: inherit;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
}
button:hover, .button:hover { background: var(--navy-light); }
button.danger { background: #8c2f2f; }
.error { color: #8c2f2f; font-weight: 500; margin-bottom: 0.75rem; }

/* --- Tabell --- */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    background: #fff;
}
th, td {
    text-align: left;
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--border);
}
th { font-weight: 500; color: var(--muted); font-size: 0.9rem; }
td a { color: var(--navy); }
.muted { color: var(--muted); font-size: 0.9rem; }

/* --- Autosave-felt --- */
.field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-bottom: 0.75rem;
}
.field label { font-weight: 500; font-size: 0.9rem; color: var(--muted); }
.field input, .field textarea {
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font: inherit;
    background: var(--bg);
    color: var(--navy);
}
.field input:focus, .field textarea:focus {
    outline: 2px solid var(--navy-light);
    outline-offset: 1px;
}
.field input.htmx-request, .field textarea.htmx-request {
    border-color: var(--accent);
}
#save-status { margin-left: 1rem; font-size: 0.9rem; }
#save-status.ok { color: #2f6b3a; }
#save-status.error { color: #8c2f2f; }

/* --- Audit-logg --- */
.audit-log {
    font-family: ui-monospace, monospace;
    font-size: 0.8rem;
    background: #f6f7f9;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.75rem 1rem;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
}
section.card { margin-bottom: 1.25rem; }

/* --- Call-layout m/ sidebar --- */
.call-grid {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 1.5rem;
    align-items: start;
}
@media (max-width: 900px) {
    .call-grid { grid-template-columns: 1fr; }
}
.sidebar { position: sticky; top: 1rem; }
.search-form { display: flex; gap: 0.5rem; }
.search-form input[type=search] {
    flex: 1;
    padding: 0.5rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font: inherit;
    font-size: 0.9rem;
}
.search-form button { margin: 0; padding: 0.5rem 0.9rem; font-size: 0.9rem; }

/* --- Judgment capture --- */
.ai-badge {
    margin-left: 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--accent);
    border: 1px solid var(--accent);
    border-radius: 4px;
    padding: 0.05rem 0.35rem;
}
button.approve, button.reject {
    margin: 0 0 0 0.35rem;
    padding: 0.05rem 0.4rem;
    font-size: 0.8rem;
    background: #fff;
    color: var(--navy);
    border: 1px solid var(--border);
    border-radius: 4px;
}
button.approve:hover { background: #e8f3ea; border-color: #2f6b3a; }
button.approve.active { background: #2f6b3a; color: #fff; }
button.reject:hover { background: #f5e8e8; border-color: #8c2f2f; }
button.reject.active { background: #8c2f2f; color: #fff; }
.ref-verdict { margin-left: auto; }
.verdict { display: flex; align-items: center; gap: 0.25rem; margin-bottom: 0.5rem; }
form.inline { display: inline; }
.live-transcript {
    max-height: 320px;
    overflow-y: auto;
    font: inherit;
    font-size: 0.9rem;
    line-height: 1.6;
    white-space: pre-wrap;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-left: 3px solid #c0392b;
    border-radius: 6px;
    background: var(--bg);
    color: var(--navy);
}
.transcription-edit, .juridisk-edit {
    width: 100%;
    font: inherit;
    font-size: 0.9rem;
    line-height: 1.6;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg);
    color: var(--navy);
}
/* Rettskildesøk: inline-utvidelse med htmx */
button.ref-toggle {
    margin: 0 0 0 auto;
    padding: 0.1rem 0.6rem;
    font-size: 0.8rem;
    background: #fff;
    color: var(--navy);
    border: 1px solid var(--border);
    border-radius: 4px;
}
button.ref-toggle:hover { background: #f0f2f5; }
.ref-body:empty { display: none; }
.ref-body .reference-text {
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.7;
    background: #f6f7f9;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.75rem 1rem;
    margin: 0.5rem 0;
    max-height: 480px;
    overflow-y: auto;
}
.ref-excerpt { margin-bottom: 0.25rem; }
.kpi dl { display: grid; grid-template-columns: auto 1fr; gap: 0.3rem 1rem; font-size: 0.9rem; }
.kpi dt { color: var(--muted); }
.kpi dd { font-weight: 500; }

/* --- AI-pipeline --- */
.pipeline-steps {
    list-style: none;
    padding: 0;
    display: flex;
    gap: 1.5rem;
    margin-bottom: 0.5rem;
}
.pipeline-steps li { font-weight: 500; }
.pipeline-steps li.running { color: var(--accent); }
.pipeline-steps li.done { color: #2f6b3a; }
.pipeline-steps li.failed { color: #8c2f2f; }
.reference-item {
    border-top: 1px solid var(--border);
    padding: 0.6rem 0;
}
.reference-head {
    display: flex;
    gap: 0.5rem;
    align-items: baseline;
    margin-bottom: 0.2rem;
}
.reference-item p {
    font-size: 0.9rem;
    color: var(--muted);
}
.transcription, .juridisk-metode {
    font-family: inherit;
    font-size: 0.95rem;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 500px;
    overflow-y: auto;
}

/* --- Lyd: opptak og opplasting --- */
.record-ui, .upload-ui {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
}
button.rec {
    margin: 0;
    min-width: 72px;
    background: #8c2f2f;
}
button.rec.recording {
    background: var(--muted);
    animation: pulse-rec 1.2s infinite;
}
@keyframes pulse-rec {
    0%, 100% { box-shadow: 0 0 0 0 rgba(140, 47, 47, 0.5); }
    50% { box-shadow: 0 0 0 10px rgba(140, 47, 47, 0); }
}
#record-timer { font-variant-numeric: tabular-nums; font-size: 1.1rem; }
#record-status, #upload-status { color: var(--muted); font-size: 0.9rem; }
.upload-ui input[type=file] {
    font: inherit;
    font-size: 0.9rem;
}
.upload-ui button { margin: 0; }
.audio-item {
    border-top: 1px solid var(--border);
    padding: 0.75rem 0;
}
.audio-meta {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}
.audio-item audio {
    width: 100%;
    height: 36px;
}
