/* ═══════════════════════════════════════════════
   CRM TRACKER — Design System v2
   Clean, functional, modern CRM aesthetic
   ═══════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --font: 'Manrope', -apple-system, BlinkMacSystemFont, sans-serif;
    --bg: #f0f2f5;
    --surface: #ffffff;
    --surface-raised: #ffffff;
    --border: #e2e5ea;
    --border-strong: #c4c9d1;
    --text: #1a1d23;
    --text-secondary: #5f6672;
    --text-muted: #8b919d;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --accent-light: #eff4ff;
    --danger: #dc2626;
    --danger-light: #fef2f2;
    --success: #16a34a;
    --success-light: #f0fdf4;
    --warning: #d97706;
    --warning-light: #fffbeb;
    --violet: #7c3aed;
    --violet-light: #f5f3ff;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-xs: 6px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
    --shadow-lg: 0 12px 40px rgba(0,0,0,0.12), 0 4px 12px rgba(0,0,0,0.06);
    --transition: 0.15s ease;

    /* Status row colors */
    --row-green: #f0fdf4;
    --row-red: #fef2f2;
    --row-violet: #f5f3ff;
    --row-blue: #eff6ff;
    --row-yellow: #fefce8;
    --row-white: #ffffff;
}

html { font-size: 14px; }
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ═══ LAYOUT ═══ */

.layout { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0 20px;
    height: 56px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.topbar__brand {
    font-weight: 800;
    font-size: 15px;
    letter-spacing: -0.02em;
    color: var(--text);
    text-decoration: none;
    white-space: nowrap;
}

.topbar__nav {
    display: flex;
    align-items: center;
    gap: 2px;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all var(--transition);
    white-space: nowrap;
    position: relative;
    border: none;
    background: none;
    cursor: pointer;
}

.nav-link:hover { background: var(--bg); color: var(--text); text-decoration: none; }
.nav-link--active { background: var(--accent-light); color: var(--accent); }

.nav-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    font-size: 11px;
    font-weight: 700;
    background: var(--accent-light);
    color: var(--accent);
}
.nav-badge--danger { background: var(--danger); color: #fff; }

.nav-more { position: relative; }
.nav-more__dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 6px;
    min-width: 180px;
    box-shadow: var(--shadow-lg);
    z-index: 200;
}
.nav-more__dropdown a {
    display: block;
    padding: 8px 12px;
    border-radius: var(--radius-xs);
    color: var(--text);
    font-size: 13px;
    font-weight: 500;
}
.nav-more__dropdown a:hover { background: var(--bg); text-decoration: none; }
.nav-more__dropdown hr { border: none; border-top: 1px solid var(--border); margin: 4px 0; }

.content {
    padding: 20px;
    max-width: 1360px;
    margin: 0 auto;
    width: 100%;
    flex: 1;
}
.page-analytics .content { max-width: 100%; padding: 16px; }

/* ═══ CARDS ═══ */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
}
.card--narrow { max-width: 640px; }
.card--danger-border { border-left: 4px solid var(--danger); }

h1 { font-size: 18px; font-weight: 800; margin: 0 0 16px; letter-spacing: -0.02em; }
h2 { font-size: 15px; font-weight: 700; margin: 0 0 12px; }
h3 { font-size: 14px; font-weight: 700; margin: 0 0 8px; }

.muted { color: var(--text-muted); font-size: 13px; }

/* ═══ FORMS ═══ */

.form { display: grid; gap: 12px; }
.form--inline {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    align-items: end;
}

label {
    display: grid;
    gap: 4px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 0;
}
label .checkbox-label { display: flex; align-items: center; gap: 8px; }

input, select, textarea {
    width: 100%;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    padding: 9px 12px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 13px;
    min-height: 40px;
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
}
input:focus, select:focus, textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}
textarea { resize: vertical; min-height: 80px; line-height: 1.5; }
select[multiple] { min-height: 120px; padding: 6px; }

