:root {
    --bg: #f4f6f8;
    --surface: #ffffff;
    --surface-muted: #eef2f5;
    --text: #17202a;
    --muted: #667085;
    --border: #d9e1e8;
    --accent: #1f6feb;
    --accent-strong: #164f9f;
    --success-bg: #e8f7ee;
    --success-text: #17633a;
    --error-bg: #fdecec;
    --error-text: #9f1d20;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: var(--text);
    background: var(--bg);
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.5;
}

a {
    color: inherit;
}

.layout {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 24px;
    background: #101828;
    color: #ffffff;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    text-decoration: none;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    background: #ffffff;
    color: #101828;
    font-size: 14px;
}

.brand-logo {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    object-fit: contain;
    background: #ffffff;
}

.nav {
    display: grid;
    gap: 6px;
}

.nav-link {
    display: block;
    padding: 10px 12px;
    border-radius: 8px;
    color: #d0d5dd;
    text-decoration: none;
}

.nav-link.is-active {
    background: #1d2939;
    color: #ffffff;
}

.nav-link.is-disabled {
    color: #8b95a5;
    cursor: default;
}

.sidebar-logout {
    margin-top: auto;
}

button,
.button-primary,
.button-secondary,
.button-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 10px 16px;
    border: 0;
    border-radius: 8px;
    background: var(--accent);
    color: #ffffff;
    font: inherit;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

button:hover,
.button-primary:hover {
    background: var(--accent-strong);
}

.button-secondary {
    border: 1px solid var(--border);
    background: #ffffff;
    color: var(--text);
}

.button-secondary:hover {
    background: var(--surface-muted);
}

.button-danger {
    background: #b42318;
    color: #ffffff;
}

.button-danger:hover {
    background: #912018;
}

.inline-form {
    display: inline-flex;
    margin: 0;
}

.button-link {
    min-height: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--accent);
    font: inherit;
    font-weight: 700;
}

.button-link:hover {
    background: transparent;
    color: var(--accent-strong);
}

.sidebar-logout button {
    width: 100%;
    background: #344054;
}

.main {
    min-width: 0;
    padding: 28px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 24px;
}

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

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

.user-chip {
    display: grid;
    gap: 2px;
    min-width: 180px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    text-align: right;
}

.user-chip span {
    color: var(--text);
    font-weight: 700;
}

.user-chip strong {
    color: var(--muted);
    font-size: 12px;
}

.panel,
.auth-panel {
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: 0 10px 30px rgba(16, 24, 40, 0.06);
}

.panel {
    margin-bottom: 18px;
    padding: 24px;
}

.panel-narrow {
    max-width: 520px;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.dashboard-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
    padding: 20px 0 4px;
}

.dashboard-hero h2 {
    margin: 0;
    font-size: 24px;
}

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

.dashboard-metric-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.dashboard-metric-grid-operational {
    grid-template-columns: repeat(6, minmax(140px, 1fr));
}

.dashboard-card-grid {
    grid-template-columns: repeat(4, minmax(180px, 1fr));
}

.metric-card {
    display: grid;
    align-content: space-between;
    gap: 8px;
    min-height: 136px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #ffffff;
}

.dashboard-card {
    color: inherit;
    text-decoration: none;
    transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.dashboard-card.is-clickable:hover {
    border-color: var(--accent);
    box-shadow: 0 12px 28px rgba(16, 24, 40, 0.10);
    transform: translateY(-1px);
}

.dashboard-card.is-static {
    cursor: default;
}

.dashboard-card-action {
    align-self: end;
    color: var(--accent);
    font-size: 12px;
    font-weight: 700;
}

.dashboard-expand-card,
.dashboard-card.is-expandable {
    align-content: start;
    padding: 0;
}

.dashboard-card.is-expandable {
    cursor: pointer;
}

.dashboard-card.is-expandable:hover,
.dashboard-card.is-expandable[open] {
    border-color: var(--accent);
    box-shadow: 0 12px 28px rgba(16, 24, 40, 0.10);
}

.dashboard-card.is-expandable[open] {
    background: #f8fbff;
}

.dashboard-card.is-expandable summary {
    display: block;
    padding: 16px;
    cursor: pointer;
    list-style: none;
}

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

.dashboard-card-summary {
    display: grid;
    gap: 8px;
}

.dashboard-card.is-expandable[open] .dashboard-card-action {
    color: var(--accent-strong);
}

.dashboard-card.is-expandable[open] .dashboard-card-action::after {
    content: "ed";
}

.dashboard-card-detail-list {
    display: grid;
    gap: 8px;
    padding: 0 16px 16px;
}

.dashboard-card-detail-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
}

