/* =========================================================
   SalesSuite CRM – Hauptstylesheet
   Design: Dark Sidebar + Clean White Content
   Font: Inter (Google Fonts)
   ========================================================= */

/* ---------- Reset & Base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --sidebar-bg:     #0d1117;
    --sidebar-hover:  #161b27;
    --sidebar-active: #1a2744;
    --sidebar-border: #21262d;
    --sidebar-w:      240px;

    --accent:         #22c55e;
    --accent-dark:    #16a34a;
    --accent-light:   #f0fdf4;

    --bg:             #f6f8fa;
    --card-bg:        #ffffff;
    --border:         #e2e8f0;

    --text-primary:   #0f172a;
    --text-secondary: #64748b;
    --text-muted:     #94a3b8;

    --blue:    #3b82f6;
    --yellow:  #f59e0b;
    --red:     #ef4444;
    --purple:  #8b5cf6;
    --teal:    #14b8a6;

    --radius:  10px;
    --radius-sm: 6px;
    --shadow:  0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -1px rgba(0,0,0,.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -2px rgba(0,0,0,.05);
}

html { font-size: 15px; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text-primary);
    line-height: 1.5;
    display: flex;
    min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }

/* =========================================================
   SIDEBAR
   ========================================================= */
.sidebar {
    width: var(--sidebar-w);
    min-width: var(--sidebar-w);
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    z-index: 100;
    border-right: 1px solid var(--sidebar-border);
    transition: transform .3s ease;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: 1.25rem 1.25rem 1rem;
    border-bottom: 1px solid var(--sidebar-border);
}

.logo-icon {
    width: 36px; height: 36px;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}

.logo-name {
    font-size: 1.05rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: -.01em;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem .75rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .6rem .75rem;
    border-radius: var(--radius-sm);
    color: #94a3b8;
    font-size: .875rem;
    font-weight: 500;
    transition: background .15s, color .15s;
}

.nav-item:hover {
    background: var(--sidebar-hover);
    color: #e2e8f0;
}

.nav-item.active {
    background: var(--sidebar-active);
    color: var(--accent);
}

.nav-icon {
    width: 18px; height: 18px;
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
}

.nav-icon svg { width: 18px; height: 18px; }

.sidebar-footer {
    padding: .75rem;
    border-top: 1px solid var(--sidebar-border);
}

.user-widget {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .5rem .5rem;
    border-radius: var(--radius-sm);
}

.user-avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: .7rem; font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.user-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: .8rem;
    font-weight: 600;
    color: #e2e8f0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: .7rem;
    color: #64748b;
}

.logout-btn {
    color: #64748b;
    padding: .25rem;
    border-radius: 4px;
    display: flex;
    transition: color .15s;
    flex-shrink: 0;
}
.logout-btn:hover { color: var(--red); }
.logout-btn svg { width: 16px; height: 16px; }

/* =========================================================
   MAIN LAYOUT
   ========================================================= */
.main-wrap {
    margin-left: var(--sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-width: 0;
}

.topbar {
    position: sticky; top: 0; z-index: 50;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    padding: 0 1.75rem;
    height: 58px;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: .4rem;
    border-radius: 6px;
}
.sidebar-toggle:hover { background: var(--bg); }

.topbar-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
}

.topbar-actions {
    display: flex;
    gap: .75rem;
    align-items: center;
}

.content {
    padding: 1.75rem;
    flex: 1;
}

/* =========================================================
   BUTTONS
   ========================================================= */
.btn {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    padding: .55rem 1.1rem;
    border-radius: var(--radius-sm);
    font-size: .875rem;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: background .15s, box-shadow .15s, opacity .15s;
    white-space: nowrap;
    line-height: 1;
}

.btn svg { width: 15px; height: 15px; flex-shrink: 0; }

.btn-primary {
    background: var(--accent);
    color: #fff;
}
.btn-primary:hover { background: var(--accent-dark); }

.btn-secondary {
    background: var(--card-bg);
    color: var(--text-primary);
    border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg); }

.btn-danger {
    background: var(--red);
    color: #fff;
}
.btn-danger:hover { background: #dc2626; }

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid transparent;
}
.btn-ghost:hover { background: var(--bg); color: var(--text-primary); }