button, .button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 16px;
    border: 1px solid var(--accent);
    border-radius: var(--radius-sm);
    background: var(--accent);
    color: #fff;
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    min-height: 40px;
    transition: all var(--transition);
    white-space: nowrap;
}
button:hover, .button:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.button--ghost {
    background: var(--surface);
    color: var(--text);
    border-color: var(--border-strong);
}
.button--ghost:hover { background: var(--bg); }
.button--small { padding: 5px 10px; font-size: 12px; min-height: 30px; }
.button--tick { width: 40px; min-width: 40px; max-width: 40px; font-size: 16px; padding: 0; }
.button--danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.button--danger:hover { background: #b91c1c; border-color: #b91c1c; }

.link-danger {
    border: none; background: transparent; padding: 4px 8px;
    color: var(--danger); text-decoration: underline; font-size: 12px;
    min-height: auto; width: auto; cursor: pointer;
}
.link-danger:hover { color: #b91c1c; }

/* ═══ FLASH ═══ */

.flash {
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    margin-bottom: 16px;
    font-size: 13px;
    font-weight: 600;
    background: var(--success-light);
    color: var(--success);
    border: 1px solid #bbf7d0;
    animation: flashIn 0.3s ease;
}
.flash--error { background: var(--danger-light); color: var(--danger); border-color: #fecaca; }
@keyframes flashIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

/* ═══ HERO STATS ═══ */

.hero-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.hero-card {
    border-radius: var(--radius);
    padding: 16px;
    color: #fff;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: var(--shadow);
}
.hero-card__label { font-size: 12px; font-weight: 600; opacity: 0.9; }
.hero-card__value { font-size: 26px; font-weight: 800; line-height: 1; letter-spacing: -0.02em; }

.hero-card--blue { background: linear-gradient(135deg, #2563eb, #3b82f6); }
.hero-card--violet { background: linear-gradient(135deg, #7c3aed, #8b5cf6); }
.hero-card--red { background: linear-gradient(135deg, #dc2626, #ef4444); }
.hero-card--yellow { background: linear-gradient(135deg, #d97706, #f59e0b); }
.hero-card--roi-plus { background: linear-gradient(135deg, #16a34a, #22c55e); }
.hero-card--roi-minus { background: linear-gradient(135deg, #dc2626, #ef4444); }
.hero-card--green-soft { background: linear-gradient(135deg, #16a34a, #4ade80); }
.hero-card--red-soft { background: linear-gradient(135deg, #dc2626, #f87171); }

/* ═══ TABLES ═══ */

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

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
th, td {
    text-align: left;
    padding: 10px 12px;
    vertical-align: middle;
    border-bottom: 1px solid var(--border);
}
thead th {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    background: var(--bg);
    border-bottom: 2px solid var(--border);
}
tbody tr { transition: background var(--transition); }
tbody tr:hover { background: rgba(0,0,0,0.015); }

/* Status row colors */
tbody tr.lead-row--green td { background: var(--row-green); }
tbody tr.lead-row--red td { background: var(--row-red); }
tbody tr.lead-row--violet td { background: var(--row-violet); }
tbody tr.lead-row--blue td { background: var(--row-blue); }
tbody tr.lead-row--yellow td { background: var(--row-yellow); }
tbody tr.lead-row--white td { background: var(--row-white); }

tbody tr.lead-row--green td:first-child { box-shadow: inset 3px 0 0 var(--success); }
tbody tr.lead-row--red td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
tbody tr.lead-row--violet td:first-child { box-shadow: inset 3px 0 0 var(--violet); }
tbody tr.lead-row--blue td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
tbody tr.lead-row--yellow td:first-child { box-shadow: inset 3px 0 0 var(--warning); }

.table-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.table-actions--between { justify-content: space-between; }
.table-actions form { margin: 0; }

.table-note-form { display: flex; gap: 6px; align-items: center; }
.quick-note-input { width: 280px; max-width: 100%; }

.cell-break { word-break: break-all; white-space: normal; }

/* ═══ LEAD EDIT GRIDS ═══ */

.lead-top-grid { display: grid; gap: 12px; margin-bottom: 12px; }
.lead-top-grid--4 { grid-template-columns: repeat(4, 1fr); }
.lead-main-grid { display: grid; gap: 12px; margin-bottom: 12px; }
.lead-main-grid--wide { grid-template-columns: 1.2fr 0.7fr 0.5fr 0.9fr 0.9fr 0.9fr; }
.lead-products-box { grid-row: span 2; }
.lead-products-box select { height: 100%; }
.lead-address-box { grid-column: span 2; }
.lead-note-box { grid-column: span 3; }
.lead-utm-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }

.metric-field { font-size: 16px; font-weight: 700; }
.metric-field--compact { font-size: 16px; }
.metric-field--readonly { background: var(--bg); }

.touch-form { margin-bottom: 12px; }
.touch-textarea { min-height: 80px; }
.touch-note-cell { font-size: 13px; line-height: 1.5; min-width: 300px; }

.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

.toggle-panel { margin-top: 12px; }
.section-title { margin: 0; }

/* ═══ SPLIT ═══ */

.split-two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ═══ CHART ═══ */

.chart-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 6px; }
.chart-legend .l {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 8px; border-radius: 99px; font-size: 11px; font-weight: 700; color: #fff;
}
.chart-legend .l1 { background: var(--accent); }
.chart-legend .l2 { background: var(--violet); }
.chart-legend .l3 { background: var(--success); }
.chart-legend .l4 { background: var(--danger); }
.chart-legend .l5 { background: var(--warning); }

.chart-wrap {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    padding: 12px;
    height: 260px;
    position: relative;
}
.trend-svg { width: 100%; height: 100%; display: block; }
.chart-days {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(40px, 1fr));
    gap: 2px; margin-top: 6px;
    color: var(--text-muted); font-size: 10px;
}

/* ═══ TAGS ═══ */

.tag-cloud { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-pill {
    display: inline-flex;
    border: 1px solid var(--border);
    border-radius: 99px;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 700;
    background: var(--surface);
}

/* ═══ KANBAN ═══ */

.page-board .content { max-width: none; width: 100%; padding: 12px; }

.kanban-wrap {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 12px;
    padding-bottom: 8px;
}

.kanban-col {
    min-width: 240px; max-width: 240px; flex: 0 0 240px;
    border: 1px solid var(--border); border-radius: var(--radius);
    background: var(--bg); display: flex; flex-direction: column;
}
.kanban-col__head {
    display: flex; justify-content: space-between; align-items: center; gap: 8px;
    padding: 12px; border-bottom: 1px solid var(--border);
    background: var(--surface); border-radius: var(--radius) var(--radius) 0 0;
    position: sticky; top: 0; z-index: 2;
}
.kanban-col__title { font-weight: 700; font-size: 13px; line-height: 1.2; }
.kanban-col__count {
    min-width: 26px; height: 26px; border-radius: 99px;
    border: 1px solid var(--border-strong); background: var(--surface);
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 11px;
}
.kanban-col__list {
    display: grid; gap: 8px; padding: 8px;
    max-height: calc(100vh - 260px); overflow-y: auto;
}
.kanban-empty {
    border: 1px dashed var(--border); border-radius: var(--radius-sm);
    background: var(--surface); padding: 12px; color: var(--text-muted); font-size: 12px;
}

.kanban-card {
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--surface); padding: 10px; display: grid; gap: 6px;
    cursor: grab; transition: box-shadow var(--transition);
}
.kanban-card:hover { box-shadow: var(--shadow-md); }
.kanban-card.is-dragging { opacity: 0.4; }
.kanban-dropzone.is-drop-hover { outline: 2px dashed var(--accent); outline-offset: -3px; border-radius: var(--radius-sm); background: var(--accent-light); }

.kanban-card__top { display: flex; justify-content: space-between; gap: 6px; }
.kanban-card__name { font-weight: 700; font-size: 13px; line-height: 1.2; }
.kanban-card__id { font-size: 11px; color: var(--text-muted); white-space: nowrap; }
.kanban-card__meta, .kanban-card__note { font-size: 12px; line-height: 1.3; color: var(--text-secondary); }
.kanban-card__note {
    border: 1px solid var(--border); border-radius: var(--radius-xs);
    background: var(--bg); padding: 6px; font-size: 11px;
}
.kanban-card__mini { font-size: 10px; color: var(--text-muted); }
.kanban-card__move { display: grid; grid-template-columns: 1fr 36px; gap: 6px; align-items: end; }
.kanban-card__move select, .kanban-card__move button { min-height: 32px; height: 32px; padding: 4px 8px; font-size: 12px; }
.kanban-card__actions { display: flex; justify-content: flex-end; }

.kanban-card--white { border-left: 4px solid var(--border-strong); }
.kanban-card--green { border-left: 4px solid var(--success); background: var(--success-light); }
.kanban-card--red { border-left: 4px solid var(--danger); background: var(--danger-light); }
.kanban-card--violet { border-left: 4px solid var(--violet); background: var(--violet-light); }
.kanban-card--blue { border-left: 4px solid var(--accent); background: var(--accent-light); }
.kanban-card--yellow { border-left: 4px solid var(--warning); background: var(--warning-light); }

.hidden-form { display: none; }

/* ═══ MODAL ═══ */

.modal-overlay {
    position: fixed; inset: 0; z-index: 1000;
    background: rgba(0,0,0,0.4); backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center;
    padding: 20px; animation: fadeIn 0.2s ease;
}
.modal {
    background: var(--surface); border-radius: 16px;
    width: 100%; max-width: 600px; max-height: 80vh;
    overflow-y: auto; box-shadow: var(--shadow-lg);
    animation: modalSlide 0.25s ease;
}
.modal__header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 16px 20px; border-bottom: 1px solid var(--border);
    position: sticky; top: 0; background: var(--surface); z-index: 1;
}
.modal__title { font-size: 16px; font-weight: 800; }
.modal__close {
    width: 32px; height: 32px; border-radius: 99px;
    border: none; background: var(--bg); color: var(--text);
    font-size: 18px; cursor: pointer; display: flex; align-items: center; justify-content: center;
    min-height: auto;
}
.modal__close:hover { background: var(--danger-light); color: var(--danger); }
.modal__body { padding: 20px; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalSlide { from { opacity: 0; transform: translateY(12px) scale(0.97); } to { opacity: 1; transform: translateY(0) scale(1); } }

/* ═══ TASKS ═══ */

.task-list { display: grid; gap: 6px; }
.task-item {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 10px 12px; border-radius: var(--radius-sm);
    border: 1px solid var(--border); background: var(--surface);
    transition: background var(--transition);
}
.task-item:hover { background: var(--bg); }
.task-item--overdue { border-color: #fecaca; background: var(--danger-light); }
.task-item--overdue:hover { background: #fde8e8; }
.task-item--done { opacity: 0.5; }

.task-checkbox {
    width: 28px; height: 28px; min-height: 28px; padding: 0;
    border-radius: var(--radius-xs); font-size: 16px;
    background: var(--surface); border: 2px solid var(--border-strong); color: var(--text-muted);
    flex-shrink: 0;
}
.task-checkbox:hover { border-color: var(--accent); color: var(--accent); }
.task-checkbox--done { background: var(--success-light); border-color: var(--success); color: var(--success); }

.task-item__body { flex: 1; min-width: 0; }
.task-item__text { font-size: 13px; font-weight: 600; line-height: 1.4; }
.task-item__meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; font-size: 12px; }
.task-due { color: var(--text-muted); font-weight: 500; }
.task-due--overdue { color: var(--danger); font-weight: 700; }
.task-lead-link { color: var(--accent); font-weight: 500; }
.task-item__toggle, .task-item__del { margin: 0; display: flex; }

/* ═══ INLINE POST ═══ */

.inline-post { display: inline-flex; margin: 0; }
.inline-post .button { width: auto; }

/* ═══ PAGINATION ═══ */

.pagination {
    display: flex; gap: 4px; align-items: center; justify-content: center;
    padding: 16px 0; flex-wrap: wrap;
}
.pagination a, .pagination span {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 32px; height: 32px; padding: 0 8px;
    border-radius: var(--radius-xs); font-size: 12px; font-weight: 600;
    border: 1px solid var(--border); background: var(--surface); color: var(--text);
    text-decoration: none; transition: all var(--transition);
}
.pagination a:hover { background: var(--bg); border-color: var(--border-strong); }
.pagination .pagination--active {
    background: var(--accent); border-color: var(--accent); color: #fff;
}

/* ═══ RESPONSIVE ═══ */

@media (max-width: 1100px) {
    .lead-top-grid--4, .lead-main-grid--wide, .lead-utm-grid { grid-template-columns: repeat(2, 1fr); }
    .lead-products-box, .lead-address-box, .lead-note-box { grid-column: span 2; grid-row: auto; }
    .split-two { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .topbar { padding: 0 12px; }
    .topbar__nav { gap: 0; }
    .nav-link { padding: 8px 8px; font-size: 12px; }
    .nav-link svg { display: none; }
    .content { padding: 12px; }
    .lead-top-grid--4, .lead-main-grid--wide, .lead-utm-grid { grid-template-columns: 1fr; }
    .lead-products-box, .lead-address-box, .lead-note-box { grid-column: span 1; }
    .kanban-col { min-width: 80vw; max-width: 80vw; flex-basis: 80vw; }
}

/* ═══ CHECKBOX LABEL ═══ */
label.checkbox { display: flex; flex-direction: row; align-items: center; gap: 8px; }
label.checkbox input { width: auto; min-height: auto; }

/* Reports-specific */
.reports-kpi { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.returns-kpi { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.hero-stats--board { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.hero-stats--dashboard { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }

@media (max-width: 1100px) { .reports-kpi { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 768px) { .reports-kpi, .returns-kpi, .hero-stats--board { grid-template-columns: 1fr; } }

/* Table flat variant */
.table-wrap--flat { overflow-x: visible; }
.leads-table { table-layout: auto; }
.leads-table th, .leads-table td { white-space: normal; word-break: break-word; }

/* ═══ TOOLTIP ═══ */
.chart-tooltip {
    position: absolute;
    pointer-events: none;
    background: var(--text);
    color: #fff;
    padding: 6px 10px;
    border-radius: var(--radius-xs);
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    z-index: 50;
    box-shadow: var(--shadow-md);
    transform: translate(-50%, -100%);
    margin-top: -8px;
}

/* AI Assistant */
.nav-more__dropdown a.is-active { background: var(--accent-light); color: var(--accent); }

.ai-section-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 16px;
}

.ai-bullet-list {
    display: grid;
    gap: 10px;
    font-size: 13px;
}

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

.ai-summary-cell,
.ai-funnel-step {
    display: grid;
    gap: 4px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
}

.ai-summary-cell strong,
.ai-funnel-step strong {
    font-size: 18px;
    line-height: 1.1;
}

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

.ai-mini-columns > div {
    display: grid;
    gap: 4px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: var(--bg);
}

.ai-warning-list,
.ai-problem-list {
    display: grid;
    gap: 10px;
}

.ai-warning-item,
.ai-problem-item {
    display: grid;
    gap: 6px;
    padding: 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface);
}

.ai-warning-item--danger,
.ai-problem-item--danger { border-color: rgba(220, 38, 38, 0.25); background: var(--danger-light); }
.ai-warning-item--warning,
.ai-problem-item--warning { border-color: rgba(217, 119, 6, 0.25); background: var(--warning-light); }
.ai-warning-item--success,
.ai-problem-item--success { border-color: rgba(22, 163, 74, 0.25); background: var(--success-light); }

.ai-warning-item__head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.ai-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 22px;
    padding: 0 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.ai-pill--success { background: var(--success-light); color: var(--success); }
.ai-pill--warning { background: var(--warning-light); color: var(--warning); }
.ai-pill--danger { background: var(--danger-light); color: var(--danger); }
.ai-pill--info { background: var(--accent-light); color: var(--accent); }

.ai-table-row--danger td { background: rgba(220, 38, 38, 0.03); }
.ai-table-row--warning td { background: rgba(217, 119, 6, 0.04); }
.ai-table-row--success td { background: rgba(22, 163, 74, 0.04); }

.ai-inline-note {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 12px;
}

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

.ai-funnel-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

@media (max-width: 900px) {
    .ai-summary-grid,
    .ai-funnel-grid,
    .ai-mapping-grid,
    .ai-mini-columns {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .ai-section-head {
        flex-direction: column;
        align-items: stretch;
    }

    .ai-summary-grid,
    .ai-funnel-grid,
    .ai-mapping-grid,
    .ai-mini-columns {
        grid-template-columns: 1fr;
    }
}

.field-help {
    display: block;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    line-height: 1.45;
}

.task-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 24px;
    padding: 0 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.02em;
    border: 1px solid var(--border);
    background: var(--surface);
}

.task-pill--status-new { background: var(--accent-light); color: var(--accent); border-color: rgba(37, 99, 235, 0.2); }
.task-pill--status-in_progress { background: var(--warning-light); color: var(--warning); border-color: rgba(217, 119, 6, 0.2); }
.task-pill--status-completed { background: var(--success-light); color: var(--success); border-color: rgba(22, 163, 74, 0.2); }
.task-pill--status-overdue { background: var(--danger-light); color: var(--danger); border-color: rgba(220, 38, 38, 0.2); }
.task-pill--status-canceled { background: var(--bg); color: var(--text-muted); }

.task-pill--priority-low { background: var(--bg); color: var(--text-secondary); }
.task-pill--priority-medium { background: var(--warning-light); color: var(--warning); border-color: rgba(217, 119, 6, 0.2); }
.task-pill--priority-high { background: var(--danger-light); color: var(--danger); border-color: rgba(220, 38, 38, 0.2); }