.dashboard-card-detail-row span,
.dashboard-card-detail-row strong {
    overflow-wrap: anywhere;
}

.dashboard-card-detail-row span {
    color: var(--muted);
    font-size: 12px;
}

.dashboard-card-detail-row strong {
    text-align: right;
}

.metric-card span,
.funnel-stage span,
.loss-item span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.metric-card strong {
    display: block;
    overflow-wrap: anywhere;
    font-size: 26px;
    line-height: 1.15;
}

.metric-warning {
    border-left: 4px solid #d69e2e;
}

.metric-danger {
    border-left: 4px solid #dc2626;
}

.metric-success {
    border-left: 4px solid #1f8f4d;
}

.dashboard-preview-panel {
    margin-top: 4px;
}

.dashboard-preview-wrap table {
    min-width: 760px;
}

.report-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 14px;
}

.report-tab {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #ffffff;
    color: var(--text);
    font-weight: 700;
    text-decoration: none;
}

.report-tab.is-active {
    border-color: var(--accent);
    color: var(--accent);
    background: #eef6ff;
}

.report-filter-bar {
    margin-bottom: 0;
}

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

.settings-option-row {
    display: grid;
    grid-template-columns: 1.1fr 1.4fr 100px auto minmax(220px, auto);
    gap: 10px;
    align-items: end;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #ffffff;
}

.settings-option-active {
    min-height: 42px;
    align-items: center;
}

.settings-option-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.settings-create-option-form {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

.report-kpi-grid {
    margin-bottom: 18px;
}

.report-table {
    min-width: 960px;
}

.urgent-preview-table td {
    vertical-align: top;
}

.urgent-preview-table td:first-child {
    min-width: 220px;
}

.urgent-preview-table td:nth-child(3) {
    min-width: 260px;
}

.dashboard-details {
    padding: 0;
}

.dashboard-details summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 24px;
    cursor: pointer;
    list-style: none;
}

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

.dashboard-details summary strong {
    display: block;
}

.details-cta {
    color: var(--accent);
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.dashboard-insight-grid,
.dashboard-chart-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    padding: 0 24px 24px;
}

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

.dashboard-insight-block {
    min-width: 0;
}

.dashboard-insight-block-wide {
    grid-column: 1 / -1;
}

.dashboard-insight-block h3 {
    margin: 0 0 10px;
    font-size: 16px;
}

.insight-list {
    display: grid;
    gap: 8px;
}

.insight-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.insight-row:last-child {
    border-bottom: 0;
}

.insight-row span,
.insight-row strong {
    overflow-wrap: anywhere;
}

.insight-row span {
    color: var(--muted);
    font-size: 13px;
}

.insight-row strong {
    text-align: right;
}

.dashboard-split {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.dashboard-panel {
    min-width: 0;
}

.dashboard-mini-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

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

.funnel-stage {
    min-height: 92px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-muted);
}

.funnel-stage strong {
    display: block;
    margin-top: 6px;
    font-size: 24px;
}

.dashboard-table-wrap {
    overflow-x: auto;
}

.dashboard-table {
    min-width: 0;
}

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

.dashboard-chart-box {
    position: relative;
    height: 260px;
    min-height: 260px;
    margin-bottom: 16px;
}

.dashboard-activity-list {
    display: grid;
    gap: 12px;
}

.dashboard-activity-item {
    display: grid;
    grid-template-columns: minmax(120px, auto) minmax(0, 1fr) minmax(150px, auto);
    gap: 14px;
    align-items: start;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-muted);
}

.dashboard-activity-item strong,
.dashboard-activity-item span,
.dashboard-activity-item small {
    display: block;
    overflow-wrap: anywhere;
}

.dashboard-activity-item time {
    color: var(--muted);
    font-size: 12px;
    text-align: right;
    white-space: nowrap;
}

