/* ============================================================
   NORANTIX CRM — Admin Dark Theme
   Design System v2 — Plus Jakarta Sans, WCAG AA, UX Pro Max
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700&display=swap');

:root {
    /* Surface palette — light theme */
    --night:        #F1F5F9;   /* page background (Slate-100) */
    --night-2:      #FFFFFF;   /* sidebar, cards, topbar */
    --night-3:      #F8FAFC;   /* input backgrounds, table header (Slate-50) */
    --night-4:      #EEF2F7;   /* hover backgrounds, secondary surfaces */
    --night-line:   #E2E8F0;   /* main borders (Slate-200) */
    --night-line-2: #CBD5E1;   /* secondary / active borders (Slate-300) */

    /* Accent — modern blue */
    --accent:       #2563EB;   /* Blue-600 */
    --accent-2:     #1D4ED8;   /* Blue-700 (hover) */
    --accent-soft:  rgba(37, 99, 235, 0.08);
    --accent-hover: rgba(37, 99, 235, 0.12);

    /* Text — WCAG AA on all surfaces */
    --text:         #334155;   /* Slate-700, body text — 10:1 on white */
    --text-2:       #64748B;   /* Slate-500, secondary — 4.6:1 on white */
    --text-muted:   #94A3B8;   /* Slate-400, metadata/labels — decorative use */
    --text-bright:  #0F172A;   /* Slate-900, headings & key numbers */

    /* Status */
    --ok:           #059669;   /* Emerald-600 */
    --ok-soft:      rgba(5, 150, 105, 0.10);
    --warn:         #D97706;   /* Amber-600 */
    --warn-soft:    rgba(217, 119, 6, 0.10);
    --danger:       #DC2626;   /* Red-600 */
    --danger-soft:  rgba(220, 38, 38, 0.09);

    --sidebar-w:    224px;
    --topbar-h:     56px;
    --radius:       10px;
    --radius-sm:    6px;
    --radius-lg:    14px;

    /* Shadows — light mode (subtle, color-tinted) */
    --shadow:       0 1px 3px rgba(15, 23, 42, 0.06), 0 4px 12px rgba(15, 23, 42, 0.05);
    --shadow-md:    0 4px 24px rgba(15, 23, 42, 0.09), 0 1px 4px rgba(15, 23, 42, 0.06);
    --easing:       cubic-bezier(.2, .7, .2, 1);
    --ease-out:     cubic-bezier(0, 0, 0.2, 1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; }

body {
    font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    background: var(--night);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: var(--accent); text-decoration: none; transition: color .15s; }
a:hover { color: var(--accent-2); }

code {
    font-family: monospace;
    background: var(--night-3);
    padding: 1px 5px;
    border-radius: 3px;
    font-size: .9em;
}

/* ============================================================
   Layout
   ============================================================ */

.crm-layout {
    min-height: 100vh;
}

/* ============================================================
   Sidebar
   ============================================================ */

.crm-sidebar {
    background: var(--night-2);
    border-right: 1px solid var(--night-line);
    box-shadow: 2px 0 12px rgba(15, 23, 42, 0.05);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-w);
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
}

.crm-logo {
    padding: 18px 16px 14px;
    border-bottom: 1px solid var(--night-line);
}

.crm-logo a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    color: var(--text-bright);
    text-decoration: none;
}

.crm-logo-img {
    height: 24px;
    width: auto;
    filter: brightness(0) opacity(0.75);
}

.crm-logo-label {
    font-size: .68rem;
    font-weight: 600;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.crm-nav {
    list-style: none;
    padding: 10px 8px;
    flex: 1;
}

.nav-section-label {
    padding: 18px 12px 5px;
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .10em;
    text-transform: uppercase;
    color: var(--text-muted);
    user-select: none;
}

.nav-section-label:first-child {
    padding-top: 6px;
}

.nav-section-label:not(:first-child) {
    margin-top: 4px;
    border-top: 1px solid var(--night-line);
}

/* Sub-items visually nested under parent (Rechnungen / Abo-Rechnungen under Aufträge) */
.crm-nav li.nav-sub > a {
    padding-left: 34px;
    font-size: .82rem;
    opacity: .8;
    position: relative;
}
.crm-nav li.nav-sub > a::before {
    content: '';
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    width: 1px;
    height: 55%;
    background: var(--night-line);
}
.crm-nav li.nav-sub > a svg { width: 14px; height: 14px; }
.crm-nav li.nav-sub.active > a,
.crm-nav li.nav-sub > a:hover { opacity: 1; }

.crm-nav li a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    color: var(--text-2);
    font-size: .875rem;
    font-weight: 500;
    transition: background .15s, color .15s;
}

.crm-nav li a svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    opacity: .7;
}

.crm-nav li a:hover {
    background: var(--accent-hover);
    color: var(--text-bright);
}

