/*
 * dynservices xRM – application styles.
 * Classic business look: neutral greys, one muted blue accent, system fonts,
 * thin borders, small radii. Colors are defined once as variables below.
 */

:root {
    --color-bg: #eef0f3;
    --color-panel: #ffffff;
    --color-panel-muted: #f7f8fa;
    --color-text: #1f2933;
    --color-text-muted: #616e7c;
    --color-border: #d3d8de;
    --color-border-strong: #b6bec8;
    --color-header: #233142;
    --color-header-text: #e6ebf0;
    --color-sidebar: #f9fafb;
    --color-accent: #2f5d8a;
    --color-accent-hover: #264d73;
    --color-accent-soft: #e5edf5;
    --color-danger: #a33a3a;
    --color-danger-soft: #f8e9e9;
    --color-success: #2f6f4f;
    --color-success-soft: #e6f2ec;
    --color-warning-soft: #fbf3e2;

    --radius: 3px;
    --font: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    --header-height: 48px;
    /* Navigation: as wide as its longest entry (same space left and right), at most this. */
    --sidebar-max-width: 260px;
    --label-width: 150px;
}

* { box-sizing: border-box; }

/* The hidden attribute must win over display rules of components (e.g. .form-row { display: flex }). */
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
    margin: 0;
    background: var(--color-bg);
    color: var(--color-text);
    font: 14px/1.5 var(--font);
}