.loss-strip {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 12px;
}

.loss-item {
    min-height: 84px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-muted);
}

.loss-item strong {
    display: block;
    margin-top: 6px;
    font-size: 22px;
}

.placeholder-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.placeholder-card {
    min-height: 150px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-muted);
}

.placeholder-card h3 {
    margin: 0 0 8px;
    font-size: 16px;
}

.placeholder-card p,
.panel p {
    margin: 0;
    color: var(--muted);
}

.auth-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #eef2f5 0%, #f8fafc 58%, #e8f7ee 100%);
}

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

.auth-panel {
    width: min(100%, 420px);
    padding: 28px;
}

.auth-heading {
    margin-bottom: 20px;
}

.form {
    display: grid;
    gap: 10px;
}

.form-wide {
    gap: 18px;
}

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

.form-section {
    display: grid;
    gap: 14px;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #ffffff;
}

.form-section h3 {
    margin: 0;
}

.field {
    display: grid;
    gap: 6px;
}

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

.checkbox-field {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
}

.checkbox-field input {
    width: auto;
    min-height: 0;
}

.search-picker {
    position: relative;
}

.selected-record {
    display: grid;
    gap: 2px;
    min-height: 58px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-muted);
}

.selected-record.is-empty {
    color: var(--muted);
}

.selected-record strong,
.selected-record span {
    overflow-wrap: anywhere;
}

.selected-record span {
    color: var(--muted);
    font-size: 12px;
}

.search-results {
    position: absolute;
    z-index: 20;
    top: calc(100% + 6px);
    right: 0;
    left: 0;
    display: grid;
    gap: 6px;
    max-height: 280px;
    overflow-y: auto;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 12px 30px rgba(16, 24, 40, 0.14);
}

.search-result {
    display: grid;
    justify-content: stretch;
    gap: 2px;
    width: 100%;
    min-height: 0;
    padding: 10px;
    border: 0;
    border-radius: 8px;
    background: #ffffff;
    color: var(--text);
    text-align: left;
}

.search-result:hover {
    background: var(--surface-muted);
}

.search-result strong,
.search-result span {
    display: block;
    overflow-wrap: anywhere;
}

.search-result span {
    color: var(--muted);
    font-size: 12px;
}

.search-result.is-empty {
    color: var(--muted);
    cursor: default;
}

label {
    color: var(--text);
    font-weight: 700;
}

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

input:focus,
select:focus,
textarea:focus {
    border-color: var(--accent);
    outline: 3px solid rgba(31, 111, 235, 0.16);
}

small,
.muted-text {
    display: block;
    color: var(--muted);
    font-size: 12px;
}

.filter-bar {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(160px, 220px) auto;
    gap: 14px;
    align-items: end;
    margin-bottom: 18px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-muted);
}

.filter-bar-wide {
    grid-template-columns: minmax(220px, 1fr) repeat(6, minmax(130px, 1fr)) auto;
}

.dashboard-filter-panel {
    margin-bottom: 18px;
}

.dashboard-filter-header {
    margin-bottom: 12px;
}

.dashboard-date-filter {
    grid-template-columns: minmax(180px, 1fr) repeat(2, minmax(150px, 190px)) auto;
    margin-bottom: 12px;
}

.dashboard-custom-date-field[hidden] {
    display: none;
}

.dashboard-date-field-note {
    display: flex;
    gap: 8px 14px;
    flex-wrap: wrap;
    color: var(--muted);
    font-size: 12px;
}

.dashboard-date-field-note span {
    display: inline-flex;
    align-items: center;
}

.quick-capture-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    align-items: end;
}

.quick-notes {
    grid-column: span 3;
}

.quick-submit {
    display: flex;
    align-items: end;
    height: 100%;
}

.quick-submit button {
    width: 100%;
}

.quick-preset-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.filter-actions,
.form-actions,
.button-row,
.row-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.form-actions {
    padding-top: 4px;
}

.bulk-actions {
    display: flex;
    align-items: end;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 14px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-muted);
}

.bulk-actions .field {
    min-width: 240px;
}

