/* The layout every skin shares. Colours, corners and fonts are tokens (--st-*); a skin (skin-sapera.css, skin-app.css)
   sets them for its light and dark theme and adds the rules that make it look like Sapera web or the Sapera App. No
   colour literals here: a literal would not follow the dark theme. */

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
    margin: 0;
    font-family: var(--st-font);
    font-size: var(--st-font-size);
    line-height: 1.42857143;
    background: var(--st-bg);
    color: var(--st-text);
}

.page { height: 100vh; }

.shell { display: flex; flex-direction: column; height: 100vh; }
/* Wait cursor over the whole page while anything is working (login, file load, preview, run) — desktop parity. */
.shell.busy, .shell.busy * { cursor: progress !important; }
.tab-body { flex: 1 1 auto; min-height: 0; overflow: auto; padding: 12px 16px; }

input, select, textarea, button, .file-button, a.button {
    font: inherit;
    color: inherit;
}

input, select, textarea {
    padding: var(--st-input-pad);
    font-size: var(--st-control-font-size);
    border: 1px solid var(--st-input-border);
    border-radius: var(--st-control-radius);
    background: var(--st-input-bg);
    color: var(--st-text);
    box-shadow: var(--st-input-inset);
    transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--st-focus); box-shadow: var(--st-input-inset), var(--st-focus-ring); }
input[readonly] { background: var(--st-panel); }
input:disabled, select:disabled, textarea:disabled { background: var(--st-input-disabled-bg); color: var(--st-text-disabled); }
input[type=checkbox], input[type=radio] { box-shadow: none; padding: 0; accent-color: var(--st-accent); }

textarea { width: 100%; resize: vertical; }

button, .file-button, a.button {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: var(--st-button-pad);
    font-size: var(--st-control-font-size);
    border: 1px solid var(--st-input-border);
    border-radius: var(--st-control-radius);
    background: var(--st-button-bg);
    color: var(--st-text);
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: background .15s, border-color .15s;
}

button:hover, .file-button:hover, a.button:hover { background: var(--st-button-hover); border-color: var(--st-button-hover-border); }
button:focus-visible, .file-button:focus-within, a.button:focus-visible { outline: none; box-shadow: var(--st-focus-ring); border-color: var(--st-focus); }
button.primary { background: var(--st-accent-fill); border-color: var(--st-accent-fill-border); color: var(--st-on-accent); }
button.primary:hover { background: var(--st-accent-fill-hover); border-color: var(--st-accent-fill-hover); }
/* Masseændringer: rows are ticked, the way on is open (they go into the selection) */
button.go { background: var(--st-good-fill); border-color: var(--st-good-fill); color: var(--st-on-accent); font-weight: 600; }
button.go:hover { filter: brightness(1.1); }
button:disabled { opacity: .5; cursor: default; }
button.small, .file-button.small { padding: 1px 6px; font-size: 12px; }
button.danger { color: var(--st-on-accent); background: var(--st-bad-fill); border-color: var(--st-bad-fill); }
button.danger:hover { background: var(--st-bad-fill-hover); border-color: var(--st-bad-fill-hover); }
a.button.help { font-weight: bold; width: 28px; justify-content: center; padding: 4px 0; }
.file-button input[type=file] { display: none; }
a, .link { color: var(--st-link); }
a:hover { color: var(--st-link-hover); }

.toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--st-header-bg);
    color: var(--st-header-text);
    border-bottom: 1px solid var(--st-header-border);
    box-shadow: var(--st-header-shadow);
    position: relative;
    z-index: 2;
}
.brand { display: inline-flex; align-items: center; gap: 8px; font-size: 18px; margin-right: 8px; white-space: nowrap; }
.toolbar .version, .login-product .version { font-size: 11px; font-weight: normal; color: var(--st-muted); white-space: nowrap; }
.context { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.context-chip { display: inline-flex; gap: 4px; align-items: baseline; padding: 2px 10px; border-radius: 12px; background: var(--st-panel); border: 1px solid var(--st-border); font-size: 12px; }
.context-chip span { color: var(--st-muted); }
/* On the header's colour (Sapera's blue bar): the header's own text colour, the chips and separators see-through. */
.toolbar .sep { background: var(--st-header-sep); }
.toolbar .muted { color: var(--st-header-muted); }
.toolbar .context-chip { background: var(--st-header-chip); border-color: var(--st-header-chip-border); color: var(--st-header-text); }
.toolbar .context-chip span { color: var(--st-header-muted); }
.toolbar button:not(.primary), .toolbar .file-button, .toolbar a.button { background: var(--st-header-button); border-color: var(--st-header-button-border); color: var(--st-header-button-text); }
.toolbar button:not(.primary):hover, .toolbar .file-button:hover, .toolbar a.button:hover { background: var(--st-header-button-hover); }
.toolbar button.primary { background: var(--st-header-primary); border-color: var(--st-header-primary); color: var(--st-header-primary-text); font-weight: bold; }
.toolbar button.primary:hover { background: var(--st-header-primary-hover); }
.toolbar .menu button, .toolbar .menu .file-button { background: var(--st-surface); color: var(--st-text); }
.toolbar .menu button:hover, .toolbar .menu .file-button:hover { background: var(--st-hover); }
.toolbar .language-select { width: auto; padding: 2px 4px; border-color: transparent; background: transparent; box-shadow: none; color: var(--st-header-button-text); }
.toolbar .language-select option { background: var(--st-input-bg); color: var(--st-text); }
/* Profil: log out, language, theme and version in one menu at the right edge, on the menu's colours. */
.menu.menu-right { left: auto; right: 0; min-width: 160px; }
.toolbar .profile-menu a.button { border: none; border-radius: 0; justify-content: flex-start; background: var(--st-surface); color: var(--st-text); }
.toolbar .profile-menu a.button:hover { background: var(--st-hover); }
.profile-menu .language-label { display: flex; align-items: center; gap: 6px; padding: 4px 10px; color: var(--st-text); white-space: nowrap; }
.toolbar .profile-menu .language-select { color: var(--st-text); }
.toolbar .profile-menu .version { padding: 6px 10px; border-top: 1px solid var(--st-border); font-size: 12px; color: var(--st-text); }
/* Who and where stay on one line; the toolbar wraps between the groups, not inside them. */
.toolbar .context { flex-wrap: nowrap; }
.toolbar .context-chip { white-space: nowrap; }

.sep { width: 1px; align-self: stretch; background: var(--st-border); margin: 0 4px; }
.spacer { flex: 1 1 auto; }
.ml-8 { margin-left: 8px; }
.mt-8 { margin-top: 8px; }
.mt-4 { margin-top: 4px; }
.mb-8 { margin-bottom: 8px; }
.muted { color: var(--st-muted); }
.error { color: var(--st-bad); white-space: pre-wrap; }
.center { text-align: center; }

.w-60 { width: 60px; } .w-80 { width: 80px; } .w-120 { width: 120px; } .w-130 { width: 130px; } .w-160 { width: 160px; }
.w-170 { width: 170px; } .w-180 { width: 180px; } .w-200 { width: 200px; } .w-220 { width: 220px; } .w-240 { width: 240px; }

/* Tabs: a line of tabs; the skin decides whether they are Bootstrap's boxes or underlined. */
/* Tabs: underlined, the chosen one blue and bold (Sapera's list tabs, the app's order tabs). */
.tabs { display: flex; flex-wrap: wrap; gap: 2px; border-bottom: 1px solid var(--st-border); padding: 0 8px; }
.tabs .tab { border: 0; border-radius: 0; background: none; padding: var(--st-tab-pad); font-size: var(--st-tab-font-size); color: var(--st-muted); box-shadow: inset 0 -2px 0 transparent; }
.tabs .tab:hover { background: var(--st-hover); border: 0; color: var(--st-text); }
.tabs .tab.active, .tabs .tab.active:hover { background: none; border: 0; color: var(--st-accent); font-weight: 600; box-shadow: inset 0 calc(-1 * var(--st-tab-mark)) 0 var(--st-accent); }
.main-tabs { background: var(--st-surface); padding: 4px 16px 0; }

.section-title { font-weight: bold; margin: 8px 0 4px; }
.section-title.tab-rank { font-size: 14px; color: var(--st-accent); }

.button-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 4px 0; }
.button-row.inline { display: inline-flex; margin: 0; }
.field-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 8px; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.form-grid { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 4px 8px; align-items: center; max-width: 900px; }
.check { display: inline-flex; align-items: center; gap: 6px; }
.actions { display: flex; gap: 8px; margin-top: 12px; justify-content: flex-end; }

.split { position: relative; display: inline-flex; }
.split > button:first-child { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.split-arrow { border-top-left-radius: 0; border-bottom-left-radius: 0; border-left: none; padding: 4px 6px; }
.menu, .context-menu {
    position: absolute;
    z-index: 20;
    top: 100%;
    left: 0;
    display: flex;
    flex-direction: column;
    background: var(--st-surface);
    border: 1px solid var(--st-border);
    border-radius: var(--st-control-radius);
    box-shadow: var(--st-popup-shadow);
}
.menu button, .context-menu button, .menu .file-button { border: none; border-radius: 0; justify-content: flex-start; white-space: nowrap; background: var(--st-surface); }
.menu button:hover, .context-menu button:hover, .menu .file-button:hover { background: var(--st-hover); }
.dropdown { position: relative; display: inline-flex; }
.context-menu { position: fixed; top: auto; left: auto; right: 24px; bottom: 80px; }

/* Panels: a card on the page; the skin gives its first heading Sapera's blue screen header or the App's grey strip. */
.card, .guide-card { border: 1px solid var(--st-card-border); border-radius: var(--st-radius); padding: 16px; background: var(--st-surface); box-shadow: var(--st-shadow); }
.guide-card { padding: 20px; }
.card > h3:first-child, .guide-card > h2:first-child {
    margin: -16px -16px 12px;
    padding: 8px 16px;
    background: var(--st-card-head-bg);
    color: var(--st-card-head-text);
    border-bottom: 1px solid var(--st-card-head-border);
    border-radius: var(--st-radius) var(--st-radius) 0 0;
    font-size: var(--st-card-head-size);
    font-weight: var(--st-card-head-weight);
}
.guide-card > h2:first-child { margin: -20px -20px 16px; padding: 10px 20px; }

/* Setup */
.steps-panel > .section-title:first-child, .result > .section-title:first-child {
    margin: -12px -12px 10px;
    padding: 8px 12px;
    background: var(--st-card-head-bg);
    color: var(--st-card-head-text);
    border-bottom: 1px solid var(--st-card-head-border);
    border-radius: var(--st-radius) var(--st-radius) 0 0;
    font-size: var(--st-card-head-size);
    font-weight: var(--st-card-head-weight);
}
.setup, .execute { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 12px; min-height: 100%; align-items: start; }
.execute { grid-template-columns: 280px minmax(0, 1fr); }
/* The two columns of Opsætning/Kør as cards on the grey page. */
.steps-panel, .step-editor, .result { background: var(--st-surface); border: 1px solid var(--st-card-border); border-radius: var(--st-radius); box-shadow: var(--st-shadow); padding: 12px; min-width: 0; }
.steps-panel { display: flex; flex-direction: column; position: sticky; top: 0; max-height: calc(100vh - 190px); }
.list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--st-border); border-radius: var(--st-control-radius); overflow: auto; flex: 1 1 auto; }
.list li { padding: 6px 10px; cursor: pointer; display: flex; gap: 6px; align-items: center; border-bottom: 1px solid var(--st-divider); }
.list li:last-child { border-bottom: none; }
.list li:hover { background: var(--st-hover); }
.list li.selected { background: var(--st-selected); box-shadow: inset 3px 0 0 var(--st-accent); }

