:root {
    color-scheme: light;
    --ak-bg: #f4f7fb;
    --ak-surface: #ffffff;
    --ak-surface-muted: #eef3f8;
    --ak-text: #111827;
    --ak-muted: #6b7280;
    --ak-border: #d8e0ea;
    --ak-border-strong: #b9c5d4;
    --ak-primary: #2563eb;
    --ak-primary-soft: #dbeafe;
    --ak-sidebar: #0f172a;
    --ak-sidebar-muted: #94a3b8;
    --ak-sidebar-hover: #1e293b;
    --ak-topbar: #101827;
    --ak-warning: #b7791f;
    --ak-danger: #c24141;
    --ak-info: #2563eb;
    --ak-success: #15803d;
    --ak-radius-sm: 6px;
    --ak-radius-md: 8px;
    --ak-radius-lg: 12px;
    --ak-radius-xl: 16px;
    --ak-radius-pill: 999px;
    --ak-radius: var(--ak-radius-lg);
    --ak-space-xs: 4px;
    --ak-space-sm: 8px;
    --ak-space-md: 12px;
    --ak-space-lg: 16px;
    --ak-space-xl: 24px;
    --ak-font-weight-normal: 400;
    --ak-font-weight-label: 650;
    --ak-font-weight-section: 700;
    --ak-font-weight-strong: 800;
    --ak-control-height-sm: 32px;
    --ak-control-height-md: 38px;
    --ak-control-height-lg: 42px;
    --ak-shadow-none: none;
    --ak-shadow-light: 0 8px 22px rgba(15, 23, 42, 0.04);
    --ak-shadow-card: 0 12px 30px rgba(15, 23, 42, 0.06);
    --ak-shadow-dropdown: 0 18px 48px rgba(15, 23, 42, 0.14);
    --ak-shadow: 0 18px 48px rgba(15, 23, 42, 0.08);
    --ak-transition-fast: 0.16s ease;
    --ak-transition-smooth: 0.22s ease;
    --bg: var(--ak-bg);
    --panel: var(--ak-surface);
    --panel-muted: var(--ak-surface-muted);
    --text: var(--ak-text);
    --muted: var(--ak-muted);
    --border: var(--ak-border);
    --border-strong: var(--ak-border-strong);
    --accent: var(--ak-primary);
    --accent-soft: var(--ak-primary-soft);
    --shadow: var(--ak-shadow);
}

@media (prefers-color-scheme: dark) {
    :root {
        color-scheme: light;
        --ak-bg: #f4f7fb;
        --ak-surface: #ffffff;
        --ak-surface-muted: #eef3f8;
        --ak-text: #111827;
        --ak-muted: #6b7280;
        --ak-border: #d8e0ea;
        --ak-border-strong: #b9c5d4;
        --ak-primary: #2563eb;
        --ak-primary-soft: #dbeafe;
        --ak-sidebar: #020617;
        --ak-sidebar-muted: #94a3b8;
        --ak-sidebar-hover: #111827;
        --ak-topbar: #101820;
        --ak-shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
        --ak-shadow-card: 0 12px 30px rgba(15, 23, 42, 0.06);
        --ak-shadow-dropdown: 0 18px 48px rgba(15, 23, 42, 0.14);
    }
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-weight: 400;
    overflow-x: hidden;
}

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

.app-shell,
.ak-app-shell {
    display: grid;
    min-height: 100vh;
    grid-template-columns: 272px minmax(0, 1fr);
    max-width: 100%;
    min-width: 0;
}

.sidebar,
.ak-sidebar {
    border-right: 1px solid var(--border);
    background: var(--panel);
    padding: 22px 18px;
}

.brand,
.ak-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 26px;
}

.brand-mark {
    display: grid;
    width: 44px;
    height: 44px;
    place-items: center;
    border-radius: var(--ak-radius);
    background: var(--accent);
    color: #ffffff;
    font-weight: 800;
}

.brand strong,
.brand span {
    display: block;
}

.brand .brand-mark {
    display: grid;
    flex: 0 0 auto;
}

.brand span {
    margin-top: 2px;
    color: var(--muted);
    font-size: 13px;
}

.sidebar-nav,
.ak-sidebar-nav {
    display: grid;
    gap: 20px;
}

.ak-sidebar-section {
    display: grid;
    gap: 6px;
}

.ak-sidebar-section h2 {
    margin: 0 0 4px;
    padding: 0 10px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0;
    text-transform: uppercase;
}

.sidebar-link,
.ak-sidebar-link {
    border-radius: var(--ak-radius);
    padding: 10px 11px;
    color: var(--muted);
    font-weight: 600;
}

.sidebar-link:hover,
.ak-sidebar-link:hover {
    background: var(--panel-muted);
    color: var(--text);
}

.sidebar-link.active,
.ak-sidebar-link.active {
    background: var(--accent-soft);
    color: var(--accent);
}

.sidebar-link.muted {
    cursor: default;
    opacity: 0.72;
}

.workspace,
.ak-main {
    display: grid;
    grid-template-rows: auto 1fr;
    max-width: 100%;
    min-width: 0;
}

.topbar,
.ak-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    border-bottom: 1px solid color-mix(in srgb, #ffffff 9%, transparent);
    background: var(--ak-topbar);
    color: #ffffff;
    padding: 18px 30px;
}

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

.ak-topbar-brandline {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #aab6c5;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0;
    text-transform: uppercase;
}

.ak-topbar-brandline span + span {
    border-left: 1px solid rgba(255, 255, 255, 0.18);
    padding-left: 10px;
}

.topbar h1,
.ak-topbar h1 {
    margin: 4px 0 0;
    overflow: hidden;
    color: #ffffff;
    font-size: 18px;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.eyebrow {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

.topbar-status {
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--panel-muted);
    padding: 7px 12px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.topbar-user,
.ak-topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #cbd5e1;
    font-size: 14px;
    font-weight: 700;
}

.ak-topbar-user-name {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.topbar .button.ghost,
.ak-topbar .button.ghost,
.ak-topbar .ak-btn-secondary {
    border-color: rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

.topbar .button.ghost:hover,
.ak-topbar .button.ghost:hover,
.ak-topbar .ak-btn-secondary:hover {
    border-color: rgba(255, 255, 255, 0.32);
    background: rgba(255, 255, 255, 0.14);
}

.content,
.ak-page {
    max-width: 100%;
    min-width: 0;
    padding: 28px 30px 36px;
}

.ak-page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin: 0 0 22px;
}

.ak-page-header h2 {
    margin: 0;
    color: var(--text);
    font-size: 26px;
    line-height: 1.15;
}

.ak-page-header p {
    margin: 8px 0 0;
    color: var(--muted);
    line-height: 1.55;
}

.ak-page-kicker {
    margin: 0 0 6px !important;
    color: var(--accent) !important;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0;
    text-transform: uppercase;
}

.ak-page-header-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.status-panel,
.ak-card {
    max-width: 760px;
    border: 1px solid var(--border);
    border-radius: var(--ak-radius);
    background: var(--panel);
    padding: 28px;
    box-shadow: var(--shadow);
}

.status-panel h2 {
    margin: 8px 0 12px;
    font-size: 28px;
    line-height: 1.2;
}

.status-panel p {
    margin: 0;
    color: var(--muted);
    line-height: 1.65;
}

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

.metric-card,
.stat-card,
.ak-kpi-card {
    border: 1px solid var(--border);
    border-radius: var(--ak-radius);
    background: var(--panel);
    padding: 18px;
    box-shadow: 0 8px 22px rgba(23, 33, 43, 0.04);
}

.metric-card span,
.stat-card span,
.empty-state p {
    color: var(--muted);
}

.metric-card strong,
.stat-card strong {
    display: block;
    margin-top: 8px;
    font-size: 30px;
    line-height: 1;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 14px;
    margin: 0 0 18px;
}

.list-panel,
.ak-card {
    border: 1px solid var(--border);
    border-radius: var(--ak-radius);
    background: var(--panel);
    box-shadow: var(--shadow);
    overflow: hidden;
    max-width: 100%;
    min-width: 0;
}

.table-wrap,
.ak-table-wrap {
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    overscroll-behavior-x: contain;
}

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

.crm-resizable-table {
    table-layout: fixed;
    min-width: max-content;
}

th,
td {
    border-bottom: 1px solid var(--border);
    padding: 13px 16px;
    text-align: left;
    vertical-align: top;
}

th {
    background: var(--panel-muted);
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
    white-space: nowrap;
}

td {
    color: var(--text);
}

.crm-resizable-table th {
    position: relative;
}

.crm-resizable-table th,
.crm-resizable-table td {
    white-space: normal;
    overflow-wrap: anywhere;
}

.crm-resizable-table .select-column,
.crm-resizable-table .money-cell,
.crm-resizable-table td:has(.badge),
.crm-resizable-table th:has(input),
.crm-resizable-table td:has(input) {
    white-space: nowrap;
    overflow-wrap: normal;
}

.crm-column-resize-handle {
    position: absolute;
    top: 0;
    right: -4px;
    z-index: 4;
    width: 9px;
    height: 100%;
    cursor: col-resize;
    touch-action: none;
}

.crm-column-resize-handle::after {
    content: "";
    position: absolute;
    top: 7px;
    right: 4px;
    width: 2px;
    height: calc(100% - 14px);
    background: color-mix(in srgb, var(--border) 78%, var(--accent));
    border-radius: 999px;
}

.crm-column-resize-handle:hover::after,
.crm-column-resizing .crm-column-resize-handle::after {
    background: var(--accent);
}

.crm-column-resizing {
    cursor: col-resize;
    user-select: none;
}

.delete-confirmation-alert {
    margin-bottom: 14px;
}

.field-error {
    display: block;
    margin-top: 6px;
    color: var(--ak-danger);
    font-weight: 700;
}

.detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
    gap: 18px;
}

.details-list {
    display: grid;
    grid-template-columns: minmax(120px, 0.35fr) minmax(0, 1fr);
    gap: 10px 14px;
}

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

.details-list dd {
    margin: 0;
}

.compact-form {
    margin-top: 14px;
    padding: 0;
    border: 0;
    background: transparent;
}

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

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

tbody tr:hover td {
    background: color-mix(in srgb, var(--accent-soft) 34%, transparent);
}

.empty-state,
.ak-empty-state {
    padding: 28px;
}

.empty-state h2 {
    margin: 8px 0 10px;
    font-size: 24px;
}

.pagination-wrap,
.panel-heading {
    border-top: 1px solid var(--border);
    padding: 16px;
}

.crm-pagination-wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.per-page-selector {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.per-page-selector label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.per-page-selector span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.per-page-selector select {
    width: auto;
    min-width: 86px;
}

.crm-pagination,
.crm-pagination nav,
.crm-pagination nav > div,
.crm-pagination nav span,
.crm-pagination nav a {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.crm-pagination a,
.crm-pagination .crm-page-link,
.crm-pagination span[aria-current] span,
.crm-pagination span[aria-disabled] span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    min-height: 32px;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--panel);
    color: var(--text);
    font-size: 13px;
    line-height: 1;
    text-decoration: none;
}

.crm-pagination-summary {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.crm-page-active,
.crm-pagination span[aria-current] span {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 800;
}

.crm-page-disabled,
.crm-pagination span[aria-disabled] span {
    cursor: default;
    opacity: .45;
}

.crm-page-ellipsis {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 0 2px;
    color: var(--muted);
    font-size: 13px;
}

.crm-pagination svg,
.pagination svg {
    width: 16px !important;
    height: 16px !important;
    max-width: 16px !important;
    max-height: 16px !important;
}

.calltracking-calls-pagination-wrap {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 12px;
}

.calltracking-calls-pagination-wrap .per-page-selector {
    justify-self: start;
}

.calltracking-calls-pagination {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    justify-self: center;
    gap: 10px;
}

.calltracking-pagination-spacer {
    min-width: 1px;
}

.calltracking-page-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--panel);
    color: var(--text);
    font-size: 22px;
    line-height: 1;
    text-decoration: none;
    transition: border-color .16s ease, background-color .16s ease, box-shadow .16s ease, color .16s ease;
}

