/* ============================
   Fullkostkalkyle - Premium UI
   ============================ */

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulseGlow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(109,29,108,0.15); }
    50% { box-shadow: 0 0 0 6px rgba(109,29,108,0.05); }
}

:root {
    /* Core palette - OneCo Purple */
    --primary: #6D1D6C;
    --primary-hover: #8A3A89;
    --primary-deep: #412050;
    --primary-muted: rgba(109,29,108,0.12);

    --success: #10b981;
    --success-bg: #ecfdf5;
    --success-border: #6ee7b7;
    --danger: #f43f5e;
    --danger-bg: #fff1f2;
    --danger-border: #fda4af;
    --warning: #f59e0b;

    /* Surfaces */
    --bg: #f8fafc;
    --bg-card: #ffffff;
    --bg-elevated: #ffffff;
    --bg-subtle: #f1f5f9;
    --bg-muted: #e2e8f0;

    /* Borders */
    --border: #e2e8f0;
    --border-subtle: #f1f5f9;
    --ring: rgba(109,29,108,0.25);

    /* Sidebar */
    --sidebar-bg-start: #1A0E24;
    --sidebar-bg-end: #2D1638;
    --sidebar-surface: rgba(255,255,255,0.04);
    --sidebar-surface-hover: rgba(255,255,255,0.08);
    --sidebar-surface-active: rgba(255,255,255,0.1);
    --sidebar-text: #94a3b8;
    --sidebar-text-bright: #e2e8f0;
    --sidebar-accent: #B85BB7;
    --sidebar-width: 296px;

    /* Text */
    --text: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;

    /* Table */
    --row-hover: rgba(109,29,108,0.04);
    --row-stripe: #fafbfd;
    --calculated-bg: #f8fafc;

    /* Layout */
    --topbar-height: 58px;
    --bottombar-height: 56px;
    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 14px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.04);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.08), 0 8px 10px -6px rgba(0,0,0,0.04);

    /* Font */
    --font: Arial, Helvetica, system-ui, sans-serif;
    --mono: 'Cascadia Code', 'Fira Code', 'JetBrains Mono', 'Consolas', monospace;
}

/* ===== RESET & BASE ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font);
    color: var(--text);
    background: var(--bg);
    display: grid;
    grid-template-areas:
        "topbar  topbar"
        "sidebar main"
        "bottom  bottom";
    grid-template-columns: var(--sidebar-width) 1fr;
    grid-template-rows: var(--topbar-height) 1fr var(--bottombar-height);
    min-height: 100vh;
    line-height: 1.5;
}

/* Custom scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.25); }
#sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); }
#sidebar::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }


/* ===== A. TOPPBAR ===== */
#topbar {
    grid-area: topbar;
    position: sticky;
    top: 0;
    height: var(--topbar-height);
    background: linear-gradient(135deg, #1A0E24 0%, #2D1638 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 100;
    box-shadow: 0 1px 0 rgba(255,255,255,0.04);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.topbar-left h1 {
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #e2e8f0, #fff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 14px;
}

/* Hamburger */
.hamburger {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 38px;
    height: 38px;
    background: none;
    border: 1px solid rgba(255,255,255,0.08);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.hamburger:hover {
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.15);
}

.hamburger:active {
    transform: scale(0.93);
}

.hamburger span {
    display: block;
    width: 18px;
    height: 2px;
    background: #94a3b8;
    border-radius: 2px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.hamburger:hover span {
    background: #e2e8f0;
}

body.sidebar-collapsed .hamburger span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
    background: var(--primary);
}
body.sidebar-collapsed .hamburger span:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}
body.sidebar-collapsed .hamburger span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
    background: var(--primary);
}

.btn-topbar-primary {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 9px 20px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 600;
    font-family: var(--font);
    letter-spacing: -0.01em;
    transition: all 0.2s;
    white-space: nowrap;
    box-shadow: 0 1px 3px rgba(109,29,108,0.3), inset 0 1px 0 rgba(255,255,255,0.1);
}

.btn-topbar-primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 4px 12px rgba(109,29,108,0.35), inset 0 1px 0 rgba(255,255,255,0.1);
    transform: translateY(-1px);
}

.btn-topbar-primary:active {
    transform: translateY(0);
}

.btn-topbar-primary:focus-visible {
    outline: 2px solid rgba(255,255,255,0.5);
    outline-offset: 2px;
}

.save-status {
    font-size: 0.78rem;
    color: rgba(255,255,255,0.5);
    font-weight: 500;
    letter-spacing: -0.01em;
    transition: opacity 0.3s ease;
}


/* ===== B. SIDEBAR ===== */
#sidebar {
    grid-area: sidebar;
    background: linear-gradient(180deg, var(--sidebar-bg-start) 0%, var(--sidebar-bg-end) 100%);
    color: var(--sidebar-text);
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
    z-index: 90;
}

body.sidebar-collapsed {
    grid-template-columns: 0px 1fr;
}

body.sidebar-collapsed #sidebar {
    margin-left: calc(-1 * var(--sidebar-width));
    opacity: 0;
    pointer-events: none;
}

/* Sidebar Tabs */
.sidebar-tabs {
    display: flex;
    padding: 6px 6px 0;
    gap: 2px;
    flex-shrink: 0;
}

.sidebar-tab {
    flex: 1;
    padding: 10px 4px 9px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--sidebar-text);
    font-size: 0.73rem;
    font-weight: 500;
    font-family: var(--font);
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
    white-space: nowrap;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    letter-spacing: 0.01em;
}

.sidebar-tab:hover {
    color: var(--sidebar-text-bright);
    background: var(--sidebar-surface-hover);
}

.sidebar-tab.active {
    color: #fff;
    background: var(--sidebar-surface-active);
    border-bottom-color: var(--sidebar-accent);
}

.sidebar-tab:active {
    transform: scale(0.96);
}

/* Sidebar Panels */
.sidebar-panel {
    display: none;
    flex: 1;
    overflow-y: auto;
    padding: 22px 18px;
    animation: fadeIn 0.2s ease;
}

.sidebar-panel.active {
    display: block;
}

/* Sidebar Form */
.sidebar-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.sidebar-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sidebar-form-group label {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--sidebar-text);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.sidebar-form-group textarea {
    width: 100%;
    padding: 9px 12px;
    background: var(--sidebar-surface);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: var(--radius-sm);
    color: var(--sidebar-text-bright);
    font-size: 0.85rem;
    font-family: var(--font);
    line-height: 1.5;
    resize: vertical;
    min-height: 80px;
    transition: all 0.2s;
}