.crm-nav li a:hover svg { opacity: 1; }

.crm-nav li.active a {
    background: var(--accent-soft);
    color: var(--accent);
    box-shadow: inset 3px 0 0 var(--accent);
}

.crm-nav li.active a svg { opacity: 1; }

.crm-sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--night-line);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.crm-user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.crm-user-name {
    font-size: .8rem;
    font-weight: 500;
    color: var(--text);
}

.crm-logout {
    font-size: .775rem;
    color: var(--text-muted);
}

.crm-logout:hover { color: var(--danger); }

/* ============================================================
   Main Content
   ============================================================ */

.crm-main {
    margin-left: var(--sidebar-w);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.crm-topbar {
    height: var(--topbar-h);
    border-bottom: 1px solid var(--night-line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    background: var(--night-2);
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: 0 1px 0 var(--night-line), 0 2px 8px rgba(15,23,42,.05);
}

.crm-page-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-bright);
}

.crm-content {
    padding: 24px;
    flex: 1;
}

/* ============================================================
   Page Header (inside content)
   ============================================================ */

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    gap: 16px;
    flex-wrap: wrap;
}

.page-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-bright);
}

.page-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ============================================================
   Cards
   ============================================================ */

.card {
    background: var(--night-2);
    border: 1px solid var(--night-line);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    transition: border-color .2s var(--ease-out), box-shadow .2s var(--ease-out);
}

.card:hover {
    border-color: var(--night-line-2);
    box-shadow: var(--shadow-md);
}

.card-title {
    font-size: .875rem;
    font-weight: 600;
    color: var(--text-2);
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-bottom: 12px;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--night-3);
    border: 1px solid var(--night-line);
    border-radius: var(--radius);
    padding: 18px 20px;
    transition: border-color .2s var(--ease-out), box-shadow .2s var(--ease-out);
}

.stat-card:hover {
    border-color: var(--night-line-2);
    box-shadow: var(--shadow);
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-bright);
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
}

.stat-label {
    font-size: .8rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ============================================================
   Tables
   ============================================================ */

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: .875rem;
}

thead th {
    padding: 10px 12px;
    text-align: left;
    font-size: .75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--night-line);
    white-space: nowrap;
}

tbody td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--night-line);
    color: var(--text);
    vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }

tbody tr:hover td { background: var(--night-3); }

tbody tr[onclick],
tbody tr.clickable { cursor: pointer; }

td.actions {
    white-space: nowrap;
    text-align: right;
}

/* ============================================================
   Buttons
   ============================================================ */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: .875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background .18s var(--ease-out), color .18s var(--ease-out),
                border-color .18s var(--ease-out), box-shadow .18s var(--ease-out),
                opacity .18s var(--ease-out);
    text-decoration: none;
    line-height: 1.4;
}

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

.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary {
    background: var(--accent);
    color: #ffffff;
    box-shadow: 0 1px 3px rgba(37, 99, 235, 0.25);
}
.btn-primary:hover {
    background: var(--accent-2);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
}

.btn-secondary {
    background: var(--night-3);
    border: 1px solid var(--night-line-2);
    color: var(--text);
}
.btn-secondary:hover { background: var(--night-4); color: var(--text-bright); }

.btn-danger {
    background: var(--danger-soft);
    color: var(--danger);
    border: 1px solid rgba(231, 76, 60, .25);
}
.btn-danger:hover { background: var(--danger); color: #fff; }

.btn-ghost {
    background: transparent;
    color: var(--text-2);
    border: 1px solid var(--night-line);
}
.btn-ghost:hover { color: var(--text-bright); border-color: var(--night-line-2); }

.btn-sm {
    padding: 4px 10px;
    font-size: .8rem;
}

.btn-full { width: 100%; justify-content: center; }

/* ============================================================
   Badges
   ============================================================ */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: .73rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-info    { background: var(--accent-soft);  color: var(--accent); }
.badge-success { background: var(--ok-soft);      color: var(--ok); }
.badge-warning { background: var(--warn-soft);    color: var(--warn); }
.badge-danger  { background: var(--danger-soft);  color: var(--danger); }
.badge-accent  { background: var(--accent-soft);  color: var(--accent-2); }
.badge-muted   { background: var(--night-3);      color: var(--text-muted); border: 1px solid var(--night-line); }

/* ============================================================
   Alerts / Flash Messages
   ============================================================ */

.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: .875rem;
    margin-bottom: 16px;
    border-left: 3px solid;
}

