/* ==========================================================================
   Al-Yateem CRM — Stylesheet
   Brand: #90604e (warm brown)
   ========================================================================== */

:root {
    --brand: #90604e;
    --brand-dark: #7a4f3f;
    --brand-light: #b08a78;
    --brand-bg: #faf7f4;
    --brand-tint: #f3ebe4;
    --ink: #2d2d2d;
    --ink-soft: #5c5c5c;
    --ink-muted: #8a8a8a;
    --line: #e6dcd2;
    --line-soft: #f0e8e0;
    --bg: #ffffff;
    --bg-soft: #f9f5f1;
    --green: #2e7d32;
    --green-bg: #e8f5e9;
    --amber: #ef6c00;
    --amber-bg: #fff4e5;
    --red: #c62828;
    --red-bg: #ffebee;
    --blue: #1565c0;
    --blue-bg: #e3f2fd;
    --shadow-sm: 0 1px 2px rgba(60, 30, 15, 0.04);
    --shadow: 0 2px 8px rgba(60, 30, 15, 0.08);
    --shadow-lg: 0 8px 24px rgba(60, 30, 15, 0.12);
    --radius: 8px;
    --radius-lg: 12px;
}

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

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, "Helvetica Neue", Arial, sans-serif;
    color: var(--ink);
    background: var(--brand-bg);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

button { font-family: inherit; cursor: pointer; }

input, select, textarea {
    font-family: inherit;
    font-size: inherit;
    color: var(--ink);
}

/* === LOGIN PAGE === */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, #faf7f4 0%, #ede0d3 100%);
}
.login-card {
    background: white;
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
}
.login-logo {
    margin: 0 auto 20px;
    width: 96px;
    height: 96px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.login-logo img, .login-logo svg {
    width: 100%; height: 100%;
    object-fit: contain;
}
.login-header { text-align: center; margin-bottom: 32px; }
.login-header h1 { font-size: 24px; color: var(--brand); margin-bottom: 4px; font-weight: 700; }
.login-header p { color: var(--ink-muted); font-size: 14px; }

/* === LAYOUT === */
html, body { height: 100%; }
.app-shell {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.sidebar {
    width: 240px;
    flex-shrink: 0;
    background: white;
    border-right: 1px solid var(--line);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}
.content-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}
.sidebar-brand {
    padding: 16px 20px;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    gap: 10px;
}
.brand-logo {
    width: 40px; height: 40px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.brand-logo img, .brand-logo svg {
    width: 100%; height: 100%;
    object-fit: contain;
    display: block;
}
.brand-name { font-weight: 700; color: var(--brand); font-size: 16px; line-height: 1.2; }
.brand-sub  { font-size: 11px; color: var(--ink-muted); text-transform: uppercase; letter-spacing: 0.5px; }

/* SVG icons via sprite */
.icon {
    display: inline-block;
    width: 1em;
    height: 1em;
    vertical-align: -0.15em;
    fill: currentColor;
    flex-shrink: 0;
}
.icon-lg { width: 1.25em; height: 1.25em; }
.nav-icon .icon { width: 18px; height: 18px; }
.btn .icon { width: 1em; height: 1em; margin-right: 4px; }
.btn .icon:only-child { margin-right: 0; }
.sidebar-nav { flex: 1; padding: 12px 8px; overflow-y: auto; }
.sidebar-divider { height: 1px; background: var(--line); margin: 12px 8px; }
.sidebar-footer {
    padding: 14px 16px;
    border-top: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.user-info { font-size: 13px; line-height: 1.3; }
.user-name { font-weight: 600; color: var(--ink); }
.user-role { color: var(--ink-muted); font-size: 12px; }
.btn-block { width: 100%; justify-content: center; }
.nav-icon { width: 18px; text-align: center; flex-shrink: 0; }
.nav-label { flex: 1; }
.nav-badge {
    background: var(--brand);
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}
.nav-item.active .nav-badge { background: white; color: var(--brand); }
.nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px;
    border-radius: 6px;
    color: var(--ink-soft);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 2px;
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
}
.nav-item:hover { background: var(--brand-tint); color: var(--ink); }
.nav-item.active { background: var(--brand); color: white; }
.nav-item .icon { width: 18px; height: 18px; flex-shrink: 0; }
.nav-section {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--ink-muted);
    padding: 16px 12px 6px;
    font-weight: 600;
}

.topbar {
    background: white;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    height: 60px;
    flex-shrink: 0;
}
.topbar h2 { flex: 1; font-size: 18px; font-weight: 600; }

/* Currency toggle segmented control in topbar */
.currency-toggle {
    display: inline-flex;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
    background: white;
}
.currency-btn {
    background: none;
    border: none;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    color: var(--ink-muted);
    transition: background 0.15s, color 0.15s;
}
.currency-btn:hover { background: var(--bg-soft); }
.currency-btn.active {
    background: var(--brand);
    color: white;
}
.currency-btn + .currency-btn { border-left: 1px solid var(--line); }
.currency-btn.active + .currency-btn { border-left-color: var(--brand); }

/* Live exchange rate banner on Reports page */
.rate-banner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #f5ebe5, #fff8f3);
    border: 1px solid #d9b8a3;
    border-radius: 10px;
    padding: 12px 18px;
    margin-bottom: 20px;
    font-size: 14px;
}
.rate-banner strong { color: var(--brand); font-variant-numeric: tabular-nums; font-size: 16px; }
.rate-banner-label { color: var(--ink-muted); }
.rate-banner-meta { font-size: 12px; color: var(--ink-muted); }
.topbar h2 { font-size: 18px; font-weight: 600; color: var(--ink); }
.user-menu {
    display: flex; align-items: center; gap: 12px;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 6px;
    position: relative;
}
.user-menu:hover { background: var(--brand-tint); }
.user-avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--brand);
    color: white;
    display: flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: 13px;
}
.user-info-text { font-size: 13px; }
.user-info-text .name { font-weight: 600; }
.user-info-text .role { color: var(--ink-muted); font-size: 12px; }