.bulk-selection-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 14px;
    padding: 12px 14px;
    border: 1px solid #b7d7ff;
    border-radius: 8px;
    background: #eef6ff;
}

.bulk-selection-panel[hidden] {
    display: none;
}

.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.table-wrap {
    overflow-x: auto;
}

.action-queue-table td {
    min-width: 150px;
    vertical-align: top;
}

.action-queue-table td:first-child,
.action-queue-table td:nth-child(5) {
    min-width: 220px;
}

.queue-counts {
    margin-bottom: 16px;
}

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

.queue-actions .button-primary,
.queue-actions .button-secondary {
    min-height: 36px;
    padding: 8px 10px;
    white-space: nowrap;
}

.queue-overflow-note {
    margin-top: 10px;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1080px;
}

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

th {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
}

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

.row-actions a {
    color: var(--accent);
    font-weight: 700;
    text-decoration: none;
}

.row-actions .danger-link,
.danger-link {
    color: #b42318;
    font-weight: 700;
    text-decoration: none;
}

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 3px 8px;
    border-radius: 999px;
    background: #e6f0ff;
    color: #164f9f;
    font-size: 12px;
    font-weight: 700;
}

.badge-ageing.ageing-normal {
    background: #e7eef5;
    color: #344054;
}

.badge-ageing.ageing-warning {
    background: #fff3c4;
    color: #7a4f01;
}

.badge-ageing.ageing-urgent {
    background: #ffe1cc;
    color: #9a3412;
}

.badge-ageing.ageing-overdue {
    background: #ffd7d7;
    color: #9f1d20;
}

.badge-assignment.assignment-unassigned {
    background: #fff3c4;
    color: #7a4f01;
}

.badge-assignment.assignment-assigned {
    background: var(--success-bg);
    color: var(--success-text);
}

.badge-task.task-pending {
    background: #fef3c7;
    color: #92400e;
}

.badge-task.task-due-today {
    background: #fef3c7;
    color: #92400e;
}

.badge-task.task-overdue {
    background: #ffd7d7;
    color: #9f1d20;
}

.badge-task.task-completed {
    background: var(--success-bg);
    color: var(--success-text);
}

.badge-task.task-cancelled {
    background: #eceff3;
    color: #475467;
}

.badge-status.is-active {
    background: var(--success-bg);
    color: var(--success-text);
}

.badge-status.is-inactive {
    background: #eceff3;
    color: #475467;
}

.badge-note.note-call,
.timeline-badge.timeline-call {
    background: #e7eef5;
    color: #344054;
}

.badge-note.note-whatsapp,
.timeline-badge.timeline-whatsapp {
    background: #dff7ea;
    color: #17633a;
}

.badge-note.note-email,
.timeline-badge.timeline-email,
.timeline-badge.timeline-email-sent {
    background: #e6f0ff;
    color: #164f9f;
}

.timeline-badge.timeline-email-failed {
    background: #fee2e2;
    color: #991b1b;
}

.badge-note.note-meeting,
.timeline-badge.timeline-meeting {
    background: #f2e8ff;
    color: #6941c6;
}

.badge-note.note-internal-note,
.timeline-badge.timeline-internal-note {
    background: #fff3cc;
    color: #8a5a00;
}

.badge-note.note-system-event,
.timeline-badge.timeline-system-event {
    background: #eceff3;
    color: #475467;
}

.timeline-badge.timeline-status-change,
.timeline-badge.timeline-booking-confirmed,
.timeline-badge.timeline-lead-lost {
    background: #ffe1cc;
    color: #9a3412;
}

.timeline-badge.timeline-assignment-change {
    background: #e6f0ff;
    color: #164f9f;
}

.timeline-badge.timeline-lead-created,
.timeline-badge.timeline-task-created {
    background: #dff7ea;
    color: #17633a;
}

.timeline-badge.timeline-task-completed {
    background: var(--success-bg);
    color: var(--success-text);
}

.timeline-badge.timeline-task-cancelled {
    background: #eceff3;
    color: #475467;
}

.timeline-badge.timeline-audit,
.timeline-badge.timeline-lead-updated,
.timeline-badge.timeline-contact-updated,
.timeline-badge.timeline-task-updated {
    background: #f2f4f7;
    color: #475467;
}

