/* Modena CRM — moodsam UI, modena.ee disaini põhjal */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    /* Modena brand */
    --md-dark: #012B32;
    --md-dark-2: #062429;
    --md-darker: #04191c;
    --md-yellow: #FFE66C;
    --md-yellow-hover: #FFD93D;
    --md-mint: #DFFAF2;
    --md-mint-soft: #ECFBF6;
    --md-mint-bright: #ABFFEE;
    --md-cream: #FFFEF7;

    /* Neutrals */
    --md-grey: #64748B;
    --md-grey-2: #94A3B8;
    --md-grey-light: #F1F5F9;
    --md-border: #E2E8F0;
    --md-border-soft: #F1F5F9;

    /* Status colors */
    --md-red: #DC2626;
    --md-red-soft: #FEE2E2;
    --md-amber: #D97706;
    --md-amber-soft: #FEF3C7;
    --md-green: #047857;
    --md-green-soft: #D1FAE5;
    --md-blue: #2563EB;
    --md-blue-soft: #DBEAFE;

    /* Layout */
    --sidebar-w: 248px;
    --sidebar-w-collapsed: 64px;
    --topbar-h: 64px;
    --content-pad: 24px;
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    --shadow-xs: 0 1px 2px rgba(1, 43, 50, 0.05);
    --shadow-sm: 0 2px 4px rgba(1, 43, 50, 0.06);
    --shadow: 0 4px 12px rgba(1, 43, 50, 0.08);
    --shadow-lg: 0 12px 32px rgba(1, 43, 50, 0.10);

    /* Bootstrap overrides */
    --bs-body-bg: var(--md-cream);
    --bs-body-color: var(--md-darker);
    --bs-body-font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --bs-border-color: var(--md-border);
    --bs-secondary-bg: var(--md-grey-light);
    --bs-link-color: var(--md-dark);
    --bs-link-hover-color: var(--md-darker);
}

* { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

body {
    font-family: var(--bs-body-font-family);
    color: var(--md-darker);
    background: var(--md-cream);
    font-feature-settings: "cv02", "cv03", "cv04", "cv11", "ss01";
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--md-darker);
    font-weight: 700;
    letter-spacing: -0.02em;
}

a { color: var(--md-dark); text-decoration: underline; text-underline-offset: 2px; text-decoration-thickness: 1px; text-decoration-color: rgba(1, 43, 50, 0.2); }
a:hover { color: var(--md-darker); text-decoration-color: currentColor; }
a.text-muted, .nav-link, .navbar-brand, .btn, .card a, .list-group-item, .breadcrumb a { text-decoration: none; }

code, pre, .mono { font-family: "JetBrains Mono", "SF Mono", Menlo, Monaco, monospace; font-size: 0.9em; }

/* ===== Logo ===== */
.modena-logo {
    font-weight: 800;
    letter-spacing: -0.04em;
    font-size: 1.4rem;
    color: var(--md-cream);
    line-height: 1;
}
.modena-logo::after { content: "."; color: var(--md-yellow); }
.brand-product {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255,254,247,.5);
    margin-left: .3rem;
}

/* ===== App layout: sidebar + main ===== */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    background: var(--md-darker);
    color: var(--md-cream);
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(255,255,255,0.04);
    transition: width .2s ease;
}

/* Kokkuklapitud sidebar (rail) — ainult ikoonid */
.app-shell.sidebar-collapsed .sidebar { width: var(--sidebar-w-collapsed); }
.app-shell.sidebar-collapsed .main-area { margin-left: var(--sidebar-w-collapsed); }
.app-shell.sidebar-collapsed .sidebar-brand { padding: 24px 0 20px; justify-content: center; }
.app-shell.sidebar-collapsed .sidebar-brand .modena-logo { font-size: 0; width: 12px; }
.app-shell.sidebar-collapsed .sidebar-brand .modena-logo::after { font-size: 1.6rem; }
.app-shell.sidebar-collapsed .brand-product { display: none; }
.app-shell.sidebar-collapsed .sidebar-nav { padding: 12px 8px; }
.app-shell.sidebar-collapsed .sidebar-nav .nav-link {
    justify-content: center;
    padding: 11px 0;
}
.app-shell.sidebar-collapsed .sidebar-nav .nav-link span,
.app-shell.sidebar-collapsed .sidebar-nav .nav-section-title { display: none; }
.app-shell.sidebar-collapsed .sidebar-nav .nav-link i { font-size: 1.2rem; margin: 0; }
.app-shell.sidebar-collapsed .sidebar-foot { padding: 12px 8px; }
.app-shell.sidebar-collapsed .user-chip { padding: 6px; justify-content: center; }
.app-shell.sidebar-collapsed .user-chip .user-meta,
.app-shell.sidebar-collapsed .user-chip .bi-three-dots-vertical { display: none; }

