:root {
    --ink: #1c1917;
    --ink-soft: #44403c;
    --muted: #5c564f;
    --line: rgba(28, 25, 23, 0.06);
    --line-strong: rgba(28, 25, 23, 0.1);
    --bg: #f4f1ec;
    --sidebar: #f3f1ec;
    --sidebar-ink: #3f3a36;
    --sidebar-muted: #5f5954;
    --card: rgba(255, 255, 255, 0.46);
    --glass: rgba(255, 255, 255, 0.42);
    --glass-card: rgba(255, 255, 255, 0.46);
    --glass-strong: rgba(255, 255, 255, 0.58);
    --glass-border: rgba(255, 255, 255, 0.68);
    --glass-blur: blur(22px) saturate(180%);
    --accent: #e07a3d;
    --accent-2: #c45e24;
    --accent-soft: rgba(224, 122, 61, 0.12);
    --blue: #4c7cf0;
    --blue-soft: rgba(76, 124, 240, 0.12);
    --warn: #c47a12;
    --danger: #c2414b;
    --ok: #2f9d6a;
    --shadow: 0 1px 2px rgba(28, 25, 23, 0.04), 0 14px 40px rgba(28, 25, 23, 0.06);
    --shadow-lg: 0 20px 50px rgba(28, 25, 23, 0.1);
    --radius: 22px;
    --radius-sm: 14px;
    --font: "Inter", "Segoe UI", sans-serif;
    accent-color: var(--accent);
    color-scheme: light;
}

[data-bs-theme="dark"] {
    color-scheme: dark;
    --ink: #f5f2ee;
    --ink-soft: #d6d0c8;
    --muted: #c4bdb4;
    --line: rgba(255, 255, 255, 0.08);
    --line-strong: rgba(255, 255, 255, 0.12);
    --bg: #161311;
    --sidebar: #12100e;
    --sidebar-ink: #ece7e1;
    --sidebar-muted: #c4bdb4;
    --card: rgba(29, 26, 23, 0.52);
    --glass: rgba(29, 26, 23, 0.48);
    --glass-card: rgba(29, 26, 23, 0.52);
    --glass-strong: rgba(29, 26, 23, 0.64);
    --glass-border: rgba(255, 255, 255, 0.1);
    --shadow: 0 18px 48px rgba(0, 0, 0, 0.35);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
    font-family: var(--font);
    color: var(--ink);
    background: var(--bg);
    letter-spacing: -0.014em;
    -webkit-font-smoothing: antialiased;
}
body.app-body {
    background:
        radial-gradient(560px 380px at 4% 6%, rgba(255, 176, 128, 0.72), transparent 64%),
        radial-gradient(760px 420px at 58% 4%, rgba(255, 186, 140, 0.58), transparent 60%),
        radial-gradient(640px 360px at 88% 16%, rgba(255, 220, 160, 0.5), transparent 62%),
        radial-gradient(520px 300px at 38% 0%, rgba(255, 168, 150, 0.32), transparent 55%),
        radial-gradient(480px 260px at 92% 88%, rgba(255, 200, 150, 0.28), transparent 60%),
        var(--bg);
}
a { color: var(--accent-2); text-decoration: none; }
a:hover { color: var(--accent); }

.glass, .panel {
    background: var(--glass-card);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.55);
    border-radius: var(--radius);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
}