/* Grids */
.grid-wrap { overflow: auto; border: 1px solid var(--st-grid-line); border-radius: var(--st-control-radius); max-height: 60vh; background: var(--st-surface); }
table.grid { border-collapse: collapse; width: 100%; }
.grid { font-size: var(--st-control-font-size); }
.grid th, .grid td { border: 0; border-bottom: 1px solid var(--st-grid-line); padding: var(--st-cell-pad); text-align: left; vertical-align: middle; }
.grid th { position: sticky; top: 0; background: var(--st-grid-head-bg); border-bottom: 1px solid var(--st-grid-head-line); font-weight: var(--st-grid-head-weight); font-size: var(--st-control-font-size); color: var(--st-text); white-space: nowrap; z-index: 1; }
/* Zebra and hover only on plain rows: a row with a class carries a status colour (new/changed/failed, inactive, …). */
.grid tbody tr:not([class]):nth-child(even) > td { background: var(--st-zebra); }
.grid tbody tr:not([class]):hover > td { background: var(--st-hover); }
.grid tr.selected td, table.grid tr.selected td { background: var(--st-selected); }
.grid tr.inactive td { background: var(--st-inactive); }
.grid tr.separator-below td { border-bottom: 2px solid var(--st-muted); }
.grid.data td { white-space: nowrap; }
.grid .col-narrow { width: 1%; text-align: center; }
.guide.wide { max-width: min(1800px, 100%); }
input.cell, select.cell { width: 100%; min-width: 60px; border-color: transparent; background: transparent; box-shadow: none; }
input.cell:focus, select.cell:focus { border-color: var(--st-focus); background: var(--st-input-bg); }
input.cell.invalid, input.expr.invalid { border-color: var(--st-bad); }
input.expr.valid { border-color: var(--st-good); }

/* Row colours = the desktop StatusBrushes (new/changed/unchanged/failed); the dark theme has darker ones. */
tr.row-new td, i.row-new { background: var(--st-row-new); }
tr.row-changed td, i.row-changed { background: var(--st-row-changed); }
tr.row-unchanged td, i.row-unchanged { background: var(--st-row-unchanged); }
tr.row-failed td, i.row-failed { background: var(--st-row-failed); }

/* Execute */
.progress { margin: 8px 0; }
.progress .bar { height: 18px; border: 1px solid var(--st-border); border-radius: 4px; overflow: hidden; }
.progress .fill { height: 100%; background: var(--st-accent-fill); transition: width .3s; }
.progress.grow { flex: 1 1 240px; min-width: 160px; margin: 0; }
.progress .fill.indeterminate { width: 30% !important; animation: progress-slide 1.4s ease-in-out infinite; }
@keyframes progress-slide { from { margin-left: -30%; } to { margin-left: 100%; } }
.counts { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 4px; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 4px; }
.legend span { display: inline-flex; align-items: center; gap: 4px; }
.chip { display: inline-block; width: 12px; height: 12px; border: 1px solid var(--st-border-strong); }
.toggle { border: 1px solid var(--st-border); border-radius: 4px; padding: 1px 8px; cursor: pointer; }
.toggle.on { background: var(--st-selected); }
.toggle input { display: none; }
.result { min-width: 0; }
.job-result { font-family: var(--st-mono); white-space: pre-wrap; margin: 0; }