a { color: var(--color-accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { font-weight: 600; line-height: 1.3; }
h1 { font-size: 20px; margin: 0; }
h2 { font-size: 16px; margin: 0 0 12px; }
h3 { font-size: 14px; margin: 16px 0 8px; }

code, .mono { font-family: var(--font-mono); font-size: 12.5px; }

.app-loading { padding: 40px; color: var(--color-text-muted); }

/* ---------- Layout ---------- */

.layout {
    display: grid;
    grid-template-rows: var(--header-height) 1fr;
    grid-template-columns: fit-content(var(--sidebar-max-width)) minmax(0, 1fr);
    grid-template-areas: "header header" "sidebar main";
    min-height: 100vh;
}

.header {
    grid-area: header;
    /* Stays visible while scrolling, the side panel starts below it. */
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 20px;
    background: var(--color-header);
    color: var(--color-header-text);
}

.header-brand { font-weight: 600; font-size: 15px; letter-spacing: .2px; color: #fff; }
.header-brand:hover { text-decoration: none; }
.header-brand span { color: #9fb3c8; font-weight: 400; }
.header-spacer { flex: 1; }
.env-badge {
    padding: 1px 8px;
    border: 1px solid #c9a24a;
    border-radius: var(--radius);
    color: #f0d48a;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
}
.header-user { color: #c9d6e3; font-size: 13px; }
.header a.header-link, .header button.header-link {
    color: #c9d6e3;
    background: none;
    border: 0;
    font: inherit;
    font-size: 13px;
    cursor: pointer;
    padding: 4px 0;
}
.header a.header-link:hover, .header button.header-link:hover { color: #fff; text-decoration: underline; }

.sidebar {
    grid-area: sidebar;
    background: var(--color-sidebar);
    border-right: 1px solid var(--color-border);
    padding: 16px 0;
    overflow-y: auto;
}

.nav-section { margin-bottom: 18px; }
.nav-title {
    padding: 0 23px 6px;
    white-space: nowrap;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: var(--color-text-muted);
}
.nav-link {
    display: block;
    /* Text starts 23 px from the left edge (3 px border + 20 px); the same space on the right. */
    padding: 6px 23px 6px 20px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--color-text);
    border-left: 3px solid transparent;
}
.nav-link:hover { background: #eef1f4; text-decoration: none; }
.nav-link.active {
    background: var(--color-accent-soft);
    border-left-color: var(--color-accent);
    color: var(--color-accent);
    font-weight: 600;
}
.nav-empty { padding: 4px 23px; white-space: nowrap; color: var(--color-text-muted); font-size: 13px; }

.main { grid-area: main; padding: 24px 28px 48px; min-width: 0; }

.page-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}
.page-head .actions { margin-left: auto; display: flex; gap: 8px; }
.breadcrumb { font-size: 13px; color: var(--color-text-muted); margin-bottom: 4px; }
.page-sub { color: var(--color-text-muted); margin: 2px 0 0; }

/* ---------- Panels ---------- */

.panel {
    background: var(--color-panel);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    margin-bottom: 20px;
}
.panel-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-panel-muted);
}
.panel-head h2 { margin: 0; font-size: 14px; }
.panel-head .actions { margin-left: auto; display: flex; gap: 8px; }
.panel-body { padding: 16px; }
.panel-foot {
    padding: 12px 16px;
    border-top: 1px solid var(--color-border);
    background: var(--color-panel-muted);
    display: flex;
    gap: 8px;
    align-items: center;
}
.panel-foot .spacer { flex: 1; }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.tile {
    display: block;
    background: var(--color-panel);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 14px 16px;
    color: var(--color-text);
}
.tile:hover { border-color: var(--color-accent); text-decoration: none; }
.tile-title { font-weight: 600; }
.tile-count { font-size: 22px; font-weight: 600; margin-top: 6px; color: var(--color-accent); }
.tile-desc { color: var(--color-text-muted); font-size: 13px; margin-top: 2px; }

/* ---------- Buttons ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 32px;
    padding: 0 14px;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius);
    background: var(--color-panel);
    color: var(--color-text);
    font: inherit;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
}
.btn:hover { background: #f1f3f5; text-decoration: none; }
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary { background: var(--color-accent); border-color: var(--color-accent); color: #fff; }
.btn-primary:hover { background: var(--color-accent-hover); }
.btn-danger { color: var(--color-danger); border-color: #d4a5a5; }
.btn-danger:hover { background: var(--color-danger-soft); }
.btn-danger-solid { background: var(--color-danger); border-color: var(--color-danger); color: #fff; }
.btn-danger-solid:hover { background: #8a3030; }
.btn-small { height: 26px; padding: 0 9px; font-size: 12px; }
.btn-link { border: 0; background: none; color: var(--color-accent); padding: 0; height: auto; }
.btn-link:hover { background: none; text-decoration: underline; }

.btn-group { display: inline-flex; gap: 4px; }

/* ---------- Forms ---------- */

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 20px; }
.form-grid .span-2 { grid-column: span 2; }
.form-row { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.form-control { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.required-mark { color: var(--color-danger); }

/* Label left of the input: "Vorname: [____]" (user setting form_label_position = left) */
.form-row-inline {
    display: grid;
    grid-template-columns: var(--label-width) minmax(0, 1fr);
    column-gap: 12px;
    align-items: start;
}
.form-row-inline .form-label-inline {
    padding-top: 6px;            /* align with the text inside a 32px input */
    font-weight: 600;
    font-size: 13px;
    text-align: right;
    overflow-wrap: anywhere;
}
.form-row-inline input[type=checkbox] { margin-top: 8px; width: 15px; height: 15px; }

/* Record form: fields in sort order; consecutive left/right fields form a two-column block,
   "full" fields span the whole width. */
.record-layout { display: flex; flex-direction: column; gap: 14px; }
.layout-block { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 28px; }
.layout-column { display: flex; flex-direction: column; gap: 14px; min-width: 0; }

/* Data sheet labels are regular weight so that "label_bold" is clearly visible. */
.record-layout .form-row > label,
.record-layout .form-row-inline .form-label-inline,
.record-layout .check span { font-weight: 400; }
.record-layout .label-bold,
.label-bold { font-weight: 700 !important; }

/* Headings (field type "heading"), e.g. Rechnungsadresse / Lieferadresse */
.form-heading {
    margin-top: 6px;
    padding-bottom: 5px;
    border-bottom: 1px solid var(--color-border);
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text);
}

/* Spacer (field type "spacer"): empty space of one form row, used to align the columns */
.form-spacer { height: 56px; }
.record-layout.labels-left .form-spacer { height: 32px; }

/* Input width within the column (setting input_width) */
.input.input-w-large { max-width: 75%; }
.input.input-w-medium { max-width: 50%; }
.input.input-w-small { max-width: 25%; min-width: 80px; }

/* Link fields (type reference) */
.target-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 4px 16px; }
.reference-input { display: flex; flex-direction: column; }
/* Linked record shown inside an input-like box, in place of the search input */
.reference-selected {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 32px;
    padding: 2px 3px 2px 9px;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius);
    background: #fff;
}
.reference-selected.input-w-large { max-width: 75%; }
.reference-selected.input-w-medium { max-width: 50%; }
.reference-selected.input-w-small { max-width: 25%; min-width: 220px; }
.reference-selected { cursor: text; }
.reference-selected:focus { outline: 2px solid var(--color-accent-soft); border-color: var(--color-accent); }
.reference-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reference-result.reference-clear { color: var(--color-text-muted); font-style: italic; }
.reference-search { position: relative; }
.reference-results {
    position: absolute;
    top: calc(100% + 2px);
    left: 0;
    right: 0;
    z-index: 20;
    max-height: 280px;
    overflow-y: auto;
    background: var(--color-panel);
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius);
    box-shadow: 0 4px 14px rgba(20, 30, 40, .12);
}
.reference-result {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    padding: 7px 10px;
    border: 0;
    border-bottom: 1px solid var(--color-border);
    background: none;
    font: inherit;
    font-size: 13px;
    text-align: left;
    cursor: pointer;
}
.reference-result:last-child { border-bottom: 0; }
.reference-result:hover { background: var(--color-accent-soft); }
.reference-empty { padding: 8px 10px; color: var(--color-text-muted); font-size: 13px; }

/* Radio buttons of choice fields (settings.display = radio) */
.radio-group { display: flex; flex-wrap: wrap; gap: 6px 18px; padding-top: 6px; }
.choice-select { position: relative; }
.choice-select.input-w-large { max-width: 75%; }
.choice-select.input-w-medium { max-width: 50%; }
.choice-select.input-w-small { max-width: 25%; min-width: 80px; }
.choice-select select.input { padding-right: 52px; }
/* Clear button inside the select, left of the dropdown arrow */
.choice-clear {
    position: absolute;
    top: 50%;
    right: 26px;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    padding: 0;
    border: 0;
    border-radius: var(--radius);
    background: transparent;
    color: var(--color-text-muted);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
}
.choice-clear:hover { color: var(--color-text); background: var(--color-panel-muted); }

/* Editor for the values of choice fields (field dialog) */
.options-editor { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.options-list { display: flex; flex-direction: column; gap: 6px; width: 100%; }
.options-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto auto; gap: 10px; align-items: center; padding: 2px 4px; border-radius: var(--radius); }
.options-row > input[type=checkbox] { width: 15px; height: 15px; margin: 0; }
.options-row.is-selected { background: var(--color-accent-soft); }
.options-actions { display: flex; align-items: center; gap: 8px; width: 100%; }
.options-move { display: inline-flex; gap: 6px; margin-left: auto; }
.options-row.is-inactive .input { color: var(--color-text-muted); background: var(--color-panel-muted); }
.options-row .check { font-size: 13px; }