.user-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    background: white;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    min-width: 200px;
    z-index: 100;
    display: none;
}
.user-dropdown.show { display: block; }
.user-dropdown button {
    display: block; width: 100%; text-align: left;
    padding: 10px 14px; border: none; background: none;
    font-size: 14px; color: var(--ink);
}
.user-dropdown button:hover { background: var(--bg-soft); }
.user-dropdown hr { border: none; border-top: 1px solid var(--line); margin: 4px 0; }

.main {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

/* === BUTTONS === */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 16px;
    border-radius: 6px;
    border: 1px solid transparent;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    background: var(--bg);
    color: var(--ink);
    border-color: var(--line);
    white-space: nowrap;
}
.btn:hover { background: var(--bg-soft); border-color: var(--brand-light); }
.btn-primary { background: var(--brand); color: white; border-color: var(--brand); }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-danger { background: var(--red); color: white; border-color: var(--red); }
.btn-danger:hover { background: #a01818; border-color: #a01818; }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-icon { padding: 6px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* === FORMS === */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-soft);
    margin-bottom: 6px;
}
.form-control {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    font-size: 14px;
    background: white;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.form-control:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(144, 96, 78, 0.15);
}
textarea.form-control { min-height: 80px; resize: vertical; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-check {
    display: flex; align-items: center; gap: 8px;
    font-size: 14px; cursor: pointer;
}
.form-check input { width: 16px; height: 16px; cursor: pointer; }

/* === CARDS === */
.card {
    background: white;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}
.card + .card { margin-top: 16px; }
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--line-soft);
}
.card-header h3 { font-size: 16px; font-weight: 600; }