.calltracking-page-arrow:hover,
.calltracking-page-arrow:focus-visible {
    border-color: color-mix(in srgb, var(--accent) 42%, var(--border));
    background: var(--accent-soft);
    color: var(--accent);
    outline: none;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent);
}

.calltracking-page-arrow.is-disabled {
    cursor: default;
    opacity: .42;
    pointer-events: none;
}

.calltracking-page-indicator {
    min-width: 52px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
}

@media (max-width: 680px) {
    .calltracking-calls-pagination-wrap {
        grid-template-columns: 1fr;
        justify-items: center;
    }

    .calltracking-calls-pagination-wrap .per-page-selector {
        justify-self: center;
    }

    .calltracking-pagination-spacer {
        display: none;
    }
}

.compact-table th,
.compact-table td {
    padding: 8px 10px;
    font-size: 13px;
    white-space: nowrap;
}

.compact-table td:nth-child(5),
.compact-table th:nth-child(5) {
    white-space: normal;
    min-width: 220px;
}

.import-preview-wrap,
.import-preview-scroll,
.import-financial-scroll {
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-x: contain;
}

.import-preview-table {
    min-width: 980px;
    font-size: 12px;
}

.import-preview-table th,
.import-preview-table td,
.import-financial-table th,
.import-financial-table td {
    padding: 7px 9px;
}

.import-preview-table td,
.import-preview-table th {
    white-space: nowrap;
}

.import-preview-table td:nth-child(5),
.import-preview-table th:nth-child(5) {
    min-width: 220px;
    white-space: normal;
}

.import-financial-table {
    min-width: 860px;
    font-size: 13px;
}

.import-financial-table th,
.import-financial-table td {
    white-space: nowrap;
}

.import-preview-table .sticky-col {
    position: sticky;
    z-index: 2;
    background: var(--panel);
}

.import-preview-table th.sticky-col {
    background: var(--panel-muted);
}

.import-preview-table .sticky-col-1 {
    left: 0;
    min-width: 150px;
}

.import-preview-table .sticky-col-2 {
    left: 150px;
    min-width: 135px;
}

.mapping-grid,
.import-mapping-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 14px;
    align-items: start;
    max-width: 100%;
    min-width: 0;
}

.mapping-card,
.import-mapping-card {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    min-width: 0;
}

.mapping-card legend,
.import-mapping-card legend {
    padding: 0 6px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.mapping-row,
.import-map-row {
    display: grid;
    grid-template-columns: minmax(110px, 150px) minmax(160px, 1fr);
    gap: 8px;
    align-items: center;
    margin: 0 0 8px;
    min-width: 0;
}

.mapping-row > span,
.import-map-row > span {
    color: var(--text);
    font-size: 13px;
    font-weight: 700;
}

.mapping-row select,
.import-map-row select {
    width: 100%;
    min-width: 0;
    min-height: 36px;
    padding: 7px 10px;
    font-size: 13px;
}

.mapping-row small,
.import-map-row small {
    grid-column: 2;
    color: var(--muted);
    font-size: 12px;
}

@media (max-width: 720px) {
    .import-map-row {
        grid-template-columns: 1fr;
    }

    .import-map-row small {
        grid-column: 1;
    }
}

.panel-heading h2 {
    margin: 0;
    font-size: 20px;
}

.help-text {
    margin: 0 0 18px;
    color: var(--muted);
    line-height: 1.55;
}

.wide-panel {
    grid-column: 1 / -1;
}

.code-block {
    white-space: pre-wrap;
    word-break: break-word;
    margin: 0;
    color: var(--text);
    font: inherit;
}

.button,
.crm-btn,
.ak-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    border: 1px solid var(--border);
    border-radius: var(--ak-radius);
    padding: 8px 14px;
    background: var(--panel);
    color: var(--text);
    cursor: pointer;
    font: inherit;
    font-weight: 800;
    text-decoration: none;
    transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease, opacity 0.16s ease;
}

.button:hover,
.crm-btn:hover,
.ak-btn:hover {
    border-color: color-mix(in srgb, var(--accent) 38%, var(--border));
    background: color-mix(in srgb, var(--accent) 8%, var(--panel));
}

.button.primary,
.crm-btn-primary,
.ak-btn-primary {
    border-color: var(--accent);
    background: var(--accent);
    color: #ffffff;
}

