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

:root {
    --bg: #f8f9fa;
    --surface: #ffffff;
    --border: #e2e5e9;
    --text: #1a1d21;
    --text-muted: #6b7280;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --green: #059669;
    --green-bg: #ecfdf5;
    --yellow: #d97706;
    --yellow-bg: #fffbeb;
    --orange: #ea580c;
    --orange-bg: #fff7ed;
    --red: #dc2626;
    --red-bg: #fef2f2;
    --blue-bg: #eff6ff;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
}

.header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 16px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header h1 {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.header h1 span {
    color: var(--text-muted);
    font-weight: 400;
}

.view-toggle {
    display: flex;
    background: var(--bg);
    border-radius: 6px;
    padding: 2px;
    border: 1px solid var(--border);
}

.toggle-btn {
    padding: 6px 16px;
    border: none;
    background: transparent;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.15s;
}

.toggle-btn.active {
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow);
}

.toggle-btn:hover:not(.active) {
    color: var(--text);
}

.header-actions {
    display: flex;
    gap: 8px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px 32px;
}

/* Summary Cards */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.summary-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}

.summary-card .label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.summary-card .value {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.summary-card .sub {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}

.summary-card.highlight {
    border-color: var(--accent);
    background: var(--blue-bg);
}

.summary-card.warn {
    border-color: var(--yellow);
    background: var(--yellow-bg);
}

.summary-card.good {
    border-color: var(--green);
    background: var(--green-bg);
}

/* Board */
.board-section {
    margin-bottom: 32px;
}

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

.board-header h2 {
    font-size: 18px;
    font-weight: 700;
}

.board-columns {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 20px;
    min-height: 200px;
}

.board-column {
    display: flex;
    flex-direction: column;
    min-height: 200px;
}

.board-column-header {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 8px 16px;
    border-radius: var(--radius) var(--radius) 0 0;
    text-align: center;
}

.board-column-header.pre_construction {
    background: #dbeafe;
    color: #1e40af;
}

.board-column-header.active {
    background: var(--green-bg);
    color: var(--green);
}

.board-column-header.closeout {
    background: var(--yellow-bg);
    color: var(--yellow);
}

.board-column-header.unassigned {
    background: var(--bg);
    color: var(--text-muted);
}

.board-cards {
    flex: 1;
    background: var(--bg);
    border: 2px dashed var(--border);
    border-top: none;
    border-radius: 0 0 var(--radius) var(--radius);
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 120px;
    transition: background 0.15s;
}

.board-cards.drag-over {
    background: #e8ecf0;
    border-color: var(--accent);
}

.board-card {
    padding: 14px 16px;
    border-radius: 4px;
    box-shadow: 1px 2px 6px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.06);
    cursor: pointer;
    transition: transform 0.12s, box-shadow 0.12s;
    position: relative;
}

.board-card:hover {
    transform: translateY(-2px);
    box-shadow: 2px 4px 12px rgba(0,0,0,0.15), 0 2px 4px rgba(0,0,0,0.08);
}

.board-card.dragging {
    opacity: 0.5;
    transform: rotate(2deg);
}

.card-code {
    font-size: 13px;
    font-weight: 800;
    font-family: 'SF Mono', 'Fira Code', monospace;
    letter-spacing: 0.02em;
    margin-bottom: 4px;
    color: rgba(0,0,0,0.7);
}

.card-name {
    font-size: 14px;
    font-weight: 600;
    color: rgba(0,0,0,0.85);
    line-height: 1.3;
}

.card-address {
    font-size: 12px;
    color: rgba(0,0,0,0.5);
    margin-top: 4px;
}

.card-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    font-size: 11px;
    color: rgba(0,0,0,0.45);
    font-weight: 500;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-dot.active { background: var(--green); }
.status-dot.pipeline_high { background: var(--accent); }
.status-dot.pipeline_probable { background: var(--yellow); }
.status-dot.pipeline_contingent { background: var(--orange); }
.status-dot.dead { background: var(--red); }

/* Color Picker */
.color-picker {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    padding: 4px 0;
}

.color-swatch {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform 0.1s, border-color 0.1s;
    outline: none;
}

