/* =====================================================================
   Congress of Christian Leadership - Design System
   Palette: deep midnight navy + warm ivory + muted gold
   Type: Fraunces (display serif) + Inter Tight (body)
   ===================================================================== */

:root {
    --color-ink:        #012a9b;   /* CCLM blue - primary */
    --color-ink-soft:   #0a3bbf;
    --color-paper:      #f7f2e9;   /* warm ivory */
    --color-paper-2:    #fbf7ef;
    --color-paper-3:    #ffffff;
    --color-gold:       #d5b679;   /* updated brand gold */
    --color-gold-soft:  #e5cfa3;
    --color-rule:       #e5ddcc;
    --color-muted:      #6b7587;
    --color-success:    #1f7a4d;
    --color-danger:     #b4352d;
    --color-warning:    #b47c1c;
    --color-info:       #2f5f8a;

    --radius-sm: 4px;
    --radius:    8px;
    --radius-lg: 14px;

    --shadow-sm: 0 1px 2px rgba(1, 42, 155, 0.06);
    --shadow:    0 4px 18px rgba(1, 42, 155, 0.10);
    --shadow-lg: 0 20px 50px rgba(1, 42, 155, 0.16);

    --font-display: 'Fraunces', 'Playfair Display', Georgia, serif;
    --font-body:    'Inter Tight', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: var(--font-body);
    color: var(--color-ink);
    background: var(--color-paper);
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background-image:
        radial-gradient(circle at 0% 0%, rgba(180, 138, 58, 0.06), transparent 40%),
        radial-gradient(circle at 100% 100%, rgba(1, 42, 155, 0.04), transparent 50%);
    background-attachment: fixed;
    min-height: 100vh;
}

h1, h2, h3, h4 {
    font-family: var(--font-display);
    font-weight: 500;
    letter-spacing: -0.01em;
    color: var(--color-ink);
    margin: 0 0 0.6em;
}

h1 { font-size: 2.1rem; }
h2 { font-size: 1.55rem; }
h3 { font-size: 1.2rem; }
h4 { font-size: 1rem; }

a {
    color: var(--color-ink);
    text-decoration: none;
    border-bottom: 1px solid var(--color-gold-soft);
    transition: all 0.15s ease;
}
a:hover { color: var(--color-gold); border-bottom-color: var(--color-gold); }

/* ---- Layout ---- */
.app-shell {
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: 100vh;
}

.sidebar {
    background: var(--color-ink);
    color: var(--color-paper);
    padding: 1.5rem 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-brand {
    padding: 0 1.5rem 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    text-align: center;
}
.sidebar-brand-mark {
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    color: var(--color-gold-soft);
    line-height: 1.1;
    text-align: center;
}
.sidebar-logo {
    display: block;
    max-width: 100%;
    max-height: 120px;
    height: auto;
    margin: 0 auto;
    object-fit: contain;
    filter: brightness(1.02);
}
.auth-logo {
    display: block;
    max-width: 220px;
    max-height: 140px;
    height: auto;
    margin: 0 auto 0.75rem;
    object-fit: contain;
}
.sidebar-brand-sub {
    font-size: 0.7rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.5);
    margin-top: 0.4rem;
    text-align: center;
}

.sidebar-nav {
    list-style: none;
    padding: 1rem 0;
    margin: 0;
}
.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 1.5rem;
    color: rgba(255,255,255,0.75);
    border: 0;
    border-left: 3px solid transparent;
    font-size: 0.93rem;
}
.sidebar-nav a:hover {
    color: var(--color-paper);
    background: rgba(255,255,255,0.04);
}
.sidebar-nav a.active {
    color: var(--color-gold-soft);
    border-left-color: var(--color-gold);
    background: rgba(180, 138, 58, 0.1);
}
.sidebar-nav .nav-icon {
    width: 18px;
    height: 18px;
    opacity: 0.8;
}

.sidebar-user {
    position: absolute;
    bottom: 0;
    left: 0; right: 0;
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(255,255,255,0.08);
    font-size: 0.83rem;
    color: rgba(255,255,255,0.6);
}
.sidebar-user .name { color: var(--color-paper); font-weight: 500; }
.sidebar-user a { color: var(--color-gold-soft); border: 0; }

.main-area {
    padding: 2rem 2.5rem 4rem;
    max-width: 1400px;
}

/* ---- Topbar ---- */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--color-rule);
    margin-bottom: 2rem;
}
.topbar h1 { margin: 0; }
.topbar-meta {
    font-size: 0.85rem;
    color: var(--color-muted);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

/* ---- Cards ---- */
.card {
    background: var(--color-paper-3);
    border: 1px solid var(--color-rule);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
}
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    padding-bottom: 0.9rem;
    border-bottom: 1px solid var(--color-rule);
}
.card-header h2, .card-header h3 {
    margin: 0;
}