.sidebar-form-group textarea:hover {
    border-color: rgba(255,255,255,0.15);
    background: var(--sidebar-surface-hover);
}

.sidebar-form-group textarea:focus {
    outline: none;
    border-color: var(--sidebar-accent);
    background: var(--sidebar-surface-hover);
    box-shadow: 0 0 0 3px rgba(138,58,137,0.15);
}

.sidebar-form-group textarea::placeholder {
    color: var(--sidebar-text);
    opacity: 0.6;
}

.sidebar-form-group input,
.sidebar-form-group select {
    width: 100%;
    padding: 9px 12px;
    background: var(--sidebar-surface);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: var(--radius-sm);
    color: var(--sidebar-text-bright);
    font-size: 0.88rem;
    font-family: var(--font);
    transition: all 0.2s;
}

.sidebar-form-group input:hover,
.sidebar-form-group select:hover {
    border-color: rgba(255,255,255,0.15);
    background: var(--sidebar-surface-hover);
}

.sidebar-form-group input:focus,
.sidebar-form-group select:focus {
    outline: none;
    border-color: var(--sidebar-accent);
    background: var(--sidebar-surface-hover);
    box-shadow: 0 0 0 3px rgba(138,58,137,0.15);
}

.sidebar-form-group input[type="number"] {
    font-family: var(--mono);
    text-align: right;
    font-size: 0.85rem;
}

.sidebar-form-group select {
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 28px;
}

.sidebar-form-group select option {
    background: #2D1638;
    color: var(--sidebar-text-bright);
}

/* Param group headings */
.sidebar-param-group {
    margin-bottom: 10px;
}

.sidebar-param-heading {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--sidebar-accent);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 12px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.sidebar-param-group .sidebar-form-group {
    margin-bottom: 14px;
}

/* Authority table in sidebar */
.authority-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.8rem;
}

.authority-table th {
    background: var(--sidebar-surface);
    color: var(--sidebar-text);
    padding: 9px 10px;
    text-align: left;
    font-weight: 600;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.authority-table th:first-child { border-radius: var(--radius-sm) 0 0 0; }
.authority-table th:last-child { border-radius: 0 var(--radius-sm) 0 0; }

.authority-table td {
    padding: 9px 10px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    color: var(--sidebar-text);
}

.authority-table tr.active-level {
    background: linear-gradient(135deg, rgba(109,29,108,0.2), rgba(109,29,108,0.12));
}

.authority-table tr.active-level td {
    color: #fff;
    font-weight: 600;
}

.authority-table tbody tr {
    transition: background 0.15s;
}

.authority-table tbody tr:hover:not(.active-level) {
    background: rgba(255,255,255,0.03);
}

.auth-check {
    color: var(--success);
    font-weight: 700;
}

/* Storage panel */
.sidebar-storage-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar-action-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 13px 14px;
    background: var(--sidebar-surface);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: var(--radius);
    color: var(--sidebar-text-bright);
    font-size: 0.86rem;
    font-weight: 500;
    font-family: var(--font);
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}

.sidebar-action-btn:hover {
    background: var(--sidebar-surface-hover);
    border-color: rgba(255,255,255,0.12);
    transform: translateX(3px);
}

.sidebar-action-btn:active {
    transform: translateX(1px) scale(0.98);
}

.sidebar-action-icon {
    font-size: 1.15rem;
    width: 26px;
    text-align: center;
    opacity: 0.8;
}

.sidebar-action-danger {
    border-color: rgba(244,63,94,0.2);
    color: #fda4af;
}

.sidebar-action-danger:hover {
    background: rgba(244,63,94,0.1);
    border-color: rgba(244,63,94,0.3);
}

.sidebar-action-primary {
    background: rgba(109,29,108,0.15);
    border-color: rgba(109,29,108,0.25);
    color: var(--sidebar-accent);
}

.sidebar-action-primary:hover {
    background: rgba(109,29,108,0.25);
    border-color: rgba(109,29,108,0.35);
}

.shortcut-hint {
    margin-left: auto;
    font-size: 0.65rem;
    font-weight: 600;
    color: rgba(255,255,255,0.25);
    background: rgba(255,255,255,0.06);
    padding: 2px 7px;
    border-radius: 4px;
    letter-spacing: 0.02em;
    font-family: var(--mono);
}

.sidebar-divider {
    border: none;
    border-top: 1px solid rgba(255,255,255,0.06);
    margin: 4px 0;
}


/* ===== DASHBOARD OVERLAY ===== */
.dashboard-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.85);
    z-index: 350;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    animation: fadeIn 0.2s ease;
}

.dashboard-overlay.hidden {
    display: none !important;
}

.dashboard-container {
    width: 94vw;
    max-width: 1300px;
    max-height: 88vh;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: fadeIn 0.2s ease;
}

.dashboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 28px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-card);
    flex-shrink: 0;
    gap: 16px;
}

.dashboard-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.dashboard-header h2 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
}

.dashboard-count {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--bg-subtle);
    padding: 2px 10px;
    border-radius: 20px;
}

.dashboard-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    justify-content: flex-end;
}

.dashboard-search-wrap {
    flex: 1;
    max-width: 340px;
    position: relative;
}

.dashboard-search-wrap::before {
    content: '\1F50D';
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.85rem;
    opacity: 0.4;
    pointer-events: none;
    z-index: 1;
}

.dashboard-search {
    width: 100%;
    padding: 9px 14px 9px 36px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-family: var(--font);
    color: var(--text);
    background: var(--bg);
    transition: all 0.2s;
}

.dashboard-search:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--ring);
    background: #fff;
}

.dashboard-search::placeholder {
    color: var(--text-muted);
}

.btn-close-dashboard {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 1.3rem;
    cursor: pointer;
    padding: 4px 10px;
    line-height: 1;
    border-radius: var(--radius-sm);
    transition: all 0.15s;
    flex-shrink: 0;
}

.btn-close-dashboard:hover {
    background: var(--bg-subtle);
    color: var(--text);
    border-color: var(--text-muted);
}

.btn-close-dashboard:active {
    transform: scale(0.92);
}

