* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
    background: #f3f4f6;
    color: #1f2937;
}
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #111827;
    color: #fff;
    padding: 14px 24px;
}
.brand { font-weight: 700; font-size: 18px; }
.topbar nav a {
    color: #d1d5db;
    text-decoration: none;
    margin-left: 18px;
    font-size: 14px;
}
.topbar nav a.active, .topbar nav a:hover { color: #fff; }
.topbar nav a.btn-add {
    background: #10b981;
    color: #fff;
    padding: 6px 12px;
    border-radius: 6px;
}
main { padding: 20px 24px; max-width: 1400px; margin: 0 auto; }
.flash {
    background: #d1fae5;
    color: #065f46;
    padding: 10px 16px;
    margin: 16px 24px 0;
    border-radius: 6px;
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
}
.board-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 16px;
}
.search-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.search-form input[type="text"], .search-form select {
    padding: 8px 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
}
.search-form button {
    padding: 8px 14px;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}
.clear-link { font-size: 13px; color: #6b7280; }
.legend { font-size: 13px; color: #6b7280; }
.checkbox-label { font-size: 14px; display: flex; align-items: center; gap: 4px; }

/* Kanban */
.kanban-board {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    padding-bottom: 12px;
}
.kanban-column {
    background: #e5e7eb;
    border-radius: 10px;
    min-width: 260px;
    max-width: 260px;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 180px);
}
.column-head {
    display: flex;
    justify-content: space-between;
    padding: 10px 12px;
    font-weight: 600;
    font-size: 14px;
    border-top: 4px solid #999;
    border-radius: 8px 8px 0 0;
    background: #fff;
}
.column-head .count {
    background: #f3f4f6;
    border-radius: 10px;
    padding: 0 8px;
    font-size: 12px;
    color: #6b7280;
}
.column-body {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 80px;
}
.empty-hint { text-align: center; color: #9ca3af; font-size: 12px; padding: 16px 0; }
.lead-card {
    background: #fff;
    border-radius: 8px;
    padding: 10px 12px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.08);
    cursor: grab;
    font-size: 13px;
}
.lead-card.overdue { border-left: 4px solid #ef4444; }
.lead-card:active { cursor: grabbing; }
.card-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.card-menu a { text-decoration: none; margin-left: 6px; font-size: 13px; }
.card-line { color: #4b5563; margin-top: 2px; }
.card-line.muted { color: #9ca3af; font-size: 12px; }
.card-followup { margin-top: 6px; font-size: 12px; color: #374151; }
.text-overdue { color: #dc2626; font-weight: 600; }
.text-today { color: #d97706; font-weight: 600; }

/* Forms */
.form-card {
    background: #fff;
    border-radius: 10px;
    padding: 24px;
    max-width: 560px;
    margin: 0 auto;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.form-card h2 { margin-top: 0; }
.lead-form label {
    display: block;
    margin-bottom: 14px;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
}
.lead-form .hint { font-weight: 400; color: #9ca3af; font-size: 12px; }
.lead-form input, .lead-form select, .lead-form textarea {
    display: block;
    width: 100%;
    margin-top: 6px;
    padding: 9px 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
}
.form-actions { display: flex; gap: 10px; margin-top: 10px; }
.form-actions button {
    background: #2563eb;
    color: #fff;
    border: none;
    padding: 10px 18px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
}
.btn-cancel {
    align-self: center;
    color: #6b7280;
    text-decoration: none;
    font-size: 14px;
}
.error { background: #fee2e2; color: #991b1b; padding: 8px 12px; border-radius: 6px; margin-bottom: 12px; font-size: 14px; }

/* Table */
.table-wrap { overflow-x: auto; background: #fff; border-radius: 10px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.leads-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.leads-table th, .leads-table td { padding: 10px 12px; border-bottom: 1px solid #f3f4f6; text-align: left; vertical-align: top; }
.leads-table th { background: #f9fafb; font-size: 12px; text-transform: uppercase; color: #6b7280; }
.row-overdue { background: #fef2f2; }
.status-pill { color: #fff; padding: 3px 10px; border-radius: 12px; font-size: 12px; white-space: nowrap; }
.notes-cell { max-width: 220px; color: #6b7280; }
.actions-cell a { margin-right: 10px; font-size: 13px; text-decoration: none; color: #2563eb; }
.empty-row { text-align: center; color: #9ca3af; padding: 30px; }

.footer { text-align: center; color: #9ca3af; font-size: 12px; padding: 24px; }

@media (max-width: 700px) {
    .topbar { flex-direction: column; align-items: flex-start; gap: 10px; }
    .kanban-board { flex-direction: column; }
    .kanban-column { max-width: 100%; }
}