.timeline-icon {
    display: inline-flex;
    align-items: center;
    margin-right: 4px;
    font-size: 13px;
    line-height: 1;
}

.lead-row.ageing-warning td {
    background: #fffaf0;
}

.lead-row.ageing-urgent td {
    background: #fff3eb;
}

.lead-row.ageing-overdue td {
    background: #fff0f0;
}

.task-row.task-overdue td {
    background: #fff0f0;
}

.task-row.task-pending td,
.task-row.task-due-today td {
    background: #fffbeb;
}

.task-row.task-completed td {
    background: #f1fbf4;
}

.task-row.task-cancelled td {
    background: #f2f4f7;
}

.lead-row.ageing-warning td:first-child,
.detail-item.ageing-warning {
    border-left: 4px solid #d69e2e;
}

.lead-row.ageing-urgent td:first-child,
.detail-item.ageing-urgent {
    border-left: 4px solid #ea580c;
}

.lead-row.ageing-overdue td:first-child,
.detail-item.ageing-overdue {
    border-left: 4px solid #dc2626;
}

.task-row.task-overdue td:first-child,
.detail-item.task-overdue,
.timeline-item.task-overdue {
    border-left: 4px solid #dc2626;
}

.task-row.task-pending td:first-child,
.task-row.task-due-today td:first-child,
.detail-item.task-pending,
.detail-item.task-due-today,
.timeline-item.task-pending {
    border-left: 4px solid #d69e2e;
}

.task-row.task-completed td:first-child,
.detail-item.task-completed,
.timeline-item.task-completed {
    border-left: 4px solid #1f8f4d;
}

.task-row.task-cancelled td:first-child,
.detail-item.task-cancelled,
.timeline-item.task-cancelled {
    border-left: 4px solid #667085;
}

.empty-state {
    padding: 28px;
    border: 1px dashed var(--border);
    border-radius: 8px;
    background: #ffffff;
    text-align: center;
}

.empty-state.compact {
    padding: 18px;
    text-align: left;
}

.empty-state h3 {
    margin: 0 0 6px;
}

.form-errors,
.duplicate-box,
.delete-warning,
.deleted-banner {
    margin-bottom: 16px;
    padding: 14px;
    border-radius: 8px;
}

.form-errors {
    background: var(--error-bg);
    color: var(--error-text);
}

.delete-warning,
.deleted-banner {
    border: 1px solid #f3c0bd;
    background: #fff1f0;
    color: #7a271a;
}

.delete-warning h3 {
    margin: 0 0 4px;
}

.deleted-banner {
    display: grid;
    gap: 2px;
}

.danger-form {
    margin-top: 16px;
}

.form-errors ul {
    margin: 8px 0 0;
    padding-left: 20px;
}

.duplicate-box {
    border: 1px solid #f3c969;
    background: #fff7df;
    color: #664d03;
}

.reassignment-warning {
    grid-column: 1 / -1;
}

.reassignment-warning p {
    margin: 4px 0 0;
}

.duplicate-list {
    display: grid;
    gap: 8px;
    margin-top: 10px;
}

.duplicate-list a {
    display: grid;
    gap: 2px;
    padding: 10px;
    border-radius: 8px;
    background: #ffffff;
    color: inherit;
    text-decoration: none;
}

.duplicate-list span {
    color: var(--muted);
    font-size: 12px;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.detail-grid + .detail-grid,
.detail-grid + .empty-state {
    margin-top: 14px;
}

.detail-item {
    min-height: 96px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-muted);
}