.alert-success { background: var(--ok-soft);     border-color: var(--ok);     color: var(--ok); }
.alert-error   { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }
.alert-warning { background: var(--warn-soft);   border-color: var(--warn);   color: var(--warn); }
.alert-info    { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

/* ============================================================
   Forms
   ============================================================ */

.form-group {
    margin-bottom: 16px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

label {
    display: block;
    font-size: .8rem;
    font-weight: 500;
    color: var(--text-2);
    margin-bottom: 5px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="url"],
input[type="number"],
input[type="date"],
input[type="datetime-local"],
select,
textarea {
    width: 100%;
    background: var(--night-3);
    border: 1px solid var(--night-line-2);
    border-radius: var(--radius-sm);
    color: var(--text-bright);
    font-family: inherit;
    font-size: .875rem;
    padding: 8px 12px;
    transition: border-color .15s, box-shadow .15s;
    outline: none;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

select { cursor: pointer; }

textarea { resize: vertical; min-height: 100px; }

input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
    cursor: pointer;
}

.form-hint {
    font-size: .775rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.form-actions {
    display: flex;
    gap: 8px;
    padding-top: 8px;
}

/* ============================================================
   Pagination
   ============================================================ */

.pagination {
    display: flex;
    gap: 4px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    background: var(--night-3);
    border: 1px solid var(--night-line);
    border-radius: var(--radius-sm);
    color: var(--text-2);
    font-size: .8rem;
    font-weight: 500;
    transition: background .15s, color .15s;
}

.page-link:hover { background: var(--night-4); color: var(--text-bright); }
.page-link.active { background: var(--accent); color: #ffffff; border-color: var(--accent); }

/* ============================================================
   Filter Bar
   ============================================================ */

.filter-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.filter-bar input,
.filter-bar select {
    width: auto;
    min-width: 160px;
}

/* ============================================================
   Detail Page
   ============================================================ */

.detail-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
}

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

.dl-table {
    width: 100%;
    font-size: .875rem;
    border-collapse: collapse;
}

.dl-table th {
    width: 140px;
    padding: 8px 12px 8px 0;
    color: var(--text-muted);
    font-weight: 500;
    vertical-align: top;
    text-align: left;
}

.dl-table td {
    padding: 8px 0;
    color: var(--text);
    border-bottom: 1px solid var(--night-line);
}

.dl-table tr:last-child td { border-bottom: none; }

/* ============================================================
   Login Page
   ============================================================ */

.crm-login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--night);
}

.crm-login-wrap {
    width: 100%;
    max-width: 400px;
    padding: 24px 16px;
}

.crm-login-logo {
    text-align: center;
    margin-bottom: 28px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.crm-login-logo img {
    height: 44px;
    width: auto;
}

.crm-login-subtitle {
    font-size: .8rem;
    color: var(--text-muted);
    font-weight: 500;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.crm-login-card {
    background: var(--night-2);
    border: 1px solid var(--night-line);
    border-radius: var(--radius);
    padding: 28px 28px 24px;
}

.crm-login-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-bright);
    margin-bottom: 20px;
}

.crm-login-back {
    text-align: center;
    margin-top: 16px;
    font-size: .8rem;
}

.crm-login-back a { color: var(--text-muted); }
.crm-login-back a:hover { color: var(--text); }

/* ============================================================
   Error Pages
   ============================================================ */

.crm-error-page {
    text-align: center;
    padding: 40px 20px;
}

.crm-error-code {
    display: block;
    font-size: 5rem;
    font-weight: 700;
    color: var(--night-line-2);
    line-height: 1;
    margin-bottom: 8px;
}

.crm-error-page h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-bright);
    margin-bottom: 8px;
}

.crm-error-page p {
    color: var(--text-muted);
    margin-bottom: 20px;
}

/* ============================================================
   Interactions Timeline
   ============================================================ */

.timeline {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.timeline-item {
    display: flex;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid var(--night-line);
}

.timeline-item:last-child { border-bottom: none; }

.timeline-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--night-3);
    border: 1px solid var(--night-line);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: .875rem;
}

.timeline-body { flex: 1; min-width: 0; }

.timeline-header {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}

.timeline-subject {
    font-weight: 600;
    color: var(--text-bright);
    font-size: .875rem;
}

.timeline-meta {
    font-size: .775rem;
    color: var(--text-muted);
}

.timeline-text {
    font-size: .875rem;
    color: var(--text-2);
    white-space: pre-wrap;
}

/* ============================================================
   Position Table (Positionen in Belegen)
   ============================================================ */

.pos-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .875rem;
    counter-reset: pos-row;
}

.pos-table thead th {
    padding: 5px 8px 10px;
    color: var(--text-muted);
    font-size: .72rem;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: .05em;
    border-bottom: 1.5px solid var(--night-line);
    text-align: left;
    white-space: nowrap;
    background: none;
}

.pos-table thead th.pos-total-col,
.pos-table thead th.pos-right { text-align: right; }

.pos-table tbody tr {
    counter-increment: pos-row;
    border-bottom: 1px solid var(--night-3);
    transition: background .15s;
}

.pos-table tbody tr:last-child { border-bottom: none; }
.pos-table tbody tr:hover { background: var(--night-3); }

/* Row number */
.pos-num-col {
    width: 26px;
    padding: 14px 6px 10px 0;
    color: var(--text-muted);
    font-size: .72rem;
    font-weight: 600;
    text-align: right;
    vertical-align: top;
}
.pos-table tbody .pos-num-col::before { content: counter(pos-row); }

/* Bezeichnung + Beschreibung cell */
.pos-desc-cell {
    padding: 10px 14px 10px 8px;
    vertical-align: top;
}

/* Name input — underline style */
.pos-name-inp {
    display: block;
    width: 100%;
    background: none;
    border: none;
    border-bottom: 1.5px solid var(--night-line);
    border-radius: 0;
    padding: 3px 0 5px;
    font-size: .9rem;
    font-weight: 600;
    color: var(--text-bright);
    outline: none;
    transition: border-color .2s;
    margin-bottom: 6px;
    font-family: inherit;
}
.pos-name-inp:focus { border-bottom-color: var(--accent); }
.pos-name-inp::placeholder { color: var(--text-muted); font-weight: 400; }

/* Description textarea — minimal */
.pos-desc-inp {
    display: block;
    width: 100%;
    background: none;
    border: none;
    resize: none;
    padding: 0;
    font-size: .8rem;
    color: var(--text-2);
    line-height: 1.5;
    outline: none;
    font-family: inherit;
    min-height: 18px;
}
.pos-desc-inp::placeholder { color: var(--text-muted); font-style: italic; }

/* Numeric / unit columns */
.pos-qty-col   { width: 72px;  padding: 12px 6px; vertical-align: top; }
.pos-unit-col  { width: 80px;  padding: 12px 6px; vertical-align: top; }
.pos-price-col { width: 110px; padding: 12px 6px; vertical-align: top; }
.pos-vat-col   { width: 72px;  padding: 12px 6px; vertical-align: top; }
.pos-total-col { width: 106px; padding: 12px 8px; vertical-align: top; text-align: right; }
.pos-del-col   { width: 34px;  padding: 10px 2px; vertical-align: top; }

/* Input style for qty/unit/price/vat */
.pos-field {
    width: 100%;
    background: var(--night-3);
    border: 1px solid var(--night-line);
    border-radius: var(--radius-sm);
    padding: 5px 8px;
    font-size: .85rem;
    color: var(--text-bright);
    text-align: right;
    outline: none;
    transition: border-color .2s, background .2s;
    font-family: inherit;
    font-variant-numeric: tabular-nums;
}
.pos-field:focus {
    border-color: var(--accent);
    background: #fff;
}
.pos-field--center { text-align: center; }

/* Row total display */
.pos-row-total {
    font-size: .875rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

/* Delete button */
.pos-del-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    transition: color .15s, background .15s;
    margin-top: 2px;
}
.pos-del-btn:hover {
    color: var(--danger);
    background: var(--danger-soft);
}
.pos-del-btn svg { pointer-events: none; }

/* Add-row button */
.pos-add-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 12px;
    padding: 7px 16px;
    background: none;
    border: 1.5px dashed var(--night-line);
    border-radius: var(--radius);
    font-size: .83rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: border-color .2s, color .2s;
    font-family: inherit;
}
.pos-add-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* Totals block */
.pos-totals {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1.5px solid var(--night-line);
}

.pos-total-line {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0;
    padding: 4px 0;
    font-size: .875rem;
}

.pos-total-line > .pos-tl-label {
    color: var(--text-muted);
    min-width: 130px;
    text-align: right;
    padding-right: 24px;
}

.pos-total-line > .pos-tl-value {
    min-width: 110px;
    text-align: right;
    font-variant-numeric: tabular-nums;
    color: var(--text);
}

.pos-total-line--grand {
    font-weight: 700;
    font-size: 1rem;
    border-top: 1px solid var(--night-line);
    margin-top: 6px;
    padding-top: 8px;
}

.pos-total-line--grand .pos-tl-label,
.pos-total-line--grand .pos-tl-value {
    color: var(--text-bright);
}

/* Legacy alias — keep old class working for any remaining references */
.quote-total-row {
    display: flex;
    justify-content: flex-end;
    gap: 24px;
    padding: 4px 0;
    font-size: .875rem;
}
.quote-total-row.grand-total {
    font-weight: 700;
    color: var(--text-bright);
    font-size: 1rem;
    border-top: 1px solid var(--night-line);
    padding-top: 8px;
}

/* ============================================================
   Input addon group (select/input + icon button)
   ============================================================ */

.input-addon-group {
    display: flex;
    gap: 0;
}

.input-addon-group select,
.input-addon-group input {
    border-radius: var(--radius) 0 0 var(--radius) !important;
    flex: 1;
    min-width: 0;
}