.app-shell { min-height: 100vh; }
.sidebar {
    width: 248px;
    min-height: 100vh;
    position: sticky;
    top: 0;
    background: var(--glass);
    backdrop-filter: blur(22px) saturate(170%);
    -webkit-backdrop-filter: blur(22px) saturate(170%);
    color: #1c1917;
    flex-shrink: 0;
    border-right: 1px solid rgba(255, 255, 255, 0.55);
}
[data-bs-theme="dark"] .sidebar {
    background: rgba(18, 16, 14, 0.62);
    border-right-color: rgba(255, 255, 255, 0.06);
    color: var(--sidebar-ink);
}
.brand-mark {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    background: #1c1917;
    color: #fff;
    font-weight: 700;
    font-size: .85rem;
}
.brand-name {
    font-weight: 700;
    letter-spacing: -.03em;
    font-size: .98rem;
}
.brand-sub { display: none; }
.sidebar-rule {
    height: 1px;
    border: 0;
    margin: .85rem 0;
    background: rgba(28, 25, 23, 0.08);
}
[data-bs-theme="dark"] .sidebar-rule { background: rgba(255, 255, 255, 0.08); }
[data-bs-theme="dark"] .crm-select-menu,
[data-bs-theme="dark"] .crm-cal,
[data-bs-theme="dark"] .dropdown-menu {
    background: #1d1a17;
    border-color: rgba(255, 255, 255, 0.1);
}
.nav-label {
    color: var(--sidebar-muted);
    font-size: .66rem;
    letter-spacing: .14em;
    text-transform: uppercase;
    font-weight: 650;
    padding: .85rem .55rem .25rem;
}
.sidebar nav a {
    color: #1c1917;
    text-decoration: none;
    border-radius: 10px;
    padding: .5rem .65rem;
    display: flex;
    align-items: center;
    gap: .7rem;
    font-size: .92rem;
    font-weight: 500;
    letter-spacing: -.015em;
}
[data-bs-theme="dark"] .sidebar nav a { color: var(--sidebar-ink); }
.sidebar nav a i {
    width: 1.15rem;
    text-align: center;
    color: #3f3a36;
    font-size: 1.05rem;
}
.sidebar nav a:hover { background: rgba(28, 25, 23, 0.05); color: var(--sidebar-ink); }
.sidebar nav a.active {
    background: var(--glass-strong);
    color: var(--sidebar-ink);
}
[data-bs-theme="dark"] .sidebar nav a:hover,
[data-bs-theme="dark"] .sidebar nav a.active {
    background: rgba(255, 255, 255, 0.08);
    color: var(--sidebar-ink);
}
[data-bs-theme="dark"] .sidebar nav a i { color: var(--sidebar-muted); }
[data-bs-theme="dark"] .sidebar-cta {
    background: rgba(255, 255, 255, 0.08);
    color: var(--sidebar-ink);
}
[data-bs-theme="dark"] .sidebar-cta:hover { color: var(--sidebar-ink); }
.sidebar-cta {
    display: flex;
    align-items: center;
    gap: .55rem;
    background: rgba(28, 25, 23, 0.06);
    border: 0;
    border-radius: 12px;
    padding: .62rem .85rem;
    font-weight: 600;
    font-size: .92rem;
    color: #1c1917;
    text-decoration: none;
}
.sidebar-cta:hover { background: rgba(28, 25, 23, 0.09); color: #1c1917; }
.sidebar-agent {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    width: 100%;
    border-radius: 12px;
    padding: .62rem .85rem;
    background: var(--accent-soft);
    border: 1px solid rgba(224, 122, 61, 0.28);
    color: var(--accent-2);
    font-weight: 600;
    font-size: .9rem;
    text-decoration: none;
}
.sidebar-agent:hover { background: rgba(224, 122, 61, 0.18); color: var(--accent-2); }
.sidebar-user { background: transparent; padding-top: 0; position: relative; z-index: 5; overflow: visible; }
.sidebar-theme-btn {
    width: 100%;
    color: #1c1917;
    text-decoration: none;
    border: 0;
    background: transparent;
    border-radius: 10px;
    padding: .5rem .65rem;
    display: flex;
    align-items: center;
    gap: .7rem;
    font-size: .92rem;
    font-weight: 500;
    letter-spacing: -.015em;
    text-align: left;
}
.sidebar-theme-btn i {
    width: 1.15rem;
    text-align: center;
    color: #3f3a36;
    font-size: 1.05rem;
}
.sidebar-theme-btn:hover { background: rgba(28, 25, 23, 0.05); color: var(--sidebar-ink); }
[data-bs-theme="dark"] .sidebar-theme-btn { color: var(--sidebar-ink); }
[data-bs-theme="dark"] .sidebar-theme-btn i { color: var(--sidebar-muted); }
[data-bs-theme="dark"] .sidebar-theme-btn:hover { background: rgba(255, 255, 255, 0.08); }
.sidebar .dropdown-menu {
    z-index: 2000;
}
.app-main { min-width: 0; }
.topbar {
    min-height: auto;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    padding: 0 !important;
}
.search-wrap {
    background: var(--glass-strong);
    border: 1px solid var(--glass-border);
    border-radius: 999px;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(28, 25, 23, 0.05), inset 0 1px 0 rgba(255, 255, 255, 0.55);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    max-width: 420px;
}
.search-wrap:focus-within {
    border-color: rgba(224, 122, 61, .45);
    box-shadow: 0 0 0 .2rem var(--accent-soft);
}
.search-wrap .form-control,
.search-wrap .form-control:focus {
    flex: 1 1 auto;
    min-width: 0;
    border: 0;
    border-radius: 0;
    background: transparent !important;
    box-shadow: none !important;
    outline: 0;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    color: var(--ink);
}
.search-wrap .form-control::placeholder {
    color: var(--muted);
}
.search-wrap > i,
.search-wrap .search-submit {
    flex-shrink: 0;
    color: var(--muted);
}
.search-wrap .search-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin: 0;
    border: 0;
    background: transparent;
    line-height: 1;
}
.search-wrap .search-submit:hover,
.search-wrap .search-submit:focus-visible {
    color: var(--ink);
}
[data-bs-theme="dark"] .search-wrap {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(255, 255, 255, 0.14);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
[data-bs-theme="dark"] .kbd {
    background: rgba(255, 255, 255, 0.08);
}
.kbd {
    font-size: .68rem;
    border-radius: 6px;
    padding: .1rem .4rem;
    color: var(--muted);
    background: rgba(28, 25, 23, 0.06);
    margin-left: .35rem;
}
.skip-link {
    position: absolute;
    left: .75rem;
    top: -3rem;
    z-index: 3000;
    background: #1c1917;
    color: #fff;
    padding: .55rem .9rem;
    border-radius: 999px;
    font-weight: 650;
}
.skip-link:focus { top: .75rem; color: #fff; }
.text-secondary { color: var(--muted) !important; }

.btn {
    border-radius: 999px;
    font-weight: 600;
    letter-spacing: -0.015em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: auto;
    min-height: 42px;
    line-height: 1.2;
    padding: .55rem 1.05rem;
    white-space: nowrap;
}
.btn-primary, .btn-dark, .btn-accent {
    --bs-btn-bg: #1c1917;
    --bs-btn-border-color: #1c1917;
    --bs-btn-hover-bg: #000;
    --bs-btn-hover-border-color: #000;
    --bs-btn-color: #fff;
    background: #1c1917;
    border-color: #1c1917;
    color: #fff;
    box-shadow: 0 10px 22px rgba(28, 25, 23, 0.12);
}
.btn-accent:hover, .btn-dark:hover { color: #fff; }
.btn-ghost, .btn-outline-dark, .btn-light {
    background: var(--glass-strong);
    border: 1px solid var(--glass-border);
    color: var(--ink);
    box-shadow: 0 8px 20px rgba(28, 25, 23, 0.05), inset 0 1px 0 rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(14px) saturate(160%);
    -webkit-backdrop-filter: blur(14px) saturate(160%);
}
.btn-ghost:hover, .btn-outline-dark:hover, .btn-light:hover {
    background: var(--glass-strong);
    color: var(--ink);
}
.btn-success { background: var(--ok); border-color: var(--ok); border-radius: 999px; }
.btn-outline-primary {
    border: 1.5px solid var(--accent);
    color: var(--accent-2);
    background: transparent;
    border-radius: 999px;
}
.icon-btn {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    padding: 0;
    background: var(--glass-strong);
    border: 1px solid var(--glass-border);
    box-shadow: 0 8px 20px rgba(28, 25, 23, 0.05), inset 0 1px 0 rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(14px) saturate(160%);
    -webkit-backdrop-filter: blur(14px) saturate(160%);
}

.form-control, .form-select {
    border-radius: 14px;
    border: 1px solid var(--glass-border);
    padding: .7rem .95rem;
    color: var(--ink);
    background: var(--glass);
    backdrop-filter: blur(12px) saturate(160%);
    -webkit-backdrop-filter: blur(12px) saturate(160%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
}
.form-control:focus, .form-select:focus {
    border-color: rgba(224, 122, 61, .45);
    box-shadow: 0 0 0 .2rem var(--accent-soft);
    background: var(--glass-strong);
    color: var(--ink);
}
.form-select {
    appearance: none;
    -webkit-appearance: none;
    background-image: none;
    padding-right: 2.4rem;
}
[data-bulk-toolbar] .form-select,
[data-bulk-toolbar] .form-control {
    width: auto;
    min-height: 2.15rem;
    padding: .35rem .85rem;
}
.form-label { font-weight: 600; font-size: .82rem; color: var(--ink-soft); }
.form-check-input {
    width: 1.1rem;
    height: 1.1rem;
    border-radius: 6px;
    border: 1.5px solid rgba(224, 122, 61, 0.45);
    background-color: rgba(255, 255, 255, 0.65);
    box-shadow: none;
}
.form-check-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 .2rem var(--accent-soft);
}
.form-check-input:checked {
    background-color: var(--accent);
    border-color: var(--accent);
}
.form-check-input:checked[type="checkbox"] {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='m6 10 3 3 6-6'/%3e%3c/svg%3e");
}
.form-control::file-selector-button {
    border: 0;
    border-radius: 999px;
    margin-right: .75rem;
    padding: .4rem .85rem;
    background: #1c1917;
    color: #fff;
    font-weight: 600;
}
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator {
    opacity: 0;
    display: none;
}

.table { --bs-table-bg: transparent; }
.table thead th {
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--muted);
    font-weight: 650;
    border-bottom-width: 1px;
    white-space: nowrap;
}
.table tbody tr { transition: background .15s ease; }
.table tbody tr:hover { background: rgba(224, 122, 61, 0.04); }
.table td, .table th { vertical-align: middle; }
.table a { font-weight: 650; color: var(--ink); }
.table a:hover { color: var(--accent-2); }
.table a.btn,
.table a.btn:hover {
    font-weight: 600;
    text-decoration: none;
}
.table a.btn-accent,
.table a.btn-dark,
.table a.btn-primary {
    color: #fff;
}
.table a.btn-accent:hover,
.table a.btn-dark:hover,
.table a.btn-primary:hover {
    color: #fff;
}
.table a.btn-ghost:hover,
.table a.btn-outline-dark:hover,
.table a.btn-light:hover {
    color: var(--ink);
}

.metric-card {
    background: var(--glass-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.55);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}
.metric-card:hover {
    transform: translateY(-2px);
    background: var(--glass-strong);
    box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 255, 255, 0.65);
}
.metric-label { color: var(--muted); font-size: .78rem; font-weight: 600; }
.metric-value { font-size: 1.55rem; font-weight: 750; letter-spacing: -.045em; line-height: 1.15; }
.metric-icon {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: var(--accent-soft);
    color: var(--accent-2);
}

.team-target-accordion__summary {
    cursor: pointer;
    list-style: none;
}
.team-target-accordion__summary::-webkit-details-marker {
    display: none;
}
.team-target-accordion__chevron {
    transition: transform .18s ease;
}
.team-target-accordion[open] .team-target-accordion__chevron {
    transform: rotate(180deg);
}
.team-target-member-scroll {
    max-height: 14.5rem; /* ~4 member rows + header */
    overflow-y: auto;
}
.team-target-member-scroll .table {
    --bs-table-bg: #ffffff;
}
.team-target-member-scroll thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background-color: #ffffff !important;
    background-clip: padding-box;
    box-shadow: inset 0 -1px 0 var(--line);
}
[data-bs-theme="dark"] .team-target-member-scroll .table {
    --bs-table-bg: #1d1a17;
}
[data-bs-theme="dark"] .team-target-member-scroll thead th {
    background-color: #1d1a17 !important;
}
.team-target-member-cards {
    max-height: 28rem; /* ~4 member cards in 2-col grid */
    overflow-y: auto;
    overflow-x: hidden;
}