.button.primary:hover,
.crm-btn-primary:hover,
.ak-btn-primary:hover {
    border-color: color-mix(in srgb, var(--accent) 82%, #000000);
    background: color-mix(in srgb, var(--accent) 90%, #000000);
    color: #ffffff;
}

.button.ghost,
.crm-btn-secondary,
.crm-btn-muted,
.crm-btn-back,
.crm-btn-toolbar,
.ak-btn-secondary {
    background: var(--panel-muted);
    color: var(--text);
}

.crm-btn-danger,
.ak-btn-danger {
    border-color: var(--ak-danger);
    background: color-mix(in srgb, var(--ak-danger) 12%, var(--panel));
    color: var(--ak-danger);
}

.crm-btn-small {
    min-height: 32px;
    padding: 6px 10px;
    font-size: 13px;
}

.button.disabled,
.crm-btn.disabled,
.ak-btn.disabled,
.button[aria-disabled="true"],
.crm-btn[aria-disabled="true"],
.ak-btn[aria-disabled="true"] {
    cursor: default;
    opacity: 0.62;
    pointer-events: none;
}

.link-button {
    border: 0;
    background: transparent;
    color: var(--accent);
    cursor: pointer;
    font: inherit;
    font-weight: 800;
    padding: 0;
}

.entity-link {
    color: var(--accent);
    font-weight: 800;
    text-decoration: none;
}

.entity-link:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.page-actions {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 18px;
}

.list-toolbar,
.ak-toolbar {
    display: grid;
    gap: 8px;
    margin-bottom: 8px;
}

.list-toolbar-main,
.list-toolbar-filters,
.list-toolbar-actions,
.compact-metrics {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.list-toolbar-main {
    justify-content: flex-start;
}

.list-toolbar-start {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.list-toolbar-main > .list-toolbar-start {
    flex: 0 1 auto;
    min-width: 0;
}

.list-toolbar form.list-toolbar-start,
.list-toolbar form.list-toolbar-filters,
.list-toolbar form.bulk-action-form {
    flex: 0 1 auto;
    margin: 0;
}

.list-toolbar .search-input {
    width: 320px;
    max-width: min(320px, 100%);
}

.list-toolbar-filters {
    padding-top: 2px;
}

.list-toolbar input,
.list-toolbar select,
.list-toolbar .button,
.list-toolbar .crm-btn {
    flex: 0 0 auto;
}

.list-toolbar-filters select,
.list-toolbar-filters input[type="date"] {
    width: 190px;
    min-width: 0;
}

.list-toolbar .period-picker-toggle {
    justify-content: flex-start;
    width: 310px;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 700;
    white-space: nowrap;
}

.compact-metric {
    min-width: 132px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--panel);
    padding: 8px 10px;
}

.compact-metric span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.compact-metric strong {
    display: block;
    margin-top: 3px;
    font-size: 17px;
    line-height: 1.1;
}

.select-column {
    width: 44px;
    text-align: center;
}

.period-picker {
    position: relative;
    flex: 0 0 auto;
}

.period-picker-panel {
    position: absolute;
    z-index: 20;
    top: calc(100% + 8px);
    left: 0;
    display: none;
    width: 320px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: var(--shadow);
    padding: 12px;
}

.period-picker.open .period-picker-panel {
    display: grid;
    gap: 10px;
}

.period-picker-panel label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

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

.search-form {
    display: flex;
    gap: 8px;
    width: min(520px, 100%);
}

.filter-form {
    display: grid;
    grid-template-columns: minmax(180px, 1.5fr) repeat(4, minmax(140px, 1fr)) auto;
    gap: 8px;
    width: min(980px, 100%);
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--panel);
    color: var(--text);
    padding: 10px 12px;
    font: inherit;
}

textarea {
    resize: vertical;
}

.form-panel,
.auth-card {
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: var(--shadow);
    padding: 28px;
}

.form-grid {
    display: grid;
    gap: 16px;
}

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

.crm-processing-form {
    display: grid;
    gap: 14px;
    padding: 22px;
}

.crm-processing-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.crm-processing-grid-vehicle {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.crm-processing-field,
.crm-processing-field-full {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 800;
}

.crm-processing-field-full textarea {
    min-height: 92px;
}

.form-grid label,
.form-panel > label,
.auth-card label {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 800;
}

.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin: 18px 0;
}

.checkbox-row {
    display: inline-flex !important;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 8px !important;
}

.checkbox-row input {
    width: auto;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.alert,
.ak-alert {
    border: 1px solid var(--border);
    border-radius: var(--ak-radius);
    margin-bottom: 18px;
    padding: 13px 15px;
    background: var(--panel);
}

.alert.success,
.ak-alert-success {
    border-color: color-mix(in srgb, var(--accent) 50%, var(--border));
    background: var(--accent-soft);
}

.alert.warning,
.ak-alert-warning {
    border-color: var(--ak-warning);
    background: color-mix(in srgb, var(--ak-warning) 16%, var(--panel));
}

.alert.error,
.ak-alert-error {
    border-color: var(--ak-danger);
    background: color-mix(in srgb, var(--ak-danger) 14%, var(--panel));
}

.alert ul {
    margin: 8px 0 0 18px;
}

.badge,
.ak-badge,
.ak-badge-muted {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    background: var(--panel-muted);
    color: var(--muted);
    padding: 4px 8px;
    font-size: 12px;
    font-weight: 800;
}

.badge.accent,
.ak-badge-success {
    background: var(--accent-soft);
    color: var(--accent);
}

.badge.warning,
.ak-badge-warning {
    background: color-mix(in srgb, var(--ak-warning) 16%, var(--panel));
    color: var(--ak-warning);
}

.badge.danger,
.ak-badge-danger {
    background: color-mix(in srgb, var(--ak-danger) 16%, var(--panel));
    color: var(--ak-danger);
}

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

.compact-note {
    margin-top: 3px;
    font-size: 12px;
    line-height: 1.2;
}

.archived-row {
    opacity: 0.68;
}

.archived-badge {
    background: var(--panel-muted);
    color: var(--muted);
}

.crm-extra-cell {
    width: 1%;
    white-space: nowrap;
}

.crm-extra-badges {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.crm-extra-badge {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    border-radius: 999px;
    padding: 2px 8px;
    background: var(--panel-muted);
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
}

.crm-extra-badge-archive {
    background: color-mix(in srgb, var(--muted) 14%, var(--panel));
    color: var(--muted);
}

.inbox-status-action-cell {
    white-space: nowrap;
}

.compact-action-button {
    min-height: 30px;
    padding: 6px 10px;
    font-size: 13px;
}

.actions-cell {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.actions-cell a {
    color: var(--accent);
    font-weight: 800;
}

.details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 18px;
    margin-bottom: 18px;
}

.details-panel {
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--panel);
    padding: 22px;
    box-shadow: var(--shadow);
}

.details-panel h2 {
    margin: 0 0 16px;
    font-size: 20px;
}

dl {
    display: grid;
    grid-template-columns: minmax(130px, 0.45fr) 1fr;
    gap: 10px 16px;
    margin: 0;
}

dt {
    color: var(--muted);
    font-weight: 800;
}

dd {
    margin: 0;
}

.stack-list {
    display: grid;
    gap: 10px;
}

.panel-stack {
    padding: 16px;
}

.stack-item {
    display: grid;
    gap: 4px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
    background: var(--panel-muted);
}

.stack-item small {
    color: var(--muted);
}

.inline-form {
    display: grid;
    gap: 10px;
    margin-top: 16px;
}

.auth-page {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 24px;
}

.auth-card {
    width: min(440px, 100%);
}

.auth-card h1 {
    margin: 20px 0 8px;
    font-size: 28px;
}

.auth-card p {
    margin: 0 0 20px;
    color: var(--muted);
}

.auth-brand {
    margin-bottom: 0;
}

/* UI Visual Phase 1.1 */
.app-shell,
.ak-app-shell {
    grid-template-columns: 264px minmax(0, 1fr);
    background: var(--ak-bg);
}

.sidebar,
.ak-sidebar {
    position: sticky;
    top: 0;
    align-self: start;
    min-height: 100vh;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    background:
        linear-gradient(180deg, rgba(37, 99, 235, 0.14), transparent 220px),
        var(--ak-sidebar);
    color: #e5edf7;
    padding: 20px 14px;
}

.brand,
.ak-brand {
    min-height: 52px;
    border-radius: 16px;
    margin: 0 4px 24px;
    padding: 8px 8px;
}

.brand:hover,
.ak-brand:hover {
    background: rgba(255, 255, 255, 0.05);
}

.brand-mark {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    box-shadow: 0 12px 26px rgba(37, 99, 235, 0.34);
    font-size: 16px;
    overflow: hidden;
}

.brand-logo {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    padding: 0;
}

.brand-logo-fill {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.brand strong {
    color: #ffffff;
    font-size: 13px;
    letter-spacing: 0;
}

.brand span {
    color: var(--ak-sidebar-muted);
}

.sidebar-nav,
.ak-sidebar-nav {
    gap: 18px;
}

.ak-sidebar-section {
    gap: 5px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding-top: 14px;
}

.ak-sidebar-section:first-child {
    border-top: 0;
    padding-top: 0;
}

.ak-sidebar-section h2 {
    color: #718096;
    font-size: 10px;
    letter-spacing: 0;
}

.ak-sidebar-section.active h2 {
    color: #bfdbfe;
}

.ak-sidebar-section.active h2::before {
    content: "";
    display: inline-block;
    width: 6px;
    height: 6px;
    margin-right: 7px;
    border-radius: 999px;
    background: #60a5fa;
    vertical-align: 1px;
}

.sidebar-link,
.ak-sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 38px;
    border-radius: 999px;
    padding: 8px 10px;
    color: #cbd5e1;
    font-size: 14px;
    font-weight: 750;
}

.ak-sidebar-icon {
    display: inline-grid;
    flex: 0 0 24px;
    width: 24px;
    height: 24px;
    place-items: center;
    border-radius: 9px;
    background: rgba(148, 163, 184, 0.14);
    color: #bfdbfe;
    font-size: 11px;
    font-weight: 900;
}

.sidebar-link:hover,
.ak-sidebar-link:hover {
    background: var(--ak-sidebar-hover);
    color: #ffffff;
}

.sidebar-link.active,
.ak-sidebar-link.active {
    background: rgba(37, 99, 235, 0.22);
    color: #ffffff;
    box-shadow: inset 3px 0 0 #60a5fa;
}

.sidebar-link.active .ak-sidebar-icon,
.ak-sidebar-link.active .ak-sidebar-icon {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

.workspace,
.ak-main {
    background: var(--ak-bg);
}

.topbar,
.ak-topbar {
    position: sticky;
    z-index: 30;
    top: 0;
    min-height: 62px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: var(--ak-topbar);
    padding: 10px 26px;
}

.ak-topbar-heading {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ak-topbar-menu {
    display: inline-grid;
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.06);
    color: #dbeafe;
    font-weight: 900;
}

.topbar h1,
.ak-topbar h1 {
    margin: 0;
    font-size: 22px;
    font-weight: 600;
    letter-spacing: 0;
}

.ak-topbar-search {
    display: flex;
    align-items: center;
    gap: 8px;
    width: min(360px, 32vw);
    min-width: 220px;
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.07);
    padding: 0 12px;
    color: #93a4ba;
}

.ak-topbar-search input {
    min-height: 38px;
    border: 0;
    background: transparent;
    color: #dbeafe;
    padding: 0;
}

.ak-topbar-search input::placeholder {
    color: #93a4ba;
}

.ak-topbar-search-disabled {
    opacity: 0.78;
    cursor: not-allowed;
}

.ak-topbar-search-disabled input {
    cursor: not-allowed;
}

.ak-topbar-profile {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    color: #ffffff;
}

.ak-topbar-profile small,
.ak-topbar-user-name {
    display: block;
}

.ak-topbar-profile small {
    color: #94a3b8;
    font-size: 12px;
    font-weight: 650;
}

.ak-topbar-avatar {
    display: inline-grid;
    width: 36px;
    height: 36px;
    place-items: center;
    border-radius: 999px;
    background: linear-gradient(135deg, #60a5fa, #2563eb);
    box-shadow: 0 12px 24px rgba(37, 99, 235, 0.28);
    color: #ffffff;
    font-size: 14px;
    font-weight: 900;
}

.topbar .button.ghost,
.ak-topbar .button.ghost,
.ak-topbar .ak-btn-secondary {
    min-height: 36px;
    border-color: rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.07);
    padding: 7px 12px;
}

.content,
.ak-page {
    width: min(100%, 1480px);
    margin: 0 auto;
    padding: 22px 30px 38px;
}

.ak-page-header {
    min-height: auto;
    border: 1px solid rgba(216, 224, 234, 0.75);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.72);
    box-shadow: 0 16px 42px rgba(15, 23, 42, 0.05);
    margin-bottom: 16px;
    padding: 12px 16px;
}

.ak-page-header h2 {
    font-size: 28px;
    font-weight: 600;
    letter-spacing: 0;
}

.ak-page-kicker {
    color: var(--ak-primary) !important;
}

.status-panel,
.metric-card,
.stat-card,
.list-panel,
.details-panel,
.form-panel,
.auth-card,
.mapping-card,
.compact-metric,
.ak-card,
.ak-kpi-card {
    border: 1px solid rgba(216, 224, 234, 0.86);
    border-radius: 16px;
    background: var(--ak-surface);
    box-shadow: 0 14px 36px rgba(15, 23, 42, 0.06);
}

.status-panel,
.ak-card {
    max-width: none;
}

.metric-card,
.stat-card,
.ak-kpi-card {
    position: relative;
    overflow: hidden;
    min-height: 112px;
    padding: 18px 18px 16px;
    transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.metric-card::before,
.stat-card::before,
.ak-kpi-card::before {
    content: "";
    position: absolute;
    top: 18px;
    right: 18px;
    width: 34px;
    height: 34px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.16), rgba(96, 165, 250, 0.24));
}

.metric-card strong,
.stat-card strong {
    font-size: 32px;
    font-weight: 650;
    letter-spacing: 0;
}

.metric-card span,
.stat-card span {
    font-size: 13px;
    font-weight: 500;
}

.list-panel {
    margin-top: 14px;
}

.table-wrap,
.ak-table-wrap {
    max-width: 100%;
    border-radius: 0 0 16px 16px;
}

table,
.ak-table {
    min-width: 760px;
}

th,
td {
    padding: 9px 12px;
}

th {
    background: #f8fafc;
    color: #64748b;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: uppercase;
}

td {
    font-weight: 400;
}

td[title] {
    max-width: 360px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

tbody tr:hover td {
    background: #f8fbff;
}

.panel-heading,
.pagination-wrap {
    background: #ffffff;
    padding: 14px 16px;
}

.button,
.crm-btn,
.ak-btn {
    min-height: 36px;
    border-radius: 999px;
    font-weight: 500;
}

.button.primary,
.crm-btn-primary,
.ak-btn-primary {
    border-color: #2563eb;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    box-shadow: 0 10px 22px rgba(37, 99, 235, 0.2);
}

.button.ghost,
.crm-btn-secondary,
.crm-btn-muted,
.crm-btn-back,
.crm-btn-toolbar,
.ak-btn-secondary {
    background: #ffffff;
    color: #334155;
}

.button.ghost:hover,
.crm-btn-secondary:hover,
.crm-btn-muted:hover,
.crm-btn-back:hover,
.crm-btn-toolbar:hover,
.ak-btn-secondary:hover {
    background: #f8fafc;
}

.crm-btn-danger,
.ak-btn-danger {
    border-color: rgba(194, 65, 65, 0.32);
    background: #fff5f5;
}

input,
select,
textarea {
    min-height: 40px;
    border-radius: 12px;
    background: #ffffff;
    transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

input:focus,
select:focus,
textarea:focus {
    border-color: rgba(37, 99, 235, 0.72);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
    outline: 0;
}

.list-toolbar,
.ak-toolbar,
.page-actions {
    border-radius: 16px;
}

.list-toolbar {
    margin-bottom: 12px;
}

.list-toolbar-main,
.list-toolbar-filters {
    gap: 10px;
}

.badge,
.ak-badge,
.ak-badge-muted {
    border: 1px solid transparent;
    padding: 3px 8px;
    font-weight: 500;
    line-height: 1.25;
}

.badge.accent,
.ak-badge-success {
    border-color: rgba(21, 128, 61, 0.18);
    background: #dcfce7;
    color: var(--ak-success);
}

.badge.warning,
.ak-badge-warning {
    border-color: rgba(183, 121, 31, 0.2);
    background: #fef3c7;
}

.badge.danger,
.ak-badge-danger {
    border-color: rgba(194, 65, 65, 0.18);
    background: #fee2e2;
}

.alert,
.ak-alert {
    border-radius: 14px;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.05);
}

.stack-item {
    border-radius: 12px;
    background: #f8fafc;
    transition: border-color 0.16s ease, background-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.metric-card:hover,
.stat-card:hover,
.ak-kpi-card:hover,
.stack-item:hover {
    border-color: color-mix(in srgb, var(--accent) 22%, var(--border));
    box-shadow: 0 16px 34px rgba(15, 23, 42, 0.08);
    transform: translateY(-1px);
}

.list-panel,
.details-panel,
.status-panel,
.form-panel,
.auth-card,
.ak-card {
    animation: ak-soft-appear 0.18s ease-out;
}

@keyframes ak-soft-appear {
    from {
        opacity: 0;
        transform: translateY(3px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.crm-pagination a,
.crm-pagination span[aria-current] span,
.crm-pagination span[aria-disabled] span {
    border-radius: 999px;
}

.period-picker-panel {
    border-radius: 16px;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 14px;
    margin-bottom: 16px;
}

.settings-card {
    display: grid;
    align-content: start;
    gap: 10px;
    border: 1px solid rgba(216, 224, 234, 0.86);
    border-radius: 16px;
    background: #ffffff;
    box-shadow: 0 14px 36px rgba(15, 23, 42, 0.06);
    padding: 18px;
}

.settings-card-wide {
    grid-column: 1 / -1;
}

.settings-card h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.settings-card p {
    margin: 0;
    color: var(--muted);
    line-height: 1.55;
}

.settings-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
}

.settings-system-panel {
    margin-top: 16px;
}

.appointment-dashboard-widget,
.appointment-calendar-shell {
    border: 1px solid var(--ak-border);
    border-radius: var(--ak-radius-xl);
    margin-bottom: var(--ak-space-lg);
    background: var(--ak-surface);
    box-shadow: var(--ak-shadow-card);
    padding: var(--ak-space-xl);
}

.appointment-widget-heading,
.appointment-calendar-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--ak-space-lg);
    margin-bottom: var(--ak-space-lg);
}

.appointment-widget-heading h2,
.appointment-calendar-heading h2 {
    margin: 4px 0 6px;
    font-size: 22px;
    font-weight: var(--ak-font-weight-section);
}

.appointment-widget-heading p,
.appointment-calendar-heading p {
    margin: 0;
    color: var(--ak-muted);
}

.appointment-widget-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--ak-space-sm);
    justify-content: flex-end;
}

.appointment-dashboard-days {
    display: grid;
    grid-template-columns: repeat(7, minmax(130px, 1fr));
    gap: var(--ak-space-sm);
}

.appointment-dashboard-day,
.appointment-day-card {
    position: relative;
    min-width: 0;
    border: 1px solid var(--ak-border);
    border-radius: var(--ak-radius-md);
    background: #f8fafc;
    padding: 10px;
}

.appointment-dashboard-day.today,
.appointment-day-card.today {
    border-color: color-mix(in srgb, var(--ak-primary) 42%, var(--ak-border));
    background: color-mix(in srgb, var(--ak-primary) 7%, #ffffff);
}

.appointment-dashboard-day header,
.appointment-day-card header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--ak-space-sm);
    margin-bottom: 8px;
}