.input-addon-btn {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    border: 1px solid var(--night-line);
    border-left: none;
    border-radius: 0 var(--radius) var(--radius) 0;
    background: var(--night-3);
    color: var(--text-muted);
    cursor: pointer;
    transition: background .15s, color .15s, border-color .15s;
}

.input-addon-btn:hover {
    background: var(--accent-soft);
    color: var(--accent);
    border-color: var(--accent);
}

.input-addon-btn.is-active {
    background: var(--accent-soft);
    color: var(--accent);
    border-color: var(--accent);
}

/* Slide-down panel for quick-create forms */
.nc-slide {
    display: grid;
    grid-template-rows: 0fr;
    opacity: 0;
    transition: grid-template-rows .28s ease, opacity .2s ease;
}

.nc-slide > .nc-slide-inner {
    overflow: hidden;
}

.nc-slide.is-open {
    grid-template-rows: 1fr;
    opacity: 1;
    transition: grid-template-rows .28s ease, opacity .2s ease .06s;
}

/* ============================================================
   Article Picker Modal
   ============================================================ */

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.6);
    z-index: 200;
    align-items: center;
    justify-content: center;
}

.modal-overlay.open { display: flex; }

.modal {
    background: var(--night-2);
    border: 1px solid var(--night-line);
    border-radius: var(--radius);
    width: 860px;
    max-width: 95vw;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--night-line);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-bright);
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.modal-close:hover { color: var(--text); }

.modal-body {
    padding: 16px 20px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--night-line);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* ============================================================
   Akte Drawer
   ============================================================ */

.akte-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.60);
    z-index: 400;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s var(--easing);
}

.akte-overlay.open {
    opacity: 1;
    pointer-events: all;
}

.akte-drawer {
    position: relative;
    width: 780px;
    max-width: 100%;
    max-height: 88vh;
    background: var(--night-2);
    border: 1px solid var(--night-line-2);
    border-radius: var(--radius);
    z-index: 401;
    display: flex;
    flex-direction: column;
    transform: scale(0.95) translateY(-16px);
    transition: transform 0.25s var(--easing);
    box-shadow: 0 8px 40px rgba(15, 23, 42, 0.18), 0 2px 8px rgba(15, 23, 42, 0.10);
}

.akte-overlay.open .akte-drawer {
    transform: scale(1) translateY(0);
}

.akte-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--night-line);
    flex-shrink: 0;
    min-width: 0;
}

.akte-header-main {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex-wrap: wrap;
}

.akte-title-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.akte-company-name {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-bright);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.akte-header .badge {
    flex-shrink: 0;
}

.akte-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    margin-left: auto;
}

.akte-close {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    border: none;
    background: transparent;
    color: var(--text-2);
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
    flex-shrink: 0;
}

.akte-close:hover {
    background: var(--accent-hover);
    color: var(--accent);
}

.akte-tabs {
    display: flex;
    gap: 2px;
    padding: 10px 16px 0;
    border-bottom: 1px solid var(--night-line);
    flex-shrink: 0;
    overflow-x: auto;
    scrollbar-width: none;
}

.akte-tabs::-webkit-scrollbar { display: none; }

.akte-tab {
    padding: 7px 14px;
    border: none;
    background: transparent;
    color: var(--text-2);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
}

.akte-tab:hover {
    color: var(--text);
    background: var(--accent-soft);
}

.akte-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
    background: transparent;
}

.tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: var(--night-4);
    color: var(--text-2);
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1;
}

.akte-tab.active .tab-count {
    background: var(--accent-soft);
    color: var(--accent);
}

.akte-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    scrollbar-width: thin;
    scrollbar-color: var(--night-4) transparent;
}

.akte-body::-webkit-scrollbar { width: 5px; }
.akte-body::-webkit-scrollbar-track { background: transparent; }
.akte-body::-webkit-scrollbar-thumb { background: var(--night-4); border-radius: 3px; }

.akte-panel { display: none; }
.akte-panel.active { display: block; }

.akte-loading {
    text-align: center;
    color: var(--text-muted);
    padding: 48px 0;
    font-size: 0.9rem;
}

.akte-loading::before {
    content: '';
    display: block;
    width: 28px;
    height: 28px;
    margin: 0 auto 12px;
    border: 2px solid var(--night-4);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.akte-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 40px 0;
    font-size: 0.88rem;
}

/* Stammdaten panel */
.akte-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 20px;
}

.akte-field label {
    display: block;
    font-size: 0.73rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 3px;
}

.akte-field span {
    font-size: 0.88rem;
    color: var(--text);
    word-break: break-word;
}

.akte-field.full {
    grid-column: 1 / -1;
}

.akte-notes {
    margin-top: 16px;
    padding: 12px 14px;
    background: var(--night-3);
    border-radius: var(--radius-sm);
    border: 1px solid var(--night-line);
    font-size: 0.85rem;
    line-height: 1.6;
    white-space: pre-wrap;
    color: var(--text);
}