.detail-item span {
    display: block;
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.detail-item strong {
    display: block;
    overflow-wrap: anywhere;
}

.import-workflow {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin: 0 0 18px;
    padding: 0;
    list-style: none;
}

.import-step {
    min-height: 64px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #ffffff;
}

.import-step span,
.import-overview-item span,
.import-summary-item span {
    display: block;
    margin-bottom: 3px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.import-step strong,
.import-overview-item strong,
.import-summary-item strong {
    display: block;
    overflow-wrap: anywhere;
}

.import-step.is-active {
    border-color: #9dc3ff;
    background: #eef6ff;
}

.import-step.is-complete {
    border-color: #b7dfc6;
    background: #f1fbf4;
}

.import-overview-grid,
.import-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.import-summary-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.import-overview-item,
.import-summary-item {
    min-height: 72px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #ffffff;
}

.import-summary-item small {
    display: block;
    margin-top: 2px;
    color: var(--muted);
}

.import-compact-section {
    display: grid;
    gap: 10px;
    margin-top: 16px;
}

.import-section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.import-section-heading h3 {
    margin: 0;
    font-size: 16px;
}

.import-column-list {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.import-column-chip {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-muted);
    font-size: 13px;
    font-weight: 700;
}

table.import-mapping-table {
    min-width: 520px;
}

table.import-preview-table {
    min-width: 760px;
}

.timeline-list {
    display: grid;
    gap: 12px;
}

.note-form {
    margin-bottom: 16px;
}

.note-actions {
    margin-top: 10px;
}

.timeline-item {
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-muted);
}

.timeline-item strong,
.timeline-item span {
    display: block;
}

.timeline-item span {
    color: var(--muted);
    font-size: 12px;
}

.timeline-item p {
    margin-top: 8px;
}

.timeline-filter-bar {
    margin-bottom: 16px;
}

.timeline-toggle-field {
    align-self: end;
}

.timeline-summary-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 16px;
}

.timeline-summary-item {
    min-height: 84px;
}

.timeline-feed {
    display: grid;
    gap: 12px;
}

.timeline-card {
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-muted);
}

.timeline-card-low {
    background: #fafbfc;
}

.timeline-card-high {
    background: #ffffff;
}

.timeline-kind-audit {
    color: #475467;
}

.timeline-card-status-change,
.timeline-card-booking-confirmed,
.timeline-card-lead-lost {
    border-left: 4px solid #ea580c;
}

.timeline-card-assignment-change {
    border-left: 4px solid #2f6fed;
}

.timeline-card-call,
.timeline-card-whatsapp,
.timeline-card-email,
.timeline-card-email-sent,
.timeline-card-meeting,
.timeline-card-internal-note,
.timeline-card-system-event {
    border-left: 4px solid #1f8f4d;
}

.timeline-card-email-failed {
    border-left: 4px solid #dc2626;
}

.timeline-card-task-completed {
    border-left: 4px solid #1f8f4d;
}

.timeline-card-task-cancelled {
    border-left: 4px solid #667085;
}

.timeline-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.timeline-card-header span:last-child,
.timeline-card small {
    color: var(--muted);
    font-size: 12px;
}

.timeline-card h3 {
    margin: 0;
    font-size: 16px;
}

.timeline-card p {
    margin: 8px 0;
}

.pagination-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
}

.task-action-grid,
.task-summary-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.task-follow-up-strip {
    margin-bottom: 14px;
}

.task-reminder-banner {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 1000;
    width: min(520px, calc(100vw - 32px));
    border: 1px solid #f59e0b;
    border-left: 6px solid #d97706;
    border-radius: 8px;
    background: #fffbeb;
    box-shadow: 0 18px 38px rgba(15, 23, 42, 0.18);
}

.task-reminder-content {
    display: grid;
    gap: 12px;
    padding: 16px;
}

.task-reminder-text {
    display: grid;
    gap: 4px;
}

.task-reminder-text strong {
    color: #78350f;
}

.task-reminder-text span {
    color: #92400e;
    font-size: 13px;
}

.task-reminder-meta {
    display: grid;
    gap: 2px;
}

.task-reminder-meta-row,
.task-reminder-due {
    color: #92400e;
    font-size: 13px;
}

.task-reminder-due {
    font-weight: 600;
}

.task-reminder-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.task-reminder-list {
    display: grid;
    gap: 10px;
    margin-top: 4px;
}

.task-reminder-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: start;
    padding-top: 10px;
    border-top: 1px solid #fde68a;
}