.appointment-dashboard-day header strong,
.appointment-day-card header span {
    color: var(--ak-text);
    font-size: 15px;
    font-weight: var(--ak-font-weight-section);
}

.appointment-dashboard-day header span,
.appointment-day-card header strong {
    color: var(--ak-primary);
    font-size: 12px;
    font-weight: var(--ak-font-weight-label);
}

.appointment-day-empty {
    margin: 0;
    color: var(--ak-muted);
    font-size: 12px;
}

.appointment-chip-list {
    display: grid;
    gap: 6px;
    min-width: 0;
}

.appointment-chip {
    position: relative;
    display: grid;
    min-width: 0;
    border: 1px solid color-mix(in srgb, var(--ak-border) 82%, var(--ak-primary));
    border-radius: var(--ak-radius-md);
    background: #ffffff;
    color: var(--ak-text);
    padding: 7px 8px;
    transition: border-color var(--ak-transition-fast), box-shadow var(--ak-transition-fast), transform var(--ak-transition-fast);
}

.appointment-chip:hover,
.appointment-chip:focus-visible {
    z-index: 8;
    border-color: color-mix(in srgb, var(--ak-primary) 48%, var(--ak-border));
    box-shadow: var(--ak-shadow-dropdown);
    outline: 0;
    transform: translateY(-1px);
}

.appointment-chip-main,
.appointment-chip-meta {
    display: flex;
    align-items: center;
    min-width: 0;
    gap: 6px;
}

.appointment-chip-main strong {
    flex: 0 0 auto;
    color: var(--ak-primary);
    font-size: 12px;
}

.appointment-chip-main span,
.appointment-chip-meta span:first-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.appointment-chip-main span {
    font-size: 13px;
    font-weight: var(--ak-font-weight-label);
}

.appointment-chip-meta {
    margin-top: 3px;
    color: var(--ak-muted);
    font-size: 11px;
}

.appointment-more {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    border-radius: var(--ak-radius-pill);
    background: var(--ak-surface-muted);
    color: var(--ak-muted);
    padding: 4px 8px;
    font-size: 12px;
    font-weight: var(--ak-font-weight-label);
}

.appointment-popover {
    position: absolute;
    z-index: 40;
    left: 0;
    top: calc(100% + 8px);
    display: grid;
    width: min(340px, calc(100vw - 48px));
    max-width: 340px;
    gap: 5px;
    border: 1px solid var(--ak-border);
    border-radius: var(--ak-radius-lg);
    background: #ffffff;
    box-shadow: var(--ak-shadow-dropdown);
    color: var(--ak-text);
    opacity: 0;
    padding: 12px;
    pointer-events: none;
    transform: translateY(-4px);
    transition: opacity var(--ak-transition-fast), transform var(--ak-transition-fast);
}

.appointment-popover-title {
    color: var(--ak-text);
    font-weight: var(--ak-font-weight-section);
}

.appointment-popover span {
    font-size: 12px;
    line-height: 1.35;
}

.appointment-popover-links {
    color: var(--ak-primary);
    font-weight: var(--ak-font-weight-label);
}

.appointment-chip:hover .appointment-popover,
.appointment-chip:focus-visible .appointment-popover {
    opacity: 1;
    transform: translateY(0);
}

.appointment-filter-panel {
    padding: 12px;
    border: 1px solid var(--ak-border);
    border-radius: var(--ak-radius-xl);
    background: var(--ak-surface);
    box-shadow: var(--ak-shadow-light);
}

.appointment-weekdays,
.appointment-month-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: var(--ak-space-sm);
}

.appointment-weekdays {
    margin-bottom: var(--ak-space-sm);
}

.appointment-weekdays span {
    color: var(--ak-muted);
    font-size: 12px;
    font-weight: var(--ak-font-weight-section);
    text-align: center;
    text-transform: uppercase;
}

.appointment-day-card {
    min-height: 168px;
    background: #ffffff;
}

.appointment-day-card.muted {
    background: #f8fafc;
    opacity: 0.62;
}

.appointment-form {
    max-width: 1120px;
}

.inline-action-form {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.inline-action-form input {
    width: 220px;
    min-height: var(--ak-control-height-md);
}

.ak-calendar-shell {
    overflow: visible;
    border-color: color-mix(in srgb, var(--ak-border) 86%, #ffffff);
    border-radius: 18px;
    background: #ffffff;
    padding: 0;
    box-shadow: 0 18px 44px rgba(15, 23, 42, 0.07);
}

.ak-calendar-toolbar {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) auto minmax(360px, 1.2fr);
    gap: 14px;
    align-items: center;
    border-bottom: 1px solid var(--ak-border);
    padding: 14px 16px;
}

.ak-calendar-toolbar-left,
.ak-calendar-toolbar-right,
.ak-calendar-view-switcher,
.ak-calendar-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.ak-calendar-toolbar-right {
    justify-content: flex-end;
    flex-wrap: wrap;
}

.ak-calendar-plus {
    display: inline-grid;
    flex: 0 0 34px;
    width: 34px;
    height: 34px;
    place-items: center;
    border: 1px solid var(--ak-primary);
    border-radius: 10px;
    background: var(--ak-primary);
    color: #ffffff;
    font-size: 22px;
    font-weight: 650;
    line-height: 1;
}

.ak-calendar-plus:hover,
.ak-calendar-plus:focus-visible {
    background: color-mix(in srgb, var(--ak-primary) 88%, #000000);
    outline: 3px solid color-mix(in srgb, var(--ak-primary) 20%, transparent);
    outline-offset: 2px;
}

.ak-calendar-title {
    display: grid;
    min-width: 0;
    gap: 1px;
}

.ak-calendar-title strong {
    overflow: hidden;
    color: var(--ak-text);
    font-size: 30px;
    font-weight: 760;
    letter-spacing: 0;
    line-height: 1.05;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ak-calendar-title span {
    color: var(--ak-muted);
    font-size: 12px;
    font-weight: var(--ak-font-weight-label);
}

.ak-calendar-view-switcher {
    border: 1px solid var(--ak-border);
    border-radius: 10px;
    background: #f8fafc;
    padding: 3px;
}

.ak-calendar-view {
    min-height: 30px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--ak-muted);
    cursor: default;
    font: inherit;
    font-size: 13px;
    font-weight: var(--ak-font-weight-label);
    padding: 5px 10px;
}

.ak-calendar-view.active {
    background: #ffffff;
    box-shadow: 0 1px 6px rgba(15, 23, 42, 0.08);
    color: var(--ak-text);
}

.ak-calendar-view:disabled {
    opacity: 0.55;
}

.ak-calendar-search {
    display: flex;
    align-items: center;
    gap: 6px;
    width: min(220px, 100%);
    min-width: 160px;
    border: 1px solid var(--ak-border);
    border-radius: 10px;
    background: #f8fafc;
    padding: 0 10px;
}

.ak-calendar-search span {
    color: var(--ak-muted);
}

.ak-calendar-search input {
    width: 100%;
    min-height: 32px;
    border: 0;
    background: transparent;
    padding: 0;
}

.ak-calendar-toolbar select {
    width: auto;
    min-width: 118px;
    min-height: 34px;
    border-radius: 10px;
    padding: 6px 28px 6px 10px;
    font-size: 13px;
}

.ak-calendar-filter-submit,
.ak-calendar-today,
.ak-calendar-nav-button {
    min-height: 34px;
    border-radius: 10px;
    padding: 6px 11px;
    font-size: 13px;
}

.ak-calendar-nav-button {
    width: 34px;
    padding-inline: 0;
    font-size: 18px;
}

.ak-calendar-meta {
    justify-content: space-between;
    min-height: 36px;
    border-bottom: 1px solid var(--ak-border);
    padding: 8px 16px;
    color: var(--ak-muted);
    font-size: 12px;
    font-weight: var(--ak-font-weight-label);
}

.ak-calendar-meta a {
    color: var(--ak-primary);
}

.ak-calendar-weekdays {
    gap: 0;
    margin: 0;
    border-bottom: 1px solid var(--ak-border);
    background: #fbfdff;
}

.ak-calendar-weekday {
    padding: 10px 8px;
    border-right: 1px solid var(--ak-border);
    color: #64748b;
    font-size: 12px;
    font-weight: var(--ak-font-weight-section);
    text-align: center;
}

.ak-calendar-weekday:last-child {
    border-right: 0;
}

.ak-calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 0;
}

.ak-calendar-day {
    min-height: 150px;
    border: 0;
    border-right: 1px solid var(--ak-border);
    border-bottom: 1px solid var(--ak-border);
    border-radius: 0;
    background: #ffffff;
    padding: 8px;
    transition: background-color var(--ak-transition-fast);
}

.ak-calendar-day:nth-child(7n) {
    border-right: 0;
}

.ak-calendar-day:hover {
    background: #fbfdff;
}

.ak-calendar-day-weekend {
    background: #fafcff;
}

.ak-calendar-day-muted {
    background: #fbfbfc;
    opacity: 1;
}

.ak-calendar-day-muted .ak-calendar-day-number,
.ak-calendar-day-muted .appointment-day-empty {
    color: #b6c1cf;
}

.ak-calendar-day-today {
    background: color-mix(in srgb, var(--ak-primary) 5%, #ffffff);
    box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--ak-primary) 32%, transparent);
}

.ak-calendar-day header {
    margin-bottom: 7px;
}

.ak-calendar-day-number {
    display: inline-grid;
    min-width: 26px;
    height: 26px;
    place-items: center;
    border-radius: 999px;
    color: var(--ak-text);
    font-size: 13px;
    font-weight: 760;
}

.ak-calendar-day-today .ak-calendar-day-number {
    background: var(--ak-primary);
    color: #ffffff;
}

.ak-calendar-day header strong {
    color: var(--ak-primary);
    font-size: 11px;
}

.ak-appointment-chip {
    overflow: visible;
    min-height: 34px;
    border: 1px solid color-mix(in srgb, var(--ak-border) 76%, transparent);
    border-left: 3px solid color-mix(in srgb, var(--ak-primary) 54%, var(--ak-border));
    border-radius: 8px;
    background: #f8fbff;
    box-shadow: none;
    padding: 5px 7px;
}

.ak-appointment-chip-status-confirmed,
.ak-appointment-chip-status-done {
    border-left-color: #22c55e;
    background: #f7fdf9;
}

.ak-appointment-chip-status-in_progress {
    border-left-color: #f59e0b;
    background: #fffaf0;
}

.ak-appointment-chip-status-canceled,
.ak-appointment-chip-status-no_show {
    border-left-color: #ef4444;
    background: #fff8f8;
}

.ak-appointment-status-dot {
    display: inline-block;
    flex: 0 0 7px;
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--ak-primary) 60%, #ffffff);
}

.ak-appointment-chip-status-confirmed .ak-appointment-status-dot,
.ak-appointment-chip-status-done .ak-appointment-status-dot {
    background: #22c55e;
}

.ak-appointment-chip-status-in_progress .ak-appointment-status-dot {
    background: #f59e0b;
}

.ak-appointment-chip-status-canceled .ak-appointment-status-dot,
.ak-appointment-chip-status-no_show .ak-appointment-status-dot {
    background: #ef4444;
}

.ak-appointment-chip .appointment-chip-main strong {
    font-size: 11px;
}

.ak-appointment-chip .appointment-chip-main span:last-child {
    font-size: 12px;
}

.ak-appointment-chip .appointment-chip-meta {
    gap: 5px;
    color: #64748b;
    font-size: 10.5px;
}

.ak-appointment-popover {
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 18px 42px rgba(15, 23, 42, 0.16);
}

.ak-calendar-more {
    border-radius: 7px;
    background: #eef3f8;
    color: #64748b;
    font-size: 11px;
    padding: 4px 7px;
}

.ak-dashboard-calendar {
    border-color: color-mix(in srgb, var(--ak-border) 86%, #ffffff);
    background: #ffffff;
    padding: 16px;
}

.ak-dashboard-calendar .appointment-widget-heading {
    margin-bottom: 12px;
}

.ak-dashboard-calendar .appointment-widget-heading h2 {
    font-size: 20px;
}

.ak-dashboard-calendar .appointment-dashboard-days {
    grid-template-columns: repeat(7, minmax(112px, 1fr));
}

.ak-dashboard-calendar .appointment-dashboard-day {
    background: #fbfdff;
    padding: 8px;
}

.ak-dashboard-calendar .appointment-dashboard-day.today {
    box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--ak-primary) 24%, transparent);
}

.ak-filter-bar {
    align-items: start;
    gap: 8px;
}

.ak-filter-form {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    width: auto;
    max-width: 100%;
}

.ak-filter-form input:not([type="hidden"]),
.ak-filter-form select {
    width: auto;
    min-width: 138px;
    max-width: 220px;
}

.ak-filter-form .search-input {
    width: 240px;
}

.ak-filter-form input[type="date"] {
    min-width: 142px;
}

.ak-filter-form .checkbox-row {
    min-height: 36px;
    padding-inline: 2px;
}

.ak-filter-actions {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

/* UI Phase 3A: global tokens and component aliases */
.button,
.crm-btn,
.ak-btn {
    min-height: var(--ak-control-height-md);
    border: 1px solid var(--ak-border);
    border-radius: var(--ak-radius-md);
    background: var(--ak-surface);
    box-shadow: var(--ak-shadow-none);
    color: var(--ak-text);
    gap: var(--ak-space-sm);
    padding: 8px 14px;
    font-weight: var(--ak-font-weight-label);
    line-height: 1.2;
    transition:
        background-color var(--ak-transition-fast),
        border-color var(--ak-transition-fast),
        box-shadow var(--ak-transition-fast),
        color var(--ak-transition-fast),
        opacity var(--ak-transition-fast),
        transform var(--ak-transition-fast);
}

.button:hover,
.crm-btn:hover,
.ak-btn:hover {
    border-color: color-mix(in srgb, var(--ak-primary) 36%, var(--ak-border));
    background: color-mix(in srgb, var(--ak-primary) 7%, var(--ak-surface));
    color: var(--ak-text);
}

.button:focus-visible,
.crm-btn:focus-visible,
.ak-btn:focus-visible,
.link-button:focus-visible,
.entity-link:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--ak-primary) 28%, transparent);
    outline-offset: 2px;
}

.button.primary,
.crm-btn-primary,
.ak-btn-primary {
    border-color: var(--ak-primary);
    background: var(--ak-primary);
    box-shadow: var(--ak-shadow-none);
    color: #ffffff;
}

