/* Import7C — one stylesheet for web and Windows. Colours follow Support7C's app.css. */

:root {
    --primary: #0066cc;
    --primary-hover: #0052a3;
    --primary-soft: #e6f2ff;
    --primary-text: #0052a3;
    --accent: #4da6ff;
    --surface: #ffffff;
    --ground: #f8f9fa;
    --line: #e9ecef;
    --line-strong: #ced4da;
    --text: #212529;
    --text-2: #495057;
    --text-3: #6c757d;
    --ok-bg: #e6f4ea;
    --ok-text: #1e6b30;
    --warn-bg: #fff4e0;
    --warn-row: #fffaf0;
    --warn-line: #e0a040;
    --warn-text: #7a4a00;
    --error-bg: #fbe9eb;
    --error-text: #a3222f;
    --radius: 6px;
    --radius-lg: 8px;
}

html, body {
    margin: 0;
    background: var(--ground);
    color: var(--text);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: 14px;
    line-height: 1.45;
}

*, *::before, *::after { box-sizing: border-box; }

a { color: var(--primary); }
a:hover { color: var(--primary-hover); }

h1, h2 { margin: 0; font-weight: 600; }
h1 { font-size: 24px; }
h2 { font-size: 16px; }
p { margin: 0; }

.muted { color: var(--text-2); }
.faint { color: #adb5bd; display: inline-flex; }
.faint-text { color: var(--text-3); }
.ok-text { color: var(--ok-text); display: inline-flex; }
.warn-text { color: var(--warn-text); }

.visually-hidden {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap;
}

/* ── Buttons ───────────────────────────────────────────── */

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 44px; padding: 0 20px;
    border: 1px solid var(--line-strong); border-radius: var(--radius);
    background: var(--surface); color: var(--text);
    font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn:hover:not(:disabled) { background: var(--ground); color: var(--text); }
.btn:disabled { color: var(--text-3); background: var(--ground); cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); border-color: var(--primary-hover); color: #fff; }
.btn-primary:disabled { background: #8fb8e6; border-color: #8fb8e6; color: #fff; }
.btn-block { width: 100%; }
.btn-small { min-height: 34px; padding: 0 12px; font-size: 13px; gap: 6px; }

.link-button {
    border: none; background: none; padding: 6px 8px;
    color: var(--primary); font: inherit; cursor: pointer; text-decoration: underline;
}
.icon-button {
    width: 36px; height: 36px; border: none; border-radius: var(--radius);
    background: transparent; color: var(--text-3); cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
}
.icon-button:hover { background: var(--ground); color: var(--text); }

button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
    outline: 2px solid var(--accent); outline-offset: 2px;
}

/* ── Badges, chips ─────────────────────────────────────── */

.badge {
    display: inline-block; padding: 3px 8px; border-radius: 10px;
    background: var(--line); color: var(--text-2);
    font-size: 12px; font-weight: 600; white-space: nowrap;
}
.badge-ok { background: var(--ok-bg); color: var(--ok-text); }
.badge-next, .badge-warn { background: var(--warn-bg); color: var(--warn-text); }
.chip {
    display: inline-block; padding: 3px 8px; border-radius: 4px;
    background: #f1f3f5; color: #343a40; font-size: 12px;
}
.tag {
    margin-left: auto; padding: 2px 6px; border-radius: 10px;
    background: var(--line); color: var(--text-2); font-size: 11px;
}
.tag-next { background: var(--warn-bg); color: var(--warn-text); }

/* ── Alerts ───────────────────────────────────────────── */

.alert {
    display: flex; gap: 10px; align-items: flex-start;
    padding: 12px 14px; border-radius: var(--radius); font-size: 13px;
}
.alert-error { background: var(--error-bg); color: var(--error-text); }
.alert-warn { background: var(--warn-bg); color: var(--warn-text); }

/* ── Shell ────────────────────────────────────────────── */

.app { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
    min-height: 56px; padding: 8px 20px;
    display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
    background: var(--surface); border-bottom: 1px solid var(--line);
}
.topbar-spacer { flex: 1 1 auto; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; }
.brand:hover { color: var(--text); }
.brand-name { font-size: 18px; font-weight: 600; }
.brand-mark {
    width: 32px; height: 32px; border-radius: var(--radius);
    background: var(--primary); color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
}
.brand-mark-lg { width: 44px; height: 44px; border-radius: var(--radius-lg); }

.company-chip {
    display: flex; align-items: center; gap: 10px;
    padding: 3px 4px 3px 10px; border: 1px solid var(--line); border-radius: var(--radius);
    font-size: 13px;
}
.company-name { font-weight: 600; }
.company-name .muted { font-weight: 400; }
.env-pill {
    padding: 2px 6px; border-radius: 4px; font-size: 11px; font-weight: 700;
    background: var(--line); color: var(--text-2);
}
.env-uat { background: var(--warn-bg); color: var(--warn-text); }
.env-prod { background: var(--error-bg); color: var(--error-text); }
.user-email { font-size: 13px; color: var(--text-2); }

.shell { display: flex; flex-wrap: wrap; flex: 1 1 auto; }

.sidebar {
    flex: 1 1 220px; max-width: 100%;
    padding: 16px 12px; display: flex; flex-direction: column; gap: 2px;
    background: var(--surface); border-right: 1px solid var(--line);
}
.nav-link {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; border-radius: var(--radius);
    color: var(--text); text-decoration: none; font-size: 14px;
}
.nav-link:hover { background: var(--ground); color: var(--text); }
.nav-link.active { background: var(--primary-soft); color: var(--primary-text); font-weight: 600; }
.nav-disabled { color: var(--text-3); }
.nav-disabled:hover { background: none; color: var(--text-3); }
.nav-section {
    padding: 16px 12px 6px; color: var(--text-3);
    font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
}
.source-mark {
    width: 18px; height: 18px; border-radius: 4px;
    background: var(--line); color: var(--text-2);
    font-size: 10px; font-weight: 700;
    display: inline-flex; align-items: center; justify-content: center;
}
.source-mark-lg { width: 44px; height: 44px; border-radius: var(--radius-lg); font-size: 18px; }
.source-dk { background: var(--primary); color: #fff; }

.main { flex: 999 1 560px; min-width: 0; padding: 28px 32px; }

/* ── Page building blocks ─────────────────────────────── */

.page { max-width: 1140px; display: flex; flex-direction: column; gap: 24px; }
.page-head { display: flex; flex-direction: column; gap: 6px; }
.lead { font-size: 15px; color: var(--text-2); max-width: 640px; }
.crumbs { font-size: 13px; color: var(--text-2); }
.page-actions { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

.panel {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
}
.panel-bar {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    padding: 14px 20px; border-bottom: 1px solid var(--line);
}
.panel-bar-end { margin-left: auto; }
.empty { padding: 20px; color: var(--text-2); }

.split { display: flex; gap: 24px; flex-wrap: wrap; align-items: flex-start; }
.split-main { flex: 999 1 520px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.split-side { flex: 1 1 260px; padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.split-side h2 { font-size: 15px; }
.side-note { border-top: 1px solid #f1f3f5; padding-top: 12px; font-size: 13px; }

/* ── Home: source cards ───────────────────────────────── */

.source-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; }
.source-card { padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.source-card-active { border-color: var(--primary); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06); }
.source-card-head { display: flex; align-items: center; gap: 12px; }
.source-card-head .badge { margin-left: auto; }
.source-card-title { display: flex; flex-direction: column; gap: 2px; font-size: 17px; }
.source-card-title .muted { font-size: 13px; }
.source-card p { line-height: 1.5; }
.source-card-action { margin-top: auto; }

/* ── Import steps ─────────────────────────────────────── */

.steps { list-style: none; margin: 0; padding: 0; display: flex; gap: 8px; flex-wrap: wrap; }
.step {
    flex: 1 1 160px; display: flex; align-items: center; gap: 10px;
    padding: 10px 14px; border-radius: var(--radius); font-size: 14px;
}
.step-number {
    width: 24px; height: 24px; border-radius: 50%; font-size: 13px;
    display: inline-flex; align-items: center; justify-content: center;
}
.step-current { background: var(--primary); color: #fff; font-weight: 600; }
.step-current .step-number { background: #fff; color: var(--primary); }
.step-done { background: var(--primary-soft); color: var(--primary-text); font-weight: 600; }
.step-done .step-number { background: var(--primary); color: #fff; }
.step-todo { background: var(--surface); border: 1px solid var(--line); color: var(--text-2); }
.step-todo .step-number { background: var(--line); color: var(--text-2); }

/* ── dk files ─────────────────────────────────────────── */

.dropzone {
    position: relative;
    display: flex; flex-direction: column; align-items: center; gap: 12px;
    padding: 36px 24px; text-align: center;
    border: 2px dashed var(--accent); border-radius: 10px;
    background: #f3f8ff; color: var(--primary);
    cursor: pointer;
}
.dropzone:hover { background: #eaf3ff; }
.dropzone:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.dropzone-over { background: var(--primary-soft); border-color: var(--primary); }
.dropzone-title { font-size: 17px; font-weight: 600; color: var(--text); }
.dropzone .link { color: var(--primary); font-weight: 600; text-decoration: underline; }

.file-row {
    display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
    padding: 14px 20px; border-bottom: 1px solid #f1f3f5;
}
.file-row:last-child { border-bottom: none; }
.file-row-warn { background: var(--warn-row); }
.file-row-muted .file-name { color: var(--text-2); }
.file-kind {
    width: 36px; height: 36px; border-radius: var(--radius);
    background: var(--ok-bg); color: var(--ok-text);
    font-size: 11px; font-weight: 700;
    display: inline-flex; align-items: center; justify-content: center;
}
.file-kind-warn { background: var(--warn-bg); color: var(--warn-text); }
.file-kind-muted { background: var(--line); color: var(--text-2); }
.file-text { flex: 1 1 220px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.file-name { font-weight: 600; overflow-wrap: anywhere; }
.file-detail { font-size: 13px; color: var(--text-2); }
.file-entity { display: flex; flex-direction: column; align-items: flex-end; }
.file-entity .muted { font-size: 12px; }

.checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.checklist li { display: flex; align-items: center; gap: 10px; }

/* ── Forms ────────────────────────────────────────────── */

.form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.field input, .inline-field select {
    height: 42px; padding: 0 12px;
    border: 1px solid var(--line-strong); border-radius: var(--radius);
    font: inherit; font-weight: 400; color: var(--text); background: var(--surface);
}
.inline-field { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); }
.inline-field select { height: 36px; min-width: 220px; padding: 0 8px; }
.select-warn { border-color: var(--warn-line) !important; }

.segmented { margin: 0; padding: 0; border: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(70px, 1fr)); gap: 6px; }
.segmented legend { padding: 0 0 8px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.segment {
    height: 40px; border: 1px solid var(--line-strong); border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer;
}
.segment-on { border: 2px solid var(--primary); background: var(--primary-soft); color: var(--primary-text); font-weight: 600; }
.segmented:disabled .segment { cursor: default; opacity: 0.75; }

/* ── Sign in ──────────────────────────────────────────── */

.bare { min-height: 100vh; }
.signin { padding: 64px 16px; display: flex; flex-direction: column; align-items: center; gap: 32px; }
.signin-brand { display: flex; align-items: center; gap: 12px; }
.signin-title { font-size: 26px; font-weight: 600; }
.signin-panels { width: 100%; max-width: 940px; display: flex; gap: 24px; flex-wrap: wrap; align-items: stretch; }
.signin-panel { flex: 1 1 340px; padding: 28px; display: flex; flex-direction: column; gap: 18px; }
.signin-panel h1, .signin-panel h2 { font-size: 18px; }
.panel-active { border: 2px solid var(--primary); box-shadow: 0 2px 8px rgba(0, 102, 204, 0.08); }
.panel-waiting { opacity: 0.6; }
.panel-heading { display: flex; align-items: center; gap: 10px; }
.step-dot {
    width: 26px; height: 26px; border-radius: 50%;
    background: var(--primary); color: #fff; font-size: 13px; font-weight: 600;
    display: inline-flex; align-items: center; justify-content: center;
}
.ok-line { display: flex; align-items: center; gap: 8px; color: var(--ok-text); font-weight: 600; font-size: 13px; }

.company-list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; max-height: 320px; overflow-y: auto; }
.company-option { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); cursor: pointer; }
.company-option:last-child { border-bottom: none; }
.company-option-on { background: var(--primary-soft); }
.company-option-on .company-option-name { font-weight: 600; color: var(--primary-text); }
.company-option-name { flex: 1 1 auto; }

.notfound { padding: 96px 16px; display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center; }

/* ── Phone width ──────────────────────────────────────── */

@media (max-width: 640px) {
    .main { padding: 20px 16px; }
    .topbar { padding: 8px 16px; }
    .sidebar { border-right: none; border-bottom: 1px solid var(--line); }
    .signin { padding: 32px 16px; }
}

/* ── Blazor error UI ──────────────────────────────────── */

#blazor-error-ui {
    display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: 1000;
    padding: 12px 20px; background: var(--error-bg); color: var(--error-text);
    box-shadow: 0 -1px 4px rgba(0, 0, 0, 0.15);
}
#blazor-error-ui .dismiss { float: right; cursor: pointer; }

/* ── Map, validate, import ────────────────────────────── */

.panel-body { padding: 16px 20px; display: flex; flex-direction: column; gap: 12px; }
.panel .empty { margin: 0; }

.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
    padding: 8px 20px; text-align: left; font-weight: 600; color: var(--text-2);
    background: var(--ground); border-bottom: 1px solid var(--line);
}
.data-table td { padding: 8px 20px; border-bottom: 1px solid #f1f3f5; vertical-align: top; }
.data-table tr:last-child td { border-bottom: none; }
.data-table .num { text-align: right; width: 1%; white-space: nowrap; }
.data-table-compact th, .data-table-compact td { padding: 6px 8px; }
.split-side .data-table { margin: 0 -8px; width: calc(100% + 16px); }
.row-warn td { background: var(--warn-row); }
.row-error td { background: var(--error-bg); }
.row-muted td { color: var(--text-3); }
.table-select {
    width: 100%; max-width: 360px; height: 34px; padding: 0 8px;
    border: 1px solid var(--line-strong); border-radius: var(--radius);
    font: inherit; background: var(--surface); color: var(--text);
}
.error-text { color: var(--error-text); }
.badge-error { background: var(--error-bg); color: var(--error-text); }
.check-field { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); cursor: pointer; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
.stat { padding: 16px 20px; display: flex; flex-direction: column; gap: 2px; font-size: 13px; color: var(--text-2); }
.stat-value { font-size: 28px; font-weight: 600; color: var(--text); line-height: 1.2; }
.stat-ok .stat-value { color: var(--ok-text); }
.stat-warn { border-color: var(--warn-line); }
.stat-warn .stat-value { color: var(--warn-text); }
.stat-error { border-color: var(--error-text); }
.stat-error .stat-value { color: var(--error-text); }

.confirm ul { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }
.result { gap: 8px; }
.page-actions-note { align-self: center; font-size: 13px; }
.row-default td { background: var(--ground); font-weight: 600; color: var(--text-2); }

/* ── Language switch: IS / EN ───────────────────────────────────── */
.lang-switch {
    display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--radius); overflow: hidden;
}
.lang-option {
    border: none; background: var(--surface); color: var(--text-2); font: inherit; font-size: 12px; font-weight: 600;
    padding: 4px 9px; cursor: pointer;
}
.lang-option + .lang-option { border-left: 1px solid var(--line-strong); }
.lang-option:hover { background: var(--ground); }
.lang-option.lang-on { background: var(--primary); color: #fff; }
.lang-option:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.bare-bar { display: flex; justify-content: flex-end; padding: 12px 16px 0; }

/* ── Chart of accounts: VAT codes and the accounts leaving ──────── */
.panel-note { margin: 0; padding: 10px 16px; font-size: 13px; }
.hint { font-size: 12px; margin-top: 4px; max-width: 260px; }
.vat-new {
    display: grid; grid-template-columns: 80px 1fr 90px; gap: 8px 10px; margin-top: 10px;
    padding: 10px; border: 1px dashed var(--line-strong); border-radius: var(--radius); background: var(--ground);
}
.vat-new .field-wide { grid-column: 1 / -1; }
.field-small { font-size: 12px; }
.vat-new input, .vat-new select {
    height: 34px; font: inherit; font-weight: 400; padding: 6px 8px; border: 1px solid var(--line-strong);
    border-radius: var(--radius); background: var(--surface); color: var(--text);
}
.ref-line { font-size: 12px; line-height: 1.5; }
.removal-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
details.panel-note summary { cursor: pointer; color: var(--text-2); }

/* The count of records behind a dk value: hover (or focus) lists them. */
.count-members { cursor: help; border-bottom: 1px dotted var(--text-3); }

/* ── Pager, list filters ───────────────────────────────── */
.pager {
    display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
    padding: 10px 20px; border-top: 1px solid var(--line);
}
.pager-size select { min-width: 0; width: 80px; }
.pager-buttons { display: inline-flex; align-items: center; gap: 2px; margin-left: auto; }
.pager-buttons .icon-button:disabled { color: var(--line-strong); cursor: default; background: transparent; }
.pager-page { font-size: 13px; color: var(--text-2); padding: 0 8px; white-space: nowrap; }
.list-filters { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.list-filters select, .list-filters input[type=search] {
    height: 34px; padding: 0 8px; border: 1px solid var(--line-strong); border-radius: var(--radius);
    font: inherit; font-size: 13px; background: var(--surface); color: var(--text);
}
.list-filters input[type=search] { width: 220px; }
@media (max-width: 640px) {
    .pager-buttons { margin-left: 0; }
    .list-filters input[type=search] { width: 100%; }
}


/* ── Busy ──────────────────────────────────────────────── */
.busy { display: flex; align-items: center; gap: 10px; padding: 16px 0; color: var(--text-2); }
.busy-inline { display: inline-flex; padding: 0; gap: 8px; color: inherit; }
.spinner {
    width: 18px; height: 18px; flex: none; border-radius: 50%;
    border: 2px solid currentColor; border-right-color: transparent; opacity: .8;
    animation: spin .8s linear infinite;
}
.busy-inline .spinner { width: 14px; height: 14px; }
.busy-panel { display: flex; align-items: center; gap: 12px; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }
