:root {
    --bg: #f3f5f9;
    --bg-soft: #141c29;
    --card: #ffffff;
    --card-2: #f7f9fc;
    --card-3: #eef3f8;
    --line: rgba(25, 39, 61, 0.1);
    --line-strong: rgba(25, 39, 61, 0.18);
    --text: #1a2433;
    --muted: #6d788b;
    --muted-strong: #415067;
    --accent: #18a7f4;
    --accent-soft: rgba(24, 167, 244, 0.12);
    --accent-alt: #48b8ff;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #f59e0b;
    --radius: 22px;
    --radius-md: 18px;
    --radius-sm: 14px;
    --shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
    --shadow-soft: 0 10px 24px rgba(15, 23, 42, 0.07);
    --space-1: 0.35rem;
    --space-2: 0.55rem;
    --space-3: 0.8rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-7: 1.9rem;
    --space-8: 2.4rem;
    --content-max: 1520px;
    --input-height: 44px;
    --sidebar-width: 246px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(circle at top right, rgba(24, 167, 244, 0.08), transparent 24%),
        linear-gradient(180deg, #f8fafc 0%, var(--bg) 100%);
    color: var(--text);
    font-family: "Manrope", sans-serif;
    line-height: 1.55;
    text-rendering: optimizeLegibility;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
    display: block;
}

.muted {
    color: var(--muted);
}

h1,
h2,
h3 {
    letter-spacing: -0.02em;
}

.eyebrow {
    margin: 0 0 var(--space-1);
    color: var(--accent);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.app-layout {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 1rem 0.85rem;
    background: linear-gradient(180deg, #161f2d 0%, #182233 100%);
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    overflow-y: auto;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.15rem 0.35rem 0.65rem;
}

.brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 15px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--accent), #4ec3ff);
    color: #ffffff;
    font-size: 1.3rem;
    font-weight: 800;
}

.sidebar-brand strong {
    font-size: 1rem;
    line-height: 1.1;
}

.sidebar-brand p,
.sidebar-footer p,
.topbar-user-card p,
.topbar-subtitle,
.small-label {
    margin: 0.2rem 0 0;
    color: var(--muted);
}

.sidebar-brand strong,
.sidebar-footer strong {
    color: #f8fbff;
}

.sidebar-brand p,
.sidebar-footer p,
.sidebar-section-title,
.sidebar-meta {
    color: rgba(216, 225, 236, 0.62);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.sidebar-nav-group {
    display: grid;
    gap: 0.15rem;
}

.sidebar-link {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 40px;
    padding: 0.5rem 0.8rem;
    border-radius: 14px;
    color: rgba(232, 238, 246, 0.78);
    font-weight: 600;
    border: 1px solid transparent;
    transition: 0.18s ease;
}

.sidebar-link:hover,
.sidebar-link.is-active {
    background: rgba(41, 62, 87, 0.78);
    color: #ffffff;
    border-color: rgba(24, 167, 244, 0.22);
}

.sidebar-link.is-active {
    background: linear-gradient(180deg, rgba(30, 89, 134, 0.96), rgba(36, 104, 155, 0.92));
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.sidebar-link.is-active::before {
    content: "";
    position: absolute;
    left: -0.2rem;
    top: 0.5rem;
    bottom: 0.5rem;
    width: 3px;
    border-radius: 999px;
    background: linear-gradient(180deg, #2fc1ff, #8fe0ff);
}

.sidebar-link-label {
    min-width: 0;
    font-size: 0.96rem;
    line-height: 1.2;
}

.sidebar-section-title,
.sidebar-meta {
    margin: 0 0 0.45rem;
    color: var(--muted);
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    padding-left: 0.25rem;
}

.sidebar-meta-group {
    padding-top: 0.8rem;
    border-top: 1px solid var(--line);
}

.sidebar-footer {
    margin-top: auto;
    padding: 0.85rem 0.95rem;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-toggle {
    display: none;
}

.mobile-only {
    display: none;
}

.app-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--space-5);
    padding: var(--space-6) var(--space-7);
    backdrop-filter: blur(16px);
    background: rgba(248, 250, 252, 0.88);
    border-bottom: 1px solid rgba(25, 39, 61, 0.08);
}

.topbar-heading {
    min-width: 0;
}

.topbar-heading-copy {
    display: grid;
    gap: 0.35rem;
}

.topbar h1,
.panel h2,
.panel h3,
.auth-card h2,
.auth-card h1 {
    margin: 0;
}

.topbar h1 {
    font-size: clamp(1.7rem, 2vw, 2.25rem);
    line-height: 1.05;
}

.topbar-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--space-3);
    flex-wrap: wrap;
}

.tenant-switch-form {
    display: grid;
    gap: 0.35rem;
    min-width: 220px;
}

.topbar-user-card {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: 0.65rem 0.85rem;
    border-radius: var(--radius-md);
    background: #ffffff;
    border: 1px solid var(--line);
    min-height: 56px;
}

.avatar-circle {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, rgba(24, 167, 244, 0.18), rgba(105, 194, 255, 0.26));
    font-weight: 800;
}

.content-shell {
    width: 100%;
    max-width: var(--content-max);
    margin: 0 auto;
    padding: var(--space-6) var(--space-7) var(--space-8);
}

.panel,
.stat-card,
.auth-card,
.auth-brand-card,
.details-card,
.subtle-panel {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(249, 251, 253, 0.98));
    border: 1px solid rgba(25, 39, 61, 0.08);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.panel,
.stat-card,
.auth-card,
.auth-brand-card {
    padding: clamp(1.1rem, 1rem + 0.4vw, 1.45rem);
}

.subtle-panel {
    padding: var(--space-4) var(--space-5);
}

.compact-panel {
    padding: var(--space-4) var(--space-5);
}

.panel-header,
.drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--space-4);
    margin-bottom: var(--space-4);
}

.button,
.input,
.textarea,
select,
.tab-button,
.sidebar-toggle,
.icon-button {
    font: inherit;
}

.button {
    border: 1px solid transparent;
    border-radius: 16px;
    min-height: var(--input-height);
    padding: 0.72rem 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.button:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-soft);
}

.button-primary {
    background: linear-gradient(135deg, var(--accent), #0ea5e9);
    color: #ffffff;
}

.button-ghost {
    background: #ffffff;
    color: var(--text);
    border-color: var(--line);
}

.button-danger-outline {
    background: rgba(220, 38, 38, 0.04);
    color: var(--danger);
    border-color: rgba(220, 38, 38, 0.18);
}

.button-block {
    width: 100%;
}

.button-small {
    min-height: 34px;
    padding: 0.48rem 0.72rem;
    border-radius: 12px;
    font-size: 0.88rem;
}

.input,
.textarea,
select {
    width: 100%;
    min-height: var(--input-height);
    padding: 0.78rem 0.95rem;
    border-radius: 15px;
    border: 1px solid var(--line);
    background: #ffffff;
    color: var(--text);
    outline: none;
}

.input::placeholder,
.textarea::placeholder {
    color: rgba(109, 120, 139, 0.8);
}

.input:focus,
.textarea:focus,
select:focus {
    border-color: rgba(56, 189, 248, 0.52);
    box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.12);
}

.textarea {
    resize: vertical;
    min-height: 110px;
}

.code-textarea {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    min-height: 360px;
}

.field-label {
    display: block;
    font-size: 0.83rem;
    font-weight: 700;
    color: var(--muted);
    margin: 0;
    line-height: 1.35;
}

.checkbox-field {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    min-height: var(--input-height);
    padding: 0.75rem 0.95rem;
    background: var(--card-2);
    border-radius: 15px;
    border: 1px solid var(--line);
}

.grid-form {
    display: grid;
    gap: 0.95rem 1rem;
    align-items: start;
}