/* Contact cards */
.akte-contact-card {
    background: var(--night-3);
    border: 1px solid var(--night-line);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin-bottom: 10px;
    transition: border-color 0.15s;
}

.akte-contact-card:hover {
    border-color: var(--night-line-2);
}

.akte-contact-card.primary {
    border-left: 3px solid var(--accent);
}

.akte-contact-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.akte-contact-header strong {
    font-size: 0.93rem;
    color: var(--text-bright);
    flex: 1;
}

.akte-contact-meta {
    font-size: 0.82rem;
    color: var(--text-2);
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    margin-bottom: 4px;
}

.akte-contact-meta a {
    color: var(--accent);
    text-decoration: none;
}

.akte-contact-meta a:hover {
    text-decoration: underline;
}

.akte-contact-position {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.akte-contact-socials {
    display: flex;
    gap: 8px;
    margin-top: 6px;
}

.akte-contact-socials a {
    font-size: 0.78rem;
    color: var(--text-2);
    text-decoration: none;
    padding: 2px 8px;
    border-radius: 4px;
    background: var(--night-4);
    transition: background 0.15s, color 0.15s;
}

.akte-contact-socials a:hover {
    background: var(--accent-soft);
    color: var(--accent);
}

/* Interactions timeline */
.akte-timeline {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.akte-timeline-item {
    display: flex;
    gap: 12px;
    padding: 12px 14px;
    background: var(--night-3);
    border: 1px solid var(--night-line);
    border-radius: var(--radius-sm);
}

.akte-timeline-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--night-4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.akte-timeline-body {
    flex: 1;
    min-width: 0;
}

.akte-timeline-head {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 4px;
    flex-wrap: wrap;
}

.akte-timeline-subject {
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-bright);
    flex: 1;
}

.akte-timeline-date {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.akte-timeline-text {
    font-size: 0.82rem;
    color: var(--text-2);
    margin-top: 4px;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.akte-timeline-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Quotes list */
.akte-quote-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.akte-quote-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--night-3);
    border: 1px solid var(--night-line);
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: inherit;
    transition: border-color 0.15s, background 0.15s;
}

.akte-quote-row:hover {
    border-color: var(--accent);
    background: var(--night-4);
}

.akte-quote-number {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--accent);
    white-space: nowrap;
}

.akte-quote-title {
    flex: 1;
    font-size: 0.88rem;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.akte-quote-date {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
}

/* Company table row states */
.company-row {
    cursor: pointer;
    transition: background 0.12s;
}

.company-row:hover {
    background: var(--night-3) !important;
}

.company-row.selected {
    background: var(--accent-soft) !important;
    outline: 1px solid var(--accent);
    outline-offset: -1px;
}

/* ============================================================
   Searchable Select (ss-*)
   ============================================================ */

.ss-wrapper {
    position: relative;
    width: 100%;
}

.ss-control {
    display: flex;
    align-items: center;
    background: var(--night-3);
    border: 1px solid var(--night-line-2);
    border-radius: var(--radius-sm);
    transition: border-color 0.15s;
    cursor: pointer;
}

.ss-wrapper.open .ss-control,
.ss-control:focus-within {
    border-color: var(--accent);
    outline: none;
}

.ss-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    padding: 8px 10px;
    color: var(--text);
    font-size: .875rem;
    cursor: pointer;
    min-width: 0;
}

.ss-input::placeholder { color: var(--text-muted); }

.ss-arrow {
    padding: 0 10px;
    color: var(--text-muted);
    font-size: .75rem;
    user-select: none;
    transition: transform 0.2s;
    flex-shrink: 0;
}

.ss-wrapper.open .ss-arrow {
    transform: rotate(180deg);
}

.ss-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--night-3);
    border: 1px solid var(--night-line-2);
    border-radius: var(--radius-sm);
    max-height: 240px;
    overflow-y: auto;
    z-index: 500;
    box-shadow: var(--shadow);
    scrollbar-width: thin;
    scrollbar-color: var(--night-4) transparent;
}

.ss-wrapper.open .ss-dropdown { display: block; }

.ss-option {
    padding: 8px 12px;
    font-size: .875rem;
    color: var(--text);
    cursor: pointer;
    transition: background 0.1s;
}

.ss-option:hover,
.ss-option.active {
    background: var(--accent-hover);
    color: var(--text-bright);
}

.ss-option.selected {
    color: var(--accent);
    font-weight: 500;
}

.ss-no-results {
    padding: 10px 12px;
    font-size: .82rem;
    color: var(--text-muted);
    text-align: center;
}

/* ============================================================
   Dokumente & Verträge (Akte-Drawer Tab)
   ============================================================ */

/* Upload-Bereich */
.doc-upload-area {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--night-3);
    border: 1px dashed var(--night-line-2);
    border-radius: var(--radius-sm);
    margin-bottom: 14px;
    transition: border-color 0.15s;
}