/* Dashboard body / table */
.dashboard-body {
    flex: 1;
    overflow-y: auto;
}

.dashboard-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.84rem;
}

.dashboard-table thead {
    position: sticky;
    top: 0;
    z-index: 2;
}

.dashboard-table th {
    background: var(--bg-subtle);
    color: var(--text-secondary);
    padding: 10px 14px;
    text-align: left;
    font-weight: 600;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    user-select: none;
}

.dashboard-table th.dt-sortable {
    cursor: pointer;
    transition: color 0.15s;
}

.dashboard-table th.dt-sortable:hover {
    color: var(--primary);
}

.dashboard-table th.dt-sort-active {
    color: var(--primary);
}

.dashboard-table th.dt-sortable::after {
    content: '';
    display: inline-block;
    width: 0;
    margin-left: 4px;
}

.dashboard-table th.dt-sort-active.dt-sort-asc::after {
    content: ' \2191';
}

.dashboard-table th.dt-sort-active.dt-sort-desc::after {
    content: ' \2193';
}

.dashboard-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-subtle);
    vertical-align: middle;
    color: var(--text);
}

.dashboard-table tbody tr {
    cursor: pointer;
    transition: background 0.1s;
}

.dashboard-table tbody tr:hover {
    background: rgba(109,29,108,0.05);
    box-shadow: inset 3px 0 0 var(--primary);
}

.dashboard-table tbody tr.dt-row-active {
    background: rgba(109,29,108,0.06);
    box-shadow: inset 3px 0 0 var(--primary);
}

.dashboard-table tbody tr.dt-row-active:hover {
    background: rgba(109,29,108,0.08);
}

.dashboard-table tbody tr.dt-row-active td:first-child {
    padding-left: 14px;
}

/* Column styles */
.dt-name { min-width: 180px; }
.dt-customer { min-width: 120px; }
.dt-projnr { min-width: 90px; }
.dt-lines { width: 55px; text-align: center !important; }
.dt-hours { width: 70px; text-align: right !important; }
.dt-price { width: 130px; text-align: right !important; }
.dt-ebitda { width: 100px; text-align: center !important; }
.dt-date { width: 100px; }
.dt-actions { width: 120px; text-align: right !important; }

.dt-cell-name {
    font-weight: 600;
    color: var(--text);
}

.dt-cell-customer {
    color: var(--text-secondary);
    font-size: 0.82rem;
}

.dt-cell-projnr {
    font-family: var(--mono);
    font-size: 0.78rem;
    color: var(--text-muted);
}

.dt-cell-num {
    font-family: var(--mono);
    font-size: 0.82rem;
    text-align: right;
    font-weight: 500;
}

.dt-cell-price {
    font-family: var(--mono);
    font-size: 0.85rem;
    font-weight: 600;
    text-align: right;
    color: var(--text);
}

.dt-cell-date {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.dt-cell-center {
    text-align: center;
}

/* EBITDA badge in table */
.dt-ebitda-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.01em;
    white-space: nowrap;
}

.dt-ebitda-badge.aksept { background: var(--success); }
.dt-ebitda-badge.ikke-aksept { background: var(--danger); }

/* Action buttons in table row */
.dt-action-btns {
    display: flex;
    gap: 2px;
    justify-content: flex-end;
    opacity: 0.3;
    transition: opacity 0.15s;
}

.dashboard-table tbody tr:hover .dt-action-btns {
    opacity: 1;
}

.dt-action-btn {
    background: none;
    border: 1px solid transparent;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    font-family: var(--font);
    font-weight: 500;
    transition: all 0.15s;
    white-space: nowrap;
}

.dt-action-btn:hover {
    background: var(--bg-subtle);
    border-color: var(--border);
    color: var(--text);
    transform: translateY(-1px);
}

.dt-action-btn:active {
    transform: translateY(0);
}

.dt-action-btn.dt-action-delete:hover {
    background: var(--danger-bg);
    border-color: var(--danger-border);
    color: var(--danger);
}

/* Active quote badge in topbar */
.active-quote-badge {
    font-size: 0.82rem;
    font-weight: 600;
    color: #fff;
    padding: 4px 14px;
    background: rgba(109,29,108,0.35);
    border-radius: 20px;
    border: 1px solid rgba(109,29,108,0.4);
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.active-quote-badge:empty {
    display: none;
}

/* Unsaved changes indicator */
.unsaved-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--warning);
    box-shadow: 0 0 6px rgba(245,158,11,0.5);
    flex-shrink: 0;
}

.unsaved-dot.hidden {
    display: none;
}

/* Topbar secondary button */
.btn-topbar-secondary {
    background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.7);
    border: 1px solid rgba(255,255,255,0.1);
    padding: 7px 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
    font-family: var(--font);
    transition: all 0.2s;
}

.btn-topbar-secondary:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
    border-color: rgba(255,255,255,0.2);
}

.btn-topbar-secondary:active {
    transform: scale(0.97);
}

.btn-topbar-secondary:focus-visible {
    outline: 2px solid rgba(255,255,255,0.5);
    outline-offset: 2px;
}

/* Dashboard empty state */
.dashboard-empty {
    text-align: center;
    padding: 60px 40px;
    color: var(--text-muted);
}

.dashboard-empty-icon {
    font-size: 3rem;
    margin-bottom: 12px;
    opacity: 0.4;
}

.dashboard-empty-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.dashboard-empty-sub {
    font-size: 0.88rem;
    color: var(--text-muted);
}


/* ===== C. MAIN CONTENT ===== */
#main-content {
    grid-area: main;
    padding: 24px 28px;
    overflow-y: auto;
    overflow-x: hidden;
    min-width: 0;
}

/* Card base */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: 24px;
    overflow: hidden;
    box-shadow: var(--shadow);
    animation: fadeIn 0.3s ease;
    transition: box-shadow 0.3s ease;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-title {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text);
    padding: 16px 22px;
    letter-spacing: -0.02em;
    border-bottom: 1px solid var(--border);
    position: relative;
}

.card-title::after {
    content: '';
    position: absolute;
    left: 22px;
    bottom: -1px;
    width: 48px;
    height: 2px;
    background: linear-gradient(90deg, var(--primary), var(--primary-hover));
    border-radius: 2px;
}


/* ===== LINE ITEMS TABLE ===== */
.table-container {
    overflow-x: auto;
}

#line-items-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.82rem;
}

