/* style.css — Tierra Capital Group CRM
   Mobile-first design. Minimum 16px text. White background, black text.
   Works on iPhone and Android without JavaScript.
*/

/* ─── Reset & base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #ffffff;
    color: #111111;
    line-height: 1.5;
    min-height: 100vh;
}

a { color: #1a56db; text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; }

/* ─── Navigation ───────────────────────────────────────────────────────────── */
.main-nav {
    background: #111;
    color: #fff;
    padding: 0 16px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand {
    font-size: 1rem;
    font-weight: 700;
    padding: 12px 0 4px;
    color: #fff;
    letter-spacing: 0.02em;
}

.nav-links {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 6px 0 10px;
}

.nav-links a {
    color: #ccc;
    font-size: 0.875rem;
    font-weight: 500;
    padding: 6px 10px;
    border-radius: 4px;
    white-space: nowrap;
    text-decoration: none;
}

.nav-links a:hover { background: #333; color: #fff; }
.nav-links a.active { background: #1a56db; color: #fff; }
.nav-links a.nav-logout { color: #f87171; margin-left: auto; }
.nav-links a.nav-logout:hover { background: #7f1d1d; color: #fff; }

/* ─── Page wrapper ─────────────────────────────────────────────────────────── */
.page {
    max-width: 960px;
    margin: 0 auto;
    padding: 20px 16px 40px;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #111;
}

/* ─── Flash messages ───────────────────────────────────────────────────────── */
.flash {
    padding: 14px 16px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 1rem;
    font-weight: 500;
}
.flash-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.flash-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }

/* ─── Cards / stat boxes ───────────────────────────────────────────────────── */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

@media (min-width: 600px) {
    .stat-grid { grid-template-columns: repeat(4, 1fr); }
}

.stat-card {
    background: #f8f9fa;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
    text-align: center;
}

.stat-card .stat-num {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1;
    color: #111;
}

.stat-card .stat-label {
    font-size: 0.8125rem;
    color: #6b7280;
    margin-top: 4px;
}

/* ─── Progress bar ($100k goal) ────────────────────────────────────────────── */
.goal-section {
    background: #f8f9fa;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 24px;
}

.goal-label {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.goal-subtitle {
    font-size: 0.875rem;
    color: #6b7280;
    margin-bottom: 12px;
}

.progress-bar-outer {
    background: #e5e7eb;
    border-radius: 999px;
    height: 20px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-bar-inner {
    background: #16a34a;
    height: 100%;
    border-radius: 999px;
    transition: width 0.3s ease;
    min-width: 2px;
}

.goal-amounts {
    display: flex;
    justify-content: space-between;
    font-size: 0.875rem;
    color: #374151;
}

.goal-amounts .earned { font-weight: 700; color: #16a34a; }

/* ─── Today's todos ────────────────────────────────────────────────────────── */
.section-title {
    font-size: 1.125rem;
    font-weight: 700;
    margin-bottom: 12px;
    margin-top: 24px;
}

/* ─── Tables ───────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; margin-bottom: 24px; }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9375rem;
    min-width: 500px;
}

thead th {
    background: #111;
    color: #fff;
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 0.875rem;
}

tbody tr { border-bottom: 1px solid #e5e7eb; }
tbody tr:hover { background: #f9fafb; }
tbody td { padding: 10px 12px; vertical-align: top; }

/* ─── Forms ────────────────────────────────────────────────────────────────── */
.form-card {
    background: #f8f9fa;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 24px;
    max-width: 640px;
}

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

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    font-size: 1rem;
    border: 1.5px solid #d1d5db;
    border-radius: 6px;
    background: #fff;
    color: #111;
    appearance: auto;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #1a56db;
    box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.1);
}

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

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

@media (max-width: 480px) {
    .form-row { grid-template-columns: 1fr; }
}

/* ─── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
    display: inline-block;
    padding: 10px 20px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
}

.btn-primary  { background: #111; color: #fff; }
.btn-primary:hover { background: #1a56db; color: #fff; text-decoration: none; }

.btn-success  { background: #16a34a; color: #fff; }
.btn-success:hover { background: #15803d; color: #fff; text-decoration: none; }

.btn-danger   { background: #dc2626; color: #fff; }
.btn-danger:hover { background: #b91c1c; color: #fff; text-decoration: none; }

.btn-sm {
    padding: 5px 12px;
    font-size: 0.8125rem;
}

.btn-outline {
    background: transparent;
    border: 1.5px solid #111;
    color: #111;
}
.btn-outline:hover { background: #111; color: #fff; text-decoration: none; }

/* ─── Filter bar ───────────────────────────────────────────────────────────── */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-end;
    margin-bottom: 20px;
    background: #f8f9fa;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
}

.filter-bar select,
.filter-bar input {
    padding: 8px 10px;
    font-size: 0.9375rem;
    border: 1.5px solid #d1d5db;
    border-radius: 6px;
    background: #fff;
    min-width: 140px;
}

.filter-bar .btn { flex-shrink: 0; }

/* ─── Status badges ────────────────────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}
.badge-lead        { background: #e0f2fe; color: #0369a1; }
.badge-contacted   { background: #fef9c3; color: #854d0e; }
.badge-negotiating { background: #ffedd5; color: #c2410c; }
.badge-contract    { background: #dcfce7; color: #166534; }
.badge-closed      { background: #f0fdf4; color: #15803d; border: 1px solid #86efac; }
.badge-dead        { background: #f3f4f6; color: #6b7280; }
.badge-active      { background: #dbeafe; color: #1d4ed8; }
.badge-pending     { background: #fef3c7; color: #92400e; }
.badge-cancelled   { background: #fee2e2; color: #991b1b; }
.badge-high        { background: #fee2e2; color: #991b1b; }
.badge-medium      { background: #fef3c7; color: #92400e; }
.badge-low         { background: #f3f4f6; color: #6b7280; }

/* ─── Todo list ────────────────────────────────────────────────────────────── */
.todo-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    margin-bottom: 8px;
    background: #fff;
}

.todo-item.completed { opacity: 0.5; }
.todo-item.completed .todo-title { text-decoration: line-through; }

.todo-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    margin-top: 2px;
    cursor: pointer;
}

.todo-title { font-weight: 600; font-size: 1rem; }
.todo-meta  { font-size: 0.8125rem; color: #6b7280; margin-top: 2px; }

/* ─── Calculator result box ────────────────────────────────────────────────── */
.calc-result {
    background: #f0fdf4;
    border: 1.5px solid #86efac;
    border-radius: 8px;
    padding: 20px;
    margin-top: 20px;
}

.calc-result h3 { font-size: 1.125rem; font-weight: 700; margin-bottom: 12px; }

.calc-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #bbf7d0;
    font-size: 1rem;
}
.calc-row:last-child { border-bottom: none; }
.calc-row .calc-key   { color: #374151; }
.calc-row .calc-val   { font-weight: 700; color: #111; }
.calc-row.highlight .calc-val { color: #16a34a; font-size: 1.125rem; }

/* ─── Login page ───────────────────────────────────────────────────────────── */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f9fafb;
    padding: 20px;
}

.login-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 32px 28px;
    width: 100%;
    max-width: 380px;
}

.login-card h1 {
    font-size: 1.375rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.login-card .login-sub {
    font-size: 0.875rem;
    color: #6b7280;
    margin-bottom: 24px;
}

/* ─── Utility ──────────────────────────────────────────────────────────────── */
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.text-muted { color: #6b7280; font-size: 0.875rem; }
.text-right { text-align: right; }
.flex-gap { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.w-full { width: 100%; }
.no-data { padding: 32px; text-align: center; color: #6b7280; font-size: 0.9375rem; }