/* ---- Stat cards ---- */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}
.stat-card {
    background: var(--color-paper-3);
    border: 1px solid var(--color-rule);
    border-radius: var(--radius);
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 3px; height: 100%;
    background: var(--color-gold);
}
.stat-card .label {
    font-size: 0.75rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--color-muted);
    margin-bottom: 0.5rem;
}
.stat-card .value {
    font-family: var(--font-display);
    font-size: 2.4rem;
    font-weight: 500;
    line-height: 1;
    color: var(--color-ink);
}
.stat-card .sub {
    font-size: 0.85rem;
    color: var(--color-muted);
    margin-top: 0.6rem;
}
.stat-card .trend-up    { color: var(--color-success); }
.stat-card .trend-down  { color: var(--color-danger); }

/* ---- Tables ---- */
.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--color-rule);
    border-radius: var(--radius);
    background: var(--color-paper-3);
}
table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}
table.data th {
    text-align: left;
    font-weight: 500;
    font-size: 0.72rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--color-muted);
    padding: 0.85rem 1rem;
    background: var(--color-paper-2);
    border-bottom: 1px solid var(--color-rule);
    white-space: nowrap;
}
table.data td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--color-rule);
    vertical-align: middle;
}
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: var(--color-paper-2); }

/* ---- Forms ---- */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.25rem 1.5rem;
}
.form-grid .full { grid-column: 1 / -1; }
.form-grid .half { grid-column: span 1; }

.field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}
.field label {
    font-size: 0.78rem;
    font-weight: 500;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--color-muted);
}
.field label .req { color: var(--color-danger); margin-left: 3px; }

.field input[type=text],
.field input[type=email],
.field input[type=tel],
.field input[type=url],
.field input[type=date],
.field input[type=time],
.field input[type=number],
.field input[type=password],
.field input[type=search],
.field select,
.field textarea {
    font-family: var(--font-body);
    font-size: 0.95rem;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--color-rule);
    border-radius: var(--radius-sm);
    background: var(--color-paper-3);
    color: var(--color-ink);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    width: 100%;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: 0;
    border-color: var(--color-gold);
    box-shadow: 0 0 0 3px rgba(180, 138, 58, 0.18);
}
.field textarea { min-height: 100px; resize: vertical; }

.field .hint {
    font-size: 0.78rem;
    color: var(--color-muted);
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.checkbox-row input[type=checkbox] {
    width: 18px; height: 18px;
    accent-color: var(--color-gold);
}

.checkbox-group {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.5rem 1rem;
}

.radio-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.radio-pills label {
    padding: 0.45rem 0.9rem;
    border: 1px solid var(--color-rule);
    border-radius: 999px;
    cursor: pointer;
    font-size: 0.88rem;
    background: var(--color-paper-3);
    text-transform: none;
    letter-spacing: 0;
    color: var(--color-ink);
}
.radio-pills input[type=radio] {
    display: none;
}
.radio-pills label:has(input:checked) {
    background: var(--color-ink);
    color: var(--color-paper);
    border-color: var(--color-ink);
}

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    font-family: var(--font-body);
    font-size: 0.92rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s ease;
    background: none;
    text-decoration: none;
}
.btn-primary {
    background: var(--color-ink);
    color: var(--color-paper);
    border-color: var(--color-ink);
}
.btn-primary:hover {
    background: var(--color-gold);
    border-color: var(--color-gold);
    color: var(--color-ink);
}
.btn-secondary {
    background: var(--color-paper-3);
    color: var(--color-ink);
    border-color: var(--color-rule);
}
.btn-secondary:hover {
    border-color: var(--color-ink);
}
.btn-danger {
    background: var(--color-danger);
    color: white;
    border-color: var(--color-danger);
}
.btn-danger:hover { opacity: 0.9; }
.btn-sm { padding: 0.35rem 0.8rem; font-size: 0.82rem; }