#line-items-table th {
    background: var(--bg-subtle);
    color: var(--text-secondary);
    padding: 10px 8px;
    text-align: center;
    font-weight: 600;
    font-size: 0.68rem;
    white-space: nowrap;
    position: sticky;
    top: 0;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--border);
}

#line-items-table td {
    padding: 5px 6px;
    border-bottom: 1px solid var(--border);
    text-align: center;
    vertical-align: middle;
}

#line-items-table tbody tr {
    transition: all 0.15s;
    border-left: 3px solid transparent;
}

#line-items-table tbody tr:nth-child(even) {
    background: #f8f4f8;
}

#line-items-table tbody tr:nth-child(odd) {
    background: #fff;
}

#line-items-table tbody tr:hover {
    background: rgba(109,29,108,0.07);
    border-left-color: var(--primary);
    box-shadow: inset 0 0 0 1px rgba(109,29,108,0.08);
}

/* Row number / drag handle */
.col-nr {
    font-weight: 700;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-family: var(--mono);
    background: var(--bg-subtle);
    border-right: 1px solid var(--border);
}

.drag-handle {
    cursor: grab;
    user-select: none;
    position: relative;
}

.drag-handle:active {
    cursor: grabbing;
}

.drag-handle::before {
    content: '\2807';
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-right: 3px;
    opacity: 0.4;
    transition: opacity 0.15s;
}

#line-items-table tbody tr:hover .drag-handle::before {
    opacity: 0.8;
}

/* Include checkbox column */
.col-incl {
    width: 36px;
    text-align: center !important;
}

.incl-checkbox {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--primary);
}

/* Excluded row (unchecked) */
.row-excluded {
    opacity: 0.4;
}

.row-excluded td {
    background: var(--bg-subtle) !important;
}

/* Drag feedback */
#line-items-table tbody tr.dragging {
    opacity: 0.3;
    background: var(--primary-muted) !important;
}

#line-items-table tbody tr.drag-over {
    box-shadow: 0 -3px 0 0 var(--primary);
}

/* Emne (section header) row */
.emne-row {
    background: linear-gradient(135deg, #F5EAF5 0%, #EDE0ED 100%) !important;
    border-left: 3px solid var(--primary) !important;
}

.emne-row:hover {
    background: linear-gradient(135deg, #EDE0ED 0%, #E0D4E0 100%) !important;
}

.emne-row td {
    border-bottom: 2px solid rgba(109,29,108,0.2) !important;
}

.emne-cell {
    padding: 6px 8px !important;
}

.emne-input {
    font-weight: 700;
    font-size: 0.92rem !important;
    color: var(--primary-deep) !important;
    background: transparent !important;
    border: 1px solid transparent !important;
    width: 100%;
    padding: 6px 10px !important;
    font-family: var(--font) !important;
    text-align: left !important;
    letter-spacing: -0.01em;
}

.emne-input:focus {
    border-color: var(--primary) !important;
    background: rgba(255,255,255,0.7) !important;
    box-shadow: 0 0 0 3px var(--ring) !important;
    outline: none;
}

.emne-input::placeholder {
    color: var(--text-muted);
    font-weight: 500;
}

#line-items-table input {
    width: 100%;
    padding: 8px 9px;
    border: 1px solid transparent;
    border-radius: 5px;
    font-size: 0.82rem;
    background: transparent;
    text-align: right;
    font-family: var(--mono);
    color: var(--text);
    transition: all 0.2s;
}

#line-items-table input.text-input {
    text-align: left;
    font-family: var(--font);
}

#line-items-table input:hover {
    background: rgba(109,29,108,0.03);
    border-color: rgba(109,29,108,0.15);
}

#line-items-table input:focus {
    border-color: var(--primary);
    background: #fff;
    outline: none;
    box-shadow: 0 0 0 3px var(--ring);
}

#line-items-table .calculated {
    background: rgba(241,245,249,0.6);
    font-family: var(--mono);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.8rem;
    padding: 8px 8px;
}

/* Sum total column highlighted */
.col-sum-total.calculated {
    color: var(--text);
    font-weight: 700;
}

.totals-row {
    background: var(--bg-subtle) !important;
}

.totals-row td {
    padding: 10px 8px;
    font-family: var(--mono);
    font-weight: 700;
    font-size: 0.82rem;
    color: var(--text);
    border-top: 2px solid var(--border);
    border-bottom: none;
}

/* Column widths */
.col-nr { width: 38px; }
.col-desc { width: 220px; min-width: 150px; }
.col-elno { width: 95px; }
.col-qty { width: 55px; }
.col-price { width: 90px; }
.col-sum-inn { width: 85px; }
.col-markup { width: 65px; }
.col-bonus { width: 75px; }
.col-sum-mat { width: 95px; }
.col-hours { width: 65px; }
.col-hourprice { width: 75px; }
.col-sum-work { width: 85px; }
.col-sum-total { width: 95px; }
.col-unit-price { width: 85px; }
.col-actions { width: 50px; }

/* Table buttons */
.btn-search {
    background: none;
    border: 1px solid var(--border);
    border-radius: 5px;
    cursor: pointer;
    padding: 3px 7px;
    font-size: 0.78rem;
    color: var(--primary);
    transition: all 0.2s;
}

.btn-search:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    box-shadow: 0 2px 4px rgba(109,29,108,0.25);
    transform: scale(1.1);
}

.btn-search:active {
    transform: scale(0.95);
}

.btn-delete-row {
    background: none;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    padding: 3px 8px;
    font-size: 1rem;
    color: var(--text-muted);
    transition: all 0.2s;
}

.btn-delete-row:hover {
    background: var(--danger-bg);
    color: var(--danger);
    transform: scale(1.15);
}

.btn-delete-row:active {
    transform: scale(0.9);
}

.add-row-actions {
    display: flex;
    border-top: 1px dashed var(--border);
}

.btn-add-row,
.btn-add-emne {
    flex: 1;
    padding: 13px;
    border: none;
    background: transparent;
    color: var(--primary);
    font-size: 0.86rem;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: -0.01em;
}

.btn-add-row:active,
.btn-add-emne:active {
    transform: scale(0.98);
}

.btn-add-row {
    border-radius: 0 0 0 var(--radius-lg);
    border-right: 1px dashed var(--border);
}

