/* Components - portable atoms */

/* === Card === */
.card {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    box-shadow: var(--shadow-card);
    margin-bottom: var(--space-4);
}

.section-title {
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin: 0 0 var(--space-4) 0;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--space-4);
    gap: var(--space-3);
}
.section-header .section-title { margin-bottom: 0; }

.section-meta {
    font-size: var(--font-size-sm);
    color: var(--color-text-faint);
    margin: var(--space-1) 0 0 0;
}

/* === Button === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    font-family: inherit;
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-medium);
    line-height: 1.25;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.12s, border-color 0.12s, color 0.12s;
    white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
    background: var(--color-card);
    color: var(--color-text);
    border-color: var(--color-border-strong);
}
.btn-secondary:hover:not(:disabled) {
    background: var(--color-card-alt);
    border-color: var(--color-text-muted);
    text-decoration: none;
}

.btn-danger {
    background: var(--color-card);
    color: var(--color-danger);
    border-color: var(--color-border-strong);
}
.btn-danger:hover:not(:disabled) {
    background: var(--color-danger-bg);
    border-color: var(--color-danger);
    text-decoration: none;
}

.btn-link {
    background: transparent;
    color: var(--color-accent);
    border-color: transparent;
    padding: var(--space-2);
}
.btn-link:hover:not(:disabled) {
    color: var(--color-accent-hover);
    text-decoration: underline;
}

.btn-sm {
    padding: var(--space-1) var(--space-3);
    font-size: var(--font-size-sm);
}

/* === Field === */
.field { margin-bottom: var(--space-3); }
.field-label,
.field > label {
    display: block;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text);
    margin-bottom: var(--space-1);
}
.field-input,
.field input[type="text"],
.field input[type="number"],
.field input[type="date"],
.field input[type="email"],
.field input[type="password"],
.field input[type="search"],
.field textarea,
.field select {
    width: 100%;
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: var(--font-size-base);
    color: var(--color-text);
    background: var(--color-card);
    box-sizing: border-box;
    transition: border-color 0.12s, box-shadow 0.12s;
}
.field-input:focus,
.field input:focus,
.field textarea:focus,
.field select:focus {
    outline: none;
    border-color: var(--color-brand-navy);
    box-shadow: 0 0 0 3px rgba(15, 40, 73, 0.08);
}
.field-hint {
    font-size: var(--font-size-xs);
    color: var(--color-text-faint);
    margin-top: var(--space-1);
}
.field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3);
}

/* === Badge / Pill === */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px var(--space-2);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
    border-radius: var(--radius-pill);
    background: var(--color-card-alt);
    color: var(--color-text-muted);
}
.badge-success { background: var(--color-success-bg); color: var(--color-success); }
.badge-warning { background: var(--color-warning-bg); color: var(--color-warning); }
.badge-danger  { background: var(--color-danger-bg);  color: var(--color-danger); }
.badge-info    { background: var(--color-info-bg);    color: var(--color-info); }

/* === Action bar === */
.actions {
    display: flex;
    gap: var(--space-3);
    align-items: center;
    margin-top: var(--space-5);
}

/* === Empty state === */
.empty-state {
    text-align: center;
    padding: var(--space-6) var(--space-3);
    color: var(--color-text-faint);
}
.empty-state-title {
    font-weight: var(--font-weight-medium);
    color: var(--color-text-muted);
    margin: 0 0 var(--space-1) 0;
}



/* === TopNav (CMS-exact: gradient bg, inset highlight, struktur fra max-w-7xl) === */

.topnav .topnav-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--color-text-inverse);
    flex-shrink: 0;
    transition: opacity 0.15s ease;
}
.topnav .topnav-brand:hover {
    text-decoration: none;
    color: var(--color-text-inverse);
    opacity: 0.9;
}
.topnav .topnav-logo {
    height: 36px;
    width: auto;
    filter: brightness(0) invert(1);
}
.topnav .topnav-brand-sub {
    font-size: 16px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
    letter-spacing: 0.025em;
}
.topnav {
    background: linear-gradient(rgb(36, 59, 122) 0%, rgb(27, 43, 94) 100%);
    color: var(--color-text-inverse);
    height: var(--topnav-height);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 3px rgba(0, 0, 0, 0.1);
}

.topnav .topnav-inner {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 32px;
    height: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.topnav .topnav-left {
    display: flex;
    align-items: center;
    gap: 24px;
}



.topnav .topnav-links {
    display: flex;
    align-items: center;
    gap: 4px;
}

.topnav .topnav-link {
    display: inline-flex;
    align-items: center;
    height: 36px;
    padding: 8px 14px;
    color: rgba(255, 255, 255, 0.75);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    line-height: 20px;
    border-radius: 8px;
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
}
.topnav .topnav-link:hover {
    color: rgb(255, 255, 255);
    background: rgba(255, 255, 255, 0.08);
    text-decoration: none;
}
.topnav .topnav-link.active {
    color: rgb(255, 255, 255);
    background: rgba(255, 255, 255, 0.12);
}

.topnav .topnav-user {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.topnav .topnav-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    color: var(--color-text-inverse);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
}
.topnav .topnav-username {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.9);
}

.btn-primary {
    background: var(--color-brand-navy);
    color: var(--color-text-inverse);
    border-color: var(--color-brand-navy);
    box-shadow: 0 4px 12px rgba(27, 43, 94, 0.25);
}