.color-swatch:hover {
    transform: scale(1.15);
}

.color-swatch.selected {
    border-color: var(--text);
    box-shadow: 0 0 0 2px white, 0 0 0 4px var(--text);
}

.color-swatch.yellow { background: #fff9c4; }
.color-swatch.blue { background: #bbdefb; }
.color-swatch.green { background: #c8e6c9; }
.color-swatch.pink { background: #f8bbd0; }
.color-swatch.purple { background: #e1bee7; }
.color-swatch.orange { background: #ffe0b2; }
.color-swatch.teal { background: #b2dfdb; }
.color-swatch.gray { background: #cfd8dc; }

.job-code {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 12px;
    font-weight: 700;
    color: var(--accent);
}

/* Status Sections */
.status-section {
    margin-bottom: 32px;
}

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

.status-header h2 {
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.status-badge.active { background: var(--green-bg); color: var(--green); }
.status-badge.pipeline_high { background: var(--blue-bg); color: var(--accent); }
.status-badge.pipeline_probable { background: var(--yellow-bg); color: var(--yellow); }
.status-badge.pipeline_contingent { background: var(--orange-bg); color: var(--orange); }
.status-badge.dead { background: var(--red-bg); color: var(--red); }

.section-total {
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 500;
}

/* Project Table */
.project-table {
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border-collapse: separate;
    border-spacing: 0;
    overflow: hidden;
}

.project-table th {
    text-align: left;
    padding: 10px 16px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}

.project-table td {
    padding: 12px 16px;
    font-size: 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.project-table tr:last-child td {
    border-bottom: none;
}

.project-table tr:hover td {
    background: #f8fafc;
}

.project-table .name-cell {
    font-weight: 600;
}

.project-link {
    color: inherit;
    text-decoration: none;
}

.project-link:hover {
    color: var(--accent);
}

.project-table .name-cell .client {
    font-weight: 400;
    color: var(--text-muted);
    font-size: 12px;
}

.project-table .money {
    font-variant-numeric: tabular-nums;
    text-align: right;
    font-weight: 500;
}

.project-table .money.fee {
    color: var(--green);
}

.type-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.type-tag.commercial { background: #dbeafe; color: #1e40af; }
.type-tag.residential { background: #fce7f3; color: #9d174d; }
.type-tag.development { background: #e0e7ff; color: #3730a3; }

.project-table th.col-2026 {
    background: #eff6ff;
    border-bottom-color: #bfdbfe;
}

.project-table td.col-2026 {
    background: #f8faff;
}

.project-table tr:hover td.col-2026 {
    background: #eff6ff;
}

.notes-text {
    max-width: 250px;
    font-size: 12px;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.project-actions {
    display: flex;
    gap: 4px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    background: var(--surface);
    color: var(--text);
    transition: all 0.15s;
}

.btn:hover { background: var(--bg); }

.btn-primary {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.btn-primary:hover { background: var(--accent-hover); }

.btn-sm {
    padding: 4px 10px;
    font-size: 12px;
}

.btn-icon {
    padding: 4px 8px;
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--text-muted);
    border-radius: 4px;
    font-size: 14px;
}

.btn-icon:hover { background: var(--bg); color: var(--text); }
.btn-icon.danger:hover { background: var(--red-bg); color: var(--red); }

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 100;
    align-items: center;
    justify-content: center;
}

.modal-overlay.open { display: flex; }

.modal {
    background: var(--surface);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 640px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 24px;
}

.modal h2 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 20px;
}

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

.form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.form-group.full { grid-column: 1 / -1; }

.form-group label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    background: var(--surface);
    color: var(--text);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.form-group textarea { resize: vertical; min-height: 60px; }

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.money-input-group {
    position: relative;
}

.money-input-group::before {
    content: '$';
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 14px;
}

.money-input-group input {
    padding-left: 24px;
}

@media (max-width: 768px) {
    .container { padding: 16px; }
    .summary-grid { grid-template-columns: 1fr 1fr; }
    .board-columns { grid-template-columns: 1fr; }
    .project-table { font-size: 13px; }
    .form-grid { grid-template-columns: 1fr; }
}