.btn-add-emne {
    border-radius: 0 0 var(--radius-lg) 0;
    color: var(--primary-deep);
}

.btn-add-row:hover,
.btn-add-emne:hover {
    background: var(--primary-muted);
    color: var(--primary-deep);
}

/* El-nr cell */
.elno-cell {
    display: flex;
    align-items: center;
    gap: 4px;
}
.elno-cell input { flex: 1; }


/* ===== FINANCIAL SUMMARY ===== */

/* Financial Cards */
.financial-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    padding: 22px;
}

.financial-cards-single {
    grid-template-columns: 1fr;
    max-width: 400px;
    margin: 0 auto;
}

.fin-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
    position: relative;
    overflow: hidden;
    transition: all 0.25s;
    box-shadow: var(--shadow-sm);
}

.fin-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-3px);
}

.fin-card:active {
    transform: translateY(-1px);
}

.fin-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary);
    border-radius: var(--radius) var(--radius) 0 0;
}

.fin-card-label {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.fin-card-amount {
    font-size: 1.5rem;
    font-weight: 700;
    font-family: var(--mono);
    color: var(--text);
    letter-spacing: -0.02em;
    margin-bottom: 4px;
}

.ebitda-card .fin-card-amount {
    font-size: 1.65rem;
}

.fin-card-pct {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-secondary);
    font-family: var(--mono);
}

.fin-card-pct-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-secondary);
    font-family: var(--mono);
}

/* EBITDA card states */
.ebitda-card.aksept::before { background: var(--success); }
.ebitda-card.ikke-aksept::before { background: var(--danger); }

.ebitda-card.aksept {
    border-color: var(--success-border);
    background: linear-gradient(135deg, #ecfdf5, #f0fdf9);
    animation: pulseGlow 3s infinite;
}

.ebitda-card.ikke-aksept {
    border-color: var(--danger-border);
    background: linear-gradient(135deg, #fff1f2, #fef2f2);
}

.ebitda-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.65rem;
    font-weight: 700;
    font-family: var(--font);
    color: #fff;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.ebitda-badge.aksept {
    background: linear-gradient(135deg, #059669, #10b981);
    box-shadow: 0 2px 8px rgba(16,185,129,0.35);
}

.ebitda-badge.ikke-aksept {
    background: linear-gradient(135deg, #e11d48, #f43f5e);
    box-shadow: 0 2px 8px rgba(244,63,94,0.35);
}

/* Financial Details (expandable) */
.financial-details {
    border-top: 1px solid var(--border);
}

.financial-details summary {
    padding: 14px 22px;
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--primary);
    user-select: none;
    transition: all 0.2s;
    letter-spacing: -0.01em;
    list-style: none;
}

.financial-details summary::-webkit-details-marker { display: none; }

.financial-details summary::before {
    content: '\25B6';
    display: inline-block;
    margin-right: 8px;
    font-size: 0.6rem;
    transition: transform 0.2s;
    vertical-align: middle;
}

.financial-details[open] summary::before {
    transform: rotate(90deg);
}

.financial-details summary:hover {
    background: var(--primary-muted);
}

.financial-details[open] summary {
    border-bottom: 1px solid var(--border);
    color: var(--primary-deep);
}

/* Financial Table */
.financial-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.84rem;
}

.financial-table th {
    background: var(--bg-subtle);
    color: var(--text-secondary);
    padding: 10px 14px;
    text-align: right;
    font-weight: 600;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--border);
}

.financial-table th.fs-post {
    text-align: left;
    width: 180px;
}

.financial-table th.fs-pertime,
.financial-table th.fs-total { width: 120px; }
.financial-table th.fs-pct,
.financial-table th.fs-pct2 { width: 80px; }

.financial-table td {
    padding: 8px 14px;
    border-bottom: 1px solid var(--border-subtle);
}

.financial-table td.num {
    text-align: right;
    font-family: var(--mono);
    font-size: 0.82rem;
}

.financial-table .row-highlight {
    background: rgba(109,29,108,0.04);
    font-weight: 700;
}

.financial-table .row-highlight td {
    border-bottom: 2px solid rgba(109,29,108,0.2);
}

.financial-table .separator td {
    padding: 3px;
    border-bottom: none;
    background: var(--bg);
}

.financial-table .row-ebitda {
    font-weight: 700;
    font-size: 0.92rem;
}

.financial-table .row-ebitda.aksept {
    background: var(--success-bg);
}

.financial-table .row-ebitda.ikke-aksept {
    background: var(--danger-bg);
}


/* ===== G. BOTTOM BAR ===== */
#bottombar {
    grid-area: bottom;
    position: sticky;
    bottom: 0;
    height: var(--bottombar-height);
    background: linear-gradient(135deg, #1A0E24 0%, #2D1638 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 40px;
    z-index: 100;
    box-shadow: 0 -1px 0 rgba(255,255,255,0.04);
}

.bottom-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.bottom-label {
    font-size: 0.72rem;
    color: #64748b;
    font-weight: 500;
    letter-spacing: 0.01em;
}

.bottom-value {
    font-size: 1.08rem;
    font-weight: 700;
    font-family: var(--mono);
    letter-spacing: -0.02em;
}

.ebitda-status {
    padding: 3px 12px;
    border-radius: 20px;
    font-size: 0.82rem;
}

.ebitda-status.aksept {
    background: linear-gradient(135deg, #059669, #10b981);
    box-shadow: 0 2px 10px rgba(16,185,129,0.4);
}

.ebitda-status.ikke-aksept {
    background: linear-gradient(135deg, #e11d48, #f43f5e);
    box-shadow: 0 2px 10px rgba(244,63,94,0.4);
}


/* ===== SIDEBAR OVERLAY (mobile) ===== */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 85;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.sidebar-overlay.hidden {
    display: none;
}


/* ===== H. EFObasen Panel ===== */
.efo-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 500px;
    height: 100%;
    background: #fff;
    box-shadow: var(--shadow-xl);
    z-index: 200;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateX(0);
}

.efo-panel.efo-closed {
    transform: translateX(100%);
    pointer-events: none;
}

.efo-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background: var(--primary);
    color: #fff;
}

.efo-panel-header h3 {
    font-size: 0.95rem;
    font-weight: 600;
}

.btn-close {
    background: none;
    border: none;
    color: rgba(255,255,255,0.8);
    font-size: 1.4rem;
    cursor: pointer;
    padding: 2px 6px;
    line-height: 1;
    border-radius: var(--radius-sm);
    transition: all 0.15s;
}

