/* ============================================================
   GetMeReach CRM — Design System
   Palette pulled from the GetMeReach logo. Every future page
   should reuse these tokens/classes rather than adding new CSS.
   ============================================================ */

:root {
    --navy: #0B132B;
    --navy-soft: #141B36;
    --coral: #EF4B45;
    --amber: #F5A623;
    --blue: #3B5FE2;
    --blue-dark: #2C48B8;
    --white: #FFFFFF;
    --bg: #F7F8FB;
    --card: #FFFFFF;
    --border: #E7E9F2;
    --text: #1B1F2E;
    --text-muted: #6B7185;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 2px 10px rgba(11, 19, 43, 0.06);
    --shadow-lg: 0 12px 32px rgba(11, 19, 43, 0.12);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }
h1, h2, h3, h4 { font-weight: 600; margin: 0; }
ul { list-style: none; margin: 0; padding: 0; }

/* ---------------- Layout ---------------- */
.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 250px;
    background: var(--navy);
    color: var(--white);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar-brand {
    padding: 22px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.brand-logo {
    width: 100%;
    max-width: 170px;
    display: block;
    border-radius: 8px;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow-y: auto;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    color: rgba(255,255,255,0.72);
    font-size: 13.5px;
    font-weight: 500;
    transition: background 0.15s ease, color 0.15s ease;
}

.nav-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255,255,255,0.35);
    flex-shrink: 0;
    transition: background 0.15s ease;
}

.nav-link:hover {
    background: rgba(255,255,255,0.06);
    color: var(--white);
}

.nav-link.active {
    background: var(--blue);
    color: var(--white);
}

.nav-link.active .nav-dot {
    background: var(--amber);
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--coral), var(--amber));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: var(--navy);
    flex-shrink: 0;
}

.user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--white);
}

.user-logout {
    font-size: 12px;
    color: rgba(255,255,255,0.55);
}

.user-logout:hover { color: var(--coral); }

.main-content {
    flex: 1;
    min-width: 0;
}

.topbar {
    background: var(--card);
    border-bottom: 1px solid var(--border);
    padding: 20px 32px;
    position: sticky;
    top: 0;
    z-index: 5;
}

.page-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--navy);
}

.page-body {
    padding: 28px 32px 60px;
}

/* ---------------- Alerts ---------------- */
.alert {
    margin: 20px 32px 0;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-weight: 500;
}

.alert-success { background: #E9F9EE; color: #1C8A45; border: 1px solid #BEEBD0; }
.alert-error   { background: #FDEDEC; color: var(--coral); border: 1px solid #F8CFCD; }

/* ---------------- Cards / stat tiles ---------------- */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 4px; height: 100%;
    background: var(--accent, var(--blue));
}

.stat-card.accent-blue  { --accent: var(--blue); }
.stat-card.accent-coral { --accent: var(--coral); }
.stat-card.accent-amber { --accent: var(--amber); }
.stat-card.accent-navy  { --accent: var(--navy); }

.stat-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 26px;
    font-weight: 700;
    color: var(--navy);
}

.stat-sub {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

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

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

.card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--navy);
}

/* ---------------- Buttons ---------------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: filter 0.15s ease, transform 0.05s ease;
}

.btn:active { transform: scale(0.98); }

.btn-primary { background: var(--blue); color: var(--white); }
.btn-primary:hover { filter: brightness(1.08); }

.btn-danger { background: var(--coral); color: var(--white); }
.btn-danger:hover { filter: brightness(1.08); }

.btn-outline {
    background: transparent;
    color: var(--navy);
    border: 1px solid var(--border);
}
.btn-outline:hover { background: var(--bg); }

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

/* ---------------- Forms ---------------- */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
}

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

.form-group label {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-muted);
}

.form-group input,
.form-group select,
.form-group textarea {
    font-family: inherit;
    font-size: 13.5px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg);
    color: var(--text);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--blue);
    background: var(--white);
}

.form-actions {
    margin-top: 18px;
    display: flex;
    gap: 10px;
}

/* ---------------- Tables ---------------- */
.table-wrap { overflow-x: auto; }

table.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}

.data-table th {
    text-align: left;
    padding: 12px 14px;
    background: var(--bg);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.data-table td {
    padding: 13px 14px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    white-space: nowrap;
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #FBFBFD; }

.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-coral { color: var(--coral); }
.text-blue { color: var(--blue); }
.text-amber { color: #B5790E; }

/* ---------------- Badges ---------------- */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}

.badge-paid    { background: #E9F9EE; color: #1C8A45; }
.badge-pending { background: #FEF3E2; color: #B5790E; }
.badge-active  { background: #E9F0FE; color: var(--blue); }
.badge-inactive{ background: #F1F1F5; color: var(--text-muted); }
.badge-partial { background: #FEF3E2; color: #B5790E; }

/* ---------------- Empty state ---------------- */
.empty-state {
    text-align: center;
    padding: 50px 20px;
    color: var(--text-muted);
}

.empty-state h3 { color: var(--navy); margin-bottom: 6px; }

/* ---------------- Modal ---------------- */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(11,19,43,0.45);
    z-index: 50;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

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

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

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

.modal-close {
    cursor: pointer;
    color: var(--text-muted);
    font-size: 20px;
    line-height: 1;
    background: none;
    border: none;
}

/* ---------------- Login page ---------------- */
.auth-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--navy);
    padding: 20px;
}

.auth-box {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 380px;
    padding: 36px 32px;
    text-align: center;
}

.auth-logo { width: 150px; margin: 0 auto 22px; display: block; }
.auth-title { font-size: 17px; color: var(--navy); margin-bottom: 22px; }
.auth-box .form-group { text-align: left; margin-bottom: 14px; }
.auth-box .btn { width: 100%; justify-content: center; margin-top: 6px; padding: 11px; }

/* ---------------- Responsive ---------------- */
@media (max-width: 900px) {
    .sidebar { width: 76px; }
    .sidebar-brand { padding: 16px 10px; }
    .brand-logo { max-width: 44px; border-radius: 8px; }
    .nav-link span:last-child { display: none; }
    .nav-link { justify-content: center; }
    .user-info { display: none; }
    .page-body { padding: 20px 16px 40px; }
    .topbar { padding: 16px 20px; }
}