/* ---- Badges / tags ---- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.22rem 0.55rem;
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    border-radius: var(--radius-sm);
    background: var(--color-paper-2);
    color: var(--color-muted);
    border: 1px solid var(--color-rule);
}
.badge-success { background: rgba(31, 122, 77, 0.1); color: var(--color-success); border-color: rgba(31, 122, 77, 0.2); }
.badge-danger  { background: rgba(180, 53, 45, 0.1); color: var(--color-danger); border-color: rgba(180, 53, 45, 0.2); }
.badge-warning { background: rgba(180, 124, 28, 0.1); color: var(--color-warning); border-color: rgba(180, 124, 28, 0.2); }
.badge-tier {
    background: var(--tier-color, var(--color-ink));
    color: white;
    border: 0;
}

/* ---- Alerts / flash ---- */
.alert {
    padding: 0.9rem 1.1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    border-left: 3px solid var(--color-info);
    background: rgba(47, 95, 138, 0.08);
    font-size: 0.92rem;
}
.alert-success { border-left-color: var(--color-success); background: rgba(31, 122, 77, 0.08); }
.alert-danger  { border-left-color: var(--color-danger); background: rgba(180, 53, 45, 0.08); }
.alert-warning { border-left-color: var(--color-warning); background: rgba(180, 124, 28, 0.08); }

/* ---- Avatar ---- */
.avatar {
    width: 40px; height: 40px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--color-rule);
    border: 1px solid var(--color-rule);
}
.avatar-lg { width: 110px; height: 110px; }
.avatar-sm { width: 28px; height: 28px; }

/* ---- Member row ---- */
.member-cell {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.member-cell .name { font-weight: 500; }
.member-cell .id-sub { font-size: 0.78rem; color: var(--color-muted); }

/* Suppress link underlines inside data tables to keep rows clean */
table.data a,
table.data a:link,
table.data a:visited { text-decoration: none; }
table.data a:hover { text-decoration: none; }
table.data .name,
table.data .id-sub { text-decoration: none !important; }

/* ---- Login page ---- */
.auth-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1.5rem;
    background:
      radial-gradient(ellipse at top, rgba(180, 138, 58, 0.1), transparent 50%),
      radial-gradient(ellipse at bottom, rgba(1, 42, 155, 0.06), transparent 50%),
      var(--color-paper);
}
.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--color-paper-3);
    border: 1px solid var(--color-rule);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    box-shadow: var(--shadow-lg);
}
.auth-brand {
    text-align: center;
    margin-bottom: 2rem;
}
.auth-brand .mark {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 500;
    color: var(--color-ink);
    display: block;
}
.auth-brand .sub {
    font-size: 0.72rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--color-gold);
    margin-top: 0.5rem;
}
.auth-brand .crest {
    display: inline-block;
    width: 40px;
    height: 40px;
    margin-bottom: 1rem;
    border-radius: 50%;
    background: var(--color-ink);
    position: relative;
}
.auth-brand .crest::after {
    content: '✝';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-gold-soft);
    font-size: 1.3rem;
}

/* ---- Tabs ---- */
.tabs {
    display: flex;
    border-bottom: 1px solid var(--color-rule);
    margin-bottom: 1.5rem;
    gap: 0;
    overflow-x: auto;
}
.tabs a {
    padding: 0.7rem 1.2rem;
    border: 0;
    border-bottom: 2px solid transparent;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--color-muted);
    white-space: nowrap;
}
.tabs a.active {
    color: var(--color-ink);
    border-bottom-color: var(--color-gold);
}

/* ---- Mobile ---- */
.mobile-toggle {
    display: none;
    background: var(--color-ink);
    color: var(--color-paper);
    border: 0;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 1.2rem;
    align-items: center;
    justify-content: center;
}

@media (max-width: 900px) {
    .app-shell {
        grid-template-columns: 1fr;
    }
    .sidebar {
        position: fixed;
        top: 0; left: -260px;
        width: 240px;
        transition: left 0.25s ease;
        z-index: 100;
        box-shadow: var(--shadow-lg);
    }
    .sidebar.open { left: 0; }
    .mobile-toggle { display: inline-flex; }
    .main-area { padding: 1rem 1.25rem 4rem; }
    .topbar { flex-direction: column; align-items: flex-start; gap: 0.75rem; }
    .stat-card .value { font-size: 1.9rem; }
    h1 { font-size: 1.6rem; }
    .sidebar-user { position: static; margin-top: 2rem; }
}

/* ---- Utility ---- */
.text-muted    { color: var(--color-muted); }
.text-center   { text-align: center; }
.text-right    { text-align: right; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-wrap { flex-wrap: wrap; }
.w-full { width: 100%; }

/* ---- Hairline accent ---- */
.rule-accent {
    display: block;
    height: 1px;
    background: linear-gradient(to right, var(--color-gold) 0%, var(--color-gold) 40px, var(--color-rule) 40px, var(--color-rule) 100%);
    margin: 0.5rem 0 1.5rem;
    border: 0;
}

/* ---- Print ---- */
@media print {
    .sidebar, .topbar button, .btn { display: none !important; }
    body { background: white; }
    .main-area { padding: 0; }
}