/* Destructive actions (instance page) */
.danger-actions { display: flex; flex-direction: column; }
.danger-action { display: flex; align-items: center; gap: 24px; padding: 12px 0; border-top: 1px solid var(--color-border); }
.danger-action:first-child { border-top: 0; padding-top: 0; }
.danger-action:last-child { padding-bottom: 0; }
.danger-action > div { flex: 1; }
.danger-action p { margin: 4px 0 0; color: var(--color-text-muted); font-size: 13px; }

/* File selection and preview (instance import) */
.badge-inline { margin-left: 8px; }
.table tr.row-existing td { color: var(--color-text-muted); background: var(--color-panel-muted); }
dialog.modal.modal-wide { width: min(980px, calc(100vw - 32px)); }
.file-input { display: block; margin: 6px 0 12px; font: inherit; font-size: 13px; }

/* Colour picker in the field dialog */
.color-row { display: flex; align-items: center; gap: 12px; }
.input.input-color { width: 52px; height: 32px; padding: 2px; cursor: pointer; }

.table tr.row-heading td { background: var(--color-panel-muted); }
.table th.col-check, .table td.col-check { width: 36px; padding-right: 0; }
.table th.col-check input, .table td.col-check input { width: 15px; height: 15px; margin: 0; vertical-align: middle; cursor: pointer; }
.table tbody tr.row-selected td, .table tbody tr.row-selected:nth-child(even) td { background: var(--color-accent-soft); }

/* ---------- Workspace tabs (open pages above the content) ---------- */

.workspace-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin: -8px 0 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--color-border);
}
.workspace-tab {
    display: inline-flex;
    align-items: center;
    max-width: 240px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-panel-muted);
    font-size: 12.5px;
    cursor: grab;
}
.workspace-tab:hover { border-color: var(--color-border-strong); }
.workspace-tab.active { background: var(--color-panel); border-color: var(--color-accent); box-shadow: inset 0 -2px 0 var(--color-accent); }
.workspace-tab.dragging { opacity: .35; border-style: dashed; }

/* Context menu (right click on a tab) */
.context-menu {
    position: fixed;
    z-index: 100;
    min-width: 200px;
    padding: 4px 0;
    background: var(--color-panel);
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius);
    box-shadow: 0 6px 18px rgba(20, 30, 40, .16);
}
.context-menu-item {
    display: block;
    width: 100%;
    padding: 7px 14px;
    border: 0;
    background: none;
    font: inherit;
    font-size: 13px;
    text-align: left;
    color: var(--color-text);
    cursor: pointer;
}
.context-menu-item:hover, .context-menu-item:focus { background: var(--color-accent-soft); outline: none; }
.workspace-tab-label {
    padding: 5px 4px 5px 10px;
    color: var(--color-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.workspace-tab.active .workspace-tab-label { color: var(--color-accent); font-weight: 600; }
.workspace-tab-label:hover { text-decoration: none; }
.workspace-tab-close {
    padding: 2px 8px 3px 6px;
    border: 0;
    background: none;
    color: var(--color-text-muted);
    font: inherit;
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
}
.workspace-tab-close:hover { color: var(--color-danger); }

/* Title field selects (instance administration) */
.title-fields { display: flex; flex-direction: column; gap: 6px; max-width: 640px; }
.title-field-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; }

/* ---------- Relations tab (records linking to a record) ---------- */

.relations { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 20px; align-items: start; }
.relations.relations-empty { grid-template-columns: 1fr; }
.relations-nav { display: flex; flex-direction: column; gap: 4px; }
.relations-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px 12px;
    border: 1px solid var(--color-border);
    border-left: 3px solid transparent;
    border-radius: var(--radius);
    background: var(--color-panel);
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.relations-item:hover { border-color: var(--color-border-strong); }
.relations-item.active { border-left-color: var(--color-accent); background: var(--color-accent-soft); }
.relations-name { display: flex; justify-content: space-between; gap: 8px; font-weight: 600; }
.relations-item.active .relations-name { color: var(--color-accent); }
.relations-count { min-width: 22px; padding: 0 6px; border-radius: 9px; background: var(--color-panel-muted); border: 1px solid var(--color-border); font-size: 11px; line-height: 18px; text-align: center; color: var(--color-text-muted); }
.relations-via { font-size: 12px; color: var(--color-text-muted); }

@media (max-width: 860px) {
    .relations { grid-template-columns: 1fr; }
}

/* ---------- Tabs (Reiter) ---------- */

.tabs-bar {
    display: flex;
    gap: 2px;
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 16px;
}
.tab {
    position: relative;
    top: 1px;
    padding: 8px 18px;
    border: 1px solid transparent;
    border-bottom: 0;
    border-radius: var(--radius) var(--radius) 0 0;
    background: none;
    color: var(--color-text-muted);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}
.tab:hover { color: var(--color-text); background: #e6e9ed; }
.tab.active {
    background: var(--color-bg);
    border-color: var(--color-border);
    border-bottom: 1px solid var(--color-bg);
    color: var(--color-accent);
}
.form-row > label, .form-label { font-weight: 600; font-size: 13px; }
.form-row .required::after { content: " *"; color: var(--color-danger); }
.form-help { color: var(--color-text-muted); font-size: 12px; }
.form-error { color: var(--color-danger); font-size: 12px; }

.input, select.input, textarea.input {
    width: 100%;
    height: 32px;
    padding: 5px 9px;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius);
    background: #fff;
    color: var(--color-text);
    font: inherit;
}
textarea.input { height: auto; min-height: 90px; resize: vertical; }
.input:focus { outline: 2px solid var(--color-accent-soft); border-color: var(--color-accent); }
.input[readonly] { background: var(--color-panel-muted); color: var(--color-text-muted); }
.is-invalid .input { border-color: var(--color-danger); }

/* Radio choices with a small example (e.g. display settings) */
.choices { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 4px; }
.choice {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 10px 14px;
    min-width: 240px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-panel);
    cursor: pointer;
}
.choice:has(input:checked) { border-color: var(--color-accent); background: var(--color-accent-soft); }
.choice input { margin: 3px 0 0; }
.choice-title { display: block; font-weight: 600; }
.choice-example { display: flex; flex-direction: column; margin-top: 4px; font-family: var(--font-mono); font-size: 12px; color: var(--color-text-muted); white-space: pre; }