.doc-upload-area:hover { border-color: var(--accent); }

.doc-upload-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: .82rem;
    font-weight: 500;
    color: var(--accent);
    cursor: pointer;
    white-space: nowrap;
}

.doc-upload-label:hover { color: var(--accent-2); }

.doc-upload-status {
    font-size: .78rem;
    color: var(--text-muted);
}

/* Section title within dokumente tab */
.doc-section-title {
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 8px;
}

/* Dokument-Zeile */
.doc-list { display: flex; flex-direction: column; gap: 6px; }

.doc-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    background: var(--night-3);
    border: 1px solid var(--night-line);
    border-radius: var(--radius-sm);
    transition: border-color 0.15s;
}

.doc-row:hover { border-color: var(--night-line-2); }

.doc-row-icon {
    width: 32px;
    height: 32px;
    background: var(--night-4);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .6rem;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: .02em;
    flex-shrink: 0;
}

.doc-row-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.doc-row-name {
    font-size: .84rem;
    color: var(--accent);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.doc-row-name:hover { color: var(--accent-2); }

.doc-row-meta {
    font-size: .74rem;
    color: var(--text-muted);
}

.doc-row-delete {
    flex-shrink: 0;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    transition: color 0.15s, background 0.15s;
}

.doc-row-delete:hover {
    color: var(--danger);
    background: var(--danger-soft);
}

/* Vertrags-Liste */
.contract-list { display: flex; flex-direction: column; gap: 8px; }

.contract-row {
    padding: 12px 14px;
    background: var(--night-3);
    border: 1px solid var(--night-line);
    border-radius: var(--radius-sm);
    transition: border-color 0.15s;
}

.contract-row:hover { border-color: var(--night-line-2); }

.contract-row-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

/* ============================================================
   Dashboard Deadline-Banner
   ============================================================ */

.deadline-banner {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    padding: 14px 18px;
    background: var(--warn-soft);
    border: 1px solid rgba(217, 119, 6, 0.30);
    border-radius: var(--radius);
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.deadline-banner-icon {
    flex-shrink: 0;
    color: var(--warn);
    margin-top: 2px;
}

.deadline-banner-body { flex: 1; min-width: 0; }

.deadline-banner-body strong {
    display: block;
    font-size: .88rem;
    color: var(--warn);
    margin-bottom: 8px;
}

.deadline-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.deadline-list li {
    font-size: .84rem;
    color: var(--text);
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.deadline-list a { color: var(--accent); }

.deadline-days {
    font-size: .78rem;
    color: var(--text-muted);
    padding: 1px 7px;
    background: var(--night-3);
    border-radius: 20px;
    white-space: nowrap;
}

.deadline-days.urgent {
    color: var(--danger);
    background: var(--danger-soft);
}

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 768px) {
    .crm-layout {
        grid-template-columns: 1fr;
    }

    .crm-sidebar {
        width: 100%;
        height: auto;
        position: relative;
    }

    .crm-main {
        margin-left: 0;
    }

    .crm-content {
        padding: 16px;
    }

    .filter-bar { flex-direction: column; }
    .filter-bar input, .filter-bar select { width: 100%; }
}

/* ============================================================
   Design System v2 — Accessibility & UX Enhancements
   ============================================================ */

/* Skip to main content (screen readers + keyboard) */
.skip-link {
    position: absolute;
    top: -100%;
    left: 12px;
    background: var(--accent);
    color: var(--night);
    font-size: .875rem;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    z-index: 9999;
    transition: top .1s;
}

.skip-link:focus { top: 8px; }

/* Focus-visible: all interactive elements */
a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 3px;
}

.crm-nav li a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
    border-radius: var(--radius-sm);
}

.page-link:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.akte-tab:focus-visible,
.modal-close:focus-visible,
.akte-close:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* Tabular numbers on financial data */
.quote-total-row,
.quote-items-table td,
.stat-value {
    font-variant-numeric: tabular-nums;
}

/* Nav link transition improvement */
.crm-nav li a {
    transition: background .18s var(--ease-out), color .18s var(--ease-out),
                box-shadow .18s var(--ease-out);
}

/* Active nav: stronger visual anchor */
.crm-nav li.active a {
    font-weight: 600;
}

/* Sidebar brand area — subtle gradient accent */
.crm-logo {
    background: linear-gradient(180deg, rgba(79,195,247,.04) 0%, transparent 100%);
}

/* Topbar page title — slightly larger + tighter tracking */
.crm-page-title {
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--text-bright);
}

/* Card title — more refined */
.card-title {
    font-size: .75rem;
    letter-spacing: .08em;
}

/* Table header — cleaner tracking */
thead th {
    letter-spacing: .06em;
    font-size: .72rem;
}

/* Input / select — improved focus ring size */
input:focus,
select:focus,
textarea:focus {
    box-shadow: 0 0 0 3px var(--accent-soft), 0 0 0 1px var(--accent);
}

