:root {
    --primary: #1565C0;
    --primary-dark: #0d47a1;
    --bg: #f4f6f9;
    --card-bg: #ffffff;
    --border: #e0e4e9;
    --text: #1f2937;
    --text-muted: #6b7280;
    --success: #2e7d32;
    --error: #c62828;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
}

.topbar {
    background: var(--primary);
    color: #fff;
}
.topbar-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 14px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.brand {
    color: #fff;
    font-weight: 700;
    font-size: 18px;
    text-decoration: none;
}
.topnav a {
    color: #fff;
    text-decoration: none;
    margin-left: 20px;
    font-size: 14px;
    opacity: 0.92;
}
.topnav a:hover { opacity: 1; text-decoration: underline; }

.wrap {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 20px 60px;
}

h1 { font-size: 22px; margin: 0 0 16px; }
h2 { font-size: 17px; margin: 0 0 12px; }

.board-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 16px;
}
.lead-count { color: var(--text-muted); font-size: 14px; }

.board {
    display: grid;
    grid-template-columns: repeat(6, minmax(200px, 1fr));
    gap: 14px;
    overflow-x: auto;
}
@media (max-width: 1100px) {
    .board { grid-template-columns: repeat(6, 220px); }
}

.column {
    background: #eceff3;
    border-radius: 10px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    min-height: 200px;
}
.column-head {
    font-weight: 600;
    font-size: 13px;
    padding: 8px 10px;
    border-radius: 6px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    background: #dde2e8;
    color: var(--text);
}
.column-head .count {
    background: rgba(0,0,0,0.1);
    border-radius: 10px;
    padding: 1px 8px;
    font-size: 12px;
}
.stage-new { background: #dbeafe; }
.stage-contacted { background: #e0e7ff; }
.stage-qualified { background: #fef3c7; }
.stage-quoted { background: #fde8cc; }
.stage-won { background: #d1fae5; }
.stage-lost { background: #fee2e2; }

.column-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
    text-decoration: none;
    color: var(--text);
    display: block;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
    transition: box-shadow 0.15s, transform 0.15s;
}
.card:hover { box-shadow: 0 3px 10px rgba(0,0,0,0.08); transform: translateY(-1px); }
.card-title { font-weight: 600; font-size: 14px; margin-bottom: 2px; }
.card-sub { font-size: 12.5px; color: var(--text-muted); }
.card-value { font-size: 12.5px; color: var(--primary-dark); font-weight: 600; margin-top: 4px; }
.card-meta { font-size: 11.5px; color: var(--text-muted); margin-top: 6px; }

.empty-col { font-size: 12.5px; color: var(--text-muted); padding: 8px; }

/* Forms */
.form-card, .notes-panel {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px;
}
label { display: block; font-size: 13px; font-weight: 600; margin: 12px 0 4px; }
label:first-of-type { margin-top: 0; }
input[type=text], input[type=email], input[type=number], input[type=date], input[type=password], select, textarea {
    width: 100%;
    padding: 9px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
}
textarea { resize: vertical; }
button {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 10px 18px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 16px;
}
button:hover { background: var(--primary-dark); }

.detail-grid {
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    gap: 20px;
    align-items: start;
}
@media (max-width: 850px) {
    .detail-grid { grid-template-columns: 1fr; }
}

.back-link { display: inline-block; margin-bottom: 14px; color: var(--primary); text-decoration: none; font-size: 14px; }
.back-link:hover { text-decoration: underline; }

.note-form textarea { margin-bottom: 6px; }
.note-form .inline-label { margin-top: 8px; font-size: 12px; }
.notes-list { margin-top: 18px; display: flex; flex-direction: column; gap: 10px; }
.note-item {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
    background: #fafbfc;
    font-size: 13.5px;
}
.note-item.note-done { opacity: 0.55; }
.note-text { margin-bottom: 6px; white-space: pre-wrap; }
.note-meta { display: flex; gap: 10px; align-items: center; font-size: 11.5px; color: var(--text-muted); flex-wrap: wrap; }
.note-followup { background: #fff3cd; color: #7a5c00; padding: 2px 8px; border-radius: 10px; }
.inline-form { display: inline; margin: 0; }
.mini-btn {
    padding: 3px 9px;
    font-size: 11px;
    margin-top: 0;
    background: #e5e7eb;
    color: var(--text);
}
.mini-btn:hover { background: #d1d5db; }

/* Auth pages */
.auth-wrap { display: flex; align-items: center; justify-content: center; min-height: 80vh; }
.auth-box {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 32px;
    width: 100%;
    max-width: 360px;
    text-align: center;
}
.auth-box h1 { font-size: 20px; margin-bottom: 20px; }
.auth-box form { text-align: left; }
.auth-box button { width: 100%; }
.btn-link {
    display: inline-block;
    margin-top: 14px;
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.msg-success { color: var(--success); background: #eaf6ec; padding: 10px 14px; border-radius: 6px; font-size: 14px; margin-bottom: 14px; }
.msg-error { color: var(--error); background: #fdecea; padding: 10px 14px; border-radius: 6px; font-size: 14px; margin-bottom: 14px; }