.btn-close:hover {
    background: rgba(255,255,255,0.15);
    color: #fff;
}

.efo-panel-body {
    flex: 1;
    overflow: hidden;
}

.efo-panel-body iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.efo-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 199;
    backdrop-filter: blur(2px);
}

.efo-overlay.hidden {
    display: none;
}


/* ===== MODALS ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,0.5);
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    animation: fadeIn 0.15s ease;
}

.modal-overlay.hidden {
    display: none;
}

.modal {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 32px;
    min-width: 420px;
    max-width: 500px;
    box-shadow: var(--shadow-xl);
    animation: modalIn 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal.hidden {
    display: none;
}

.modal h2 {
    margin-bottom: 20px;
    color: var(--text);
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.modal label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 0.84rem;
    color: var(--text-secondary);
}

.modal input[type="text"] {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.92rem;
    font-family: var(--font);
    margin-bottom: 20px;
    transition: all 0.2s;
}

.modal input[type="text"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--ring);
}

.modal-message {
    font-size: 0.92rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 24px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.btn-danger {
    background: var(--danger);
    border-color: var(--danger);
}

.btn-danger:hover {
    background: #e11d48;
    border-color: #e11d48;
    box-shadow: 0 4px 8px rgba(244,63,94,0.3);
}

.btn-secondary {
    background: var(--bg-subtle);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    padding: 9px 20px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.86rem;
    font-weight: 500;
    font-family: var(--font);
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: var(--bg-muted);
    color: var(--text);
}

.btn-secondary:active {
    transform: scale(0.98);
}

.btn-secondary:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    border: 1px solid var(--primary);
    padding: 9px 20px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.86rem;
    font-weight: 600;
    font-family: var(--font);
    transition: all 0.2s;
    box-shadow: 0 1px 3px rgba(109,29,108,0.25);
}

.btn-primary:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    box-shadow: 0 4px 8px rgba(109,29,108,0.3);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Saved calcs list */
.saved-list {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 20px;
}

.saved-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 6px;
    cursor: pointer;
    transition: all 0.15s;
}

.saved-item:hover {
    background: var(--primary-muted);
    border-color: rgba(109,29,108,0.2);
}

.saved-item-info {
    flex: 1;
}

.saved-item-name {
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--text);
}

.saved-item-date {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 1px;
}

.saved-item-delete {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: all 0.15s;
}

.saved-item-delete:hover {
    background: var(--danger-bg);
    color: var(--danger);
}

.no-saved {
    color: var(--text-muted);
    text-align: center;
    padding: 24px;
    font-size: 0.86rem;
}


/* ===== QUOTE VIEW (PDF Generation) ===== */
.quote-view {
    display: none;
}

.quote-view.generating {
    display: block !important;
    position: fixed;
    top: 0;
    left: 0;
    z-index: -9999;
    overflow: hidden;
}

.qv-page {
    width: 794px;
    min-height: 1123px;
    background: #ffffff;
    font-family: Arial, Helvetica, system-ui, sans-serif;
    color: #1e293b;
    font-size: 10pt;
    line-height: 1.6;
    position: relative;
    display: flex;
    flex-direction: column;
}