/* Kollapse-button topbaril */
.sidebar-collapse-btn {
    background: transparent;
    border: 0;
    width: 36px; height: 36px;
    border-radius: 8px;
    color: var(--md-grey);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background .12s, color .12s;
}
.sidebar-collapse-btn:hover { background: var(--md-grey-light); color: var(--md-darker); }
.sidebar-collapse-btn i { font-size: 1.2rem; }
@media (max-width: 992px) { .sidebar-collapse-btn { display: none; } }

.sidebar-brand {
    padding: 24px 20px 20px;
    display: flex;
    align-items: baseline;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}
.sidebar-nav .nav-section-title {
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255,254,247,0.35);
    padding: 16px 12px 8px;
    font-weight: 600;
}
.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
    color: rgba(255,254,247,0.78);
    border-radius: 10px;
    margin-bottom: 2px;
    font-weight: 500;
    font-size: .92rem;
    transition: background .15s ease, color .15s ease;
    position: relative;
}
.sidebar-nav .nav-link i { font-size: 1.05rem; width: 20px; text-align: center; opacity: 0.85; }
.sidebar-nav .nav-link:hover {
    background: rgba(255,255,255,0.06);
    color: var(--md-cream);
}
.sidebar-nav .nav-link.active {
    background: var(--md-yellow);
    color: var(--md-darker);
    font-weight: 600;
}
.sidebar-nav .nav-link.active i { opacity: 1; }

.sidebar-foot {
    padding: 16px;
    border-top: 1px solid rgba(255,255,255,0.06);
    background: rgba(0,0,0,0.15);
}
.user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: 10px;
    transition: background .15s;
    cursor: pointer;
}
.user-chip:hover { background: rgba(255,255,255,0.06); }
.user-chip .avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: var(--md-yellow);
    color: var(--md-darker);
    font-weight: 700;
    font-size: .85rem;
    flex-shrink: 0;
}
.user-chip .user-meta { flex: 1; min-width: 0; }
.user-chip .user-name { color: var(--md-cream); font-size: .85rem; font-weight: 600; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip .user-role { color: rgba(255,254,247,0.5); font-size: .72rem; }

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

.topbar {
    height: var(--topbar-h);
    background: rgba(255, 254, 247, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--md-border-soft);
    display: flex;
    align-items: center;
    padding: 0 var(--content-pad);
    position: sticky;
    top: 0;
    z-index: 500;
    gap: 16px;
}
.topbar .page-title { font-size: 1rem; font-weight: 600; color: var(--md-darker); }
.topbar .page-crumbs { font-size: .85rem; color: var(--md-grey); }
.topbar .page-crumbs a { color: var(--md-grey); }
.topbar-search {
    margin-left: auto;
    position: relative;
}
.topbar-search input {
    background: var(--md-grey-light);
    border: 1px solid transparent;
    border-radius: var(--radius);
    padding: 8px 14px 8px 36px;
    width: 280px;
    font-size: .88rem;
    transition: all .15s;
}
.topbar-search input:focus {
    outline: none;
    border-color: var(--md-dark);
    background: white;
    box-shadow: 0 0 0 3px rgba(1, 43, 50, 0.08);
}
.topbar-search i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--md-grey);
    pointer-events: none;
}

.content-area {
    flex: 1;
    padding: var(--content-pad);
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
}

/* Mobile sidebar */
.sidebar-toggle { display: none; background: transparent; border: 0; padding: 6px; color: var(--md-darker); }
@media (max-width: 992px) {
    :root { --sidebar-w: 0px; }
    .sidebar { transform: translateX(-100%); transition: transform .25s ease; width: 248px; }
    .sidebar.open { transform: translateX(0); }
    .main-area { margin-left: 0; }
    .sidebar-toggle { display: inline-flex; }
    .topbar-search input { width: 180px; }
    .topbar-search { display: none; }
}

/* ===== Buttons ===== */
.btn {
    border-radius: var(--radius-sm);
    font-weight: 600;
    padding: 0.55rem 1.1rem;
    letter-spacing: -0.005em;
    transition: transform .05s, background .15s, color .15s, border-color .15s, box-shadow .15s;
    border: 1px solid transparent;
    font-size: .92rem;
}
.btn:active { transform: translateY(1px); }
.btn-lg { border-radius: var(--radius); padding: 0.78rem 1.5rem; font-size: 1rem; }
.btn-sm { border-radius: 6px; padding: 0.35rem 0.75rem; font-size: .82rem; }