.task-reminder-item-main {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.task-reminder-item-main strong,
.task-reminder-item-main span {
    overflow-wrap: anywhere;
}

.task-reminder-row-actions {
    justify-content: flex-end;
}

.task-reminder-row-actions .button-primary,
.task-reminder-row-actions .button-secondary {
    padding: 6px 10px;
    font-size: 12px;
}

.task-reminder-more {
    width: fit-content;
    color: #78350f;
    font-size: 13px;
    font-weight: 600;
}

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

.task-summary-column {
    display: grid;
    align-content: start;
    gap: 10px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #ffffff;
}

.task-summary-column h3 {
    margin: 0;
}

.flash {
    margin: 0 0 16px;
    padding: 12px 14px;
    border-radius: 8px;
    font-weight: 700;
}

.flash-success {
    background: var(--success-bg);
    color: var(--success-text);
}

.flash-error {
    background: var(--error-bg);
    color: var(--error-text);
}

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

    .sidebar {
        position: static;
        padding: 16px;
    }

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

    .main {
        padding: 18px;
    }

    .topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .user-chip {
        width: 100%;
        text-align: left;
    }

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

    .dashboard-hero {
        align-items: flex-start;
        flex-direction: column;
    }

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

    .dashboard-split,
    .dashboard-insight-grid,
    .dashboard-chart-grid,
    .loss-strip {
        grid-template-columns: 1fr;
    }

    .filter-bar,
    .filter-bar-wide,
    .quick-capture-grid,
    .quick-preset-grid,
    .detail-grid,
    .import-workflow,
    .import-overview-grid,
    .import-summary-grid,
    .dashboard-mini-grid,
    .funnel-grid,
    .settings-option-row,
    .dashboard-activity-item,
    .timeline-summary-grid,
    .task-action-grid,
    .task-summary-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-details summary {
        align-items: flex-start;
        flex-direction: column;
    }

    .dashboard-insight-grid,
    .dashboard-chart-grid {
        padding: 0 18px 18px;
    }

    .quick-notes {
        grid-column: auto;
    }

    .dashboard-activity-item time {
        text-align: left;
    }
}

@media (max-width: 560px) {
    .nav,
    .dashboard-metric-grid,
    .dashboard-card-grid,
    .placeholder-grid,
    .form-grid {
        grid-template-columns: 1fr;
    }

    .auth-panel,
    .panel {
        padding: 18px;
    }

    .task-reminder-banner {
        right: 12px;
        bottom: 12px;
        width: calc(100vw - 24px);
    }

    .task-reminder-actions {
        display: grid;
        grid-template-columns: 1fr;
    }

    .task-reminder-item {
        grid-template-columns: 1fr;
    }

    .task-reminder-row-actions {
        justify-content: stretch;
    }
}

.report-chart-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.report-chart-card {
    min-width: 0;
}

.report-chart-frame {
    height: 320px;
    min-height: 260px;
    position: relative;
}

.report-chart-frame canvas {
    display: block;
    height: 100% !important;
    width: 100% !important;
}

.report-export-panel .panel-header {
    align-items: center;
}

.permissions-category-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.permissions-category-strip span {
    background: #eef2f7;
    border: 1px solid #d8e0ea;
    border-radius: 999px;
    color: #334155;
    font-size: 12px;
    font-weight: 700;
    padding: 6px 10px;
}

.permission-role-panel .panel-header {
    align-items: flex-start;
}

.permission-role-form {
    display: grid;
    gap: 22px;
}

.permission-category {
    display: grid;
    gap: 12px;
}

.permission-category h3 {
    color: #0f172a;
    font-size: 15px;
    margin: 0;
}

.permission-grid {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.permission-card {
    align-items: flex-start;
    background: #ffffff;
    border: 1px solid #d8e0ea;
    border-radius: 8px;
    cursor: pointer;
    display: grid;
    gap: 10px;
    grid-template-columns: auto minmax(0, 1fr);
    min-height: 112px;
    padding: 12px;
}

.permission-card input {
    margin-top: 3px;
}

.permission-card span {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.permission-card strong {
    color: #0f172a;
    font-size: 14px;
}

.permission-card small {
    color: #64748b;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 11px;
    overflow-wrap: anywhere;
}

.permission-card em {
    color: #475569;
    font-size: 12px;
    font-style: normal;
    line-height: 1.35;
}

@media (max-width: 900px) {
    .report-chart-grid {
        grid-template-columns: 1fr;
    }

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

@media (max-width: 560px) {
    .report-chart-frame {
        height: 280px;
    }

    .permission-grid {
        grid-template-columns: 1fr;
    }
}