/* === STAT CARDS === */
.stats-grid, .stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    border: 1px solid var(--line);
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 4px; height: 100%;
    background: var(--brand);
}
.stat-card.green::before { background: var(--green); }
.stat-card.amber::before { background: var(--amber); }
.stat-card.orange::before { background: var(--amber); }
.stat-card.red::before { background: var(--red); }
.stat-card.blue::before { background: var(--blue); }
.stat-card.muted::before { background: #90a4ae; }
.stat-card.pink::before { background: #c2185b; }
.stat-card.purple::before { background: #7b1fa2; }
.pending-card { background: #fff8e1; border-color: #ffd54f; }
.pending-card .card-header h3 { color: #b26a00; }

/* Recently-edited highlight */
@keyframes flashHighlight {
    0%   { background-color: #fff9c4; }
    100% { background-color: transparent; }
}
.recently-edited > td, tr.recently-edited > td {
    animation: flashHighlight 3s ease-out;
}

/* Family detail as page */
.page-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 8px 0 20px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 20px;
}
.page-header-title { flex: 1; }
.page-header-title h2 { font-size: 22px; font-weight: 700; }
.page-footer {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-top: 20px;
    margin-top: 20px;
    border-top: 1px solid var(--line);
}

/* Modal back button */
.btn-back {
    background: none;
    border: none;
    color: var(--brand);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 6px;
    margin-right: 8px;
}
.btn-back:hover { background: var(--bg-soft); }
.modal-header { display: flex; align-items: center; gap: 8px; }
.modal-header h2 { flex: 1; }

.pending-row {
    background: white;
    border: 1px solid #ffd54f;
    border-radius: var(--radius-md);
    margin-top: 12px;
    overflow: hidden;
}
.pending-row-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: #fff3cd;
    border-bottom: 1px solid #ffe082;
    flex-wrap: wrap;
    gap: 8px;
}
.pending-diff { padding: 10px 14px; }
.diff-row {
    display: grid;
    grid-template-columns: 160px 1fr 24px 1fr;
    gap: 12px;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px dashed #f0e0a0;
    font-size: 14px;
}
.diff-row:last-child { border-bottom: none; }
.diff-label { font-weight: 600; color: #555; }
.diff-old   { color: #b71c1c; text-decoration: line-through; opacity: 0.85; }
.diff-arrow { color: #888; text-align: center; }
.diff-new   { color: #1b5e20; font-weight: 500; }

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 10px;
    background: #f3e5f5;
    border-radius: var(--radius-md);
    border: 1px solid #ce93d8;
}
.checkbox-label input[type="checkbox"] { width: 18px; height: 18px; cursor: pointer; }
.stat-label {
    font-size: 12px;
    color: var(--ink-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    margin-bottom: 6px;
}
.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--ink);
    line-height: 1;
}
.stat-sub {
    font-size: 12px;
    color: var(--ink-muted);
    margin-top: 6px;
}

/* === TABLES === */
.table-wrap { overflow-x: auto; }
table.data {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 14px;
}
table.data th {
    text-align: left;
    padding: 10px 12px;
    background: var(--bg-soft);
    color: var(--ink-soft);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}
table.data td {
    padding: 12px;
    border-bottom: 1px solid var(--line-soft);
    vertical-align: middle;
}
table.data tr:hover td { background: var(--bg-soft); }
table.data tr.clickable { cursor: pointer; }
table.data tr:last-child td { border-bottom: none; }

/* === BADGES === */
.badge {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
/* Member status badges */
.badge-orphan      { background: var(--green-bg); color: var(--green); }
.badge-aftercare   { background: var(--amber-bg); color: var(--amber); }
.badge-transition  { background: var(--red-bg);   color: var(--red); }
.badge-need        { background: #f3e5f5;          color: #7b1fa2; }

/* Family status badges */
.badge-active      { background: var(--green-bg); color: var(--green); }
.badge-inactive    { background: #eceff1;          color: #607d8b; }
.badge-review      { background: var(--amber-bg); color: var(--amber); }
.badge-rejected    { background: #ffcdd2;          color: #b71c1c; }
.badge-nlq         { background: var(--red-bg);   color: var(--red); }

/* Generic */
.badge-warning     { background: var(--amber-bg); color: var(--amber); }
.badge-info        { background: var(--blue-bg);  color: var(--blue); }
.badge-muted       { background: var(--line);     color: var(--ink-soft); }
/* Legacy alias */
.badge-not-qual    { background: var(--red-bg);   color: var(--red); }
.badge-exception   { background: #f3e5f5; color: #7b1fa2; }

.stat-card.purple::before { background: #9c27b0; }

.nav-badge {
    background: var(--red);
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

/* === FILTER BAR === */
.filter-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    align-items: center;
}
.filter-bar .search-input {
    flex: 1;
    min-width: 200px;
    max-width: 400px;
}

/* === MODALS === */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(45, 30, 20, 0.5);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}
.modal {
    background: white;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
}
.modal-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.modal-header h3 { font-size: 17px; font-weight: 600; }
.modal-close {
    background: none; border: none;
    width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 6px;
    color: var(--ink-muted);
    font-size: 22px;
    line-height: 1;
}
.modal-close:hover { background: var(--bg-soft); color: var(--ink); }
.modal-body {
    padding: 20px 24px;
    overflow-y: auto;
}
.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--line);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* === ALERTS === */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    border: 1px solid;
    font-size: 14px;
}
.alert-error { background: var(--red-bg); border-color: rgba(198,40,40,0.2); color: var(--red); }
.alert-success { background: var(--green-bg); border-color: rgba(46,125,50,0.2); color: var(--green); }
.alert-warning { background: var(--amber-bg); border-color: rgba(239,108,0,0.2); color: var(--amber); }
.alert-info { background: var(--blue-bg); border-color: rgba(21,101,192,0.2); color: var(--blue); }

/* === EMPTY STATE === */
.empty {
    padding: 48px 20px;
    text-align: center;
    color: var(--ink-muted);
}
.empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.4;
}

/* === LOADING === */
.spinner {
    width: 24px; height: 24px;
    border: 3px solid var(--line);
    border-top-color: var(--brand);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-overlay {
    display: flex; align-items: center; justify-content: center;
    padding: 40px;
    color: var(--ink-muted);
    gap: 10px;
}

/* === TOAST === */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--ink);
    color: white;
    padding: 12px 18px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 2000;
    animation: toast-in 0.2s ease-out;
    max-width: 360px;
}
.toast.success { background: var(--green); }
.toast.error { background: var(--red); }
@keyframes toast-in {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* === MEMBER LIST WITHIN FAMILY VIEW === */
.member-row {
    display: grid;
    grid-template-columns: 40px 1fr auto auto auto;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    margin-bottom: 8px;
    background: white;
}
.member-row .member-num {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--brand-tint);
    color: var(--brand);
    display: flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: 13px;
}
.member-row .member-name { font-weight: 600; }
.member-row .member-meta {
    font-size: 12px; color: var(--ink-muted);
    margin-top: 2px;
}

/* === REGION TABS === */
.region-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--line);
    overflow-x: auto;
}
.region-tab {
    padding: 10px 16px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--ink-soft);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
}
.region-tab:hover { color: var(--brand); }
.region-tab.active {
    color: var(--brand);
    border-bottom-color: var(--brand);
    font-weight: 600;
}

/* === RESPONSIVE === */
@media (max-width: 800px) {
    .sidebar {
        position: fixed;
        top: 0; left: 0;
        height: 100%;
        width: 240px;
        z-index: 200;
        transform: translateX(-100%);
        transition: transform 0.2s;
        box-shadow: var(--shadow-lg);
    }
    .sidebar.open { transform: translateX(0); }
    .menu-toggle { display: block !important; }
    .form-row { grid-template-columns: 1fr; }
}
.menu-toggle { display: none; background: none; border: none; padding: 8px; }

/* RTL support for Arabic names */
[dir="auto"], .rtl-content { unicode-bidi: plaintext; }

/* utility */
.text-muted { color: var(--ink-muted); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.mt-2 { margin-top: 16px; } .mb-2 { margin-bottom: 16px; }
.flex { display: flex; }
.gap-2 { gap: 12px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }

/* ============================================================
   v4 utility classes
   ============================================================ */

.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.gap-1 { gap: 6px; }
.gap-2 { gap: 8px; }
.wrap { flex-wrap: wrap; }

.section-title {
    margin: 24px 0 12px;
    font-size: 14px;
    font-weight: 700;
    color: var(--ink-soft);
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    background: var(--bg-soft);
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 16px;
}
.detail-label {
    font-size: 11px;
    color: var(--ink-soft);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 4px;
}
.detail-value {
    font-size: 14px;
    color: var(--ink);
    font-weight: 500;
}

.note-block {
    background: #fff8e1;
    border-left: 3px solid var(--amber);
    padding: 10px 14px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 13px;
}
.note-block strong {
    display: block;
    margin-bottom: 4px;
    color: var(--amber);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.big-amount {
    font-size: 32px;
    font-weight: 700;
    color: var(--brand);
    margin: 8px 0;
    font-variant-numeric: tabular-nums;
}

.member-meta {
    font-size: 12px;
    color: var(--ink-soft);
}

.btn-warning {
    background: var(--amber);
    color: white;
    border-color: var(--amber);
}
.btn-warning:hover {
    filter: brightness(0.92);
}

.alert-info {
    background: var(--blue-bg);
    color: var(--blue);
    border-left: 3px solid var(--blue);
}
.alert-success {
    background: var(--green-bg);
    color: var(--green);
    border-left: 3px solid var(--green);
}
.alert-warning {
    background: var(--amber-bg);
    color: var(--amber);
    border-left: 3px solid var(--amber);
}

.text-right { text-align: right; }

/* ============================================================ */
/* MEMBER PHOTOS + REPORTS                                       */
/* ============================================================ */

/* Thumbnail in member list */
.member-thumb {
    width: 36px; height: 36px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    background: var(--bg-soft);
}
.member-thumb-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ink-muted);
    font-size: 20px;
}

/* Photo widget inside member modal */
.photo-widget {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px;
    background: var(--bg-soft);
    border-radius: 10px;
    margin-bottom: 12px;
}
.photo-preview {
    width: 96px; height: 96px;
    border-radius: 50%;
    overflow: hidden;
    background: white;
    border: 2px solid var(--line);
    flex-shrink: 0;
}
.photo-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-placeholder {
    width: 100%; height: 100%;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    color: var(--ink-muted);
    font-size: 28px;
    text-align: center;
}
.photo-placeholder small { font-size: 10px; margin-top: 4px; }
.photo-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Reports card inside member modal */
.reports-card {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 2px solid var(--line);
}
.reports-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.reports-card-header h4 { font-size: 15px; font-weight: 600; color: var(--brand); }
.reports-list { display: flex; flex-direction: column; gap: 8px; }
.report-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: white;
    border: 1px solid var(--line);
    border-radius: 8px;
    transition: background 0.15s;
}
.report-row:hover { background: var(--bg-soft); }
.report-row-main { flex: 1; min-width: 0; }
.report-row-meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-muted); }
.report-date { font-variant-numeric: tabular-nums; font-weight: 600; }
.report-attach-badge { color: var(--brand); }
.report-subject { font-weight: 600; margin-top: 2px; font-size: 14px; }
.report-snippet {
    font-size: 13px; color: var(--ink-muted);
    margin-top: 3px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Report detail view */
.report-view-meta {
    display: flex; gap: 24px;
    font-size: 13px; color: var(--ink-muted);
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
}
.report-view-subject {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--ink);
}
.report-view-body {
    line-height: 1.6;
    color: var(--ink);
    white-space: pre-wrap;
    word-wrap: break-word;
    margin-bottom: 16px;
}
.report-attach-box {
    margin-top: 16px;
    padding: 12px;
    background: var(--bg-soft);
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.current-attachment {
    padding: 8px 12px;
    background: var(--bg-soft);
    border-radius: 6px;
    font-size: 13px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.loading-inline { padding: 14px; color: var(--ink-muted); font-size: 13px; }
.spinner-sm {
    display: inline-block;
    width: 12px; height: 12px;
    border: 2px solid var(--line);
    border-top-color: var(--brand);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    vertical-align: -2px;
    margin-right: 6px;
}

/* Member detail page top card */
.member-top-card { padding: 24px; }
.member-top-row {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}
.member-photo-large {
    width: 140px; height: 140px;
    border-radius: 12px;
    overflow: hidden;
    background: var(--bg-soft);
    border: 1px solid var(--line);
    flex-shrink: 0;
}
.member-photo-large img { width: 100%; height: 100%; object-fit: cover; display: block; }
.member-photo-large .photo-placeholder {
    width: 100%; height: 100%;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    color: var(--ink-muted); font-size: 32px;
}
.member-photo-large .photo-placeholder small { font-size: 11px; margin-top: 4px; }
.member-top-info { flex: 1; min-width: 0; }
.member-top-name {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--ink);
}
.member-top-status { margin-bottom: 8px; }
.member-top-meta {
    color: var(--ink-muted);
    font-size: 14px;
    margin-bottom: 10px;
}
.member-top-amount {
    font-size: 22px;
    font-weight: 700;
    color: var(--brand);
    margin-bottom: 14px;
    font-variant-numeric: tabular-nums;
}
.member-top-actions {
    display: flex;
    gap: 8px;
}

@media (max-width: 640px) {
    .member-top-row { flex-direction: column; align-items: center; text-align: center; }
}

/* Pagination controls */
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    flex-wrap: wrap;
    gap: 12px;
}
.pagination-info {
    color: var(--ink-muted);
    font-size: 13px;
    padding: 8px 0;
}
.pagination-controls {
    display: flex;
    gap: 6px;
    align-items: center;
}
.pagination-page {
    padding: 0 12px;
    font-weight: 600;
    color: var(--ink);
    font-size: 13px;
}
.pagination .btn[disabled] { opacity: 0.4; cursor: not-allowed; }