.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 400; cursor: pointer; }
.check input { width: 15px; height: 15px; margin: 0; }

.form-section-title {
    grid-column: span 2;
    margin: 6px 0 -4px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--color-border);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--color-text-muted);
}

/* ---------- Tables ---------- */

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
    vertical-align: middle;
}
.table th {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-muted);
    background: var(--color-panel-muted);
    white-space: nowrap;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:nth-child(even) td { background: #fbfbfc; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: var(--color-accent-soft); }
.table td.actions { text-align: right; white-space: nowrap; }
.table td.num, .table th.num { text-align: right; }
.table td.center, .table th.center { text-align: center; }
.muted, .table .muted { color: var(--color-text-muted); }
.table-empty { padding: 28px 16px; text-align: center; color: var(--color-text-muted); }

th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--color-text); }
th.sortable .sort-indicator { display: inline-block; width: 10px; margin-left: 4px; font-size: 10px; }

.toolbar { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--color-border); }
.toolbar .input { max-width: 320px; }
.toolbar .info { margin-left: auto; color: var(--color-text-muted); font-size: 13px; }

.pagination { display: flex; align-items: center; gap: 8px; flex: 1; }
.pagination .spacer { flex: 1; }
.pagination .info { color: var(--color-text-muted); font-size: 13px; }

/* ---------- Badges ---------- */