.btn-modena, .btn-dark {
    background: var(--md-darker);
    color: var(--md-cream);
}
.btn-modena:hover, .btn-dark:hover {
    background: var(--md-dark);
    color: var(--md-cream);
    box-shadow: var(--shadow-sm);
}

.btn-modena-yellow, .btn-warning {
    background: var(--md-yellow);
    color: var(--md-darker);
    border-color: var(--md-yellow);
}
.btn-modena-yellow:hover, .btn-warning:hover {
    background: var(--md-yellow-hover);
    color: var(--md-darker);
    border-color: var(--md-yellow-hover);
}

.btn-success {
    background: var(--md-green);
    color: white;
    border-color: var(--md-green);
}
.btn-success:hover { background: #036247; border-color: #036247; color: white; }

.btn-outline-dark {
    color: var(--md-darker);
    border-color: var(--md-border);
    background: white;
}
.btn-outline-dark:hover {
    background: var(--md-darker);
    color: var(--md-cream);
    border-color: var(--md-darker);
}

.btn-ghost {
    background: transparent;
    color: var(--md-darker);
    border-color: transparent;
}
.btn-ghost:hover { background: var(--md-grey-light); }

.btn-icon { padding: 0.5rem; line-height: 1; }
.btn-icon i { font-size: 1.05rem; }

.btn-link { color: var(--md-dark); padding: 0; font-weight: 500; }
.btn-link:hover { color: var(--md-darker); text-decoration: underline; }

/* ===== Cards ===== */
.card {
    border: 1px solid var(--md-border-soft);
    border-radius: var(--radius-lg);
    background: white;
    box-shadow: var(--shadow-xs);
}
.card-header {
    background: transparent;
    border-bottom: 1px solid var(--md-border-soft);
    font-weight: 600;
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: .92rem;
}
.card-body { padding: 1.25rem; }
.card.card-mint { background: var(--md-mint-soft); border-color: transparent; }
.card.card-dark { background: var(--md-darker); color: var(--md-cream); border-color: var(--md-darker); }
.card.card-dark .text-muted { color: rgba(255,254,247,0.6) !important; }

/* ===== Stat cards ===== */
.stat-card {
    background: white;
    border: 1px solid var(--md-border-soft);
    border-radius: var(--radius-lg);
    padding: 18px;
    transition: transform .12s ease, box-shadow .12s ease, border-color .15s;
    text-decoration: none;
    color: inherit;
    display: block;
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
    border-color: var(--md-border);
    color: inherit;
}
.stat-card .stat-icon {
    width: 36px; height: 36px;
    background: var(--md-mint-soft);
    color: var(--md-darker);
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    margin-bottom: 12px;
}
.stat-card .stat-label { font-size: .82rem; color: var(--md-grey); font-weight: 500; }
.stat-card .stat-value { font-size: 1.85rem; font-weight: 700; color: var(--md-darker); margin-top: 2px; letter-spacing: -0.025em; }
.stat-card .stat-meta { font-size: .78rem; color: var(--md-grey); margin-top: 4px; }
.stat-card.is-accent { background: var(--md-darker); color: var(--md-cream); border-color: var(--md-darker); }
.stat-card.is-accent .stat-icon { background: rgba(255, 230, 108, 0.18); color: var(--md-yellow); }
.stat-card.is-accent .stat-label { color: rgba(255,254,247,0.65); }
.stat-card.is-accent .stat-value { color: var(--md-cream); }
.stat-card.is-warning .stat-icon { background: var(--md-amber-soft); color: var(--md-amber); }
.stat-card.is-success .stat-icon { background: var(--md-green-soft); color: var(--md-green); }
.stat-card.is-danger .stat-icon { background: var(--md-red-soft); color: var(--md-red); }

/* ===== Tables ===== */
.table {
    --bs-table-bg: transparent;
    color: var(--md-darker);
    margin-bottom: 0;
}
.table > :not(caption) > * > * {
    padding: 0.85rem 1rem;
    border-bottom-color: var(--md-border-soft);
    vertical-align: middle;
}
.table thead th, .table-light th {
    background: var(--md-grey-light) !important;
    color: var(--md-grey);
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
    border-bottom: 0;
}
.table tbody tr[onclick] { cursor: pointer; transition: background .1s; }
.table tbody tr[onclick]:hover { background: var(--md-mint-soft); }
.table tbody tr:last-child td { border-bottom: 0; }

.table-card {
    background: white;
    border: 1px solid var(--md-border-soft);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

/* Score chips */
.score-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: .82rem;
    font-weight: 600;
    background: var(--md-grey-light);
    color: var(--md-darker);
}
.score-chip.is-low { background: var(--md-green-soft); color: var(--md-green); }
.score-chip.is-mid { background: var(--md-amber-soft); color: var(--md-amber); }
.score-chip.is-high { background: var(--md-red-soft); color: var(--md-red); }

/* ===== Forms ===== */
.form-control, .form-select {
    border-radius: var(--radius-sm);
    border-color: var(--md-border);
    padding: 0.55rem 0.85rem;
    background: white;
    font-size: .92rem;
    transition: border-color .15s, box-shadow .15s;
}
.form-control:focus, .form-select:focus {
    border-color: var(--md-dark);
    box-shadow: 0 0 0 3px rgba(1, 43, 50, 0.08);
}
.form-control-lg { padding: 0.85rem 1rem; font-size: 1.05rem; border-radius: var(--radius); }
.form-label { font-weight: 500; font-size: .88rem; color: var(--md-darker); margin-bottom: 6px; }
.form-label.small { color: var(--md-grey); font-weight: 500; font-size: .78rem; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 4px; }

textarea.form-control { font-family: inherit; line-height: 1.5; }

/* ===== Badges ===== */
.badge {
    font-weight: 600;
    letter-spacing: -0.005em;
    padding: 0.35em 0.7em;
    border-radius: 6px;
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.badge.bg-success { background: var(--md-green-soft) !important; color: var(--md-green) !important; }
.badge.bg-warning { background: var(--md-amber-soft) !important; color: var(--md-amber) !important; }
.badge.bg-danger { background: var(--md-red-soft) !important; color: var(--md-red) !important; }
.badge.bg-info { background: var(--md-blue-soft) !important; color: var(--md-blue) !important; }
.badge.bg-secondary { background: var(--md-grey-light) !important; color: var(--md-grey) !important; }
.badge.bg-light { background: var(--md-grey-light) !important; color: var(--md-grey) !important; }
.badge.bg-dark { background: var(--md-darker) !important; color: var(--md-cream) !important; }
.badge-pill { padding: 0.4em 0.8em; border-radius: 999px; }

/* Status pills (large) */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: .78rem;
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0;
}
.status-pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-pill.s-new { background: var(--md-grey-light); color: var(--md-grey); }
.status-pill.s-progress { background: var(--md-amber-soft); color: var(--md-amber); }
.status-pill.s-approved { background: var(--md-blue-soft); color: var(--md-blue); }
.status-pill.s-signed { background: var(--md-green-soft); color: var(--md-green); }
.status-pill.s-rejected { background: var(--md-red-soft); color: var(--md-red); }
.status-pill.s-expired { background: var(--md-grey-light); color: var(--md-grey-2); }

/* ===== Alerts (modernized as toasts) ===== */
.alert {
    border-radius: var(--radius);
    border: 1px solid transparent;
    padding: 12px 16px;
    font-size: .9rem;
    box-shadow: var(--shadow-xs);
    display: flex;
    align-items: center;
    gap: 10px;
}
.alert::before { font-family: "bootstrap-icons"; font-size: 1.1rem; flex-shrink: 0; }
.alert-success { background: var(--md-mint-soft); color: var(--md-darker); border-color: var(--md-mint); }
.alert-success::before { content: "\F26B"; color: var(--md-green); }
.alert-info { background: var(--md-blue-soft); color: var(--md-darker); border-color: var(--md-blue-soft); }
.alert-info::before { content: "\F431"; color: var(--md-blue); }
.alert-warning { background: var(--md-amber-soft); color: var(--md-darker); border-color: var(--md-amber-soft); }
.alert-warning::before { content: "\F33A"; color: var(--md-amber); }
.alert-danger { background: var(--md-red-soft); color: var(--md-darker); border-color: var(--md-red-soft); }
.alert-danger::before { content: "\F33A"; color: var(--md-red); }

.toast-container {
    position: fixed;
    top: 80px; right: 24px;
    z-index: 1100;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.toast-container .alert {
    min-width: 280px;
    box-shadow: var(--shadow-lg);
    animation: slideInRight .25s ease;
}
@keyframes slideInRight { from { transform: translateX(110%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ===== Tabs ===== */
.nav-tabs {
    border-bottom: 1px solid var(--md-border);
    gap: 4px;
}
.nav-tabs .nav-link {
    color: var(--md-grey);
    border: 0;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    padding: 0.7rem 1rem;
    font-weight: 500;
    font-size: .92rem;
    margin-bottom: -1px;
}
.nav-tabs .nav-link:hover { color: var(--md-darker); border-color: transparent; background: transparent; }
.nav-tabs .nav-link.active {
    color: var(--md-darker);
    background: transparent;
    border-bottom-color: var(--md-darker);
    font-weight: 600;
}
.tab-content.bg-white {
    background: white !important;
    border: 1px solid var(--md-border-soft) !important;
    border-top: 0 !important;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ===== Auth screen ===== */
.auth-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    background:
        radial-gradient(ellipse 60% 60% at 20% 25%, rgba(171, 255, 238, 0.55) 0%, transparent 60%),
        radial-gradient(ellipse 60% 60% at 80% 75%, rgba(255, 230, 108, 0.45) 0%, transparent 60%),
        var(--md-cream);
}
.auth-card {
    width: 100%;
    max-width: 440px;
    background: white;
    border: 1px solid var(--md-border);
    border-radius: var(--radius-xl);
    padding: 2.5rem 2.25rem;
    box-shadow: 0 16px 48px rgba(1, 43, 50, 0.08);
}
.auth-brand { display: flex; align-items: baseline; gap: .5rem; margin-bottom: 1.5rem; }
.auth-brand .modena-logo { color: var(--md-darker); font-size: 1.55rem; }
.auth-product {
    color: var(--md-grey);
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.auth-title {
    font-size: 1.6rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    letter-spacing: -0.025em;
}
.auth-lead { color: var(--md-grey); margin-bottom: 1.25rem; font-size: .92rem; line-height: 1.55; }
.dev-link {
    background: var(--md-mint-soft);
    border-radius: var(--radius);
    padding: 1rem;
    border: 1px dashed var(--md-mint);
}

/* ===== Page hero ===== */
.page-hero {
    margin-bottom: 24px;
}
.page-hero h1 { font-size: 1.6rem; letter-spacing: -0.02em; margin-bottom: 4px; }
.page-hero .subtitle { color: var(--md-grey); font-size: .92rem; }

.entity-hero {
    background: white;
    border: 1px solid var(--md-border-soft);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 20px;
}
.entity-hero h1 { font-size: 1.55rem; margin-bottom: 8px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.entity-hero .crumb-row { font-size: .82rem; color: var(--md-grey); margin-bottom: 4px; }
.entity-hero .meta-row { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 12px; font-size: .85rem; color: var(--md-grey); }
.entity-hero .meta-row span i { color: var(--md-grey-2); margin-right: 4px; }

/* ===== Avatar ===== */
.avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: .78rem;
    font-weight: 600;
    flex-shrink: 0;
    background: var(--md-mint);
    color: var(--md-darker);
}
.avatar-sm { width: 26px; height: 26px; font-size: .68rem; }
.avatar-lg { width: 44px; height: 44px; font-size: .92rem; }
.avatar.avatar-yellow { background: var(--md-yellow); color: var(--md-darker); }
.avatar.avatar-mint { background: var(--md-mint-bright); color: var(--md-darker); }
.avatar.avatar-blue { background: var(--md-blue-soft); color: var(--md-blue); }
.avatar.avatar-amber { background: var(--md-amber-soft); color: var(--md-amber); }

/* ===== Kanban ===== */
/* 5 veergu venitatud kättesaadava laiusega; horisontaalne kerimine viimases hädaolukorras */
.kanban-row {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 10px;
    padding-bottom: 1rem;
}
@media (max-width: 1100px) {
    .kanban-row { grid-template-columns: repeat(5, minmax(180px, 1fr)); overflow-x: auto; }
}
@media (max-width: 768px) {
    .kanban-row { grid-template-columns: repeat(5, 220px); }
}

.kanban-col {
    background: white;
    border: 1px solid var(--md-border-soft);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.kanban-header {
    border-bottom: 1px solid var(--md-border-soft);
    font-weight: 600;
    padding: 10px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: .85rem;
    gap: 6px;
}
.kanban-header > span:first-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}
.kanban-body { flex: 1; padding: 8px; min-height: 120px; max-height: calc(100vh - 230px); overflow-y: auto; }
.kanban-card {
    transition: transform .1s, box-shadow .1s, border-color .15s;
    border: 1px solid var(--md-border-soft);
    background: white;
    border-radius: 8px;
    margin-bottom: 6px;
    text-decoration: none;
    color: inherit;
    display: block;
    overflow: hidden;
}
.kanban-card .card-body { padding: 9px 10px; }
.kanban-card:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
    border-color: var(--md-dark);
    color: inherit;
}
.kanban-card .card-title {
    font-size: .82rem;
    font-weight: 600;
    margin: 0;
    line-height: 1.25;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    word-break: break-word;
}
.kanban-card .score-chip { font-size: .7rem; padding: 1px 5px; }
.kanban-card .avatar-sm { width: 22px; height: 22px; font-size: .62rem; }
.kanban-card .meta-line { font-size: .7rem; color: var(--md-grey); margin-top: 5px; display: flex; flex-wrap: wrap; gap: 6px; }
.kanban-card .meta-line span {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}
.kanban-card .meta-line i { font-size: .8rem; opacity: 0.6; }

/* ===== Comments timeline ===== */
.comment-thread { display: flex; flex-direction: column; gap: 12px; }
.comment-item {
    display: flex;
    gap: 12px;
}
.comment-item .comment-body {
    flex: 1;
    background: var(--md-mint-soft);
    border-radius: var(--radius);
    padding: 12px 14px;
}
.comment-item .comment-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.comment-item .comment-head strong { font-size: .9rem; }
.comment-item .comment-head time { color: var(--md-grey); font-size: .76rem; }
.comment-item .comment-text { font-size: .92rem; line-height: 1.55; white-space: pre-wrap; word-wrap: break-word; }
.comment-item .comment-type-tag {
    font-size: .68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 1px 6px;
    border-radius: 4px;
    margin-left: 6px;
}
.comment-type-tag.t-sales { background: var(--md-yellow); color: var(--md-darker); }
.comment-type-tag.t-risk { background: var(--md-amber-soft); color: var(--md-amber); }
.comment-type-tag.t-decision { background: var(--md-green-soft); color: var(--md-green); }
.comment-type-tag.t-general { background: var(--md-grey-light); color: var(--md-grey); }

/* ===== Activity feed ===== */
.activity-feed { display: flex; flex-direction: column; }
.activity-item {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--md-border-soft);
}
.activity-item:last-child { border-bottom: 0; }
.activity-item .act-icon {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--md-mint-soft);
    color: var(--md-darker);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: .9rem;
    flex-shrink: 0;
}
.activity-item .act-body { flex: 1; min-width: 0; }
.activity-item .act-subject { font-weight: 600; font-size: .9rem; }
.activity-item .act-meta { font-size: .76rem; color: var(--md-grey); }

/* ===== Empty state ===== */
.empty {
    text-align: center;
    padding: 48px 24px;
    color: var(--md-grey);
}
.empty .empty-icon {
    width: 64px; height: 64px;
    background: var(--md-mint-soft);
    color: var(--md-darker);
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    margin-bottom: 12px;
}
.empty h3 { font-size: 1.05rem; margin-bottom: 6px; }
.empty p { font-size: .88rem; margin-bottom: 16px; }

/* ===== Misc ===== */
.text-muted { color: var(--md-grey) !important; }
.text-danger { color: var(--md-red) !important; }

footer { color: var(--md-grey); font-size: .82rem; padding: 24px; border-top: 1px solid var(--md-border-soft); margin-top: 24px; }

.divider { height: 1px; background: var(--md-border-soft); margin: 16px 0; }

.progress { background: var(--md-grey-light); border-radius: 999px; height: 6px; }
.progress-bar { background: var(--md-darker); border-radius: 999px; }
.progress-bar.bg-success { background: var(--md-green) !important; }

/* Definition list / key-value rows */
.kv-list { display: grid; grid-template-columns: minmax(120px, auto) 1fr; gap: 6px 16px; font-size: .9rem; }
.kv-list dt { color: var(--md-grey); font-weight: 500; }
.kv-list dd { margin: 0; color: var(--md-darker); font-weight: 500; }

/* Row click affordance */
tr[onclick] td { position: relative; }
tr[onclick]:hover td:last-child::after {
    content: "→";
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--md-grey);
    pointer-events: none;
}

/* Money emphasis */
.money-strong { font-weight: 700; font-feature-settings: "tnum"; letter-spacing: -0.01em; }

/* Smooth transitions */
.card, .stat-card, .btn { will-change: transform; }