.btn-sm { padding: .4rem .8rem; font-size: .8rem; }
.btn-lg { padding: .75rem 1.5rem; font-size: 1rem; }

/* =========================================================
   CARDS
   ========================================================= */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    box-shadow: var(--shadow);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

.card-title {
    font-size: .95rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* =========================================================
   KPI CARDS
   ========================================================= */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 1.75rem;
}

.kpi-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    box-shadow: var(--shadow);
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.kpi-icon {
    width: 44px; height: 44px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.kpi-icon svg { width: 22px; height: 22px; }

.kpi-icon.green  { background: #f0fdf4; color: var(--accent); }
.kpi-icon.blue   { background: #eff6ff; color: var(--blue); }
.kpi-icon.yellow { background: #fffbeb; color: var(--yellow); }
.kpi-icon.purple { background: #f5f3ff; color: var(--purple); }
.kpi-icon.red    { background: #fef2f2; color: var(--red); }
.kpi-icon.teal   { background: #f0fdfa; color: var(--teal); }

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

.kpi-value {
    font-size: 1.65rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: .25rem;
}

.kpi-label {
    font-size: .8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.kpi-sub {
    font-size: .75rem;
    color: var(--text-muted);
    margin-top: .2rem;
}

/* =========================================================
   BADGES
   ========================================================= */
.badge {
    display: inline-flex;
    align-items: center;
    padding: .2rem .6rem;
    border-radius: 99px;
    font-size: .72rem;
    font-weight: 600;
    white-space: nowrap;
}
.badge-green  { background: #f0fdf4; color: #16a34a; }
.badge-blue   { background: #eff6ff; color: #2563eb; }
.badge-yellow { background: #fffbeb; color: #d97706; }
.badge-red    { background: #fef2f2; color: #dc2626; }
.badge-purple { background: #f5f3ff; color: #7c3aed; }
.badge-gray   { background: #f8fafc; color: #64748b; border: 1px solid #e2e8f0; }

/* =========================================================
   TABLE
   ========================================================= */
.table-wrap {
    overflow-x: auto;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--card-bg);
    box-shadow: var(--shadow);
}

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

thead th {
    background: var(--bg);
    padding: .65rem 1rem;
    text-align: left;
    font-size: .75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: .04em;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

tbody td {
    padding: .75rem 1rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    color: var(--text-primary);
}

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

tbody tr:hover { background: #fafbfc; }

.td-actions {
    display: flex;
    gap: .4rem;
    justify-content: flex-end;
}

/* =========================================================
   FORMS
   ========================================================= */
.form-group { margin-bottom: 1.1rem; }

.form-label {
    display: block;
    font-size: .8rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: .35rem;
}

.form-control {
    width: 100%;
    padding: .6rem .9rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: .875rem;
    color: var(--text-primary);
    background: var(--card-bg);
    transition: border-color .2s, box-shadow .2s;
    line-height: 1.5;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(34,197,94,.12);
}

select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .7rem center; background-size: 16px; padding-right: 2.5rem; }

textarea.form-control { resize: vertical; min-height: 80px; }

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1rem;
}

/* =========================================================
   MODALS
   ========================================================= */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(15,23,42,.6);
    z-index: 200;
    display: flex; align-items: center; justify-content: center;
    padding: 1rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s;
}
.modal-overlay.open {
    opacity: 1;
    pointer-events: all;
}

.modal {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 540px;
    max-height: 90vh;
    overflow-y: auto;
    transform: translateY(-10px);
    transition: transform .2s;
}
.modal-overlay.open .modal { transform: translateY(0); }

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.modal-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: .3rem;
    border-radius: 4px;
    display: flex;
    transition: color .15s;
    cursor: pointer;
}
.modal-close:hover { color: var(--text-primary); background: var(--bg); }
.modal-close svg { width: 18px; height: 18px; }

.modal-body { padding: 1.5rem; }

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: .75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    background: var(--bg);
    border-radius: 0 0 var(--radius) var(--radius);
}

/* =========================================================
   KANBAN BOARD
   ========================================================= */
.kanban-container {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    padding-bottom: 1rem;
    min-height: calc(100vh - 160px);
    align-items: flex-start;
}

.kanban-column {
    min-width: 280px;
    max-width: 280px;
    background: #f1f5f9;
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 170px);
}

.kanban-col-header {
    padding: .85rem 1rem;
    display: flex;
    align-items: center;
    gap: .6rem;
    border-bottom: 1px solid #e2e8f0;
    flex-shrink: 0;
}

.kanban-col-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.kanban-col-name {
    font-size: .82rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: .04em;
    flex: 1;
}

.kanban-col-count {
    font-size: .75rem;
    font-weight: 600;
    color: var(--text-muted);
    background: #e2e8f0;
    padding: .1rem .45rem;
    border-radius: 99px;
}

.kanban-cards {
    flex: 1;
    overflow-y: auto;
    padding: .75rem;
    display: flex;
    flex-direction: column;
    gap: .6rem;
    min-height: 80px;
}

.kanban-cards.drag-over {
    background: rgba(34,197,94,.06);
    border-radius: 8px;
}

.kanban-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: .85rem 1rem;
    box-shadow: var(--shadow);
    cursor: grab;
    transition: box-shadow .15s, transform .15s;
    position: relative;
}
.kanban-card:active { cursor: grabbing; }
.kanban-card.dragging {
    opacity: .5;
    transform: rotate(1.5deg);
}
.kanban-card:hover { box-shadow: var(--shadow-md); }

.kanban-card-title {
    font-size: .875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: .4rem;
    line-height: 1.3;
}

.kanban-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    flex-wrap: wrap;
}

.kanban-card-value {
    font-size: .8rem;
    font-weight: 600;
    color: var(--accent-dark);
}

.kanban-card-contact {
    font-size: .75rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: .3rem;
}

.kanban-card-assignee {
    width: 24px; height: 24px;
    border-radius: 50%;
    font-size: .65rem;
    font-weight: 700;
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}

.kanban-add-btn {
    display: flex;
    align-items: center;
    gap: .4rem;
    padding: .6rem .75rem;
    color: var(--text-secondary);
    font-size: .82rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    border-radius: 0 0 var(--radius) var(--radius);
    border-top: 1px solid #e2e8f0;
    transition: background .15s, color .15s;
}
.kanban-add-btn:hover { background: #e8edf3; color: var(--text-primary); }
.kanban-add-btn svg { width: 14px; height: 14px; }

/* =========================================================
   ACTIVITY FEED
   ========================================================= */
.activity-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.activity-item {
    display: flex;
    gap: 1rem;
    padding: .9rem 0;
    border-bottom: 1px solid var(--border);
    position: relative;
}
.activity-item:last-child { border-bottom: none; }

.activity-icon-wrap {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--bg);
    border: 1px solid var(--border);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    color: var(--text-secondary);
}
.activity-icon-wrap svg { width: 16px; height: 16px; }

.activity-icon-wrap.anruf   { background: #eff6ff; color: var(--blue); border-color: #bfdbfe; }
.activity-icon-wrap.email   { background: #fffbeb; color: var(--yellow); border-color: #fde68a; }
.activity-icon-wrap.meeting { background: #f0fdf4; color: var(--accent); border-color: #bbf7d0; }
.activity-icon-wrap.notiz   { background: #f8fafc; color: var(--text-secondary); }
.activity-icon-wrap.aufgabe { background: #f5f3ff; color: var(--purple); border-color: #ddd6fe; }

.activity-content { flex: 1; min-width: 0; }
.activity-subject { font-size: .875rem; font-weight: 500; color: var(--text-primary); }
.activity-note    { font-size: .82rem; color: var(--text-secondary); margin-top: .2rem; }
.activity-meta    { font-size: .75rem; color: var(--text-muted); margin-top: .3rem; display: flex; gap: .75rem; flex-wrap: wrap; }

/* =========================================================
   SEARCH & FILTER BAR
   ========================================================= */
.filter-bar {
    display: flex;
    gap: .75rem;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}

.search-input-wrap {
    position: relative;
    flex: 1;
    min-width: 200px;
    max-width: 360px;
}

.search-icon {
    position: absolute;
    left: .75rem; top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}
.search-icon svg { width: 16px; height: 16px; }

.search-input {
    width: 100%;
    padding: .55rem .9rem .55rem 2.3rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: .875rem;
    background: var(--card-bg);
    color: var(--text-primary);
    transition: border-color .2s, box-shadow .2s;
}
.search-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(34,197,94,.1);
}

/* =========================================================
   PAGINATION
   ========================================================= */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .85rem 1rem;
    border-top: 1px solid var(--border);
    font-size: .82rem;
    color: var(--text-secondary);
}

.pagination-pages {
    display: flex;
    gap: .3rem;
}

.page-btn {
    width: 30px; height: 30px;
    border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
    font-size: .82rem;
    font-weight: 500;
    border: 1px solid var(--border);
    background: var(--card-bg);
    color: var(--text-secondary);
    cursor: pointer;
    transition: background .15s, color .15s;
}
.page-btn:hover, .page-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* =========================================================
   EMPTY STATE
   ========================================================= */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    text-align: center;
    color: var(--text-secondary);
}
.empty-state svg { width: 48px; height: 48px; color: var(--text-muted); margin-bottom: 1rem; }
.empty-state h3 { font-size: 1rem; font-weight: 600; color: var(--text-primary); margin-bottom: .4rem; }
.empty-state p  { font-size: .875rem; color: var(--text-secondary); max-width: 300px; }

/* =========================================================
   TOAST
   ========================================================= */
#toast-container {
    position: fixed;
    bottom: 1.5rem; right: 1.5rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: .6rem;
    pointer-events: none;
}

.toast {
    background: var(--text-primary);
    color: #fff;
    padding: .75rem 1.1rem;
    border-radius: var(--radius-sm);
    font-size: .875rem;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: .6rem;
    pointer-events: all;
    animation: slideInToast .25s ease;
    max-width: 320px;
}
.toast.success { background: #16a34a; }
.toast.error   { background: var(--red); }
.toast.info    { background: var(--blue); }
.toast svg { width: 16px; height: 16px; flex-shrink: 0; }

@keyframes slideInToast {
    from { opacity: 0; transform: translateX(1rem); }
    to   { opacity: 1; transform: translateX(0); }
}

/* =========================================================
   AVATAR
   ========================================================= */
.avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: .75rem; font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}
.avatar-sm { width: 28px; height: 28px; font-size: .65rem; }
.avatar-lg { width: 48px; height: 48px; font-size: 1rem; }

/* =========================================================
   DETAIL VIEW (Kontakt, Deal)
   ========================================================= */
.detail-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 1.5rem;
    align-items: start;
}

.detail-sidebar { display: flex; flex-direction: column; gap: 1rem; }
.detail-main    { display: flex; flex-direction: column; gap: 1rem; }

.detail-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.detail-name { font-size: 1.2rem; font-weight: 700; color: var(--text-primary); }
.detail-sub  { font-size: .85rem; color: var(--text-secondary); margin-top: .15rem; }

.info-list { display: flex; flex-direction: column; gap: .75rem; }
.info-row  { display: flex; gap: .75rem; align-items: flex-start; }
.info-icon { color: var(--text-muted); flex-shrink: 0; margin-top: .1rem; }
.info-icon svg { width: 15px; height: 15px; }
.info-label { font-size: .72rem; color: var(--text-muted); font-weight: 500; text-transform: uppercase; letter-spacing: .04em; }
.info-value { font-size: .875rem; color: var(--text-primary); font-weight: 500; }

/* =========================================================
   BERICHTE / CHARTS
   ========================================================= */
.chart-bar-wrap {
    display: flex;
    flex-direction: column;
    gap: .6rem;
}

.chart-bar-row {
    display: flex;
    align-items: center;
    gap: .75rem;
    font-size: .82rem;
}

.chart-bar-label { width: 120px; color: var(--text-secondary); flex-shrink: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chart-bar-track { flex: 1; height: 8px; background: #f1f5f9; border-radius: 99px; overflow: hidden; }
.chart-bar-fill  { height: 100%; border-radius: 99px; background: var(--accent); transition: width .6s ease; }
.chart-bar-val   { width: 60px; text-align: right; color: var(--text-primary); font-weight: 600; flex-shrink: 0; }

/* =========================================================
   TABS
   ========================================================= */
.tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border);
    margin-bottom: 1.25rem;
}

.tab-btn {
    padding: .65rem 1.1rem;
    font-size: .875rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    transition: color .15s, border-color .15s;
}
.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }

.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* =========================================================
   ALERT
   ========================================================= */
.alert {
    padding: .85rem 1rem;
    border-radius: var(--radius-sm);
    font-size: .875rem;
    margin-bottom: 1rem;
    display: flex; align-items: flex-start; gap: .6rem;
}
.alert svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: .1rem; }
.alert-danger  { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.alert-info    { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }

/* =========================================================
   PIPELINE SELECTOR
   ========================================================= */
.pipeline-selector {
    display: flex;
    align-items: center;
    gap: .5rem;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: .4rem .75rem;
    font-size: .875rem;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
}
.pipeline-selector svg { width: 15px; height: 15px; color: var(--text-muted); }

/* =========================================================
   DROPDOWN
   ========================================================= */
.dropdown { position: relative; display: inline-flex; }
.dropdown-menu {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    min-width: 160px;
    z-index: 150;
    padding: .35rem;
    display: none;
}
.dropdown-menu.open { display: block; }
.dropdown-item {
    display: flex; align-items: center; gap: .6rem;
    padding: .5rem .75rem;
    font-size: .875rem;
    color: var(--text-primary);
    border-radius: 4px;
    cursor: pointer;
    transition: background .1s;
}
.dropdown-item:hover { background: var(--bg); }
.dropdown-item svg   { width: 15px; height: 15px; color: var(--text-secondary); }
.dropdown-item.danger { color: var(--red); }
.dropdown-item.danger svg { color: var(--red); }
.dropdown-divider { height: 1px; background: var(--border); margin: .3rem 0; }

/* =========================================================
   LOGIN PAGE
   ========================================================= */
.login-page {
    min-height: 100vh;
    background: var(--sidebar-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.login-card {
    background: #161b27;
    border: 1px solid var(--sidebar-border);
    border-radius: 16px;
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 40px rgba(0,0,0,.4);
}

.login-logo {
    display: flex; align-items: center; gap: .75rem;
    margin-bottom: 2rem;
    justify-content: center;
}

.login-logo .logo-name {
    font-size: 1.5rem;
}

.login-card h2 {
    font-size: 1.3rem;
    font-weight: 700;
    color: #f1f5f9;
    margin-bottom: .4rem;
    text-align: center;
}

.login-subtitle {
    color: #64748b;
    font-size: .875rem;
    text-align: center;
    margin-bottom: 2rem;
}

.login-card .form-label { color: #94a3b8; }

.login-card .form-control {
    background: #0d1117;
    border-color: var(--sidebar-border);
    color: #f1f5f9;
}
.login-card .form-control::placeholder { color: #4b5563; }
.login-card .form-control:focus { border-color: var(--accent); }

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-100%);
    }
    body.sidebar-open .sidebar {
        transform: translateX(0);
    }
    .main-wrap {
        margin-left: 0;
    }
    .sidebar-toggle { display: flex; }
    .detail-layout { grid-template-columns: 1fr; }
    .form-row, .form-row-3 { grid-template-columns: 1fr; }
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 560px) {
    .content { padding: 1rem; }
    .kpi-grid { grid-template-columns: 1fr; }
    .topbar { padding: 0 1rem; }
}

/* =========================================================
   UTILITY
   ========================================================= */
.flex         { display: flex; }
.flex-col     { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1        { gap: .5rem; }
.gap-2        { gap: 1rem; }
.gap-3        { gap: 1.5rem; }
.mt-1         { margin-top: .5rem; }
.mt-2         { margin-top: 1rem; }
.mt-3         { margin-top: 1.5rem; }
.mb-1         { margin-bottom: .5rem; }
.mb-2         { margin-bottom: 1rem; }
.mb-3         { margin-bottom: 1.5rem; }
.text-sm      { font-size: .875rem; }
.text-xs      { font-size: .75rem; }
.text-muted   { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.font-semibold { font-weight: 600; }
.font-bold     { font-weight: 700; }
.w-full        { width: 100%; }
.text-right    { text-align: right; }
.truncate      { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hidden        { display: none !important; }
.grid-2        { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.grid-3        { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; }