/* Badge — slightly more contrast */
.badge-muted {
    color: var(--text-2);
}

/* Akte tab count on active — crisper */
.akte-tab.active .tab-count {
    background: rgba(79,195,247,.18);
}

/* Doc row — cursor pointer */
.doc-row { cursor: default; }
.doc-row a { cursor: pointer; }

/* Smooth scrollbar (chromium) */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: var(--night-line-2);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: #A0ABBF; }

/* Scrollbar for sidebar */
.crm-sidebar::-webkit-scrollbar-thumb { background: var(--night-line); }

/* stat-card in light mode: slightly tinted surface */
.stat-card {
    background: var(--night-3);
}

/* Overlay: keep dark for contrast */
.modal-overlay,
.akte-overlay {
    background: rgba(15, 23, 42, 0.55);
}

/* Badge muted: stronger border for light mode */
.badge-muted {
    background: var(--night-4);
    color: var(--text-2);
    border-color: var(--night-line-2);
}

/* Sidebar logo gradient: lighter */
.crm-logo {
    background: linear-gradient(180deg, rgba(37,99,235,.04) 0%, transparent 100%);
}

/* Input — ensure visible placeholder on light bg */
input::placeholder,
textarea::placeholder,
.ss-input::placeholder { color: var(--text-muted); }

/* Alert messages — add shadow */
.alert { box-shadow: var(--shadow); }

/* Login card shadow */
.crm-login-card { box-shadow: var(--shadow-md); }

/* Quote total section */
.quote-total-row.grand-total {
    font-size: 1.05rem;
    border-top: 2px solid var(--night-line);
}

/* ============================================================
   prefers-reduced-motion
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}

/* ============================================================
   Print styles — hide chrome, show content
   ============================================================ */

@media print {
    .crm-sidebar,
    .crm-topbar,
    .page-actions,
    .filter-bar,
    .pagination { display: none !important; }

    .crm-main { margin-left: 0 !important; }
    .crm-content { padding: 0 !important; }

    body { background: #fff; color: #000; }
    .card { border: 1px solid #ccc; }
}

/* ============================================================
   Notification Bell & Dropdown
   ============================================================ */

.notif-bell {
    position: relative;
    flex-shrink: 0;
}

.notif-bell-btn {
    position: relative;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--night-line);
    border-radius: var(--radius-sm);
    color: var(--text-2);
    cursor: pointer;
    transition: background .18s, border-color .18s, color .18s;
}

.notif-bell-btn:hover,
.notif-bell-btn.is-active {
    background: var(--night-4);
    border-color: var(--accent);
    color: var(--accent);
}

.notif-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background: var(--danger);
    color: #fff;
    font-size: .63rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    padding: 0 4px;
    pointer-events: none;
    line-height: 1;
}

/* Dropdown panel */
.notif-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 340px;
    background: var(--night-2);
    border: 1px solid var(--night-line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md), 0 8px 32px rgba(15,23,42,.10);
    z-index: 200;
    overflow: hidden;
}

.notif-hdr {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 12px;
    border-bottom: 1px solid var(--night-line);
}

.notif-hdr-title {
    font-size: .82rem;
    font-weight: 600;
    color: var(--text-bright);
}

.notif-mark-all-btn {
    font-size: .75rem;
    font-weight: 500;
    color: var(--accent);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    transition: opacity .15s;
}

.notif-mark-all-btn:hover { opacity: .7; }

.notif-list {
    max-height: 380px;
    overflow-y: auto;
}

.notif-item {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--night-line);
    cursor: pointer;
    transition: background .15s;
    text-decoration: none;
}

.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--night-4); }

.notif-item.is-unread {
    background: rgba(37, 99, 235, 0.05);
}

.notif-item.is-unread:hover {
    background: rgba(37, 99, 235, 0.09);
}

/* Type icons */
.notif-icon {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    margin-top: 1px;
}

.notif-icon--accent  { background: rgba(37, 99, 235, 0.12); color: var(--accent); }
.notif-icon--warning { background: rgba(217, 119, 6, 0.12); color: var(--warn); }
.notif-icon--danger  { background: rgba(220, 38, 38, 0.12); color: var(--danger); }
.notif-icon--info    { background: rgba(5, 150, 105, 0.12); color: var(--ok); }
.notif-icon--muted   { background: var(--night-3); color: var(--text-muted); }

/* Notification body */
.notif-body {
    flex: 1;
    min-width: 0;
}

.notif-title {
    font-size: .8rem;
    font-weight: 600;
    color: var(--text-bright);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.notif-msg {
    font-size: .77rem;
    color: var(--text-2);
    margin-top: 2px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.45;
}

.notif-time {
    font-size: .7rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.notif-empty {
    padding: 32px 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: .84rem;
}