/* Log strip + status line + busy bar (bottom, like the desktop) */
.log-panel { border-top: 1px solid var(--st-border); background: var(--st-surface); padding: 0 8px; }
.log-panel.expanded .log-entries { height: min(220px, 33vh); }
.log-entries { list-style: none; margin: 0; padding: 4px 8px; overflow: auto; }
.log-entries li { display: flex; gap: 6px; align-items: flex-start; padding: 2px 0; border-bottom: 1px solid var(--st-divider); }
.log-entries .entry {
    flex: 1 1 auto;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    white-space: pre-wrap;
    word-break: break-word;
}
.chevron { border: none; background: none; }
.status-line { width: 100%; border: none; border-top: 1px solid var(--st-border); border-radius: 0; background: var(--st-surface); color: var(--st-muted); padding: 5px 16px; box-shadow: none; }
.status-line:hover { background: var(--st-surface); }
.status-line:focus { box-shadow: none; }
.busy-bar { height: 4px; background: transparent; }
.busy-bar.on { background: linear-gradient(90deg, transparent, var(--st-accent), transparent); background-size: 200% 100%; animation: busy 1.2s linear infinite; }
@keyframes busy { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* Login: Sapera's own login card (Security/security-ui/login: login-container + login-shared.css) - the logo over a
   line, large rounded fields, one wide button, the theme and the language at the bottom right. */
.login-wrap { flex: 1 1 auto; overflow: auto; position: relative; background: var(--st-login-bg); }
.login-corner { display: flex; align-items: center; gap: 8px; padding: 12px 16px; }
.signon-wait { flex: 1 1 auto; display: flex; align-items: center; justify-content: center; }
.login-card { width: 440px; max-width: calc(100% - 32px); margin: 4vh auto 32px; background: var(--st-login-card-bg); border-radius: var(--st-login-radius); box-shadow: var(--st-login-shadow); }
.login-card-header { padding: 32px 40px 22px; border-bottom: 1px solid var(--st-divider); text-align: center; }
.login-logo { width: 250px; max-width: 100%; }
.login-logo-dark { display: none; }
.login-product { margin-top: 8px; font-size: 15px; font-weight: 600; color: var(--st-muted); }
.login-card-body { display: flex; flex-direction: column; padding: 30px 46px 24px; }
.login-card-body > label { margin: 0 0 6px; font-size: 15px; font-weight: normal; color: var(--st-text); }
.login-card-body input:not([type=checkbox]) { height: 44px; margin-bottom: 16px; padding: 8px 12px; border-radius: 8px; box-shadow: none; font-size: 15px; }
.login-card-body input:focus { border-color: var(--st-login-accent); box-shadow: 0 0 0 3px var(--st-login-accent-ring); }
.login-card-body .input-with-button { margin-bottom: 16px; }
.login-card-body .input-with-button > input { margin-bottom: 0; }
.login-hint { margin: -10px 0 12px; }
.login-submit { justify-content: center; width: 100%; height: 48px; margin-top: 6px; border: none; border-radius: 8px; background: var(--st-login-accent); color: var(--st-on-accent); font-size: 17px; font-weight: 500; transition: background-color .15s ease, box-shadow .15s ease; }
.login-submit:hover:not(:disabled), .login-submit:focus-visible { background: var(--st-login-accent-hover); border: none; box-shadow: 0 4px 14px var(--st-login-accent-glow); }
.login-error { margin: 14px 0 0; }
/* The theme and the language as Sapera's pickers: plain text, no box. */
.login-culture { display: flex; justify-content: flex-end; align-items: center; gap: 12px; margin-top: 18px; }
.login-culture .theme-switch, .login-culture .language-select { height: auto; margin: 0; padding: 2px 4px; border: none; background: transparent; box-shadow: none; color: var(--st-text); font-size: 13px; cursor: pointer; }
.login-culture .theme-switch:hover { background: transparent; color: var(--st-login-accent); }

/* "Skift bruger": the login screen's fields in a dialog */
.login-dialog label { display: flex; flex-direction: column; gap: 2px; margin-bottom: 8px; }
.login-dialog input { width: 100%; box-sizing: border-box; }
.multi-select { display: flex; flex-direction: column; gap: 4px; max-height: 50vh; overflow-y: auto; margin-bottom: 8px; }

/* Modal dialogs */
.modal-backdrop { position: fixed; inset: 0; background: var(--st-backdrop); display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal { background: var(--st-surface); border-radius: var(--st-radius); padding: 16px; width: min(460px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow: auto; display: flex; flex-direction: column; gap: 8px; box-shadow: var(--st-shadow-raised); outline: none; }
.modal.wide { width: min(900px, calc(100vw - 32px)); }
.modal h3 { margin: -16px -16px 4px; padding: 8px 16px; background: var(--st-dialog-head-bg); color: var(--st-dialog-head-text); border-bottom: 1px solid var(--st-card-head-border); font-size: var(--st-card-head-size); font-weight: var(--st-card-head-weight); }
.modal .message { white-space: pre-wrap; margin: 0; }
.modal select[size] { width: 100%; }
.modal .select-filter { flex: 1 1 240px; }
.modal.xwide { width: min(1200px, calc(100vw - 32px)); }

/* Fixed-width position dialog (FixedWidthForm): one character = one column, bands run through every line. */
.fw-preview { overflow: auto; height: 300px; border: 1px solid var(--st-border); background: var(--st-surface); flex-shrink: 0; }
.fw-lines { position: relative; isolation: isolate; min-width: 100%; padding-bottom: 4px; font-family: var(--st-mono); font-size: 13px; line-height: 18px; cursor: text; user-select: none; }
.fw-text, .fw-rulers { white-space: pre; }
/* The ruler stays at the top while the lines scroll under it. */
.fw-rulers { position: sticky; top: 0; z-index: 1; background: linear-gradient(rgba(128, 128, 128, .09), rgba(128, 128, 128, .09)), var(--st-surface); }
/* Column bands over ruler and text; the blend keeps the text readable on the colour (multiply in light, screen in dark). */
.fw-band { position: absolute; top: 0; bottom: 0; z-index: 2; pointer-events: none; mix-blend-mode: var(--st-band-blend); }
.fw-taken { background: rgba(46, 160, 67, .38); }
.fw-overlap { background: rgba(240, 140, 0, .56); }
.fw-selected { background: rgba(46, 160, 67, .69); }
.fw-mark, .fw-overlay { background: rgba(30, 111, 217, .44); }
.fw-overlay { display: none; }
.fw-status { display: inline-block; min-width: 70px; }
.fw-spacer { flex: 1; }
.fw-confirm { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.fw-fields { max-height: 30vh; }
.fw-warning { color: var(--st-warn); margin: 0; }

#blazor-error-ui { display: none; position: fixed; bottom: 0; left: 0; right: 0; padding: 10px 24px; background: var(--st-warn-bg); border-top: 1px solid var(--st-warn-border); z-index: 100; }
#blazor-error-ui .error-details { max-height: 50vh; overflow: auto; margin: 8px 0 0; padding: 8px; background: var(--st-surface); border: 1px solid var(--st-warn-border); font-size: 12px; white-space: pre-wrap; }

/* Import guide */
.guide { max-width: 1000px; margin: 0 auto; padding: 12px 4px 32px; font-size: 14px; }
.guide h2 { font-size: 20px; margin: 8px 0 16px; }
.guide h3 { font-size: 15px; margin: 24px 0 8px; }
.stepper { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 0 0 16px; align-items: center; }
.stepper li { padding: 4px 14px; border-radius: 14px; border: 1px solid var(--st-border); background: var(--st-surface); color: var(--st-muted); font-size: 12px; }
.stepper li.done { background: var(--st-good-bg); border-color: var(--st-good-border); color: var(--st-good); }
.stepper li.current { background: var(--st-selected); border-color: var(--st-accent-border); color: var(--st-accent); font-weight: 600; }
.stepper li.stepper-name { border: none; margin-left: auto; color: var(--st-text); font-weight: 600; background: none; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.tile { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 18px; border-radius: var(--st-radius); border-color: var(--st-card-border); text-align: left; white-space: normal; box-shadow: var(--st-shadow); transition: transform .12s, box-shadow .12s, border-color .12s; }
.tile:hover { border-color: var(--st-accent); background: var(--st-surface); box-shadow: var(--st-shadow-raised); transform: translateY(-1px); }
.tile-title { font-size: 15px; font-weight: 600; }
.tile-sub { color: var(--st-muted); font-size: 12px; }
.tile-active { border-color: var(--st-accent); background: var(--st-selected); }
.tile-secondary { border-style: dashed; box-shadow: none; background: transparent; }
.more-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px; margin-top: 8px; }
.more-list button { text-align: left; white-space: normal; }
.recent { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.recent li { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border: 1px solid var(--st-card-border); border-radius: var(--st-radius); background: var(--st-surface); box-shadow: var(--st-shadow); }
.recent-name { flex: 1 1 auto; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.file-button.big { padding: 10px 18px; font-size: 14px; }
.guide-columns td { padding: 6px 8px; }
.guide-columns tr.row-check td { background: var(--st-warn-bg); }
.input-missing { border-color: var(--st-bad); }
.schedule tr.row-current td { font-weight: bold; }
.notice.warn-notice { background: var(--st-warn-bg); border-color: var(--st-warn-border); }
.schedule tr.row-focused td { font-weight: bold; background: var(--st-selected); }
.schedule .cron-edit { color: var(--st-text); text-decoration: none; padding: 0; font-family: var(--st-mono); border: none; background: none; box-shadow: none; }
.schedule .cron-edit:hover { color: var(--st-accent); background: none; }
.nowrap { white-space: nowrap; }
.job-state { font-size: 12px; padding: 1px 8px; border-radius: 10px; }
.job-state.state-failed { background: var(--st-bad-bg); color: var(--st-bad); font-weight: 600; }
.job-state.state-succeeded { background: var(--st-good-bg); color: var(--st-good); }
.job-state.state-running { background: var(--st-selected); color: var(--st-accent); }
.toggle-failed { color: var(--st-bad); border-color: var(--st-bad-border); }
.toggle-failed.on { background: var(--st-bad-bg); font-weight: 600; }
.input-with-button { display: flex; gap: 6px; align-items: center; }
.input-with-button > input { flex: 1; min-width: 0; }
.toggle-running { color: var(--st-accent); border-color: var(--st-accent-border); }
.toggle-running.on { background: var(--st-selected); font-weight: 600; }

/* AI assistant */
/* The tab's whole height (its padding stays): the input row sits at the bottom, the conversation scrolls above it. */
.ai-panel { display: flex; flex-direction: column; gap: 8px; height: 100%; min-height: 360px; }
.ai-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; flex-wrap: wrap; }
.ai-header-actions { display: flex; gap: 6px; }
.ai-model-button { gap: 6px; }
/* Under the gear at the header's right edge, so it opens leftwards into the panel. */
.ai-model-menu { left: auto; right: 0; margin-top: 2px; padding: 8px; gap: 8px; min-width: 240px; color: var(--st-text); }
.ai-model-menu label { display: flex; flex-direction: column; gap: 2px; font-weight: 600; }
.ai-model-menu select { font-weight: normal; }
.ai-model-menu .small-text { white-space: normal; }
.ai-model-menu button { align-self: flex-end; border: 1px solid var(--st-border); border-radius: var(--st-control-radius); }
.ai-transcript { flex: 1 1 auto; overflow: auto; border: 1px solid var(--st-border); border-radius: var(--st-radius); padding: 8px 8px 24px; background: var(--st-surface); display: flex; flex-direction: column; gap: 6px; }
.ai-bubble { background: var(--st-panel); border-radius: var(--st-control-radius); padding: 6px 8px; max-width: 100%; }
.ai-bubble.ai-user { background: var(--st-selected); }
.ai-role { font-weight: bold; font-size: 11px; color: var(--st-muted); margin-bottom: 2px; }
.ai-plain { white-space: pre-wrap; overflow-wrap: anywhere; }
.ai-markdown p { margin: 2px 0; overflow-wrap: anywhere; }
.ai-markdown h4, .ai-markdown h5, .ai-markdown h6 { margin: 6px 0 2px; }
.ai-markdown ul { margin: 2px 0; padding-left: 20px; }
.ai-markdown blockquote { margin: 2px 0; padding: 2px 8px; border-left: 3px solid var(--st-border-strong); color: var(--st-muted); font-style: italic; }
.ai-markdown code { background: var(--st-code-bg); padding: 0 3px; border-radius: 3px; font-family: var(--st-mono); }
.ai-markdown .md-table { overflow-x: auto; margin: 2px 0; }
.ai-markdown table { border-collapse: collapse; }
.ai-markdown th, .ai-markdown td { border: 1px solid var(--st-grid-line); padding: 3px 8px; text-align: left; vertical-align: top; }
.ai-markdown th { background: var(--st-grid-head-bg); }
.ai-input { display: flex; gap: 6px; align-items: flex-end; flex-wrap: wrap; }
/* One line, as high as the buttons; it grows downwards while typing (syncToolAutoGrow) up to max-height. */
.ai-input > button, .ai-input > .file-button { box-sizing: border-box; height: 34px; }
.ai-input textarea { flex: 1 1 280px; box-sizing: border-box; height: 34px; min-height: 34px; max-height: 200px; resize: none; overflow-y: auto; line-height: 22px; }
.ai-progress { display: flex; flex-direction: column; gap: 2px; align-self: center; }
.ai-progress .bar { height: 8px; }
.ai-activity { align-self: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 360px; }
.ai-thinking { width: 100px; height: 6px; background: var(--st-border); border-radius: 3px; overflow: hidden; align-self: center; }
.ai-thinking .bar { width: 40%; height: 100%; background: var(--st-accent); animation: ai-thinking 1.2s ease-in-out infinite; }
@keyframes ai-thinking { from { margin-left: -40%; } to { margin-left: 100%; } }
.small-text { font-size: 12px; margin-top: 2px; }
th.num, td.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ok { color: var(--st-good); }
.bad { color: var(--st-bad); }
.warn { color: var(--st-warn); }
.notice { border: 1px solid var(--st-warn-border); background: var(--st-warn-bg); border-radius: var(--st-control-radius); padding: 10px 12px; margin-bottom: 12px; }
.notice.bad-notice { border-color: var(--st-bad-border); background: var(--st-bad-bg); color: var(--st-bad); }
.summary { font-size: 15px; font-weight: 600; }
.save-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 16px; }
.guide-footer { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
button.link { border: none; background: none; color: var(--st-muted); text-decoration: underline; box-shadow: none; }

/* Mine kørsler */
.runs { margin-top: 24px; }
.run-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.run-list > li { background: var(--st-surface); box-shadow: var(--st-shadow); border: 1px solid var(--st-card-border); border-radius: var(--st-radius); padding: 8px 12px; display: flex; flex-direction: column; gap: 4px; }
.run-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.run-state { font-size: 12px; padding: 1px 8px; border-radius: 10px; background: var(--st-panel); }
.run-running .run-state, .run-queued .run-state { background: var(--st-selected); color: var(--st-accent); }
.run-succeeded .run-state { background: var(--st-good-bg); color: var(--st-good); }
.run-failed .run-state { background: var(--st-bad-bg); color: var(--st-bad); }
.run-label { font-weight: 600; }
.run-errors { margin: 4px 0 0; padding-left: 18px; color: var(--st-bad); }

@media (max-width: 800px) {
    .setup, .execute { grid-template-columns: minmax(0, 1fr); }
    .steps-panel { position: static; max-height: none; }
    .tab-body { padding: 8px; }
    .form-grid { grid-template-columns: minmax(0, 1fr); }
}

/* Masseændringer */
.bulk { padding: 8px 4px 32px; }
.bulk h3 { margin: 0 0 12px; font-size: 15px; }
.bulk-filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px 16px; align-items: start; }
.bulk-filters > label, .bulk-field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--st-label); }
.bulk-filters input, .bulk-filters select, .bulk-field .pick { font-weight: normal; font-size: 13px; }
.bulk-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.bulk-head h3 { margin: 0; flex: 1; }
.bulk-searches { margin: 8px 0 0; padding-left: 18px; color: var(--st-muted); font-size: 12px; }
.bulk-change { max-width: 900px; }
.bulk-inline { display: inline-flex; align-items: center; gap: 6px; font-weight: normal; color: var(--st-text); }
.bulk-quantities { display: flex; flex-wrap: wrap; gap: 12px; }
.bulk-quantities label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--st-label); }
.bulk-quantities input { width: 140px; font-weight: normal; }
.lookup { position: relative; }
.lookup-list { position: absolute; z-index: 20; top: 100%; left: 0; display: flex; flex-direction: column; min-width: 280px; max-height: 320px; overflow-y: auto; background: var(--st-surface); border: 1px solid var(--st-border); border-radius: var(--st-control-radius); box-shadow: var(--st-popup-shadow); }
.lookup-list button { border: none; border-radius: 0; justify-content: flex-start; white-space: nowrap; background: var(--st-surface); color: var(--st-text); font-weight: normal; }
.lookup-list button:hover { background: var(--st-hover); }
.lookup input { width: 240px; }
.discount-codes-supplier { font-size: 14px; font-weight: normal; color: var(--st-text); padding: 4px 0; }
.grid.data.discount-codes-rows { width: auto; }
.discount-codes-rows input { width: 160px; }
.discount-codes-rows input.num { width: 80px; text-align: right; }
.discount-codes-paste { width: 100%; max-width: 420px; font-family: monospace; }
.bulk-before { color: var(--st-muted); }
.bulk-after { font-weight: 600; }
/* "Ret priser": the price grid. */
.price-grid td.num, .price-grid th.num { text-align: right; }
.price-grid-wrap { max-height: 72vh; }
.price-grid td { padding: 2px 6px; }
.price-grid td.price-name { max-width: 420px; overflow: hidden; text-overflow: ellipsis; }
.price-grid input.price-cell { width: 96px; text-align: right; }
.price-grid tr.price-changed td { background: var(--st-changed-bg); }
.price-edit-bar input, .price-edit-bar select { width: auto; }
.bulk-tags { max-width: 420px; overflow: hidden; text-overflow: ellipsis; }
.grid tr.bulk-changed td { background: var(--st-good-bg); }
.grid tr.bulk-checked td { background: var(--st-selected); }
.grid tr.bulk-failed td { background: var(--st-bad-bg); }