.btn-primary:hover {
    background: var(--color-brand-navy-hover);
    border-color: var(--color-brand-navy-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(27, 43, 94, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(27, 43, 94, 0.25);
}

/* ─── Rich editor (Quill) ─── */
.rich-editor-container {
    min-height: 140px;
    background: var(--color-card);
    border-radius: var(--radius-md);
}
.ql-toolbar.ql-snow {
    border: 1px solid var(--color-border) !important;
    border-top-left-radius: var(--radius-md);
    border-top-right-radius: var(--radius-md);
    background: var(--color-card-alt);
}
.ql-container.ql-snow {
    border: 1px solid var(--color-border) !important;
    border-top: 0 !important;
    border-bottom-left-radius: var(--radius-md);
    border-bottom-right-radius: var(--radius-md);
    font-family: var(--font-sans, inherit);
    font-size: var(--font-size-sm);
    min-height: 120px;
}
.ql-editor {
    min-height: 120px;
    line-height: 1.6;
    color: var(--color-text);
}
.ql-editor.ql-blank::before {
    color: var(--color-text-faint);
    font-style: normal;
}
/* read-only render af pre-formateret description */
.rich-content {
    white-space: pre-wrap;
    line-height: 1.6;
    color: var(--color-text);
    font-size: var(--font-size-sm);
}
.rich-content p { margin: 0 0 var(--space-2); }
.rich-content p:last-child { margin-bottom: 0; }
.rich-content ul, .rich-content ol { padding-left: 1.4em; margin: 0 0 var(--space-2); }
.rich-content a { color: var(--color-accent); }
.rich-content h2 { font-size: var(--font-size-lg); margin: var(--space-3) 0 var(--space-2); }
.rich-content h3 { font-size: var(--font-size-base); margin: var(--space-3) 0 var(--space-2); }
.rich-content code {
    background: var(--color-card-alt);
    border-radius: var(--radius-sm);
    padding: 2px 6px;
    font-family: var(--font-mono);
    font-size: 12px;
}
.rich-content pre {
    background: #1e1e1e;
    color: #f0f0f0;
    border-radius: var(--radius-md);
    padding: var(--space-3);
    font-family: var(--font-mono);
    font-size: 12px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
    overflow-x: hidden;
    max-width: 100%;
    margin: 0 0 var(--space-2);
}
.rich-content pre code {
    background: transparent;
    color: inherit;
    padding: 0;
    font-size: inherit;
}

.rich-content blockquote {
    border-left: 3px solid var(--color-border);
    padding-left: var(--space-3);
    color: var(--color-text-muted);
    margin: 0 0 var(--space-2);
}


/* === Inline status pills (delt mellem komponenter) === */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px var(--space-2);
    border-radius: var(--radius-pill);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
.status-pill::before {
    content: "";
    width: 13px; height: 13px;
    flex: none;
    background-color: currentColor;
    -webkit-mask: var(--st-mask) center / contain no-repeat;
    mask: var(--st-mask) center / contain no-repeat;
    --st-mask: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='black'%20stroke-width='2.2'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Ccircle%20cx='12'%20cy='12'%20r='9'/%3E%3C/svg%3E");
}
.status-pill.status-done::before {
    --st-mask: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='black'%20stroke-width='2.4'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Ccircle%20cx='12'%20cy='12'%20r='10'/%3E%3Cpath%20d='M8%2012l3%203%205-6'/%3E%3C/svg%3E");
}
.status-pill.status-ready::before {
    --st-mask: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='black'%20stroke-width='2.2'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Ccircle%20cx='12'%20cy='12'%20r='9'/%3E%3Cpath%20d='M12%207v5l3%202'/%3E%3C/svg%3E");
}
.status-pill.status-inprogress::before {
    --st-mask: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='black'%3E%3Cpolygon%20points='6%204%2020%2012%206%2020%206%204'/%3E%3C/svg%3E");
}
.status-pill.status-blocked::before {
    --st-mask: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='black'%20stroke-width='2.2'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Crect%20x='5'%20y='11'%20width='14'%20height='10'%20rx='2'/%3E%3Cpath%20d='M8%2011V7a4%204%200%200%201%208%200v4'/%3E%3C/svg%3E");
}
.status-pill.status-cancelled::before {
    --st-mask: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='black'%20stroke-width='2.4'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Ccircle%20cx='12'%20cy='12'%20r='10'/%3E%3Cpath%20d='M15%209l-6%206M9%209l6%206'/%3E%3C/svg%3E");
}
.status-pill.pill-draft     { background: var(--color-card-alt);   color: var(--color-text-muted); }
.status-pill.pill-active    { background: var(--color-success-bg); color: var(--color-success); }
.status-pill.pill-onhold    { background: var(--color-warning-bg); color: var(--color-warning); }
.status-pill.pill-completed { background: var(--color-info-bg);    color: var(--color-info); }
.status-pill.pill-cancelled { background: var(--color-danger-bg);  color: var(--color-danger); }
.status-pill.pill-archived  { background: var(--color-card-alt);   color: var(--color-text-faint); }


/* === Priority pills (delt mellem komponenter) === */
.priority-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 11px;
    border-radius: var(--radius-pill, 999px);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    vertical-align: middle;
    background: var(--color-card-alt);
    color: var(--color-text-muted);
    border: 1px solid var(--color-border);
}
.priority-pill::before {
    content: "";
    display: inline-block;
    width: 13px; height: 13px;
    margin-right: 6px;
    vertical-align: -2px;
    flex: none;
    background-color: currentColor;
    -webkit-mask: var(--flag-mask) center / contain no-repeat;
    mask: var(--flag-mask) center / contain no-repeat;
    --flag-mask: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='black'%20stroke='black'%20stroke-width='2'%20stroke-linejoin='round'%3E%3Cpath%20d='M4%2015s1-1%204-1%205%202%208%202%204-1%204-1V3s-1%201-4%201-5-2-8-2-4%201-4%201z'/%3E%3Cpath%20d='M4%2022v-7'%20fill='none'/%3E%3C/svg%3E");
}
.priority-pill.priority-low::before     { color: var(--color-text-faint); }
.priority-pill.priority-normal::before  { color: var(--color-success); }
.priority-pill.priority-high::before    { color: var(--color-warning); }
.priority-pill.priority-urgent::before  { color: var(--color-danger); }


/* === Categories + DisplayId === */
.cat-pill {
    display: inline-block;
    color: white;
    font-weight: 700;
    font-size: 11px;
    letter-spacing: 0.5px;
    padding: 3px 10px;
    border-radius: var(--radius-pill, 999px);
    white-space: nowrap;
}



/* Wrapper-variant: InlineSelect-baseret pille i ProjectDetail */




/* Wrapper-variant til ProjectDetail naar InlineSelect bruger cat-pill */

.id-cell {
    width: 1%;
    white-space: nowrap;
}
.bc-id {
    background: var(--color-card-alt, #F1EFE8);
    color: var(--color-text-muted, #6B6B65);
    padding: 1px 8px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 12px;
    font-weight: 600;
}
.bc-sep {
    color: var(--color-text-faint, #999);
    margin: 0 4px;
}


/* === Category filter chips === */
.cat-filter-bar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin: 0 0 14px;
    padding: 4px 0;
}
.cat-chip {
    background: var(--color-card, white);
    border: 1px solid var(--color-border, #E5E3DA);
    border-radius: var(--radius-pill, 999px);
    padding: 5px 14px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    color: var(--color-text-muted, #6B6B65);
    transition: all 0.15s;
}
.cat-chip:hover {
    background: var(--color-card-alt, #F1EFE8);
}
.cat-chip.active {
    background: var(--color-text, #1f1f1f);
    color: white;
    border-color: var(--color-text, #1f1f1f);
}
.cat-chip .count {
    opacity: 0.6;
    margin-left: 6px;
    font-weight: 400;
}

/* Wrapper bruges naar InlineSelect rendrer cat-pill - tvinger farve via CSS variable */
.cat-pill-wrap .cat-pill,
.cat-pill-wrap .inline-select-display.cat-pill,
.cat-pill-wrap .inline-select-input.cat-pill {
    background: var(--cat-bg, #999) !important;
    color: var(--cat-text, white) !important;
}


/* === Activity feed v2 (to-linjes rows) === */
.activity-section {
    box-shadow: var(--shadow-card);
    margin-top: 32px;
    padding: 20px 24px;
    background: var(--color-card, white);
    border: 1px solid var(--color-border, #E5E3DA);
    border-radius: 8px;
}
.activity-header {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 16px;
}
.activity-heading {
    margin: 0;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-text-muted, #6B6B65);
}
.activity-count {
    font-size: 12px;
    color: var(--color-text-faint, #999);
}
.activity-empty {
    color: var(--color-text-muted, #6B6B65);
    font-style: italic;
    margin: 0;
}
.activity-list-v2 {
    display: flex;
    flex-direction: column;
}
.act-row {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 12px 0;
    border-bottom: 1px solid var(--color-border-faint, #EFEDE6);
}
.act-row:last-child {
    border-bottom: none;
}
.act-time-col {
    flex-shrink: 0;
    width: 70px;
    font-variant-numeric: tabular-nums;
}
.act-date {
    font-size: 12px;
    color: var(--color-text-muted, #6B6B65);
    font-weight: 500;
}
.act-clock {
    font-size: 11px;
    color: var(--color-text-faint, #999);
    margin-top: 1px;
}
.act-body-col {
    flex: 1;
    min-width: 0;
}
.act-line-1 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
    flex-wrap: wrap;
}
.act-pill {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
    white-space: nowrap;
}
.act-id {
    font-family: monospace;
    font-size: 11px;
    font-weight: 600;
    color: var(--color-text-muted, #6B6B65);
    background: var(--color-card-alt, #F1EFE8);
    padding: 1px 7px;
    border-radius: 4px;
}
.act-id-title {
    font-size: 12px;
    color: var(--color-text-muted, #6B6B65);
}
.act-line-2 {
    font-size: 13px;
    color: var(--color-text, #1f1f1f);
    margin-bottom: 2px;
}
.act-line-3 {
    font-size: 11px;
    color: var(--color-text-faint, #999);
}
.activity-more {
    margin-top: 16px;
    width: 100%;
}


/* === Audit page === */
.audit-page {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
}
.audit-header {
    margin-bottom: 20px;
}
.audit-title {
    margin: 0 0 4px;
    font-size: 24px;
    font-weight: 700;
}
.audit-sub {
    margin: 0;
    color: var(--color-text-muted, #6B6B65);
    font-size: 13px;
}
.audit-filter-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
    align-items: center;
}
.audit-search {
    flex: 1;
    min-width: 200px;
    padding: 7px 12px;
    border: 1px solid var(--color-border, #E5E3DA);
    border-radius: 6px;
    font-size: 13px;
    background: var(--color-card, white);
}
.audit-search:disabled {
    background: var(--color-card-alt, #F1EFE8);
    color: var(--color-text-faint, #999);
    cursor: not-allowed;
}
.audit-filter {
    padding: 7px 10px;
    border: 1px solid var(--color-border, #E5E3DA);
    border-radius: 6px;
    background: var(--color-card, white);
    font-size: 13px;
    cursor: pointer;
    flex-shrink: 0;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
}
/* Faste bredder per dropdown - position 2,3,4,5 efter search-felt */
.audit-filter-bar > .audit-filter:nth-of-type(1) { width: 150px; }  /* periode */
.audit-filter-bar > .audit-filter:nth-of-type(2) { width: 180px; }  /* handling */
.audit-filter-bar > .audit-filter:nth-of-type(3) { width: 260px; }  /* projekt */
.audit-filter-bar > .audit-filter:nth-of-type(4) { width: 150px; }  /* kategori */
.audit-csv {
    padding: 7px 14px;
    font-size: 12px;
}
.audit-summary {
    font-size: 12px;
    color: var(--color-text-muted, #6B6B65);
    margin-bottom: 12px;
}
.audit-empty {
    padding: 40px;
    text-align: center;
    color: var(--color-text-muted, #6B6B65);
    background: var(--color-card, white);
    border: 1px solid var(--color-border, #E5E3DA);
    border-radius: 8px;
    font-style: italic;
}
.audit-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    box-shadow: var(--shadow-card);
    background: var(--color-card, white);
    border: 1px solid var(--color-border, #E5E3DA);
    border-radius: 8px;
    overflow: hidden;
    font-size: 13px;
}
.audit-table thead th {
    text-align: left;
    padding: 10px 14px;
    background: var(--color-card-alt, #F1EFE8);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-text-muted, #6B6B65);
    border-bottom: 1px solid var(--color-border, #E5E3DA);
}
.audit-table tbody td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--color-border-faint, #EFEDE6);
    vertical-align: top;
}
.audit-table tbody tr:last-child td {
    border-bottom: none;
}
.col-time {
    width: 120px;
    color: var(--color-text-muted, #6B6B65);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.col-user {
    width: 130px;
    color: var(--color-text, #1f1f1f);
    white-space: nowrap;
}
.col-id {
    width: 130px;
}
.audit-id-link {
    font-family: monospace;
    font-size: 11px;
    font-weight: 600;
    background: var(--color-card-alt, #F1EFE8);
    color: var(--color-text, #1f1f1f);
    padding: 2px 8px;
    border-radius: 4px;
    text-decoration: none;
}
.audit-id-link:hover {
    background: var(--color-border, #E5E3DA);
}
.col-action {
    width: 130px;
}
.col-detail {
    color: var(--color-text, #1f1f1f);
}
.col-project {
    width: 200px;
}
.audit-project-link {
    color: var(--color-link, #3A6FC2);
    text-decoration: none;
}
.audit-project-link:hover {
    text-decoration: underline;
}
.audit-more {
    margin-top: 16px;
    width: 100%;
}


/* === Custom field add/remove buttons === */
.field-remove-btn {
    background: none;
    border: none;
    color: var(--color-text-faint, #999);
    font-size: 16px;
    line-height: 1;
    padding: 0 4px;
    margin-left: 4px;
    cursor: pointer;
    border-radius: 4px;
    opacity: 0;
    transition: opacity 0.15s, background 0.15s, color 0.15s;
}
.info-row:hover .field-remove-btn {
    opacity: 1;
}
.field-remove-btn:hover {
    background: var(--color-danger-bg, #FDECEC);
    color: var(--color-danger, #C13030);
}
.add-field-row {
    padding: 10px 0 0;
    margin-top: 4px;
    border-top: 1px dashed var(--color-border, #E5E3DA);
    display: flex;
    gap: 8px;
    align-items: center;
}
.add-field-select {
    flex: 1;
    font: inherit;
    padding: 5px 8px;
    border: 1px solid var(--color-info, #3B7EE5);
    border-radius: 6px;
    background: white;
    cursor: pointer;
}
.add-field-cancel {
    background: none;
    border: none;
    color: var(--color-text-muted, #6B6B65);
    font-size: 12px;
    cursor: pointer;
    padding: 4px 8px;
}
.add-field-cancel:hover {
    text-decoration: underline;
}


/* === Info layout (sidebar dl) === */
.info-dl { margin: 0; }
.info-row {
    display: flex;
    justify-content: space-between;
    gap: var(--space-3);
    padding: 6px 0;
    border-bottom: 1px solid var(--color-border);
    font-size: var(--font-size-sm);
}
.info-row dt { color: var(--color-text-muted); margin: 0; }
.info-row dd { margin: 0; color: var(--color-text); text-align: right; }
.info-row .info-tpl { font-style: italic; font-size: var(--font-size-xs); }
.info-divider {
    height: 1px;
    background: var(--color-border);
    margin: var(--space-3) 0;
}
.info-heading {
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 0 var(--space-2);
}
.info-heading { margin: 0; }


/* === Icon buttons + display-id-pill === */
.inline-desc-edit-btn.icon-btn {
    background: none;
    border: 1px solid transparent;
    color: var(--color-text-muted, #6B6B65);
    padding: 4px 6px;
    border-radius: 4px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.inline-desc-edit-btn.icon-btn:hover {
    background: var(--color-card-alt, #F1EFE8);
    color: var(--color-text, #1f1f1f);
    border-color: var(--color-border, #E5E3DA);
}
.display-id-pill {
    font-family: monospace;
    font-size: 11px;
    font-weight: 600;
    background: var(--color-card-alt, #F1EFE8);
    color: var(--color-text, #1f1f1f);
    padding: 2px 8px;
    border-radius: 4px;
    text-decoration: none;
    display: inline-block;
}
.display-id-pill:hover {
    background: var(--color-border, #E5E3DA);
    text-decoration: none;
}


/* === Image constraint in description === */
/* Display-mode: billede aldrig bredere end container */
.rich-content img,
.inline-desc-body img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 8px 0;
    border-radius: 4px;
}
/* Edit-mode (Quill): samme constraint inde i editor */
.ql-editor img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 8px 0;
}
/* Sikrer at long-form indhold aldrig overflower cardet */
.inline-desc-body,
.rich-content {
    overflow-wrap: break-word;
    word-wrap: break-word;
    overflow-x: hidden;
}


/* === Flow insert hover-zones === */
.flow-insert-zone {
    cursor: pointer;
}
.flow-insert-btn {
    opacity: 0;
    transition: opacity 0.15s ease;
    pointer-events: none;
}
.flow-insert-zone:hover .flow-insert-btn {
    opacity: 1;
}
.flow-insert-zone:hover circle {
    filter: drop-shadow(0 2px 4px rgba(55, 138, 221, 0.4));
}


/* === FlowView step-column === */
.fv-step-col {
    width: 50px;
    text-align: center;
}
.fv-step {
    display: inline-block;
    font-family: monospace;
    font-size: 11px;
    font-weight: 600;
    background: var(--color-card-alt, #F1EFE8);
    color: var(--color-text, #1f1f1f);
    padding: 2px 8px;
    border-radius: 4px;
    min-width: 28px;
}


/* === Dependency manage (tre prikker) === */
.card-heading-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}
.card-heading-row .card-heading {
    margin: 0;
}
.dep-manage-btn {
    background: none;
    border: 1px solid transparent;
    color: var(--color-text-muted, #6B6B65);
    padding: 4px 6px;
    border-radius: 4px;
    cursor: pointer;
    display: inline-flex;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.dep-manage-btn:hover {
    background: var(--color-card-alt, #F1EFE8);
    color: var(--color-text, #1f1f1f);
    border-color: var(--color-border, #E5E3DA);
}
.dep-edit-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 8px 0;
}
.dep-edit-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
}
.dep-edit-row:hover {
    background: var(--color-card-alt, #F1EFE8);
}
.dep-edit-row input[type=checkbox] {
    cursor: pointer;
}
.dep-edit-error {
    margin: 8px 0 0;
    padding: 6px 8px;
    background: var(--color-danger-bg, #FDECEC);
    color: var(--color-danger, #C13030);
    font-size: 12px;
    border-radius: 4px;
}
.dep-edit-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}
.dep-empty {
    font-size: 12px;
    color: var(--color-text-muted, #6B6B65);
    font-style: italic;
    margin: 8px 0 0;
}


/* === Flow editor page === */
.flow-edit-page {
    max-width: 1400px;
    margin: 0 auto;
    padding: 16px 24px 32px;
}
.flow-edit-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 12px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--color-border, #E5E3DA);
}
.flow-edit-back {
    display: flex;
    align-items: center;
    gap: 10px;
}
.back-link {
    color: var(--color-text-muted, #6B6B65);
    display: inline-flex;
    padding: 4px;
    border-radius: 4px;
}
.back-link:hover {
    background: var(--color-card-alt, #F1EFE8);
    color: var(--color-text, #1f1f1f);
}
.flow-edit-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text, #1f1f1f);
}
.flow-edit-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}
.flow-edit-dirty {
    font-size: 12px;
    color: var(--color-warning, #D89030);
    font-style: italic;
}
.flow-edit-error {
    font-size: 12px;
    color: var(--color-danger, #C13030);
    max-width: 300px;
}
.flow-edit-body {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 16px;
    margin-bottom: 16px;
}
.flow-edit-canvas {
    background: white;
    border: 1px solid var(--color-border, #E5E3DA);
    border-radius: 8px;
    padding: 16px;
    min-height: 300px;
}
.flow-edit-hint {
    margin-top: 12px;
    font-size: 12px;
    color: var(--color-text-muted, #6B6B65);
    font-style: italic;
    text-align: center;
}
.flow-edit-panel {
    background: white;
    border: 1px solid var(--color-border, #E5E3DA);
    border-radius: 8px;
    padding: 16px;
    height: fit-content;
    position: sticky;
    top: 16px;
}
.flow-edit-panel-empty {
    text-align: center;
    color: var(--color-text-muted, #6B6B65);
    font-size: 12px;
    padding: 20px 0;
}
.panel-empty-icon {
    font-size: 20px;
    margin: 0 0 8px;
    opacity: 0.5;
}
.panel-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-text-muted, #6B6B65);
    margin: 0 0 6px;
    font-weight: 600;
}
.panel-task-title {
    font-size: 14px;
    font-weight: 500;
    margin: 0 0 4px;
}
.panel-task-meta {
    font-size: 11px;
    color: var(--color-text-muted, #6B6B65);
    margin: 0 0 16px;
}
.panel-section {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--color-border-faint, #EFEDE6);
}
.panel-empty-text {
    font-size: 11px;
    color: var(--color-text-muted, #6B6B65);
    font-style: italic;
    margin: 4px 0;
}
.panel-dep-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
    background: var(--color-card-alt, #F1EFE8);
    border-radius: 4px;
    margin: 4px 0;
    font-size: 12px;
}
.panel-dep-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.panel-dep-dot.status-done { background: #1D9E75; }
.panel-dep-dot.status-inprogress { background: #378ADD; }
.panel-dep-dot.status-ready { background: #378ADD; }
.panel-dep-dot.status-blocked { background: #D3D1C7; }
.panel-dep-dot.status-cancelled { background: #888780; }
.panel-dep-title {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.panel-dep-remove {
    background: none;
    border: none;
    color: var(--color-text-muted, #999);
    cursor: pointer;
    font-size: 16px;
    padding: 0 4px;
    border-radius: 4px;
}
.panel-dep-remove:hover {
    background: var(--color-danger-bg, #FDECEC);
    color: var(--color-danger, #C13030);
}
.panel-add-select {
    width: 100%;
    margin-top: 6px;
    padding: 6px 8px;
    border: 1px dashed var(--color-border, #E5E3DA);
    border-radius: 4px;
    background: white;
    font-size: 12px;
    color: var(--color-text-info, #378ADD);
    cursor: pointer;
}
.flow-edit-tasklist {
    background: white;
    border: 1px solid var(--color-border, #E5E3DA);
    border-radius: 8px;
    padding: 12px 16px;
}
.flow-edit-task-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}
.task-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: var(--color-card-alt, #F1EFE8);
    border: 1px solid transparent;
    border-radius: 12px;
    font-size: 12px;
    cursor: pointer;
    color: var(--color-text, #1f1f1f);
}
.task-chip:hover {
    background: var(--color-border, #E5E3DA);
}
.task-chip.selected {
    background: #E6F1FB;
    border-color: #378ADD;
    color: #185FA5;
    font-weight: 500;
}
.task-chip-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

/* === FlowView edit-link === */
.fv-tabs-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.fv-edit-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    font-size: 12px;
    color: var(--color-text-info, #378ADD);
    text-decoration: none;
    border: 1px solid var(--color-border, #E5E3DA);
    border-radius: 6px;
    background: white;
}
.fv-edit-link:hover {
    background: var(--color-card-alt, #F1EFE8);
    text-decoration: none;
}

/* === Form system v2 (additive - layout/grouping for editor forms) === */

.field-row.cols-3 {
    grid-template-columns: 1fr 1fr 1fr;
}
@media (max-width: 640px) {
    .field-row,
    .field-row.cols-3 {
        grid-template-columns: 1fr;
    }
}

.field-group {
    margin-top: var(--space-4);
    padding-top: var(--space-4);
    border-top: 1px solid var(--color-border);
}
.field-group-head {
    margin-bottom: var(--space-3);
}
.field-group-title {
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-medium);
    color: var(--color-text);
}
.field-group-sub {
    font-size: var(--font-size-sm);
    color: var(--color-text-faint);
    margin: 2px 0 0;
}

.input-unit {
    position: relative;
}
.input-unit > .unit {
    position: absolute;
    right: var(--space-3);
    top: 50%;
    transform: translateY(-50%);
    font-size: var(--font-size-xs);
    color: var(--color-text-faint);
    pointer-events: none;
}
.input-unit input {
    padding-right: 46px;
}

.field textarea.autogrow {
    min-height: 120px;
    overflow: hidden;
    resize: none;
}

.actions.actions-split {
    justify-content: space-between;
}
.actions-group {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.switch {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    cursor: pointer;
    user-select: none;
}
.switch input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}
.switch .switch-track {
    position: relative;
    width: 42px;
    height: 24px;
    flex-shrink: 0;
    background: var(--color-border-strong);
    border-radius: var(--radius-pill);
    transition: background 0.15s;
}
.switch .switch-track::before {
    content: "";
    position: absolute;
    left: 3px;
    top: 3px;
    width: 18px;
    height: 18px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    transition: transform 0.15s;
}
.switch input:checked + .switch-track {
    background: var(--color-brand-navy);
}
.switch input:checked + .switch-track::before {
    transform: translateX(18px);
}
.switch input:focus-visible + .switch-track {
    box-shadow: 0 0 0 3px rgba(15, 40, 73, 0.15);
}
.switch .switch-label {
    font-size: var(--font-size-sm);
    color: var(--color-text);
}

/* === Phase editor (skabelon-faser) === */
.phase-empty {
    font-size: var(--font-size-sm);
    color: var(--color-text-faint);
    font-style: italic;
    margin: 0 0 var(--space-3);
}
.phase-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
}
.phase-row {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}
.phase-num {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-pill);
    background: var(--color-card-alt);
    color: var(--color-text-muted);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
}
.phase-name {
    flex: 1;
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: var(--font-size-base);
    color: var(--color-text);
    background: var(--color-card);
}
.phase-name:focus {
    outline: none;
    border-color: var(--color-brand-navy);
    box-shadow: 0 0 0 3px rgba(15, 40, 73, 0.08);
}
.phase-row-btns {
    display: flex;
    gap: 2px;
    flex-shrink: 0;
}
.phase-btn {
    background: none;
    border: 1px solid transparent;
    color: var(--color-text-muted);
    width: 28px;
    height: 28px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
}
.phase-btn:hover:not(:disabled) {
    background: var(--color-card-alt);
    color: var(--color-text);
    border-color: var(--color-border);
}
.phase-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.phase-btn-del:hover:not(:disabled) {
    background: var(--color-danger-bg);
    color: var(--color-danger);
    border-color: var(--color-danger);
}

/* ===== Required field marker (form-system v2) ===== */
.field.required > label::after {
    content: " *";
    color: var(--color-danger);
    font-weight: 600;
}
.required-mark {
    color: var(--color-danger);
    font-weight: 600;
    margin-left: 2px;
}

/* ===== Invalid field state (form-system v2) ===== */
.field.invalid input,
.field.invalid select,
.field.invalid textarea {
    border-color: var(--color-danger);
}

/* === OpgaveTabel === */
.opg-toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.opg-search { flex: 1 1 200px; min-width: 160px; padding: 6px 10px; border: 1px solid var(--color-border, #e3e3df); border-radius: 6px; background: var(--color-card, #fff); color: var(--color-text, #2b2b27); }
.opg-filter { padding: 6px 10px; border: 1px solid var(--color-border, #e3e3df); border-radius: 6px; background: var(--color-card, #fff); color: var(--color-text, #2b2b27); }
.opg-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.opg-table thead th { text-align: left; font-weight: 600; color: var(--color-text-muted, #6B6B65); border-bottom: 1px solid var(--color-border, #e3e3df); padding: 8px 10px; white-space: nowrap; }
.opg-table tbody td { border-bottom: 1px solid var(--color-border, #eceae4); padding: 8px 10px; vertical-align: middle; }
.opg-table tbody tr:hover { background: var(--color-card-alt, #f7f7f4); }
.opg-sortable { cursor: pointer; user-select: none; }
.opg-sortable:hover { color: var(--color-text, #2b2b27); }
.opg-num { text-align: right; white-space: nowrap; }
.opg-title { font-weight: 500; color: var(--color-text, #2b2b27); }
.opg-muted { color: var(--color-text-faint, #a3a39c); }
.opg-actions { text-align: right; }

/* card-grid-2: to korte kort side om side (layout C) */
.card-grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-4); align-items: stretch; margin-bottom: var(--space-4); }
.card-grid-2 > .card { margin-bottom: 0; }
@media (max-width: 860px) { .card-grid-2 { grid-template-columns: 1fr; } }

/* tpl-fields: ekstra felter inline paa Metadata-kortet */
.tpl-fields { margin-top: var(--space-4); padding-top: var(--space-4); border-top: 1px solid var(--color-border); }
.tpl-fields-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.tpl-fields-title { font-size: var(--font-size-sm); font-weight: var(--font-weight-semibold); color: var(--color-text-muted); }
.tpl-fields-sub { font-size: var(--font-size-xs); color: var(--color-text-faint); }
.tpl-field-row { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-top: 0.5px solid var(--color-border); }
.tpl-field-row:first-child { border-top: none; }
.tpl-field-main { flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0; }
.tpl-field-name { font-weight: 500; }
.tpl-fields-actions { display: flex; align-items: center; gap: 12px; margin-top: 10px; }

/* === Task-status pille-farver (delt; InlineStatusPill bruges paa flere sider) === */
.status-pill.status-blocked    { background: var(--color-card-alt);   color: var(--color-text-muted); }
.status-pill.status-ready      { background: var(--color-info-bg);    color: var(--color-info); }
.status-pill.status-inprogress { background: var(--color-info-bg);    color: var(--color-info); }
.status-pill.status-done       { background: var(--color-success-bg); color: var(--color-success); }
.status-pill.status-cancelled  { background: var(--color-card-alt);   color: var(--color-text-faint); }

/* Konsol/kode-skrift i rich text editor (#202) */
.ql-editor pre,
.ql-editor pre.ql-syntax,
.ql-editor code {
    font-family: var(--font-mono) !important;
}

/* ============================================================
   Increment 4: kategori-chips + filter (skabelon-oversigter)
   ============================================================ */
.cat-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 16px;
}
.cat-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border: 1px solid var(--border-color, #d9d9d4);
    border-radius: 999px;
    background: var(--surface, #ffffff);
    color: var(--text-color, #2b2b27);
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
    transition: background .12s ease, border-color .12s ease, color .12s ease;
}
.cat-filter-chip:hover {
    background: var(--surface-hover, #f2f2ee);
}
.cat-filter-chip.active {
    background: var(--accent, #2b2b27);
    border-color: var(--accent, #2b2b27);
    color: #ffffff;
}
.cat-filter-chip.active .cat-dot {
    box-shadow: 0 0 0 1px rgba(255,255,255,.55);
}
.cat-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-muted, #6b6b65);
}
.cat-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex: 0 0 auto;
    display: inline-block;
}

/* Trin A: custom fields flyttet til egen sektion under flow-boks */
.project-fields-section { margin: 24px 0 0; }
.project-fields-section .pf-heading {
    font-size: 13px; font-weight: 600; text-transform: uppercase;
    letter-spacing: .04em; color: var(--text-muted, #6b6b65); margin: 0 0 12px;
}

/* Trin B: Referencer-sektion */
.project-refs-section { margin: 24px 0 0; }
.ref-list { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.ref-item { display: flex; align-items: center; gap: 8px; }
.ref-link { color: var(--accent, #2b59ff); text-decoration: none; word-break: break-all; }
.ref-link:hover { text-decoration: underline; }
.ref-remove { border: none; background: none; color: var(--text-muted, #6b6b65); cursor: pointer; font-size: 13px; padding: 2px; }
.ref-entry { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ref-input { padding: 6px 10px; border: 1px solid var(--border-color, #d9d9d4); border-radius: 8px; font-size: 13px; min-width: 200px; }
.ref-entry-actions { display: flex; gap: 8px; }
.ref-cancel, .ref-add { padding: 6px 12px; border-radius: 8px; border: 1px solid var(--border-color, #d9d9d4); background: var(--surface, #fff); cursor: pointer; font-size: 13px; }
.ref-add { background: var(--accent, #2b2b27); color: #fff; border-color: var(--accent, #2b2b27); }

/* Trin B-justering: Referencer som sidebar-kort, Felter under beskrivelse */
.stamdata-card { margin-top: 16px; }
.stamdata-card .kunde-eyebrow { margin-bottom: 8px; }
.stamdata-list { display: flex; flex-direction: column; }
.stamdata-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 0.5px solid var(--color-border, #E5E3DA); min-width: 0; }
.stamdata-row:last-child { border-bottom: none; }
.stamdata-key { font-size: 12px; color: var(--text-muted, #6b6b65); white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; }
.stamdata-remove { opacity: 0; transition: opacity .15s; border: none; background: none; color: var(--text-muted, #6b6b65); cursor: pointer; font-size: 13px; line-height: 1; padding: 0 2px; }
.stamdata-row:hover .stamdata-remove { opacity: 1; }
.stamdata-val { font-size: 13px; text-align: right; min-width: 0; flex: 1 1 auto; }
.list-add-btn { width: 24px; height: 24px; border-radius: 6px; background: none; border: 0.5px dashed var(--color-border, #E5E3DA); color: var(--text-muted, #9CA3AF); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; font-size: 16px; font-weight: 400; line-height: 1; padding: 0 0 2px 0; margin-top: 10px; transition: border-color .12s, color .12s, background .12s; }
.list-add-btn:hover { border-color: var(--accent, #2b59ff); color: var(--accent, #2b59ff); background: var(--color-hover, #F3F4F6); }
.list-add-row { display: flex; justify-content: center; margin-top: 8px; }

.pcard { background: var(--color-card, white); border: 1px solid var(--color-border, #E5E3DA); border-radius: var(--radius-md, 10px); box-shadow: var(--shadow-card); padding: 14px 18px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.pcard-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 18px; margin-bottom: 2px; }
.pcard-title { font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: .8px; color: var(--color-text-muted, #6B6B65); }
.pcard-tools { display: flex; align-items: center; gap: 6px; opacity: 0; transition: opacity .12s ease; }
.pcard:hover .pcard-tools { opacity: 1; }
.pcard-del { border: none; background: transparent; color: var(--color-text-muted, #9CA3AF); cursor: pointer; padding: 2px; border-radius: 4px; display: inline-flex; }
.pcard-del:hover { color: #DC2626; background: #FEE2E2; }
.pcard-text { width: 100%; box-sizing: border-box; border: none; outline: none; padding: 0; font-size: 14px; line-height: 1.55; font-family: inherit; color: inherit; resize: vertical; min-height: 44px; background: transparent; }
.pcard-text::placeholder { color: var(--color-text-muted, #9CA3AF); }
.pc-list { display: flex; flex-direction: column; gap: 2px; }
.pc-li { display: flex; align-items: center; gap: 8px; }
.pc-li-mark { width: 18px; text-align: center; color: var(--color-text-muted, #9CA3AF); font-size: 13px; flex-shrink: 0; }
.pc-li-text { flex: 1; border: none; outline: none; background: transparent; font-size: 14px; font-family: inherit; color: inherit; padding: 2px 0; }
.pc-li-text.is-done { text-decoration: line-through; color: var(--color-text-muted, #9CA3AF); }
.pc-li-del { border: none; background: transparent; color: var(--color-text-muted, #C7C7C0); cursor: pointer; font-size: 16px; line-height: 1; padding: 0 4px; opacity: 0; transition: opacity .12s ease; }
.pc-li:hover .pc-li-del { opacity: 1; }
.pc-insert { position: absolute; left: -10px; top: -10px; width: 20px; height: 20px; border-radius: 50%; border: 1px dashed var(--color-border, #D7D3C7); background: var(--color-card, #fff); color: var(--color-text-muted, #9CA3AF); font-size: 14px; line-height: 17px; text-align: center; cursor: pointer; opacity: 0; transition: opacity .12s ease; z-index: 16; padding: 0; }
.canvas-block:hover > .pc-insert { opacity: 1; }
.pc-insert-menu { position: absolute; left: -10px; top: 14px; background: var(--color-card, #fff); border: 1px solid var(--color-border, #E5E3DA); border-radius: 8px; box-shadow: var(--shadow-card-hover, 0 4px 14px rgba(16,24,40,.12)); padding: 4px; z-index: 30; display: flex; flex-direction: column; min-width: 150px; }
.pc-insert-menu button { text-align: left; border: none; background: transparent; padding: 7px 10px; border-radius: 6px; cursor: pointer; font-size: 13px; color: inherit; }
.pc-insert-menu button:hover { background: var(--color-bg-subtle, #F5F4EF); }
.pc-tail-insert { position: relative; display: flex; justify-content: center; padding-top: 4px; }
.pc-tail-btn { width: 24px; height: 24px; border-radius: 50%; border: 1px dashed var(--color-border, #D7D3C7); background: var(--color-card, #fff); color: var(--color-text-muted, #9CA3AF); font-size: 15px; line-height: 21px; cursor: pointer; opacity: .5; transition: opacity .12s ease; padding: 0; }
.pc-tail-btn:hover { opacity: 1; }
.pc-tail-insert .pc-insert-menu { left: 50%; transform: translateX(-50%); top: 30px; }

.pc-drop-line { position: absolute; background: var(--accent, #2b59ff); border-radius: 2px; z-index: 20; pointer-events: none; display: none; }
.menu-backdrop { position: fixed; inset: 0; z-index: 40; background: transparent; }
.stamdata-add-menu { position: relative; z-index: 41; margin-top: 10px; display: flex; flex-direction: column; border: 0.5px solid var(--color-border, #E5E3DA); border-radius: 8px; background: #fff; padding: 4px; box-shadow: var(--shadow-card-hover, 0 4px 14px rgba(16,24,40,.12)); }
.stamdata-add-item { text-align: left; background: none; border: none; padding: 7px 10px; border-radius: 6px; font-size: 13px; color: var(--color-text, #2A2A28); cursor: pointer; }
.stamdata-add-item:hover { background: var(--color-hover, #F3F4F6); }
.stamdata-add-empty { padding: 7px 10px; font-size: 13px; color: var(--text-muted, #6b6b65); }
.refs-card { margin-top: 16px; }
.refs-card .kunde-eyebrow { margin-bottom: 8px; }
.refs-card .ref-list { margin: 0; }

/* #241 - Referencer redesign: raekker med ikon + host */
.refs-card .ref-list { display: flex; flex-direction: column; gap: 6px; padding: 0; margin: 0; list-style: none; }
.refs-card .ref-item { display: flex; align-items: center; gap: 2px; }
.ref-row { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border-color, #e5e3da); border-radius: 8px; text-decoration: none; color: inherit; transition: border-color .15s, background .15s; }
.ref-row:hover { border-color: var(--accent, #2b59ff); background: var(--color-info-bg, #f3f6ff); }
.ref-ic { color: var(--accent, #2b59ff); display: flex; flex: 0 0 auto; }
.ref-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.ref-label { font-size: 13px; font-weight: 600; color: var(--text-color, #2b2b27); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ref-host { font-size: 11px; color: var(--text-muted, #6b6b65); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ref-ext { color: var(--text-muted, #9a988f); flex: 0 0 auto; }
.refs-card .ref-remove { opacity: 0; transition: opacity .15s; flex: 0 0 auto; border: none; background: none; color: var(--text-muted, #6b6b65); cursor: pointer; font-size: 12px; padding: 2px 4px; }
.refs-card .ref-item:hover .ref-remove { opacity: 1; }

/* === WYSIWYG #258: .ql-editor (redigering) matcher .rich-content (visning) === */
.rich-editor-container .ql-editor p { margin: 0 0 var(--space-2); }
.rich-editor-container .ql-editor p:last-child { margin-bottom: 0; }
.rich-editor-container .ql-editor ul,
.rich-editor-container .ql-editor ol { margin: 0 0 var(--space-2); }
.rich-editor-container .ql-editor h2 { font-size: var(--font-size-lg); margin: var(--space-3) 0 var(--space-2); }
.rich-editor-container .ql-editor h3 { font-size: var(--font-size-base); margin: var(--space-3) 0 var(--space-2); }
.rich-editor-container .ql-editor blockquote { border-left: 3px solid var(--color-border); padding-left: var(--space-3); color: var(--color-text-muted); margin: 0 0 var(--space-2); }

/* Foldbar aktivitet-sektion (klikbar header + chevron) */
.activity-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    background: none;
    border: none;
    font: inherit;
    cursor: pointer;
    text-align: left;
    padding: 0;
}
.activity-toggle .activity-heading { margin: 0; }
.activity-toggle .activity-chev {
    margin-left: auto;
    color: var(--color-text-muted, #9AA0A6);
    transition: transform 0.18s ease;
    flex-shrink: 0;
}
.activity-toggle:hover .activity-chev { color: var(--color-info, #3B7EE5); }
.activity-toggle.is-open .activity-chev { transform: rotate(180deg); }
.activity-toggle:not(.is-open) { margin-bottom: 0; }

/* === Forening projekt+skabelon: faelles layout (Etape 1, flyttet fra ProjectDetail scoped) === */
.project-header {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-5) var(--space-6);
    margin-bottom: var(--space-4);
    box-shadow: var(--shadow-card);
}
.header-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--space-4);
    margin-bottom: var(--space-2);
}
.title-block {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex-wrap: wrap;
    min-width: 0;
}
.title-block h2 {
    margin: 0;
    font-size: var(--font-size-2xl);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text);
    letter-spacing: -0.01em;
}
.header-actions {
    display: flex;
    gap: var(--space-2);
    align-items: center;
    flex-wrap: wrap;
}
.ps-tiles {
    display: flex;
    flex-wrap: nowrap;
    gap: var(--space-4);
    align-items: stretch;
}
.ps-main {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 376px;
    gap: var(--space-4);
    align-items: start;
}
.ps-left {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    min-width: 0;
}
.ps-side {
    min-width: 0;
    position: sticky;
    top: var(--space-4);
    align-self: start;
}
.dt-tile {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    padding: var(--space-3) var(--space-4);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex: 1 1 0;
    min-width: 0;
}
.dt-ic {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-md);
    background: color-mix(in srgb, var(--color-accent) 12%, transparent);
    color: var(--color-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}
.dt-body { min-width: 0; }
.dt-label {
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--color-text-faint);
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.dt-val {
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text);
}
.ps-meta {
    border-top: 1px solid var(--color-border);
    margin-top: var(--space-3);
    padding-top: var(--space-4);
    gap: 0;
}
.ps-meta .dt-tile {
    background: transparent;
    border: none;
    box-shadow: none;
    border-radius: 0;
    padding: 0 var(--space-4);
    flex: 1 1 0;
}
.ps-meta .dt-tile:first-child { padding-left: 0; }
.ps-meta .dt-tile + .dt-tile { border-left: 1px solid var(--color-border); }
.ps-meta .dt-ic { width: 30px; height: 30px; }
@media (max-width: 1100px) {
    .ps-main { grid-template-columns: 1fr; }
    .ps-side { position: static; }
    .ps-tiles { flex-wrap: wrap; }
    .ps-meta { flex-wrap: wrap; gap: var(--space-3) 0; }
    .ps-meta .dt-tile { flex: 1 1 45%; padding-left: 0; }
    .ps-meta .dt-tile + .dt-tile { border-left: none; }
}

/* === Breadcrumb (flyttet fra ProjectDetail scoped saa skabelon-siden ogsaa faar den) === */
.bc-trail {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    font-size: 15px;
    font-weight: 600;
    margin-bottom: var(--space-3);
    max-width: 100%;
}
.bc-trail .bct-home {
    width: 30px; height: 30px;
    border-radius: 8px;
    border: 1.5px solid var(--color-border-strong);
    background: var(--color-card);
    color: var(--color-text-muted);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    text-decoration: none;
    transition: border-color .15s, color .15s;
}
.bc-trail .bct-home:hover {
    border-color: var(--color-breadcrumb-accent);
    color: var(--color-breadcrumb-accent);
}
.bc-trail .bct-chev { color: var(--color-border-strong); flex: none; }
.bc-trail .bct-link {
    color: var(--color-text);
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 40ch;
}
.bc-trail .bct-link:hover { text-decoration: underline; }
.bc-trail .bct-cur {
    color: var(--color-breadcrumb-accent);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 44ch;
}

/* Role pill selector (Users-side) - CMS-moenster, grid-alignet */
.rp-selector { display: grid; grid-template-columns: 46px 1fr; gap: 6px 10px; align-items: center; }
.rp-group { display: contents; }
.rp-group-label { font-size: 10px; font-weight: 700; letter-spacing: 0.04em; color: #94a3b8; text-align: left; align-self: center; }
.rp-row { display: grid; grid-template-columns: repeat(4, minmax(0, 118px)); gap: 5px; }
.rp-pill { padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; border: 1px solid transparent; cursor: pointer; background: #f1f5f9; color: #64748b; transition: all 100ms ease; text-align: center; white-space: nowrap; }
.rp-pill.rp-off { background: #f1f5f9; color: #94a3b8; border-color: #e2e8f0; }
.rp-pill.rp-off:hover { border-color: #1B2B5E; color: #475569; }
.rp-pill.rp-on { border: 1px solid; }
.rp-pill.rp-on.role-Projektbruger    { background: #E0E7FF; color: #3730A3; border-color: #E0E7FF; }
.rp-pill.rp-on.role-Skabelondesigner { background: #DBEAFE; color: #1E40AF; border-color: #DBEAFE; }
.rp-pill.rp-on.role-Feltdesigner     { background: #DBEAFE; color: #1E40AF; border-color: #DBEAFE; }
.rp-pill.rp-on.role-Kundeansvarlig   { background: #DBEAFE; color: #1E40AF; border-color: #DBEAFE; }
.rp-pill.rp-on.role-Revisor          { background: #DBEAFE; color: #1E40AF; border-color: #DBEAFE; }
.rp-pill.rp-on.role-Brugeradmin      { background: #FCE7F3; color: #9D174D; border-color: #FCE7F3; }
.rp-pill.rp-on.role-Driftsadmin      { background: #FCE7F3; color: #9D174D; border-color: #FCE7F3; }
.rp-pill.rp-on.role-Systemadmin      { background: #F2EFFB; color: #5B4B8A; border-color: #F2EFFB; }
.rp-pill[disabled] { cursor: not-allowed; }
.rp-pill.rp-implicit { opacity: 0.5; cursor: not-allowed; }
.rp-pill.rp-implicit:hover { opacity: 0.5; }