.three-columns {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.two-columns {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.full-width {
    grid-column: 1 / -1;
}

.form-field {
    display: grid;
    align-content: start;
    gap: 0.45rem;
    min-width: 0;
}

.form-field > .field-label {
    margin: 0;
}

.form-field > .input,
.form-field > .textarea,
.form-field > select {
    min-width: 0;
}

.stack-form,
.list-stack,
.timeline-list {
    display: grid;
    gap: var(--space-4);
}

.form-actions,
.table-actions,
.filters-inline,
.settings-tabs,
.pagination {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    flex-wrap: wrap;
}

.filters-inline {
    align-items: end;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

.stat-card {
    position: relative;
    overflow: hidden;
    min-height: 144px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.stat-card::after {
    content: "";
    position: absolute;
    inset: auto -20% -50% auto;
    width: 160px;
    height: 160px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(24, 167, 244, 0.14), transparent 70%);
}

.stat-card p {
    margin: 0 0 0.55rem;
    color: var(--muted);
    font-size: 0.92rem;
}

.stat-card strong {
    font-size: clamp(1.55rem, 2vw, 2rem);
    line-height: 1.05;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-4);
    margin-bottom: var(--space-4);
}

.dashboard-grid.three-columns {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.chart-canvas {
    width: 100%;
    max-height: 340px;
}

.list-stack .line-item,
.line-item-link {
    padding: 1rem 1.05rem;
    border-radius: var(--radius-md);
    background: var(--card-2);
    border: 1px solid rgba(25, 39, 61, 0.06);
    transition: 0.18s ease;
}

.line-item p,
.line-item small,
.note-block,
.details-list dd {
    margin: 0.25rem 0 0;
    color: var(--muted);
}

.line-item:hover,
.line-item-link:hover {
    border-color: rgba(24, 167, 244, 0.18);
    background: #ffffff;
}

.table-wrap {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid rgba(25, 39, 61, 0.08);
    background: #ffffff;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 0.95rem 0.9rem;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

.table th {
    color: var(--muted);
    font-size: 0.83rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    background: #f8fafc;
}

.table tbody tr:hover {
    background: #f8fbfe;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.75rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
}

.badge-success {
    background: rgba(22, 163, 74, 0.12);
    color: #17803d;
}

.badge-danger {
    background: rgba(220, 38, 38, 0.1);
    color: #b91c1c;
}

.badge-warning {
    background: rgba(245, 158, 11, 0.16);
    color: #fcd34d;
}

.badge-neutral {
    background: rgba(25, 39, 61, 0.08);
    color: #4c5c75;
}

.alerts-stack {
    display: grid;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.alert {
    padding: 1rem 1.15rem;
    border-radius: 16px;
    border: 1px solid var(--line);
}

.alert-success {
    background: rgba(22, 163, 74, 0.08);
    border-color: rgba(22, 163, 74, 0.18);
}

.alert-danger {
    background: rgba(220, 38, 38, 0.08);
    border-color: rgba(220, 38, 38, 0.18);
}

.alert-warning {
    background: rgba(245, 158, 11, 0.08);
    border-color: rgba(245, 158, 11, 0.18);
}

.pipeline-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.75rem;
    min-width: min(100%, 720px);
}

.pipeline-summary-card {
    padding: 0.8rem 0.95rem;
    border-radius: 16px;
    background: #ffffff;
    border: 1px solid rgba(25, 39, 61, 0.08);
    display: grid;
    gap: 0.2rem;
}

.pipeline-summary-card span,
.kanban-column-kpis span,
.lead-card-metrics span {
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.pipeline-summary-card strong {
    font-size: 1rem;
    line-height: 1.1;
}

.pipeline-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 1rem;
    flex-wrap: wrap;
}

.pipeline-toolbar-fields {
    display: grid;
    grid-template-columns: minmax(260px, 1.6fr) minmax(220px, 0.9fr);
    gap: 0.9rem;
    flex: 1 1 720px;
}

.pipeline-toolbar-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.kanban-wrapper {
    overflow-x: auto;
    padding-bottom: var(--space-4);
}

.kanban-board {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(288px, 320px);
    gap: 1rem;
    min-width: max-content;
}

.kanban-column {
    display: grid;
    grid-template-rows: auto auto 1fr;
    gap: 0.9rem;
    background: linear-gradient(180deg, #edf3f8 0%, #e9f0f7 100%);
    border: 1px solid rgba(25, 39, 61, 0.08);
    border-radius: var(--radius);
    padding: 1rem;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.kanban-column.is-won {
    border-color: rgba(34, 197, 94, 0.24);
}

.kanban-column.is-lost {
    border-color: rgba(239, 68, 68, 0.22);
}

.kanban-column-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
}

.kanban-column-heading {
    display: flex;
    align-items: flex-start;
    gap: 0.8rem;
    min-width: 0;
}

.kanban-column-header h2 {
    font-size: 1rem;
    line-height: 1.15;
}

.kanban-column-header p {
    margin: 0.25rem 0 0;
    color: var(--muted);
    font-size: 0.84rem;
}

.stage-dot {
    width: 14px;
    height: 14px;
    border-radius: 999px;
    margin-top: 0.2rem;
    flex: 0 0 auto;
}

.kanban-column-kpis {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
}

.kanban-column-kpis > div {
    padding: 0.75rem 0.8rem;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid rgba(25, 39, 61, 0.08);
    display: grid;
    gap: 0.18rem;
}

.kanban-column-kpis strong {
    font-size: 0.96rem;
    line-height: 1.15;
}

.kanban-column-body {
    min-height: 300px;
    display: grid;
    gap: 0.8rem;
    align-content: start;
}

.lead-card {
    display: grid;
    gap: 0.8rem;
    padding: 0.95rem;
    border-radius: var(--radius-md);
    background: linear-gradient(180deg, #ffffff 0%, #fbfcfe 100%);
    border: 1px solid rgba(25, 39, 61, 0.08);
    box-shadow: var(--shadow-soft);
    transition: transform 0.18s ease, border-color 0.18s ease;
}

.kanban-board[data-can-move="1"] .lead-card {
    cursor: grab;
}

.lead-card:hover {
    transform: translateY(-2px);
    border-color: rgba(56, 189, 248, 0.22);
}

.lead-card-head {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    align-items: flex-start;
}

.lead-card-heading {
    min-width: 0;
}

.lead-card h3,
.details-card summary strong {
    margin: 0;
    font-size: 0.98rem;
    line-height: 1.2;
}

.lead-card p {
    margin: 0;
}

.lead-card-contact {
    color: #38617f;
    font-weight: 600;
    margin-top: 0.22rem;
    font-size: 0.88rem;
}

.lead-card-meta,
.lead-card-footer small,
.tags-inline {
    color: var(--muted);
    font-size: 0.88rem;
}

.lead-card-meta-grid {
    display: grid;
    gap: 0.45rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    color: var(--muted);
    font-size: 0.82rem;
}

.lead-card-meta-grid span {
    min-width: 0;
    padding: 0.55rem 0.65rem;
    border-radius: 12px;
    background: #f7fafe;
    border: 1px solid rgba(25, 39, 61, 0.06);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lead-card-metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.55rem;
    font-size: 0.9rem;
}

.lead-card-metrics article {
    padding: 0.7rem 0.75rem;
    border-radius: 14px;
    background: #f7fafe;
    border: 1px solid rgba(25, 39, 61, 0.06);
    display: grid;
    gap: 0.2rem;
}

.lead-card-metrics strong {
    font-size: 0.95rem;
    line-height: 1.15;
}

.lead-card-tags {
    display: flex;
    gap: 0.45rem;
    flex-wrap: wrap;
}

.lead-tag {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0.35rem 0.6rem;
    border-radius: 999px;
    background: rgba(56, 189, 248, 0.1);
    border: 1px solid rgba(56, 189, 248, 0.14);
    color: #10689a;
    font-size: 0.76rem;
    font-weight: 700;
}

.lead-tag-muted {
    background: rgba(25, 39, 61, 0.08);
    border-color: rgba(25, 39, 61, 0.1);
    color: #607089;
}

.lead-card-footer {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    align-items: center;
    padding-top: 0.15rem;
    border-top: 1px solid rgba(25, 39, 61, 0.08);
}

.lead-card-days {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 0.35rem 0.65rem;
    border-radius: 999px;
    background: #f3f8fc;
    color: var(--muted-strong);
    font-size: 0.78rem;
    font-weight: 700;
}

.kanban-empty {
    padding: 1rem;
    border-radius: 18px;
    border: 1px dashed rgba(25, 39, 61, 0.14);
    background: rgba(255, 255, 255, 0.55);
    text-align: center;
}

.kanban-empty strong {
    display: block;
    margin-bottom: 0.3rem;
}

.kanban-empty p {
    margin: 0;
    color: var(--muted);
    font-size: 0.86rem;
}

.icon-button {
    background: rgba(24, 167, 244, 0.1);
    color: #0d82c2;
    border: 1px solid rgba(24, 167, 244, 0.18);
    border-radius: 12px;
    padding: 0.5rem 0.72rem;
    cursor: pointer;
    transition: 0.18s ease;
    flex: 0 0 auto;
}

.icon-button:hover {
    background: rgba(24, 167, 244, 0.14);
    border-color: rgba(24, 167, 244, 0.24);
}

.details-card {
    overflow: hidden;
}

.details-card summary {
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.15rem;
    cursor: pointer;
}

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

.details-card-body {
    padding: 0 1.15rem 1.15rem;
}

.content-grid-detail {
    display: grid;
    grid-template-columns: 1.6fr 1fr;
    gap: 1rem;
}

.detail-sidebar {
    display: grid;
    gap: 1rem;
}

.details-list {
    display: grid;
    gap: 0.75rem;
}

.details-list div {
    padding-bottom: 0.7rem;
    border-bottom: 1px solid var(--line);
}

.details-list dt {
    color: var(--muted);
    font-weight: 700;
}

.timeline-item {
    padding: 0.9rem 1rem;
    border-radius: 16px;
    background: var(--card-2);
}

[hidden] {
    display: none !important;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 120;
    display: grid;
    place-items: center;
    padding: 1.25rem;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(17, 24, 39, 0.46);
    backdrop-filter: blur(10px);
}

.modal-dialog {
    position: relative;
    width: min(680px, 100%);
    max-height: min(88vh, 920px);
    overflow-y: auto;
    padding: 1.15rem;
    border-radius: 24px;
    border: 1px solid rgba(25, 39, 61, 0.1);
    background: linear-gradient(180deg, #ffffff 0%, #f9fbfd 100%);
    box-shadow: 0 28px 64px rgba(15, 23, 42, 0.14);
}

.modal-dialog-wide {
    width: min(1040px, 100%);
}

.modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.lead-drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(17, 24, 39, 0.42);
    backdrop-filter: blur(10px);
    z-index: 99;
    display: flex;
    justify-content: flex-end;
}

.lead-drawer-panel {
    width: min(720px, 100vw);
    height: 100%;
    padding: var(--space-6);
    background: linear-gradient(180deg, #ffffff 0%, #f7f9fc 100%);
    border-left: 1px solid rgba(25, 39, 61, 0.08);
    overflow-y: auto;
}

.drawer-close {
    margin-left: auto;
    display: block;
    border: 0;
    background: transparent;
    color: var(--text);
    font-size: 2rem;
    cursor: pointer;
}

.drawer-grid {
    display: grid;
    gap: 1rem;
}

.drawer-loading {
    padding: 2rem 0;
    text-align: center;
    color: var(--muted);
}

.settings-tabs {
    margin-bottom: 1rem;
}

.tab-button {
    border: 1px solid var(--line);
    background: #ffffff;
    color: var(--muted);
    padding: 0.8rem 1rem;
    border-radius: 16px;
    cursor: pointer;
    font-weight: 700;
}

.tab-button.is-active {
    color: var(--text);
    background: var(--accent-soft);
    border-color: rgba(24, 167, 244, 0.24);
}

.settings-section {
    display: none;
}

.settings-section.is-active {
    display: block;
}

.auth-body {
    display: grid;
    place-items: center;
    padding: var(--space-8);
}

.auth-shell {
    width: min(1180px, 100%);
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    gap: var(--space-6);
    align-items: stretch;
}

.auth-shell-register {
    grid-template-columns: 1fr;
}

.auth-brand-card {
    padding: var(--space-8);
    background:
        radial-gradient(circle at top right, rgba(24, 167, 244, 0.26), transparent 28%),
        linear-gradient(180deg, #1a2331 0%, #141c29 100%);
    color: #f8fbff;
}

.auth-card {
    align-self: center;
}

.wide-auth-card {
    max-width: 920px;
    margin: 0 auto;
}

.feature-list {
    margin: 1.3rem 0 0;
    padding-left: 1.2rem;
    color: var(--muted);
    display: grid;
    gap: 0.7rem;
}

.auth-footer-link {
    color: var(--muted);
    text-align: center;
    margin: 1.2rem 0 0;
}

.auth-footer-link a {
    color: var(--accent);
}

.top-spacing {
    margin-top: 1rem;
}

@media (max-width: 1180px) {
    .kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .pipeline-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        min-width: 0;
    }

    .pipeline-toolbar-fields {
        grid-template-columns: 1fr;
        flex-basis: 100%;
    }

    .grid-form.is-structured.three-columns {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dashboard-grid,
    .dashboard-grid.three-columns,
    .content-grid-detail,
    .auth-shell {
        grid-template-columns: 1fr;
    }
}

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

    .pipeline-summary,
    .lead-card-meta-grid,
    .lead-card-metrics,
    .kanban-column-kpis {
        grid-template-columns: 1fr;
    }

    .pipeline-toolbar-actions {
        width: 100%;
    }

    .pipeline-toolbar-actions .button {
        flex: 1 1 0;
    }

    .grid-form.is-structured.three-columns,
    .grid-form.is-structured.two-columns {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        transform: translateX(-100%);
        width: min(320px, 90vw);
        z-index: 50;
        transition: transform 0.25s ease;
    }

    .sidebar.is-open {
        transform: translateX(0);
    }

    .sidebar-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 100%;
        padding: 0.8rem 1rem;
        border-radius: 14px;
        border: 1px solid var(--line);
        background: rgba(255, 255, 255, 0.03);
        color: var(--text);
    }

    .mobile-only {
        display: inline-flex;
    }

    .topbar {
        padding: var(--space-4);
    }

    .content-shell {
        padding: var(--space-4) var(--space-4) var(--space-7);
    }

    .three-columns,
    .two-columns {
        grid-template-columns: 1fr;
    }

    .topbar-actions,
    .tenant-switch-form {
        width: 100%;
    }
}

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

    .topbar h1 {
        font-size: 1.5rem;
    }

    .table th,
    .table td {
        padding: 0.85rem 0.65rem;
    }
}