/* Multi-pick (categories, search tags …) */
.pick { display: flex; flex-direction: column; gap: 4px; }
.pick-chosen { display: flex; flex-wrap: wrap; gap: 4px; }
.pick-chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 4px 1px 8px; border-radius: 12px; background: var(--st-selected); border: 1px solid var(--st-accent-border); font-size: 12px; font-weight: 600; }
.pick-remove { border: none; background: transparent; padding: 0 4px; font-size: 11px; cursor: pointer; box-shadow: none; }
.pick-list { display: flex; flex-wrap: wrap; gap: 4px; max-height: 160px; overflow-y: auto; overflow-x: hidden; padding: 2px 0; }
.pick-item { padding: 2px 8px; font-size: 12px; border-radius: 12px; white-space: normal; text-align: left; max-width: 100%; }
.pick-item.on { background: var(--st-selected); border-color: var(--st-accent); font-weight: 600; }
.pick-combo { position: relative; }
.pick-combo .pick-filter { width: 100%; box-sizing: border-box; }
.pick-dropdown { position: absolute; z-index: 20; left: 0; right: 0; top: 100%; margin-top: 2px; max-height: 260px; overflow-y: auto; background: var(--st-surface); border: 1px solid var(--st-border-strong); border-radius: var(--st-control-radius); box-shadow: var(--st-popup-shadow); }
.pick-option { display: flex; gap: 6px; padding: 5px 8px; font-size: 13px; cursor: pointer; }
.pick-option:hover { background: var(--st-selected); }
.pick-option.on { font-weight: 600; }
.pick-option.muted { cursor: default; }
.pick-option.muted:hover { background: transparent; }
.pick-check { width: 14px; flex: none; color: var(--st-accent); }
.lookup-dropdown { right: auto; min-width: 100%; width: max-content; max-width: 420px; }
.pick-option.create { border-top: 1px solid var(--st-border); color: var(--st-accent); font-weight: 600; }