.button.primary:hover,
.crm-btn-primary:hover,
.ak-btn-primary:hover {
    border-color: color-mix(in srgb, var(--ak-primary) 82%, #000000);
    background: color-mix(in srgb, var(--ak-primary) 88%, #000000);
    color: #ffffff;
}

.button.ghost,
.crm-btn-secondary,
.crm-btn-muted,
.crm-btn-back,
.crm-btn-toolbar,
.ak-btn-secondary,
.ak-btn-ghost,
.ak-btn-back {
    border-color: var(--ak-border);
    background: var(--ak-surface);
    color: #334155;
}

.button.ghost:hover,
.crm-btn-secondary:hover,
.crm-btn-muted:hover,
.crm-btn-back:hover,
.crm-btn-toolbar:hover,
.ak-btn-secondary:hover,
.ak-btn-ghost:hover,
.ak-btn-back:hover {
    border-color: color-mix(in srgb, var(--ak-primary) 30%, var(--ak-border));
    background: var(--ak-surface-muted);
    color: var(--ak-text);
}

.crm-btn-back,
.ak-btn-back {
    color: var(--ak-muted);
}

.crm-btn-danger,
.ak-btn-danger {
    border-color: color-mix(in srgb, var(--ak-danger) 34%, var(--ak-border));
    background: color-mix(in srgb, var(--ak-danger) 9%, var(--ak-surface));
    color: var(--ak-danger);
}

.crm-btn-danger:hover,
.ak-btn-danger:hover {
    border-color: color-mix(in srgb, var(--ak-danger) 56%, var(--ak-border));
    background: color-mix(in srgb, var(--ak-danger) 14%, var(--ak-surface));
    color: var(--ak-danger);
}

.crm-btn-small,
.ak-btn-sm,
td.actions-cell .button,
td.actions-cell .crm-btn,
td.actions-cell .ak-btn {
    min-height: var(--ak-control-height-sm);
    padding: 6px 10px;
    font-size: 13px;
}

.button.disabled,
.crm-btn.disabled,
.ak-btn.disabled,
.button[aria-disabled="true"],
.crm-btn[aria-disabled="true"],
.ak-btn[aria-disabled="true"],
.button:disabled,
.crm-btn:disabled,
.ak-btn:disabled {
    cursor: default;
    opacity: 0.56;
    pointer-events: none;
}

.topbar .button.ghost,
.ak-topbar .button.ghost,
.ak-topbar .ak-btn-secondary,
.ak-topbar .ak-btn-ghost {
    border-color: rgba(255, 255, 255, 0.14);
    border-radius: var(--ak-radius-md);
    background: rgba(255, 255, 255, 0.07);
    color: #ffffff;
}

.badge,
.ak-badge,
.ak-badge-muted,
.topbar-status {
    border: 1px solid color-mix(in srgb, var(--ak-border) 72%, transparent);
    border-radius: var(--ak-radius-pill);
    background: var(--ak-surface-muted);
    color: var(--ak-muted);
    padding: 3px 9px;
    font-size: 12px;
    font-weight: var(--ak-font-weight-label);
    line-height: 1.25;
}

.badge.accent,
.ak-badge-success {
    border-color: color-mix(in srgb, var(--ak-success) 18%, transparent);
    background: color-mix(in srgb, var(--ak-success) 13%, #ffffff);
    color: var(--ak-success);
}

.badge.warning,
.ak-badge-warning {
    border-color: color-mix(in srgb, var(--ak-warning) 22%, transparent);
    background: color-mix(in srgb, var(--ak-warning) 16%, #ffffff);
    color: var(--ak-warning);
}

.badge.danger,
.ak-badge-danger {
    border-color: color-mix(in srgb, var(--ak-danger) 20%, transparent);
    background: color-mix(in srgb, var(--ak-danger) 13%, #ffffff);
    color: var(--ak-danger);
}

.calltracking-nav .button,
.calltracking-nav .crm-btn,
.calltracking-nav .ak-btn {
    min-height: 34px;
    border-radius: var(--ak-radius-pill);
    padding: 6px 12px;
}

.status-panel,
.metric-card,
.stat-card,
.list-panel,
.details-panel,
.form-panel,
.auth-card,
.mapping-card,
.ak-card,
.ak-kpi-card,
.settings-card {
    border: 1px solid rgba(216, 224, 234, 0.9);
    border-radius: var(--ak-radius-xl);
    background: var(--ak-surface);
    box-shadow: var(--ak-shadow-card);
}

.status-panel,
.details-panel,
.form-panel,
.auth-card,
.ak-card,
.settings-card {
    padding: var(--ak-space-xl);
}

.list-panel {
    overflow: hidden;
    padding: 0;
}

.compact-metric {
    border: 1px solid var(--ak-border);
    border-radius: var(--ak-radius-md);
    background: var(--ak-surface);
    box-shadow: var(--ak-shadow-none);
    padding: 8px 10px;
}

.metric-card:hover,
.stat-card:hover,
.ak-kpi-card:hover,
.stack-item:hover {
    border-color: rgba(216, 224, 234, 0.9);
    box-shadow: var(--ak-shadow-card);
    transform: none;
}

input,
select,
textarea {
    min-height: var(--ak-control-height-lg);
    border: 1px solid var(--ak-border);
    border-radius: var(--ak-radius-md);
    background: var(--ak-surface);
    color: var(--ak-text);
    padding: 9px 12px;
    font: inherit;
    transition:
        border-color var(--ak-transition-fast),
        box-shadow var(--ak-transition-fast),
        background-color var(--ak-transition-fast);
}

input[type="checkbox"],
input[type="radio"] {
    width: auto;
    min-height: 0;
    accent-color: var(--ak-primary);
}

input:focus,
select:focus,
textarea:focus {
    border-color: color-mix(in srgb, var(--ak-primary) 68%, var(--ak-border));
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--ak-primary) 16%, transparent);
    outline: 0;
}

label,
.form-grid label,
.form-panel > label,
.auth-card label,
.period-picker-panel label {
    color: var(--ak-muted);
    font-weight: var(--ak-font-weight-label);
}

.help-text,
.ak-field-help {
    color: var(--ak-muted);
    font-size: 13px;
    line-height: 1.5;
}

.page-actions,
.ak-page-actions {
    gap: var(--ak-space-md);
    margin-bottom: var(--ak-space-lg);
}

.list-toolbar,
.ak-toolbar,
.ak-filter-panel {
    display: grid;
    gap: var(--ak-space-sm);
    margin-bottom: var(--ak-space-md);
}

.list-toolbar-main,
.list-toolbar-filters,
.list-toolbar-actions,
.ak-filter-grid,
.ak-filter-actions {
    align-items: center;
    gap: var(--ak-space-sm);
}

.ak-filter-grid,
.ak-filter-field {
    min-width: 0;
}

.ak-filter-field {
    display: grid;
    gap: var(--ak-space-xs);
}

.ak-filter-form input:not([type="hidden"]),
.ak-filter-form select {
    min-height: var(--ak-control-height-md);
}

.table-wrap,
.ak-table-wrap {
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    overscroll-behavior-x: contain;
}

table,
.ak-table,
.ak-data-table {
    width: 100%;
    border-collapse: collapse;
    color: var(--ak-text);
}

th,
td,
.ak-data-table th,
.ak-data-table td {
    border-bottom: 1px solid var(--ak-border);
    padding: 10px 12px;
    text-align: left;
    vertical-align: top;
}

th,
.ak-data-table th {
    background: #f8fafc;
    color: #64748b;
    font-size: 12px;
    font-weight: var(--ak-font-weight-label);
    letter-spacing: 0;
    text-transform: uppercase;
    white-space: nowrap;
}

td,
.ak-data-table td {
    font-weight: var(--ak-font-weight-normal);
}

tbody tr:hover td {
    background: color-mix(in srgb, var(--ak-primary-soft) 38%, transparent);
}

@media (min-width: 761px) {
    body.ak-sidebar-collapsed .app-shell,
    body.ak-sidebar-collapsed .ak-app-shell {
        grid-template-columns: 86px minmax(0, 1fr);
    }

    body.ak-sidebar-collapsed .sidebar,
    body.ak-sidebar-collapsed .ak-sidebar {
        padding-inline: 12px;
    }

    body.ak-sidebar-collapsed .brand,
    body.ak-sidebar-collapsed .ak-brand {
        justify-content: center;
        padding-inline: 0;
    }

    body.ak-sidebar-collapsed .ak-brand-text,
    body.ak-sidebar-collapsed .ak-sidebar-section h2,
    body.ak-sidebar-collapsed .ak-sidebar-label {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }

    body.ak-sidebar-collapsed .sidebar-nav,
    body.ak-sidebar-collapsed .ak-sidebar-nav {
        gap: 14px;
    }

    body.ak-sidebar-collapsed .ak-sidebar-section {
        justify-items: center;
        border-top-color: rgba(255, 255, 255, 0.08);
        padding-top: 12px;
    }

    body.ak-sidebar-collapsed .sidebar-link,
    body.ak-sidebar-collapsed .ak-sidebar-link {
        justify-content: center;
        width: 44px;
        min-height: 44px;
        padding: 0;
    }

    body.ak-sidebar-collapsed .ak-sidebar-icon {
        width: 30px;
        height: 30px;
        flex-basis: 30px;
    }
}

.ak-sidebar-toggle {
    border: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    font: inherit;
}

.ak-sidebar-toggle:hover {
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.11);
}

.ak-sidebar,
.ak-app-shell,
.ak-sidebar-label,
.ak-brand-text {
    transition: grid-template-columns 0.18s ease, width 0.18s ease, padding 0.18s ease, opacity 0.16s ease;
}

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

.calltracking-table-panel {
    width: 100%;
    max-width: 100%;
}

.calltracking-table {
    min-width: 1240px;
    table-layout: fixed;
}

.calltracking-visits-table th:nth-child(4),
.calltracking-visits-table th:nth-child(5),
.calltracking-visits-table td:nth-child(4),
.calltracking-visits-table td:nth-child(5) {
    width: 210px;
}

.calltracking-clicks-table th:nth-child(3),
.calltracking-clicks-table td:nth-child(3) {
    width: 280px;
}

.calltracking-url-cell,
.calltracking-token-cell,
.calltracking-url-cell a,
.calltracking-url-cell span,
.calltracking-token-cell span {
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: normal;
}

.calltracking-url-cell,
.calltracking-token-cell {
    white-space: nowrap;
}

.calltracking-url-cell a,
.calltracking-url-cell span,
.calltracking-token-cell span {
    display: inline-block;
    max-width: 100%;
    vertical-align: bottom;
}

.ak-app-shell {
    height: 100vh;
    overflow: hidden;
}

.ak-sidebar {
    height: 100vh;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.ak-main {
    height: 100vh;
    min-height: 0;
    overflow: hidden;
}

.ak-page {
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.calltracking-nav-shell {
    display: grid;
    gap: 8px;
    margin-bottom: 18px;
}

.calltracking-nav-group {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow-x: auto;
    padding: 2px 0 6px;
}

.calltracking-nav-group-admin {
    padding-top: 8px;
    border-top: 1px solid var(--ak-border);
}

.calltracking-nav-group-sub {
    padding-left: 12px;
}

.calltracking-tab {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    border: 1px solid var(--ak-border);
    border-radius: 999px;
    background: var(--ak-surface);
    color: var(--ak-muted);
    padding: 7px 13px;
    text-decoration: none;
    white-space: nowrap;
    font-size: 13px;
    font-weight: var(--ak-font-weight-label);
}

.calltracking-tab:hover,
.calltracking-tab.active {
    border-color: color-mix(in srgb, var(--ak-primary) 30%, var(--ak-border));
    background: color-mix(in srgb, var(--ak-primary) 10%, #ffffff);
    color: var(--ak-primary);
}

.calltracking-ui-stack {
    display: grid;
    gap: 18px;
}

.calltracking-hero {
    display: grid;
    gap: 18px;
    border: 1px solid rgba(216, 224, 234, 0.9);
    border-radius: 22px;
    background:
        linear-gradient(135deg, rgba(37, 99, 235, 0.09), rgba(20, 184, 166, 0.08)),
        var(--ak-surface);
    box-shadow: var(--ak-shadow-card);
    padding: 22px;
}

.calltracking-hero h2 {
    margin: 4px 0 8px;
    font-size: clamp(26px, 3vw, 40px);
    line-height: 1.12;
}

.calltracking-hero p {
    max-width: 820px;
    margin: 0;
    color: var(--ak-muted);
    line-height: 1.6;
}

.calltracking-status-grid,
.calltracking-action-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 12px;
}

.calltracking-status-card,
.calltracking-action-card,
.calltracking-soft-card {
    border: 1px solid rgba(216, 224, 234, 0.9);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.74);
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.05);
    padding: 16px;
}

.calltracking-status-card {
    display: grid;
    gap: 10px;
}

.calltracking-status-card header,
.calltracking-action-card header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.calltracking-status-card strong,
.calltracking-action-card strong {
    display: block;
    color: var(--ak-text);
    font-size: 16px;
}

.calltracking-status-card small,
.calltracking-action-card small,
.calltracking-soft-card small {
    display: block;
    margin-top: 4px;
    color: var(--ak-muted);
    line-height: 1.45;
}

.calltracking-soft-card h2 {
    margin: 10px 0 4px;
    font-size: 24px;
    line-height: 1.15;
}

.calltracking-action-card {
    display: grid;
    gap: 10px;
    color: inherit;
    text-decoration: none;
}

.calltracking-action-card:hover {
    border-color: color-mix(in srgb, var(--ak-primary) 34%, var(--ak-border));
    background: #ffffff;
}

.ak-readonly-switch {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 1px solid var(--ak-border);
    border-radius: 12px;
    background: var(--ak-surface-muted);
    box-shadow: none;
}

.ak-readonly-switch::before {
    content: "";
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: #94a3b8;
    box-shadow: 0 0 0 4px rgba(148, 163, 184, 0.14);
}

.ak-readonly-switch.is-on {
    border-color: color-mix(in srgb, var(--ak-success) 22%, var(--ak-border));
    background: color-mix(in srgb, var(--ak-success) 10%, #ffffff);
}

.ak-readonly-switch.is-warning {
    border-color: color-mix(in srgb, var(--ak-warning) 24%, var(--ak-border));
    background: color-mix(in srgb, var(--ak-warning) 10%, #ffffff);
}

.ak-readonly-switch.is-danger {
    border-color: color-mix(in srgb, var(--ak-danger) 22%, var(--ak-border));
    background: color-mix(in srgb, var(--ak-danger) 10%, #ffffff);
}

.ak-readonly-switch.is-neutral {
    border-color: var(--ak-border);
}

.ak-readonly-switch.is-on::before {
    background: var(--ak-success);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--ak-success) 16%, transparent);
}

.ak-readonly-switch.is-warning::before {
    background: var(--ak-warning);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--ak-warning) 18%, transparent);
}

.ak-readonly-switch.is-danger::before {
    background: var(--ak-danger);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--ak-danger) 16%, transparent);
}