.leaderboard-scroll {
    max-height: 22rem; /* ~5–6 agent rows; scroll for the rest */
    overflow-y: auto;
    overflow-x: hidden;
}
.leaderboard-scroll thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background-color: #ffffff;
    box-shadow: inset 0 -1px 0 var(--line);
}
[data-bs-theme="dark"] .leaderboard-scroll thead th {
    background-color: #1d1a17;
}

.avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: inline-grid;
    place-items: center;
    font-size: .7rem;
    font-weight: 700;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #3f3a36;
    flex-shrink: 0;
}
.avatar-lg { width: 52px; height: 52px; font-size: .95rem; }
.chip {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    border-radius: 999px;
    padding: .32rem .78rem;
    font-size: .8rem;
    font-weight: 550;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    color: var(--ink-soft);
    text-decoration: none;
    backdrop-filter: blur(12px) saturate(160%);
    -webkit-backdrop-filter: blur(12px) saturate(160%);
}
.chip:hover { color: var(--ink); border-color: var(--accent); background: var(--glass-strong); }
.chip.active { background: var(--glass-strong); color: var(--accent-2); border-color: var(--accent); }
.chip.tone-success { background: #e8f7ee; color: #166534; }
.chip.tone-good { background: #e8f0ff; color: #1d4f91; }
.chip.tone-warning { background: #fff1db; color: #8a5408; }
.chip.tone-attention { background: #fde8ea; color: #9f1d2a; }
.chip.tone-neutral { background: var(--glass); color: var(--ink-soft); }
.badge-soft { background: var(--accent-soft); color: var(--accent-2); }
.prio-urgent { background: #fde8ea; color: #9f1d2a; }
.prio-high { background: #fff1db; color: #8a5408; }
.prio-medium { background: #e8f0ff; color: #1d4f91; }
.prio-low { background: #f1eee9; color: #4b5563; }
.temp-hot { background: #fde8ea; color: #9f1d2a; }
.temp-warm { background: #fff1db; color: #8a5408; }
.temp-cold { background: #e8f1ff; color: #24548c; }

.page-kicker { color: var(--muted); font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; font-weight: 650; }
.page-title { font-weight: 750; letter-spacing: -.045em; }
.hero-copy { max-width: 640px; }
.hero-copy h1 { font-size: clamp(1.8rem, 3vw, 2.5rem); font-weight: 750; letter-spacing: -.05em; }
.notice-pill {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    border: 1px solid rgba(224, 122, 61, .45);
    color: var(--accent-2);
    border-radius: 999px;
    padding: .35rem .9rem;
    font-size: .82rem;
    background: rgba(255,255,255,.55);
}
.empty-state { padding: 2.6rem 1rem; text-align: center; color: var(--muted); }
.empty-state i { font-size: 1.5rem; display: block; margin-bottom: .4rem; opacity: .5; }
.work-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .85rem 0;
    border-bottom: 1px solid var(--line);
    text-decoration: none;
    color: inherit;
}
.work-row:last-child { border-bottom: 0; }
.work-row:hover .work-name { color: var(--accent-2); }

.target-card { display: flex; flex-direction: column; }
.target-progress {
    height: .55rem;
    border-radius: 999px;
    background: color-mix(in srgb, var(--text, #111) 8%, transparent);
    overflow: hidden;
}
.target-progress--sm { width: 120px; height: .4rem; }
.target-progress__bar {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--accent, #e07a3d);
    min-width: 0;
}

.team-card {
    padding: 1.15rem 0;
    border-bottom: 1px solid var(--line);
}
.team-card:first-child { padding-top: 0; }
.team-card:last-child { border-bottom: 0; padding-bottom: 0; }
.team-manage {
    margin-top: 1rem;
    padding-top: .85rem;
    border-top: 1px solid var(--line);
}
.team-manage > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    list-style: none;
    cursor: pointer;
    font-weight: 650;
    color: var(--ink);
}
.team-manage > summary::-webkit-details-marker { display: none; }
.team-manage > summary::after {
    content: "\F282";
    font-family: "bootstrap-icons";
    font-weight: 400;
    color: var(--muted);
    transition: transform .15s ease;
}
.team-manage[open] > summary::after { transform: rotate(180deg); }
.roster-picker {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(11.5rem, 1fr));
    gap: .55rem;
}
.roster-option {
    display: flex;
    align-items: center;
    gap: .6rem;
    margin: 0;
    min-height: 3rem;
    padding: .5rem .7rem;
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    background: var(--glass);
    cursor: pointer;
}
.roster-option:hover,
.roster-option:has(.form-check-input:checked) {
    border-color: rgba(224, 122, 61, .45);
    background: var(--glass-strong);
}
.roster-option .avatar { width: 28px; height: 28px; font-size: .65rem; }
.roster-option-name {
    min-width: 0;
    font-size: .9rem;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.roster-option.is-disabled {
    opacity: .72;
    cursor: not-allowed;
}
.roster-option.is-disabled:hover {
    border-color: var(--glass-border);
    background: var(--glass);
}
.roster-option.is-disabled .roster-option-name {
    white-space: normal;
}

.detail-list { display: grid; }
.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1.25rem;
    padding: .95rem 0;
    border-bottom: 1px solid var(--line);
}
.detail-row:last-child { border-bottom: 0; }
.detail-row .detail-label {
    color: var(--muted);
    font-size: .88rem;
    font-weight: 550;
}
.detail-row .detail-value {
    font-weight: 650;
    text-align: right;
    letter-spacing: -.015em;
}
.detail-stack {
    padding: .95rem 0;
    border-bottom: 1px solid var(--line);
}
.detail-stack:last-child { border-bottom: 0; }
.comment-block {
    margin-top: .45rem;
    padding: .9rem 1rem;
    border-radius: 16px;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    font-weight: 550;
    backdrop-filter: blur(12px) saturate(160%);
    -webkit-backdrop-filter: blur(12px) saturate(160%);
}
.status-pending { background: #fff1db; color: #8a5408; border-color: transparent; }
.status-approved { background: #e7f6ec; color: #2f9d6a; border-color: transparent; }
.status-rejected { background: #fde8ea; color: #9f1d2a; border-color: transparent; }
.type-won { background: var(--accent-soft); color: var(--accent-2); border-color: transparent; }
.type-lost { background: #f1eee9; color: #57534e; border-color: transparent; }
.btn-ok {
    background: var(--ok);
    border-color: var(--ok);
    color: #fff;
    box-shadow: 0 10px 22px rgba(47, 157, 106, 0.18);
}
.btn-ok:hover { background: #27875b; border-color: #27875b; color: #fff; }

.timeline-item { position: relative; padding: 0 0 1.15rem 1.2rem; }
.timeline-item::before {
    content: "";
    position: absolute;
    left: 5px;
    top: 8px;
    bottom: -4px;
    width: 1px;
    background: var(--line-strong);
}
.timeline-item:last-child::before { display: none; }
.timeline-dot {
    position: absolute;
    left: 0;
    top: 6px;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid var(--accent);
}
#timeline { scroll-margin-top: 88px; }
.timeline-item.is-fresh {
    margin: 0 -0.55rem 0.85rem;
    padding: 0.7rem 0.7rem 1.15rem 1.75rem;
    border-radius: 14px;
    background: rgba(224, 122, 61, 0.1);
    animation: timeline-fresh 1.6s ease;
}
.timeline-item.is-fresh .timeline-dot {
    left: 0.55rem;
    background: var(--accent);
}

.kanban-col {
    min-width: 292px;
    max-width: 292px;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
}
.kanban-head { display: flex; align-items: center; justify-content: space-between; padding: .2rem .1rem .75rem; }
.kanban-card { cursor: default; transition: transform .15s ease, box-shadow .15s ease; }
.kanban-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.kanban-handle { cursor: grab; min-width: 32px; min-height: 32px; padding: .2rem; }

.auth-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 2rem;
    background:
        radial-gradient(720px 380px at 50% 0%, rgba(255, 186, 140, 0.55), transparent 58%),
        radial-gradient(520px 300px at 70% 20%, rgba(255, 220, 160, 0.4), transparent 60%),
        var(--bg);
}
.auth-hero { display: none; }
.auth-panel { width: min(460px, 100%); }
.auth-card { width: 100%; }
.auth-card .input-group .form-control {
    border-right: 0;
}
.auth-card .input-group .btn {
    border-color: var(--border, rgba(15, 23, 42, 0.12));
    background: var(--glass-strong, #fff);
    color: var(--ink-soft, #64748b);
}
.auth-card .input-group .btn:hover,
.auth-card .input-group .btn:focus {
    color: var(--ink, #0f172a);
    background: var(--accent-soft, rgba(224, 122, 61, 0.12));
}
.progress-ring {
    --p: 0;
    width: 74px;
    height: 74px;
    border-radius: 50%;
    background: conic-gradient(var(--accent) calc(var(--p) * 1%), rgba(224,122,61,.12) 0);
    display: grid;
    place-items: center;
}
.progress-ring span {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--glass-strong);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: grid;
    place-items: center;
    font-size: .78rem;
    font-weight: 750;
}
.dropdown-menu {
    background: #fff;
    border: 1px solid rgba(28, 25, 23, 0.08);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: 0 18px 40px rgba(28, 25, 23, 0.16);
    padding: .45rem;
}
.dropdown-item {
    border-radius: 10px;
    padding: .55rem .75rem;
    font-weight: 550;
    color: var(--ink);
}
.dropdown-item:hover, .dropdown-item:focus {
    background: var(--accent-soft);
    color: var(--accent-2);
}
.page-link {
    background: var(--glass);
    border: 0;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}
.page-item.active .page-link {
    background: #1c1917;
}

.modal-backdrop.show { opacity: .28; }
.modal-content {
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 24px;
    overflow: hidden;
    background: var(--glass);
    backdrop-filter: blur(22px) saturate(170%);
    -webkit-backdrop-filter: blur(22px) saturate(170%);
    box-shadow: 0 24px 60px rgba(28, 25, 23, 0.12);
}
.modal-header, .modal-footer { background: transparent; }
.modal-title { font-weight: 750; letter-spacing: -.04em; }
.alert { border: 0; border-radius: 16px; }
.quick-tile {
    display: flex;
    align-items: center;
    gap: .8rem;
    padding: .85rem .95rem;
    border-radius: 14px;
    border: 1px solid rgba(28, 25, 23, 0.08);
    text-decoration: none;
    color: #1c1917;
    background: var(--glass);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}
.quick-tile:hover {
    background: var(--glass-strong);
    border-color: rgba(28, 25, 23, 0.1);
    color: #1c1917;
}
.quick-tile strong { font-weight: 650; letter-spacing: -.02em; }
.quick-tile .small { color: #9a948c; }
.quick-tile i {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    background: var(--accent-soft);
    color: var(--accent-2);
    font-size: 1.05rem;
    flex-shrink: 0;
}
.plan-badge {
    font-size: .68rem;
    border-radius: 999px;
    padding: .12rem .45rem;
    background: #e7f6ec;
    color: #2f9d6a;
    font-weight: 650;
}
.plan-badge[data-role="admin"] { background: #f4e8df; color: #c45e24; }
.plan-badge[data-role="manager"] { background: #e8eefc; color: #4c7cf0; }
.plan-badge[data-role="agent"] { background: #e7f6ec; color: #2f9d6a; }

.sidebar-backdrop {
    display: none;
}
@media (max-width: 991px) {
    .sidebar {
        position: fixed;
        z-index: 1040;
        transform: translateX(-105%);
        transition: transform .22s ease;
        box-shadow: var(--shadow-lg);
    }
    .sidebar.show { transform: none; }
    .sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 1035;
        background: rgba(28, 25, 23, 0.42);
    }
    .sidebar-backdrop[hidden] { display: none; }
    body.sidebar-open { overflow: hidden; }
    .search-wrap { max-width: none; }
}

.pagination { --bs-pagination-border-radius: 999px; }

.alert.glass {
    background: var(--glass-strong);
}

@media (prefers-reduced-transparency: reduce) {
    .glass, .panel, .metric-card, .search-wrap, .btn-ghost, .icon-btn, .form-control, .form-select, .chip, .kanban-col, .crm-toast, .modal-content, .crm-select-menu, .crm-cal, .dropdown-menu {
        background: #fff;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }
}

.toast-stack {
    position: fixed;
    top: 1.15rem;
    right: 1.15rem;
    z-index: 1080;
    display: grid;
    gap: .7rem;
    width: min(380px, calc(100vw - 1.6rem));
    pointer-events: none;
}
.crm-toast {
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: .8rem;
    padding: .9rem 1rem;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.7);
    background: var(--glass-strong);
    box-shadow: 0 18px 40px rgba(28, 25, 23, 0.12);
    transform: translateY(-10px);
    opacity: 0;
    transition: transform .24s ease, opacity .24s ease;
}
.crm-toast.is-visible {
    transform: translateY(0);
    opacity: 1;
}
.crm-toast.is-leaving {
    transform: translateY(-8px);
    opacity: 0;
}
.crm-toast-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    background: #e7f6ec;
    color: var(--ok);
    flex-shrink: 0;
}
.crm-toast-copy { min-width: 0; flex: 1; padding-top: .05rem; }
.crm-toast-title {
    font-weight: 700;
    letter-spacing: -.03em;
    line-height: 1.2;
}
.crm-toast-body {
    color: var(--ink-soft);
    font-size: .86rem;
    margin-top: .12rem;
}
.crm-toast-close {
    border: 0;
    background: transparent;
    color: var(--muted);
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}
.crm-toast-close:hover { background: rgba(28, 25, 23, 0.06); color: var(--ink); }
.crm-toast.is-error .crm-toast-icon { background: #fde8ea; color: var(--danger); }
.work-row.is-unread { font-weight: 650; }

.notification-row {
    margin: 0;
    border-bottom: 1px solid var(--line);
}
.notification-row:last-child { border-bottom: 0; }
.notification-row__hit {
    width: 100%;
    display: grid;
    grid-template-columns: 1.25rem minmax(0, 1fr) auto;
    align-items: start;
    gap: .85rem 1rem;
    padding: 1rem 1.15rem;
    border: 0;
    background: transparent;
    text-align: left;
    color: inherit;
}
.notification-row__hit:hover {
    background: color-mix(in srgb, var(--surface, #fff) 88%, var(--text, #111) 4%);
}
.notification-row__hit:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--accent, #e07a3d) 55%, transparent);
    outline-offset: -2px;
}
.notification-row__status {
    display: grid;
    place-items: center;
    width: 1.25rem;
    height: 1.25rem;
    margin-top: .15rem;
    color: var(--muted);
    font-size: .95rem;
}
.notification-row__dot {
    width: .55rem;
    height: .55rem;
    border-radius: 999px;
    background: var(--accent, #e07a3d);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent, #e07a3d) 18%, transparent);
}
.notification-row__copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: .2rem;
}
.notification-row__title {
    display: block;
    font-weight: 650;
    letter-spacing: -.02em;
    line-height: 1.3;
    text-decoration: none;
}
.notification-row__message {
    display: block;
    color: var(--ink-soft, var(--muted));
    font-size: .9rem;
    line-height: 1.4;
    font-weight: 450;
}
.notification-row__details {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem .5rem;
    margin-top: .45rem;
}
.notification-row__detail {
    display: inline-flex;
    align-items: center;
    padding: .18rem .55rem;
    border-radius: 999px;
    background: color-mix(in srgb, var(--surface, #fff) 70%, var(--text, #111) 6%);
    border: 1px solid var(--line);
    color: var(--ink-soft, var(--muted));
    font-size: .74rem;
    line-height: 1.25;
    font-weight: 500;
}
.notification-row__meta {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    white-space: nowrap;
    margin-top: .1rem;
}
.notification-row__time {
    color: var(--muted);
    font-size: .8rem;
}
.notification-row__chevron {
    color: var(--muted);
    font-size: .85rem;
    opacity: .7;
}
.notification-row.is-unread .notification-row__title { font-weight: 750; }
.notification-row:not(.is-unread) .notification-row__title,
.notification-row:not(.is-unread) .notification-row__message {
    opacity: .82;
}

.note-item, .file-item {
    padding: .7rem 0;
    border-bottom: 1px solid var(--line);
}
.note-item:last-child, .file-item:last-child { border-bottom: 0; }
.req { color: var(--danger); }

@keyframes timeline-fresh {
    0% { background: rgba(224, 122, 61, 0.22); }
    100% { background: rgba(224, 122, 61, 0.1); }
}

.crm-select, .crm-date {
    position: relative;
    display: block;
    width: 100%;
}
.crm-select.w-auto, .crm-date.w-auto {
    width: auto;
    display: inline-block;
    min-width: 160px;
}
.crm-select-trigger, .crm-date-trigger {
    width: 100%;
    min-height: 46px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .65rem;
    border-radius: 14px;
    border: 1px solid var(--glass-border);
    background: var(--glass);
    backdrop-filter: blur(12px) saturate(160%);
    -webkit-backdrop-filter: blur(12px) saturate(160%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
    padding: .65rem .95rem;
    color: var(--ink);
    font: inherit;
    font-weight: 550;
    text-align: left;
}
.crm-select-trigger span, .crm-date-trigger span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.crm-select-trigger i, .crm-date-trigger i {
    color: var(--accent-2);
    font-size: 1rem;
    flex-shrink: 0;
}
.crm-select.is-open .crm-select-trigger,
.crm-date.is-open .crm-date-trigger,
.crm-select-trigger:focus-visible,
.crm-date-trigger:focus-visible {
    border-color: rgba(224, 122, 61, .45);
    box-shadow: 0 0 0 .2rem var(--accent-soft);
    outline: 0;
}
.crm-select-menu, .crm-cal {
    position: fixed;
    z-index: 2000;
    padding: .45rem;
    border-radius: 16px;
    border: 1px solid rgba(28, 25, 23, 0.08);
    background: #fff;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: 0 18px 40px rgba(28, 25, 23, 0.16);
    display: none;
    overflow: auto;
}
.crm-select-menu.is-open,
.crm-cal.is-open { display: block; }
.crm-select-option {
    width: 100%;
    border: 0;
    background: transparent;
    border-radius: 10px;
    padding: .55rem .75rem;
    text-align: left;
    color: var(--ink);
    font: inherit;
    font-weight: 550;
}
.crm-select-option:hover,
.crm-select-option.is-active { background: var(--accent-soft); color: var(--accent-2); }
.crm-select-option.is-selected {
    background: var(--accent-soft);
    color: var(--accent-2);
}
.crm-select-option.is-disabled { opacity: .45; pointer-events: none; }
.crm-select select.crm-native,
.crm-date input.crm-native {
    position: absolute;
    inset: 0;
    opacity: 0;
    pointer-events: none;
    width: 100%;
    height: 100%;
}
.crm-cal {
    width: 320px;
    padding: .85rem;
    overflow: visible;
}
.crm-cal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .35rem;
    margin-bottom: .7rem;
}
.crm-cal-head strong {
    font-weight: 700;
    letter-spacing: -.03em;
}
.crm-cal-jump {
    display: flex;
    gap: .35rem;
    min-width: 0;
    flex: 1;
    justify-content: center;
}
.crm-cal-jump select {
    border: 0;
    background: var(--glass);
    border-radius: 10px;
    font: inherit;
    font-weight: 650;
    padding: .25rem .4rem;
    color: var(--ink);
    max-width: 100%;
    min-width: 0;
}
.crm-cal-nav {
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 10px;
    background: var(--glass);
    color: var(--accent-2);
    display: grid;
    place-items: center;
}
.crm-cal-nav:hover { background: var(--accent-soft); }
.crm-cal-week, .crm-cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: .2rem;
}
.crm-cal-week span, .crm-cal-day {
    height: 32px;
    display: grid;
    place-items: center;
    font-size: .75rem;
    color: var(--muted);
    font-weight: 650;
}
.crm-cal-day {
    border: 0;
    background: transparent;
    border-radius: 10px;
    color: var(--ink);
    font: inherit;
    font-weight: 550;
}
.crm-cal-day:hover { background: var(--accent-soft); color: var(--accent-2); }
.crm-cal-day.is-today { box-shadow: inset 0 0 0 1.5px rgba(224, 122, 61, 0.45); }
.crm-cal-day.is-selected { background: var(--accent); color: #fff; }
.crm-cal-day.is-muted { opacity: .35; }
.crm-cal-day.is-disabled,
.crm-cal-day:disabled {
    opacity: .35;
    pointer-events: none;
    cursor: not-allowed;
}
.crm-cal-day.is-disabled:hover,
.crm-cal-day:disabled:hover {
    background: transparent;
    color: inherit;
}
.crm-cal-time {
    display: flex;
    gap: .5rem;
    margin-top: .75rem;
}
.crm-cal-time input {
    min-width: 0;
}
.crm-cal-actions {
    display: flex;
    justify-content: space-between;
    gap: .5rem;
    margin-top: .75rem;
}
.crm-cal-actions .btn { min-height: 36px; padding: .35rem .8rem; }