/* "?" with a hint box on hover/focus */
.help-tip { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; margin-left: 4px; border-radius: 50%; background: var(--st-accent-fill); color: var(--st-on-accent); font-size: 11px; font-weight: 700; cursor: help; vertical-align: middle; }
.help-tip-box { display: none; position: absolute; z-index: 30; left: 50%; top: calc(100% + 6px); transform: translateX(-50%); width: 300px; max-width: 80vw; padding: 8px 10px; background: var(--st-tooltip-bg); color: var(--st-tooltip-text); border-radius: 4px; box-shadow: var(--st-popup-shadow); font-size: 12px; font-weight: 400; line-height: 1.4; text-align: left; white-space: normal; }
.help-tip:hover .help-tip-box, .help-tip:focus .help-tip-box { display: block; }

/* Profiler: the features a profile allows, an area with its kinds indented below it */
.profile-features { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.profile-features > div { display: flex; flex-direction: column; gap: 4px; }
.profile-kinds { display: flex; flex-direction: column; gap: 2px; margin: 2px 0 6px 22px; }

/* Opret produkter: one product per line; a made line is read-only */
.create-grid td { vertical-align: top; }
.create-grid input, .create-grid select, .create-grid textarea { min-width: 110px; }
.create-grid tr.create-done td { background: var(--st-good-bg); }
.create-images { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.create-image { background: var(--st-panel); border-radius: 4px; padding: 1px 6px; font-size: 12px; white-space: nowrap; }
.file-button.small { padding: 2px 8px; font-size: 12px; }
.create-columns { flex-direction: row; flex-wrap: wrap; gap: 4px 16px; }
/* Opret / Ret i liste: a field that cannot be filled in is plainly grey (locked, read-only, worked out) */
.create-grid input:disabled, .create-grid select:disabled, .create-grid textarea:disabled {
    background: var(--st-input-disabled-bg); color: var(--st-text-disabled); border-color: var(--st-border); cursor: not-allowed;
}
/* Column layouts: a shown column is dragged to its place */
.draggable { cursor: grab; }
tr.draggable:hover td { background: var(--st-hover); }
.dragging, tr.dragging td { opacity: 0.5; }
/* The place a dragged column would take */
tr.drop-here td { box-shadow: inset 0 3px 0 var(--st-accent); }
span.drop-here { box-shadow: -3px 0 0 var(--st-accent); }
/* Ret i liste: the product's pictures as thumbnails, one large on a click */
img.thumb { width: 48px; height: 48px; object-fit: cover; border-radius: 4px; border: 1px solid var(--st-border); cursor: zoom-in; }
span.thumb-loading { display: inline-block; width: 48px; height: 48px; border-radius: 4px; background: var(--st-panel); }
/* A picture on white whatever the theme: a product photo with a white background would otherwise sit in a dark frame. */
.image-large { max-width: 90vw; max-height: 90vh; background: #fff; padding: 8px; border-radius: 6px; cursor: zoom-out; }
.image-large img { display: block; max-width: calc(90vw - 16px); max-height: calc(90vh - 16px); }
/* Planlæg: Hangfire's failed runs; a long error is cut, the whole of it is in the tooltip and "Resultat" */
td.failed-error { max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Pictures: dropped onto the zone (the file input lies invisibly over it), the primary one starred */
.image-drop { position: relative; display: inline-flex; align-items: center; min-width: 130px; min-height: 26px; padding: 2px 8px; border: 1px dashed var(--st-border-strong); border-radius: 4px; font-size: 12px; color: var(--st-muted); background: var(--st-panel); cursor: pointer; white-space: nowrap; }
.image-drop:hover { border-color: var(--st-accent); color: var(--st-accent); background: var(--st-selected); }
.image-drop input[type=file] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.create-image.primary { background: var(--st-warn-bg); }
.thumb-wrap { position: relative; display: inline-block; }
.thumb-star { position: absolute; top: 1px; right: 1px; padding: 0 3px; border: none; border-radius: 3px; background: rgba(255, 255, 255, .85); font-size: 12px; line-height: 16px; color: #8a6d00; cursor: pointer; box-shadow: none; }
.thumb-star.on { cursor: default; }

/* Min/max-forslag (MinMaxTab): one product per row, the answer on the right. */
.minmax-list { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.minmax-row { display: flex; flex-wrap: wrap; gap: 8px 16px; justify-content: space-between; border: 1px solid var(--st-border); border-left: 4px solid var(--st-border); border-radius: var(--st-control-radius); padding: 8px 12px; background: var(--st-surface); }
.minmax-row.yes { border-left-color: var(--st-good); }
.minmax-row.no { border-left-color: var(--st-warn); }
.minmax-main { flex: 1 1 420px; display: flex; flex-direction: column; gap: 2px; }
.minmax-answer { flex: 0 1 280px; display: flex; flex-direction: column; gap: 4px; }
.minmax-answer input { width: 100%; }
.minmax .good { color: var(--st-good); }

/* Ukurans: a product's write-down lines, unfolded under its row. */
tr.obsolescence-layers > td { background: var(--st-panel); }
tr.obsolescence-layers table { font-size: 12px; margin: 4px 0; }
.obsolescence-scroll { overflow-x: auto; }
.obsolescence-scroll td.obsolescence-text { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.obsolescence-rule { display: flex; flex-direction: column; gap: 4px; }

/* The theme switch in the toolbar (light / dark / as the browser). */
.theme-switch { padding: 2px 8px; }

/* Shown inside Sapera or the Sapera App (?embed=…, theme.js sets data-embed): their own header and menu stand around
   the page, so SyncTool's own brand and the language choice are left out; the toolbar is the screen's own toolbar. */
:root[data-embed] .brand, :root[data-embed] .language-select, :root[data-embed] .language-label, :root[data-embed] .back-to-sapera, :root[data-embed] .theme-switch { display: none; }
/* Inside Sapera its own "?" in the header opens SyncTool's help (the Sapera App has no such button). */
:root[data-embed="sapera"] .toolbar .help { display: none; }
/* Inside Sapera the org unit is the one chosen in Sapera's header, which SyncTool follows (Sapera tells it). */
:root[data-embed="sapera"] .toolbar .org-unit-chip { display: none; }