.ak-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    width: fit-content;
    border: 1px solid var(--ak-border);
    border-radius: 999px;
    background: var(--ak-surface-muted);
    color: var(--ak-muted);
    padding: 5px 10px;
    font-size: 12px;
    font-weight: var(--ak-font-weight-label);
}

.ak-status-pill::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: currentColor;
}

.ak-status-pill.is-ok {
    border-color: color-mix(in srgb, var(--ak-success) 18%, transparent);
    background: color-mix(in srgb, var(--ak-success) 12%, #ffffff);
    color: var(--ak-success);
}

.ak-status-pill.is-warning {
    border-color: color-mix(in srgb, var(--ak-warning) 22%, transparent);
    background: color-mix(in srgb, var(--ak-warning) 14%, #ffffff);
    color: var(--ak-warning);
}

.ak-status-pill.is-danger {
    border-color: color-mix(in srgb, var(--ak-danger) 18%, transparent);
    background: color-mix(in srgb, var(--ak-danger) 12%, #ffffff);
    color: var(--ak-danger);
}

.ak-status-pill.is-neutral {
    color: var(--ak-muted);
}

.ak-technical-details {
    border: 1px solid rgba(216, 224, 234, 0.9);
    border-radius: 18px;
    background: var(--ak-surface);
    box-shadow: var(--ak-shadow-card);
    overflow: hidden;
}

.ak-technical-details > summary {
    cursor: pointer;
    padding: 16px 18px;
    color: var(--ak-text);
    font-weight: 800;
}

.ak-technical-details > summary::marker {
    color: var(--ak-muted);
}

.ak-technical-details-body {
    display: grid;
    gap: 16px;
    border-top: 1px solid var(--ak-border);
    padding: 16px;
}

.ak-technical-details .status-panel,
.ak-technical-details .details-panel {
    box-shadow: none;
}

.calltracking-call-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.calltracking-call-summary .calltracking-soft-card {
    min-height: 116px;
}

.calltracking-table-note {
    display: block;
    margin-top: 4px;
    color: var(--ak-muted);
    font-size: 12px;
    line-height: 1.35;
}

.calltracking-readonly-note {
    color: var(--ak-muted);
    font-size: 12px;
}

@media (max-width: 760px) {
    .app-shell,
    .ak-app-shell {
        height: auto;
        overflow: visible;
        grid-template-columns: 1fr;
    }

    .sidebar,
    .ak-sidebar {
        position: static;
        height: auto;
        max-height: none;
        min-height: auto;
        border-right: 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    }

    .ak-main,
    .ak-page {
        height: auto;
        overflow: visible;
    }

    .topbar,
    .ak-topbar,
    .ak-page-header {
        align-items: flex-start;
        flex-direction: column;
        padding: 20px;
    }

    .content,
    .ak-page {
        padding: 20px;
    }

    .ak-page-header {
        padding: 0;
    }

    .ak-topbar-search {
        width: 100%;
        min-width: 0;
    }

    .ak-topbar-profile {
        width: 100%;
    }

    .sidebar-nav,
    .ak-sidebar-nav {
        gap: 14px;
    }

    .ak-sidebar-section {
        grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    }

    .ak-sidebar-section h2 {
        grid-column: 1 / -1;
    }

    .page-actions,
    .search-form,
    .filter-form,
    .form-actions,
    .topbar-user,
    .ak-topbar-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .ak-topbar-user-name,
    .ak-topbar h1 {
        max-width: 100%;
        white-space: normal;
    }

    table,
    .ak-table {
        min-width: 720px;
    }

    .filter-form {
        display: flex;
    }

    .ak-filter-form,
    .ak-filter-actions {
        align-items: stretch;
        flex-direction: column;
        width: 100%;
    }

    .ak-filter-form input:not([type="hidden"]),
    .ak-filter-form select,
    .ak-filter-form .search-input {
        width: 100%;
        max-width: 100%;
    }

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

    .crm-processing-grid,
    .crm-processing-grid-vehicle {
        grid-template-columns: 1fr;
    }

    .appointment-widget-heading,
    .appointment-calendar-heading {
        flex-direction: column;
    }

    .ak-calendar-shell {
        border-radius: 14px;
    }

    .ak-calendar-toolbar {
        grid-template-columns: 1fr;
        padding: 12px;
    }

    .ak-calendar-toolbar-left,
    .ak-calendar-toolbar-right,
    .ak-calendar-view-switcher,
    .ak-calendar-meta {
        width: 100%;
    }

    .ak-calendar-toolbar-right {
        justify-content: stretch;
    }

    .ak-calendar-title strong {
        font-size: 24px;
        white-space: normal;
    }

    .ak-calendar-view-switcher {
        justify-content: center;
    }

    .ak-calendar-search,
    .ak-calendar-toolbar select,
    .ak-calendar-filter-submit,
    .ak-calendar-today {
        width: 100%;
        max-width: 100%;
    }

    .ak-calendar-nav-button {
        flex: 1 1 0;
        width: auto;
    }

    .ak-calendar-meta {
        align-items: flex-start;
        flex-direction: column;
    }

    .appointment-widget-actions,
    .appointment-widget-actions .button,
    .appointment-dashboard-days,
    .appointment-weekdays,
    .appointment-month-grid {
        width: 100%;
    }

    .appointment-dashboard-days,
    .appointment-month-grid {
        grid-template-columns: 1fr;
    }

    .ak-dashboard-calendar .appointment-dashboard-days {
        grid-template-columns: 1fr;
    }

    .appointment-weekdays {
        display: none;
    }

    .appointment-day-card {
        min-height: 0;
    }

    .ak-calendar-day {
        border-right: 0;
        border-bottom: 1px solid var(--ak-border);
        border-radius: 0;
    }

    .appointment-day-card.muted {
        display: none;
    }

    .appointment-popover {
        display: none;
    }

    .inline-action-form,
    .inline-action-form input {
        width: 100%;
    }

    dl {
        grid-template-columns: 1fr;
    }
}