/* Accent bars */
.qv-top-bar {
    height: 7px;
    background: linear-gradient(90deg, #2D0E2C, #5A1859, #6D1D6C, #8A3A89);
    flex-shrink: 0;
}

.qv-bottom-bar {
    height: 5px;
    background: linear-gradient(90deg, #2D0E2C, #5A1859, #6D1D6C, #8A3A89);
    margin-top: auto;
    flex-shrink: 0;
}

.qv-content {
    padding: 40px 54px 30px;
    flex: 1;
}

/* Header */
.qv-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
}

.qv-company-name {
    font-size: 20pt;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -0.04em;
    line-height: 1.15;
}

.qv-company-addr {
    font-size: 8pt;
    color: #94a3b8;
    margin-top: 6px;
    line-height: 1.5;
    white-space: pre-line;
}

.qv-doc-block {
    text-align: right;
}

.qv-doc-title {
    font-size: 30pt;
    font-weight: 800;
    color: #412050;
    letter-spacing: 0.14em;
    line-height: 1;
    margin-bottom: 14px;
}

.qv-meta-table {
    font-size: 8.5pt;
    border-collapse: collapse;
    margin-left: auto;
}

.qv-mk {
    color: #94a3b8;
    padding: 3px 18px 3px 0;
    text-align: left;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    white-space: nowrap;
}

.qv-mv {
    color: #1e293b;
    font-weight: 600;
    text-align: right;
    padding: 3px 0;
}

/* Separator */
.qv-sep {
    height: 1px;
    background: linear-gradient(90deg, #D4A9D3, #e2e8f0 50%, #D4A9D3);
    margin: 4px 0 22px;
}

/* Info row */
.qv-info-row {
    display: flex;
    gap: 60px;
    margin-bottom: 24px;
}

.qv-info-col {
    flex: 1;
}

.qv-lbl {
    font-size: 7pt;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin-bottom: 3px;
}

.qv-val-lg {
    font-size: 13pt;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -0.01em;
}

.qv-val-sub {
    font-size: 9pt;
    color: #475569;
    margin-top: 3px;
    line-height: 1.5;
    white-space: pre-line;
}

.qv-val-sub:empty { display: none; }

.qv-val-att {
    font-size: 9pt;
    color: #475569;
    font-style: italic;
    margin-top: 2px;
}

.qv-val-att:empty { display: none; }

/* Sections */
.qv-section {
    margin-bottom: 18px;
    page-break-inside: avoid;
}

.qv-section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.qv-section-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: #412050;
    color: #fff;
    font-size: 9pt;
    font-weight: 800;
    border-radius: 6px;
    flex-shrink: 0;
}

.qv-section-title {
    font-size: 11pt;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: 0.03em;
    margin: 0;
}

.qv-section-text {
    font-size: 9.5pt;
    color: #334155;
    line-height: 1.7;
    margin: 0 0 4px 0;
}

/* Description */
.qv-desc {
    margin: 0 0 22px;
    padding: 14px 20px;
    background: #f8fafc;
    border-left: 4px solid #6D1D6C;
    border-radius: 0 8px 8px 0;
    font-size: 9.5pt;
    color: #334155;
    line-height: 1.7;
}

.qv-desc:empty {
    display: none !important;
}

/* Table */
.qv-table {
    width: 100%;
    border-collapse: collapse;
    margin: 4px 0 8px;
    font-size: 9.5pt;
}

.qv-table thead th {
    background: #2D1638;
    color: #ffffff;
    padding: 10px 14px;
    font-size: 7pt;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.qvt-nr { text-align: center; width: 8%; }
.qvt-desc { text-align: left; width: 44%; }
.qvt-qty { text-align: right; width: 10%; }
.qvt-unit { text-align: right; width: 18%; }
.qvt-sum { text-align: right; width: 20%; }

.qv-table thead th:first-child {
    border-radius: 6px 0 0 0;
}
.qv-table thead th:last-child {
    border-radius: 0 6px 0 0;
}

.qv-table tbody td {
    padding: 9px 14px;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
}

.qv-table tbody tr:nth-child(even) {
    background: #fafbfd;
}

.qv-num {
    text-align: right;
    font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
    font-size: 9pt;
    color: #1e293b;
    font-weight: 500;
}

.qv-post-nr {
    text-align: center;
    font-weight: 700;
    color: #475569;
    font-size: 9pt;
}

/* Emne row in quote */
.qv-emne-row td {
    background: #F5EAF5 !important;
    font-weight: 700;
    font-size: 10pt;
    color: #412050;
    border-bottom: 2px solid #D4A9D3 !important;
    padding: 11px 14px !important;
}

.qv-emne-row td:first-child {
    border-left: 4px solid #6D1D6C;
}

/* Rates table */
.qv-rates-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 9.5pt;
    margin-top: 6px;
}

.qv-rates-table td {
    padding: 7px 14px;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
}

.qv-rates-table td:first-child {
    width: 65%;
}

.qv-rates-val {
    text-align: right;
    font-weight: 700;
    color: #0f172a;
    font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
    font-size: 9pt;
}

/* Forbehold list */
.qv-forbehold-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.qv-forbehold-list li {
    font-size: 9.5pt;
    color: #334155;
    line-height: 1.7;
    padding: 3px 0 3px 20px;
    position: relative;
}

.qv-forbehold-list li::before {
    content: '\2022';
    position: absolute;
    left: 4px;
    color: #6D1D6C;
    font-weight: 700;
}

/* Terms list */
.qv-terms-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.qv-terms-list li {
    font-size: 9pt;
    color: #475569;
    line-height: 1.7;
    padding: 3px 0 3px 20px;
    position: relative;
}

.qv-terms-list li::before {
    content: '\2022';
    position: absolute;
    left: 4px;
    color: #94a3b8;
    font-weight: 700;
}

/* Totals */
.qv-totals-wrap {
    display: flex;
    justify-content: flex-end;
    margin: 20px 0 28px;
}

.qv-totals {
    width: 360px;
}

.qv-tr {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 5px 0;
}

.qv-tl {
    font-size: 9pt;
    color: #64748b;
}

.qv-tv {
    font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
    font-weight: 600;
    font-size: 9.5pt;
    color: #1e293b;
    text-align: right;
    min-width: 120px;
}

.qv-tdiv {
    height: 1px;
    background: #e2e8f0;
    margin: 6px 0;
}

.qv-tbold .qv-tl {
    font-weight: 700;
    color: #0f172a;
    font-size: 9.5pt;
}

.qv-tbold .qv-tv {
    font-weight: 800;
    color: #0f172a;
}

.qv-tgrand {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    padding: 14px 20px;
    background: linear-gradient(135deg, #5A1859, #6D1D6C);
    border-radius: 10px;
    box-shadow: 0 4px 14px rgba(109, 29, 108, 0.3);
}

.qv-tgrand .qv-tl {
    font-weight: 800;
    font-size: 9.5pt;
    letter-spacing: 0.04em;
    color: rgba(255, 255, 255, 0.9);
}

.qv-tgrand .qv-tv {
    font-weight: 800;
    font-size: 14pt;
    color: #ffffff;
    letter-spacing: -0.01em;
}

/* Sign-off */
.qv-signoff {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e2e8f0;
    page-break-inside: avoid;
}

.qv-signoff-text {
    font-size: 9.5pt;
    color: #334155;
    line-height: 1.7;
    margin: 0 0 4px 0;
}

.qv-signoff-block {
    margin-top: 30px;
}

.qv-mvh {
    font-size: 9.5pt;
    color: #475569;
    margin: 0 0 28px 0;
}

.qv-signer-line {
    width: 200px;
    height: 1px;
    background: #cbd5e1;
    margin-bottom: 8px;
}

.qv-signer-company {
    font-size: 10pt;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 2px 0;
}

.qv-signer-name {
    font-size: 10pt;
    font-weight: 700;
    font-style: italic;
    color: #0f172a;
    margin: 0 0 2px 0;
}

.qv-signer-name:empty { display: none; }

.qv-signer-role {
    font-size: 8.5pt;
    color: #64748b;
    margin: 0;
}


/* ===== TOAST NOTIFICATIONS ===== */
.toast-container {
    position: fixed;
    top: calc(var(--topbar-height) + 16px);
    right: 24px;
    z-index: 500;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    font-size: 0.86rem;
    font-weight: 500;
    color: var(--text);
    pointer-events: auto;
    animation: toastIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-width: 340px;
}

.toast.toast-out {
    animation: toastOut 0.25s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.toast-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
    width: 22px;
    text-align: center;
}

.toast.toast-success {
    border-left: 3px solid var(--success);
}

.toast.toast-success .toast-icon {
    color: var(--success);
}

.toast.toast-info {
    border-left: 3px solid var(--primary);
}

.toast.toast-info .toast-icon {
    color: var(--primary);
}

.toast.toast-warning {
    border-left: 3px solid var(--warning);
}

.toast.toast-warning .toast-icon {
    color: var(--warning);
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(40px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@keyframes toastOut {
    from {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateX(40px) scale(0.95);
    }
}


/* ===== UTILITIES ===== */
.hidden {
    display: none !important;
}

.num-negative {
    color: var(--danger);
}


/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    body {
        grid-template-columns: 0px 1fr;
    }

    #sidebar {
        position: fixed;
        top: var(--topbar-height);
        left: 0;
        bottom: var(--bottombar-height);
        width: var(--sidebar-width);
        z-index: 95;
        margin-left: calc(-1 * var(--sidebar-width));
        transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    body.sidebar-open #sidebar {
        margin-left: 0;
    }

    body.sidebar-open .sidebar-overlay {
        display: block;
    }

    body.sidebar-collapsed .hamburger span:nth-child(1) { transform: none; background: #94a3b8; }
    body.sidebar-collapsed .hamburger span:nth-child(2) { opacity: 1; transform: none; }
    body.sidebar-collapsed .hamburger span:nth-child(3) { transform: none; background: #94a3b8; }

    #main-content {
        padding: 16px 12px;
    }

    .financial-cards {
        grid-template-columns: 1fr;
        gap: 10px;
        padding: 14px;
    }

    #bottombar {
        gap: 16px;
    }

    .bottom-label { font-size: 0.68rem; }
    .bottom-value { font-size: 0.9rem; }

    .efo-panel { width: 100%; }

    .modal {
        min-width: auto;
        margin: 16px;
        max-width: calc(100vw - 32px);
    }

    .dashboard-container {
        width: 98vw;
        max-height: 94vh;
        border-radius: var(--radius);
    }

    .dashboard-header {
        padding: 14px 16px;
        flex-wrap: wrap;
    }

    .dashboard-search-wrap {
        max-width: none;
        order: 10;
        width: 100%;
        flex: auto;
    }

    .dashboard-table {
        font-size: 0.78rem;
    }

    .dashboard-table th,
    .dashboard-table td {
        padding: 8px 10px;
    }

    .dt-projnr, .dt-lines { display: none; }
    .dt-hours { display: none; }
}

@media (max-width: 480px) {
    #bottombar {
        gap: 8px;
        flex-wrap: wrap;
        height: auto;
        padding: 10px 14px;
    }
}

/* ============================================================
   AUTH OVERLAY
   ============================================================ */

.auth-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.auth-container {
    text-align: center;
    max-width: 400px;
    padding: 48px 40px;
}

.auth-logo-wrap {
    margin-bottom: 48px;
}

.auth-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.auth-subtitle {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.95rem;
    font-weight: 300;
}

.auth-btn {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 14px 32px;
    background: #fff;
    color: #1a1a2e;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.auth-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 28px rgba(0,0,0,0.4);
}

.auth-ms-icon {
    width: 20px;
    height: 20px;
}

.auth-footer {
    margin-top: 24px;
    color: rgba(255, 255, 255, 0.35);
    font-size: 0.8rem;
}

/* ============================================================
   USER INFO (topbar)
   ============================================================ */

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: 12px;
    padding-left: 12px;
    border-left: 1px solid rgba(255, 255, 255, 0.2);
}