.badge {
    display: inline-block;
    padding: 0 7px;
    border-radius: var(--radius);
    font-size: 11px;
    line-height: 18px;
    border: 1px solid var(--color-border);
    color: var(--color-text-muted);
    background: var(--color-panel-muted);
}
.badge-accent { border-color: #b7c8da; color: var(--color-accent); background: var(--color-accent-soft); }
.badge-success { border-color: #b3d1c1; color: var(--color-success); background: var(--color-success-soft); }
.badge-danger { border-color: #dfb9b9; color: var(--color-danger); background: var(--color-danger-soft); }

/* ---------- Notices ---------- */

.notices { position: fixed; bottom: 20px; right: 20px; z-index: 50; display: flex; flex-direction: column; gap: 8px; }
.notice {
    min-width: 260px;
    max-width: 420px;
    padding: 10px 14px;
    border: 1px solid var(--color-border);
    border-left-width: 4px;
    border-radius: var(--radius);
    background: #fff;
    box-shadow: 0 2px 6px rgba(20, 30, 40, .08);
    font-size: 13px;
}
.notice-success { border-left-color: var(--color-success); }
.notice-error { border-left-color: var(--color-danger); }
.notice-info { border-left-color: var(--color-accent); }

.alert { padding: 10px 14px; border-radius: var(--radius); border: 1px solid; margin-bottom: 14px; font-size: 13px; }
.alert-error { background: var(--color-danger-soft); border-color: #e2c2c2; color: #7a2b2b; }
.alert-info { background: var(--color-accent-soft); border-color: #c5d4e3; color: #24486b; }
.alert-actions { margin-top: 8px; }
.alert-warning { background: var(--color-warning-soft); border-color: #e8d7b0; color: #6b5220; }

/* ---------- Dialog ---------- */

dialog.modal {
    width: min(640px, calc(100vw - 32px));
    padding: 0;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius);
    box-shadow: 0 8px 30px rgba(20, 30, 40, .2);
    color: var(--color-text);
}
dialog.modal::backdrop { background: rgba(25, 35, 45, .45); }
.modal-head { padding: 12px 16px; border-bottom: 1px solid var(--color-border); background: var(--color-panel-muted); font-weight: 600; }
.modal-body { padding: 16px; max-height: calc(100vh - 200px); overflow-y: auto; }
.modal-foot { padding: 12px 16px; border-top: 1px solid var(--color-border); display: flex; justify-content: flex-end; gap: 8px; }

/* ---------- Key/value details ---------- */

.meta-list { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 0; font-size: 13px; }
.meta-list dt { color: var(--color-text-muted); }
.meta-list dd { margin: 0; }

/* ---------- Login ---------- */

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: var(--color-bg);
}
.login-box { width: 100%; max-width: 380px; }
.login-brand { text-align: center; margin-bottom: 18px; font-size: 20px; font-weight: 600; color: var(--color-header); }
.login-brand span { color: var(--color-text-muted); font-weight: 400; }
.login-box .form-row { margin-bottom: 14px; }
.login-env { text-align: center; }
.login-box .btn { width: 100%; justify-content: center; height: 36px; }

/* ---------- Responsive ---------- */

@media (max-width: 560px) {
    .form-row-inline { grid-template-columns: 1fr; row-gap: 4px; }
    .form-row-inline .form-label-inline { text-align: left; padding-top: 0; }
}

@media (max-width: 860px) {
    .layout { grid-template-columns: 1fr; grid-template-areas: "header" "sidebar" "main"; grid-template-rows: var(--header-height) auto 1fr; }
    .sidebar { border-right: 0; border-bottom: 1px solid var(--color-border); }
    .main { padding: 16px; }
    .form-grid { grid-template-columns: 1fr; }
    .form-grid .span-2, .form-section-title { grid-column: span 1; }
    .layout-block { grid-template-columns: 1fr; gap: 14px; }
    .form-spacer { display: none; }   /* columns are stacked, alignment gaps are not needed */
    .header-user { display: none; }
}

/* ---------- Activities: call list, links of activities to records ---------- */

.input.input-auto { width: auto; max-width: 100%; }
.nowrap { white-space: nowrap; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.table th.col-icon, .table td.col-icon { width: 34px; min-width: 34px; padding-left: 6px; padding-right: 6px; text-align: center; }
.calls-table td.call-notes { max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.calls-table .initials { font-weight: 600; letter-spacing: 0.02em; }

/* Status of an activity: red = neu, yellow = in Bearbeitung, green = erledigt */
.status-dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; vertical-align: middle; flex: none; }
.status-dot.status-0 { background: #e05a4f; }
.status-dot.status-1 { background: #f2c230; }
.status-dot.status-2 { background: #4caf73; }
.status-button { display: inline-flex; padding: 4px; border: 0; border-radius: 50%; background: none; cursor: pointer; }
.status-button:hover, .status-button:focus-visible { background: var(--color-accent-soft); }
.radio-group .check .status-dot { margin-right: -2px; }

/* Icons in activity tables (telephone, disk, direction): same 24px box, 20px symbol, centred */
.icon-box, .disk-button { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; vertical-align: middle; }
.icon-box svg, .disk-button .disk-icon { display: block; width: 20px; height: 20px; }

/* Type of an activity in the history (telephone = call) */
.activity-type { color: var(--color-accent); }
.activity-type svg { fill: currentColor; }
.history-table th.call-notes { width: 100%; }
.history-table td.call-notes { width: 100%; max-width: none; white-space: normal; overflow: visible; }

/* Direction of a call: arrow to the right (inbound) or to the left (outbound) */
.direction { color: var(--color-accent); }
.direction svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* Floppy disk: outline = nothing linked, filled blue = linked, "+" = more than one record */
.link-indicator { position: relative; display: inline-flex; vertical-align: middle; }
.disk-button {
    position: relative;
    padding: 0;
    border: 0;
    border-radius: var(--radius);
    background: none;
    color: var(--color-text-muted);
    cursor: pointer;
}
.disk-button:hover, .disk-button:focus-visible { background: var(--color-accent-soft); }
.disk-icon { display: block; }
.disk-icon .disk-body { fill: #fff; stroke: var(--color-accent); stroke-width: 1; stroke-linejoin: round; }
.disk-icon .disk-detail { fill: none; stroke: var(--color-accent); stroke-width: 1; }
.disk-icon .disk-notch { fill: var(--color-accent); }
.link-indicator.is-linked .disk-body { fill: var(--color-accent); }
.link-indicator.is-linked .disk-detail { fill: #fff; stroke: none; }
.disk-plus { position: absolute; right: -3px; bottom: -3px; display: block; line-height: 0; }
.disk-plus svg { display: block; fill: none; stroke-linecap: round; }
.disk-plus .disk-plus-outline { stroke: #fff; stroke-width: 5; }
.disk-plus .disk-plus-mark { stroke: var(--color-accent); stroke-width: 2.4; }

.link-popover {
    position: fixed;
    z-index: 50;
    width: 360px;
    padding: 10px 12px 12px;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius);
    background: var(--color-panel);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
    text-align: left;
    cursor: default;
}
.link-popover-title { margin-bottom: 6px; font-size: 12px; font-weight: 600; color: var(--color-text-muted); }

.link-editor { display: flex; flex-direction: column; gap: 8px; }
.link-list { display: flex; flex-direction: column; }
.link-item { display: flex; align-items: center; gap: 8px; padding: 4px 0; border-bottom: 1px solid var(--color-border); font-size: 13px; }
.link-item:last-child { border-bottom: 0; }
.link-item a { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-remove {
    width: 22px;
    height: 22px;
    padding: 0;
    border: 0;
    border-radius: var(--radius);
    background: none;
    color: var(--color-text-muted);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
}
.link-remove:hover { color: var(--color-danger); background: var(--color-danger-soft); }
.link-empty { color: var(--color-text-muted); font-size: 13px; }
.link-search { position: relative; }
.link-results {
    position: absolute;
    top: calc(100% + 2px);
    left: 0;
    right: 0;
    z-index: 51;
    max-height: 260px;
    overflow-y: auto;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius);
    background: var(--color-panel);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}
.reference-instance { color: var(--color-text-muted); white-space: nowrap; }
.modal-foot .spacer { flex: 1; }
/* Inside dialogs the results are part of the flow, so the scrolling dialog body does not cut them off. */
dialog.modal .link-results { position: static; margin-top: 2px; box-shadow: none; }

/* ---------- Record versions (tab "Versionen") ---------- */

.versions-table td { vertical-align: top; }
.versions-table tbody.version-group + tbody.version-group tr:first-child td { border-top: 2px solid var(--color-border-strong); }
.versions-table .version-action { font-size: 12px; }
.versions-table td.version-old { color: var(--color-text-muted); text-decoration: line-through; text-decoration-color: var(--color-border-strong); }
.versions-table td.version-old.muted { text-decoration: none; }
.versions-table td.version-old, .versions-table td.version-new { white-space: pre-wrap; word-break: break-word; }

/* ---------- Side panel on the right (e.g. a call) ---------- */

:root { --side-panel-width: 560px; }
body.has-side-panel .main { margin-right: var(--side-panel-width); }
.side-panel {
    position: fixed;
    top: var(--header-height);
    right: 0;
    bottom: 0;
    z-index: 25;
    display: flex;
    flex-direction: column;
    width: min(var(--side-panel-width), 100vw);
    border-left: 1px solid var(--color-border-strong);
    background: var(--color-panel);
    box-shadow: -4px 0 14px rgba(0, 0, 0, 0.08);
}
/* Drag handle on the left edge (resize the panel) */
.side-panel-resize {
    position: absolute;
    top: 0;
    bottom: 0;
    left: -4px;
    z-index: 1;
    width: 8px;
    cursor: col-resize;
    touch-action: none;
}
.side-panel-resize:hover, body.is-resizing-side-panel .side-panel-resize { background: var(--color-accent-soft); border-left: 2px solid var(--color-accent); }
body.is-resizing-side-panel { cursor: col-resize; user-select: none; }
.side-panel-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-panel-muted);
}
.side-panel-head h2 { flex: 1; margin: 0; font-size: 15px; font-weight: 600; }
.side-panel-close {
    width: 28px;
    height: 28px;
    padding: 0;
    border: 0;
    border-radius: var(--radius);
    background: none;
    color: var(--color-text-muted);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}
.side-panel-close:hover { background: var(--color-accent-soft); color: var(--color-text); }
.side-panel-body { flex: 1; overflow-y: auto; padding: 16px; }
.side-panel-foot { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--color-border); }
.side-panel-foot .spacer { flex: 1; }
.side-panel-actions { display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-bottom: 1px solid var(--color-border); background: var(--color-panel-muted); }
.side-panel-actions .spacer { flex: 1; }
.btn.btn-icon { display: inline-flex; align-items: center; justify-content: center; padding-left: 9px; padding-right: 9px; }
.btn.btn-icon svg { display: block; }
/* Search results are part of the flow, so the scrolling panel does not cut them off. */
.side-panel .link-results { position: static; margin-top: 2px; box-shadow: none; }

@media (max-width: 1100px) {
    /* Too narrow for list and panel side by side: the panel covers the content. */
    body.has-side-panel .main { margin-right: 0; }
}

/* ---------- Call administration (Administration -> Anrufe) ---------- */

.subnav-layout { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 20px; align-items: start; }
.subnav { display: flex; flex-direction: column; gap: 2px; padding: 6px; border: 1px solid var(--color-border); border-radius: var(--radius); background: var(--color-panel); }
.subnav-item {
    padding: 8px 12px;
    border: 0;
    border-left: 3px solid transparent;
    border-radius: var(--radius);
    background: none;
    font: inherit;
    text-align: left;
    color: var(--color-text);
    cursor: pointer;
}
.subnav-item:hover { background: var(--color-panel-muted); }
.subnav-item.active { border-left-color: var(--color-accent); background: var(--color-accent-soft); color: var(--color-accent); font-weight: 600; }
.subnav-content { min-width: 0; }
.section-intro { margin: 0 0 14px; color: var(--color-text-muted); max-width: 900px; }
@media (max-width: 860px) {
    .subnav-layout { grid-template-columns: 1fr; }
    .subnav { flex-direction: row; flex-wrap: wrap; }
}

.access-table select.is-empty { color: var(--color-text-muted); }
.inline-form { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.inline-form > .input { max-width: 360px; }
.inline-form .form-row { flex: 0 1 380px; margin: 0; }
.inline-form .form-row .input { max-width: none; }
.autolink-instance { padding: 10px 0; border-bottom: 1px solid var(--color-border); }
.autolink-instance:first-child { padding-top: 0; }
.autolink-instance:last-child { border-bottom: 0; padding-bottom: 0; }
.autolink-title { font-weight: 600; margin-bottom: 6px; }
.autolink-fields { display: flex; flex-wrap: wrap; gap: 6px 22px; }
.autolink-empty { font-size: 13px; }

/* Calls: phone book name, restricted calls in the history */
.contact-input { display: flex; gap: 6px; }
.contact-input .input { flex: 1; min-width: 0; }
.contact-toggle { flex: none; justify-content: center; width: 34px; padding: 0; font-size: 18px; font-weight: 600; line-height: 1; }
.calls-table td.call-contact { white-space: nowrap; }
.history-table tr.is-restricted td { color: var(--color-text-muted); }
.status-static { display: inline-flex; padding: 4px; opacity: 0.7; }
.form-grid.form-grid-single { grid-template-columns: 1fr; }

/* Actions of an open record, above its tabs */
.record-actions { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.record-actions .spacer { flex: 1; }
.settings-form { max-width: 520px; }
.call-origin { margin: 0 0 16px; padding: 10px 12px; border: 1px solid var(--color-border); border-radius: var(--radius); background: var(--color-panel-muted); }

/* New call arrived live: short highlight */
@keyframes row-new { from { background: var(--color-accent-soft); } to { background: transparent; } }
.table tr.row-new td { animation: row-new 4s ease-out; }
.section-title { margin: 22px 0 10px; font-size: 15px; font-weight: 600; }
.page-head + .section-title { margin-top: 0; }

/* Administration -> E-Mail: result of the connection test */
.mail-test { display: grid; grid-template-columns: max-content max-content 1fr; gap: 6px 10px; align-items: baseline; }
.mail-test-label { font-weight: 600; }
.mail-test-message { overflow-wrap: anywhere; }
.mail-test-box { margin-top: 14px; padding: 10px 12px; border: 1px solid var(--color-border); border-radius: var(--radius); background: var(--color-panel-muted); }

/* Assignment editor (ui/assignment-editor.js): Administration -> Anrufe/E-Mail -> Benutzer */
.input.input-small { height: 28px; padding: 3px 7px; font-size: 13px; }
.assign-editor { max-width: 1100px; }
.assign-grid { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 14px; }
.assign-column { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.assign-select-label { font-weight: 600; }
.assign-title { margin-top: 8px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.assign-list { height: 340px; overflow-y: auto; border: 1px solid var(--color-border); border-radius: var(--radius); background: var(--color-panel); }
.assign-item { display: flex; align-items: center; gap: 8px; min-height: 34px; padding: 4px 10px; border-bottom: 1px solid var(--color-border); cursor: pointer; user-select: none; }
.assign-item:hover { background: var(--color-panel-muted); }
.assign-item.selected { background: var(--color-accent-soft); box-shadow: inset 3px 0 0 var(--color-accent); }
.assign-item:focus-visible { outline: 2px solid var(--color-accent); outline-offset: -2px; }
.assign-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.assign-hint { display: block; font-size: 12px; color: var(--color-text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.assign-empty { padding: 16px 10px; color: var(--color-text-muted); text-align: center; }
.assign-buttons { display: flex; flex-direction: column; justify-content: center; gap: 6px; padding-top: 90px; }
.assign-buttons .btn { min-width: 38px; font-size: 15px; }
.assign-foot { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.assign-dirty { padding: 2px 8px; border-radius: var(--radius); background: var(--color-warning-soft); color: #6b5220; font-size: 13px; }
@media (max-width: 860px) {
    .assign-grid { grid-template-columns: 1fr; }
    .assign-buttons { flex-direction: row; padding-top: 0; }
    .assign-list { height: 240px; }
}

/* Administration -> E-Mail -> Postfächer: form in place of the list, folder selection */
.section-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.section-head h2 { margin: 0; font-size: 15px; font-weight: 600; }
.section-head .btn { margin-left: auto; }
.form-actions { display: flex; align-items: center; gap: 8px; margin: 14px 0 20px; }
.form-actions .spacer { flex: 1; }
.folder-intro p { margin: 0; }
.folder-intro .alert { margin: 10px 0 0; }
.folder-table td { vertical-align: middle; }
.folder-table th.center, .folder-table td.center { width: 80px; }
.folder-table td.center input { width: 15px; height: 15px; margin: 0; vertical-align: middle; cursor: pointer; }
.folder-table select { width: auto; min-width: 140px; }
.mail-test-box + .form-actions { margin-top: 14px; }

/* E-mails: list (views/emails.js) and side panel (ui/emails.js) */
.emails-table .email-subject { max-width: 520px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.emails-table .email-counterpart { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.email-header { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; margin: 0 0 14px; font-size: 13px; }
.email-header dt { color: var(--color-text-muted); }
.email-header dd { margin: 0; overflow-wrap: anywhere; }
.email-content { margin-bottom: 14px; border: 1px solid var(--color-border); border-radius: var(--radius); background: #fff; }
.email-content-bar { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-bottom: 1px solid var(--color-border); background: var(--color-panel-muted); font-size: 12px; }
.email-content-bar .spacer { flex: 1; }
.email-frame { display: block; width: 100%; height: 55vh; min-height: 280px; border: 0; background: #fff; }
.email-text { margin: 0; padding: 12px; max-height: 55vh; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; font: 13px/1.5 var(--font-mono); }
.email-attachments { margin-bottom: 14px; }
.email-attachments ul { margin: 4px 0 0; padding-left: 18px; }
.email-attachments li { margin: 2px 0; }
.folder-state { font-size: 12px; }
.text-danger { color: var(--color-danger); }
.toolbar .info { white-space: nowrap; }

/* Delegation of e-mails (ui/delegation.js): person symbol, filled when delegated, number for several */
.delegate-indicator { position: relative; display: inline-flex; vertical-align: middle; }
.delegate-button { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; padding: 0; border: 0; border-radius: var(--radius); background: none; cursor: pointer; }
.delegate-button:hover, .delegate-button:focus-visible { background: var(--color-accent-soft); }
.delegate-icon { display: block; }
.delegate-icon .delegate-head, .delegate-icon .delegate-body { fill: #fff; stroke: var(--color-accent); stroke-width: 1.1; stroke-linejoin: round; }
.delegate-indicator.is-delegated .delegate-head, .delegate-indicator.is-delegated .delegate-body { fill: var(--color-accent); }
.delegate-count { position: absolute; right: -4px; bottom: -3px; min-width: 13px; height: 13px; padding: 0 3px; border: 1.5px solid #fff; border-radius: 7px; background: var(--color-accent); color: #fff; font-size: 9px; font-weight: 700; line-height: 10px; text-align: center; }
.delegate-popover { width: 320px; }
.delegate-popover .input { width: 100%; margin-bottom: 6px; }
.delegate-list { display: flex; flex-direction: column; max-height: 300px; overflow-y: auto; }
.delegate-row { display: flex; align-items: center; gap: 6px; min-height: 30px; }
.delegate-status { display: inline-flex; justify-content: center; width: 24px; flex: none; }

/* Update screen (ui/update-screen.js): covers everything while scripts/update.sh runs */
.update-screen { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 24px; background: var(--color-bg); }
.update-box { width: min(520px, 100%); padding: 32px 36px; border: 1px solid var(--color-border); border-radius: var(--radius); background: var(--color-panel); box-shadow: 0 4px 18px rgba(0, 0, 0, 0.06); text-align: center; }
.update-brand { margin-bottom: 18px; font-size: 15px; font-weight: 600; color: var(--color-text-muted); }
.update-brand span { font-weight: 400; }
.update-box h1 { margin: 0 0 22px; font-size: 19px; font-weight: 600; }
.update-box p { margin: 18px 0 0; color: var(--color-text-muted); font-size: 13px; }
.update-bar { position: relative; height: 6px; overflow: hidden; border-radius: 3px; background: var(--color-accent-soft); }
.update-bar-fill { position: absolute; top: 0; bottom: 0; left: 0; width: 35%; border-radius: 3px; background: var(--color-accent); animation: update-bar 1.6s ease-in-out infinite; }
@keyframes update-bar { from { transform: translateX(-100%); } to { transform: translateX(290%); } }
body.is-updating { overflow: hidden; }
@media (prefers-reduced-motion: reduce) { .update-bar-fill { animation-duration: 4s; } }

/* Row selection (ui/row-selection.js) and status context menu */
.table tbody tr.row-checked td, .table tbody tr.row-checked:nth-child(even) td { background: #f2f6fa; }
.table tbody tr.row-checked.row-selected td { background: var(--color-accent-soft); }
.context-menu-title { padding: 6px 14px 4px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; color: var(--color-text-muted); }
.context-menu-item .status-dot { margin-right: 8px; }

/* Eye (visibility of e-mails and tasks, ui/visibility.js), like the floppy disk: filled blue = visible to everyone, outline = private */
.eye-button { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; padding: 0; border: 0; border-radius: var(--radius); background: none; color: var(--color-accent); cursor: pointer; vertical-align: middle; }
.eye-button:hover, .eye-button:focus-visible { background: var(--color-accent-soft); }
.eye-button:disabled { opacity: .5; cursor: default; }
.eye-icon { display: block; }
.eye-icon .eye-body { fill: #fff; stroke: var(--color-accent); stroke-width: 1.1; stroke-linejoin: round; }
.eye-icon .eye-pupil { fill: none; stroke: var(--color-accent); stroke-width: 1.1; }
.eye-button.is-visible .eye-body { fill: var(--color-accent); }
.eye-button.is-visible .eye-pupil { fill: #fff; stroke: none; }

/* Tasks (views/tasks.js, ui/tasks.js) */
.task-title { font-weight: 600; }
.tasks-table td.task-title { width: 100%; max-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-overdue { color: var(--color-danger); font-weight: 600; }
.form-static { padding: 6px 0; }
.history-actions { display: flex; justify-content: flex-end; margin-bottom: 8px; }

/* Record import (views/admin-record-import.js) */
.import-options { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 18px; }
.import-option { display: flex; flex-direction: column; gap: 4px; }
.import-option .input[type=file] { padding: 4px; }
.import-header { padding-bottom: 8px; }
.import-file-info { margin-top: 10px; }
.import-mapping td { vertical-align: middle; }
.import-mapping select.is-empty { color: var(--color-text-muted); }
.import-examples { max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.import-warnings .alert { margin: 10px 16px 0; }
.import-warnings:empty { display: none; }
.import-summary { display: flex; gap: 8px; padding: 12px 16px; }
.import-value { max-width: 280px; overflow-wrap: anywhere; }
.import-more { padding: 0 16px; }
.alert-success { background: var(--color-success-soft); border-color: #b3d1c1; color: var(--color-success); }

/* Page size at the bottom of the record list (ui/record-table.js) */
.page-size { display: inline-flex; align-items: center; gap: 6px; margin-left: 12px; }

/* Warning of the conflict check (views/record-form.js) */
.conflict-warning ul { margin: 8px 0; padding-left: 20px; }
.conflict-warning li { margin: 2px 0; }

/* "Filtern" in the record list (ui/record-filter.js) */
.filter-button { display: inline-flex; align-items: center; gap: 6px; }
.filter-button.is-active { border-color: var(--color-accent); color: var(--color-accent); background: var(--color-accent-soft); }
.filter-count { min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--color-accent); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; }
.filter-count[hidden] { display: none; }
.filter-panel { padding: 10px 16px; border-bottom: 1px solid var(--color-border); background: var(--color-panel-muted); }
.filter-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.filter-head .spacer { flex: 1; }
.filter-rules { display: flex; flex-direction: column; gap: 6px; }
.filter-rule { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.filter-rule .input { max-width: 260px; }
.filter-rule .filter-value { min-width: 200px; }
.filter-add, .filter-remove { min-width: 30px; font-size: 15px; line-height: 1; }