.user-info.hidden {
    display: none;
}

.user-name {
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.82rem;
    font-weight: 500;
    white-space: nowrap;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-logout {
    background: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    padding: 4px 10px;
    font-size: 0.72rem;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-logout:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

/* ============================================================
   DASHBOARD TABS
   ============================================================ */

.dashboard-tabs {
    display: flex;
    gap: 0;
}

.dashboard-tab {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 8px 16px;
    font-size: 0.95rem;
    font-weight: 500;
    color: #888;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.dashboard-tab:hover {
    color: #555;
}

.dashboard-tab.active {
    color: #6d1d6c;
    border-bottom-color: #6d1d6c;
}

.shared-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #e74c3c;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    margin-left: 6px;
    vertical-align: middle;
}

.shared-badge.hidden {
    display: none;
}

/* ============================================================
   SHARE MODAL
   ============================================================ */

.modal-share {
    max-width: 480px;
    width: 90vw;
}

.modal-share-desc {
    color: #888;
    font-size: 0.85rem;
    margin-bottom: 16px;
}

.share-search-wrap {
    position: relative;
    margin-bottom: 12px;
}

.share-search-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
}

.share-search-input:focus {
    border-color: #6d1d6c;
}

.share-colleague-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 0 0 6px 6px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    z-index: 100;
    max-height: 240px;
    overflow-y: auto;
}

.share-colleague-results.hidden {
    display: none;
}

.share-result-item {
    padding: 10px 14px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 2px;
    transition: background 0.1s;
}

.share-result-item:hover {
    background: #f5f0fa;
}

.share-result-name {
    font-weight: 500;
    font-size: 0.9rem;
    color: #333;
}

.share-result-detail {
    font-size: 0.78rem;
    color: #888;
}

.share-selected {
    background: #f5f0fa;
    border: 1px solid #d8d0e8;
    border-radius: 6px;
    padding: 10px 14px;
    margin-bottom: 12px;
}

.share-selected.hidden {
    display: none;
}

.share-selected-person {
    display: flex;
    align-items: center;
    gap: 8px;
}

.share-person-name {
    font-weight: 500;
    color: #333;
}

.share-person-email {
    font-size: 0.82rem;
    color: #888;
    flex: 1;
}

.share-remove-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: #aaa;
    cursor: pointer;
    padding: 0 4px;
}

.share-remove-btn:hover {
    color: #e74c3c;
}

.share-permission-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.share-permission-row label {
    font-size: 0.85rem;
    color: #666;
}

.share-permission-row select {
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.85rem;
}

.share-existing {
    margin-bottom: 16px;
}

.share-existing h4 {
    font-size: 0.82rem;
    color: #888;
    margin-bottom: 8px;
    font-weight: 500;
}

.share-existing-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px solid #f0f0f0;
}

.share-existing-email {
    flex: 1;
    font-size: 0.85rem;
    color: #555;
}

.share-permission-badge {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.share-permission-badge.edit {
    background: #e8f5e9;
    color: #2e7d32;
}

.share-permission-badge.view {
    background: #e3f2fd;
    color: #1565c0;
}

.share-remove-existing {
    background: none;
    border: none;
    font-size: 1.1rem;
    color: #ccc;
    cursor: pointer;
    padding: 0 4px;
}

.share-remove-existing:hover {
    color: #e74c3c;
}

/* Share button in dashboard */
.dt-action-share {
    color: #6d1d6c !important;
    border-color: #6d1d6c !important;
}

.dt-action-share:hover {
    background: #6d1d6c !important;
    color: #fff !important;
}

/* Shared-by column */
.dt-shared-by {
    font-size: 0.82rem;
    color: #888;
}
