/* Resident portal (index.html) only - the admin pages use default.css.
   Mobile-first: one column by default, two columns from 860px. */

:root {
    --bg: #f3f5f2;
    --surface: #ffffff;
    --surface-sunk: #f7f8f6;
    --text: #1b2420;
    --text-2: #56635b;
    --text-3: #7c877f;
    --border: #e0e5e1;
    --border-strong: #c9d1cb;
    --accent: #2e6b4f;
    --accent-hover: #24573f;
    --accent-soft: #e5efe9;
    --on-accent: #ffffff;
    --danger: #b42318;
    --danger-soft: #fdecea;
    --success: #1f7a4d;
    --success-soft: #e3f3ea;
    --info-soft: #eef2f7;
    --info: #3a4a5c;
    --radius: 10px;
    --radius-lg: 14px;
    --shadow: 0 1px 2px rgba(20, 30, 25, 0.05), 0 1px 3px rgba(20, 30, 25, 0.04);
    --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #111513;
        --surface: #1a201d;
        --surface-sunk: #151a17;
        --text: #e6ebe8;
        --text-2: #a6b2ab;
        --text-3: #85918a;
        --border: #2b332f;
        --border-strong: #3a4540;
        --accent: #5fae86;
        --accent-hover: #74bf98;
        --accent-soft: #1f3329;
        --on-accent: #0d1a13;
        --danger: #f2877b;
        --danger-soft: #3a1f1c;
        --success: #6cc596;
        --success-soft: #1a3226;
        --info-soft: #1e252d;
        --info: #b7c4d3;
        --shadow: none;
        color-scheme: dark;
    }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.hidden { display: none !important; }

h1 { font-size: 1.5rem; font-weight: 600; line-height: 1.25; margin: 0 0 0.5rem; letter-spacing: -0.01em; }
h2 { font-size: 1.05rem; font-weight: 600; margin: 0 0 0.25rem; }
p { margin: 0 0 0.5rem; }
a { color: var(--accent); }
a:hover { color: var(--accent-hover); }

.muted { color: var(--text-2); }
.small { font-size: 0.875rem; }
.label { font-size: 0.8125rem; font-weight: 500; color: var(--text-2); text-transform: none; }

/* Header */
.site-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding-top: env(safe-area-inset-top);
}
.site-header-inner {
    max-width: 1040px;
    margin: 0 auto;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}
.brand { display: flex; align-items: center; gap: 0.625rem; text-decoration: none; color: var(--text); min-width: 0; }
.brand:hover { color: var(--text); }
.brand-logo { width: 44px; height: auto; flex-shrink: 0; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-name { font-weight: 600; font-size: 1rem; }
.brand-sub { font-size: 0.75rem; color: var(--text-2); }
.header-account { display: flex; align-items: center; gap: 0.5rem; min-width: 0; }
.header-address { font-size: 0.875rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.test-banner { background: #fff4d6; color: #7a4d00; text-align: center; font-size: 0.8125rem; font-weight: 500; padding: 0.25rem; }
@media (prefers-color-scheme: dark) { .test-banner { background: #3a2e12; color: #f3cf7a; } }
@media (max-width: 480px) {
    .brand-sub { display: none; }
    .brand-logo { width: 36px; }
    .header-address { display: none; }
}

/* Layout */
.page {
    flex: 1;
    width: 100%;
    max-width: 1040px;
    margin: 0 auto;
    padding: 1rem 1rem 2rem;
}
.site-footer {
    text-align: center;
    font-size: 0.8125rem;
    color: var(--text-3);
    padding: 1.25rem 1rem calc(1.25rem + env(safe-area-inset-bottom));
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 1.125rem;
    margin-bottom: 1rem;
}
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 0.25rem; }
.card-head-wrap { flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; }

/* Activity filters */
.filters { display: flex; gap: 0.375rem; flex-wrap: wrap; }
.filter {
    font: inherit;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-2);
    background: transparent;
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    padding: 0.3rem 0.75rem;
    min-height: 32px;
    cursor: pointer;
}
.filter[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.filter:hover:not([aria-pressed="true"]) { color: var(--text); }
.filter:focus-visible { outline: 3px solid var(--accent-soft); outline-offset: 2px; }

.signin-card, .pay-card, .result-card { max-width: 440px; margin: 1.5rem auto; }
/* The way into the admin area (login.php), kept quiet under the sign-in card. */
.board-signin { text-align: center; font-size: 0.8125rem; margin: -0.5rem 0 0; }
.board-signin a { color: var(--text-3); }
.board-signin a:hover { color: var(--text-2); }
@media (min-width: 600px) {
    .page { padding-top: 1.75rem; }
    .card { padding: 1.5rem; }
}

.overview-grid { display: block; }
@media (min-width: 860px) {
    .overview-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 1rem; align-items: start; }
}

/* Forms */
.field { margin-bottom: 1rem; }
.field label { display: block; font-size: 0.875rem; font-weight: 500; margin-bottom: 0.375rem; }
input[type="text"], input[type="email"], select {
    width: 100%;
    font: inherit;
    font-size: 1rem; /* keeps iOS from zooming on focus */
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    padding: 0.7rem 0.8rem;
    min-height: 46px;
    appearance: none;
    -webkit-appearance: none;
}
select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%237c877f' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.9rem center;
    padding-right: 2.25rem;
}
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.hint { font-size: 0.8125rem; color: var(--text-2); margin: 0.375rem 0 0; }
.checkbox { display: flex; gap: 0.625rem; align-items: flex-start; font-size: 0.875rem; color: var(--text-2); margin-bottom: 1rem; cursor: pointer; }
.checkbox input { width: 18px; height: 18px; margin: 0.125rem 0 0; accent-color: var(--accent); flex-shrink: 0; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font: inherit;
    font-weight: 600;
    font-size: 1rem;
    border-radius: var(--radius);
    border: 1px solid transparent;
    padding: 0.75rem 1.25rem;
    min-height: 48px;
    cursor: pointer;
    transition: background-color 0.15s ease;
}
.btn:disabled { opacity: 0.6; cursor: default; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border-strong); }
.btn-ghost:hover { background: var(--surface-sunk); }
.btn-small { min-height: 36px; padding: 0.375rem 0.75rem; font-size: 0.875rem; font-weight: 500; }
.btn-block { width: 100%; }
.btn:focus-visible, .tab:focus-visible, .switch:focus-visible, .link-button:focus-visible { outline: 3px solid var(--accent-soft); outline-offset: 2px; }
.link-button { background: none; border: 0; padding: 0; font: inherit; font-size: 0.875rem; font-weight: 500; color: var(--accent); cursor: pointer; }
.link-button:hover { color: var(--accent-hover); text-decoration: underline; }
.back-link { margin-bottom: 1rem; }

.spinner {
    width: 18px; height: 18px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    display: inline-block;
}
.spinner-dark { color: var(--accent); width: 22px; height: 22px; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { display: flex; align-items: center; justify-content: center; gap: 0.75rem; color: var(--text-2); padding: 4rem 0; }

/* Alerts and badges */
.alert { border-radius: var(--radius); padding: 0.75rem 0.875rem; font-size: 0.875rem; margin: 0.75rem 0; }
.alert-error { background: var(--danger-soft); color: var(--danger); }
.alert-info { background: var(--info-soft); color: var(--info); }
.alert-success { background: var(--success-soft); color: var(--success); margin-top: 0; }
.badge { display: inline-block; font-size: 0.75rem; font-weight: 600; border-radius: 999px; padding: 0.15rem 0.6rem; }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-success { background: var(--success-soft); color: var(--success); }

/* Tabs */
.tabs {
    display: flex;
    gap: 0.25rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0.25rem;
    margin-bottom: 1rem;
    max-width: 460px;
}
.tab {
    flex: 1;
    font: inherit;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text-2);
    background: transparent;
    border: 0;
    border-radius: 999px;
    padding: 0.5rem 0.75rem;
    min-height: 40px;
    cursor: pointer;
}
.tab[aria-selected="true"] { background: var(--accent); color: var(--on-accent); }
@media (max-width: 400px) {
    .tab { font-size: 0.875rem; padding: 0.5rem 0.375rem; white-space: nowrap; }
}
.tab:hover:not([aria-selected="true"]) { color: var(--text); }

/* Balance */
.balance-head { display: flex; align-items: center; gap: 0.5rem; }
.amount { font-size: 2.5rem; font-weight: 600; letter-spacing: -0.02em; line-height: 1.1; margin: 0.25rem 0 0.5rem; font-variant-numeric: tabular-nums; }
.amount.is-pastdue { color: var(--danger); }
.balance-meta { list-style: none; padding: 0; margin: 0 0 1rem; font-size: 0.875rem; color: var(--text-2); }
.balance-meta li { padding: 0.125rem 0; }
.balance-meta strong { color: var(--text); font-weight: 500; }
.footnote { font-size: 0.8125rem; color: var(--text-3); margin: 0.75rem 0 0; }

/* Paperless switch */
.setting-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.switch {
    position: relative;
    flex-shrink: 0;
    width: 52px; height: 30px;
    border-radius: 999px;
    border: 0;
    background: var(--border-strong);
    cursor: pointer;
    transition: background-color 0.15s ease;
    margin-top: 0.125rem;
}
.switch-thumb {
    position: absolute;
    top: 3px; left: 3px;
    width: 24px; height: 24px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    transition: transform 0.15s ease;
}
.switch[aria-checked="true"] { background: var(--accent); }
.switch[aria-checked="true"] .switch-thumb { transform: translateX(22px); }
.switch:disabled { opacity: 0.5; cursor: default; }
.status-text { margin: 0.25rem 0 0; min-height: 1.25em; color: var(--success); }
.status-text.is-error { color: var(--danger); }

.mailing { font-style: normal; margin: 0.375rem 0 0.75rem; white-space: pre-line; }

/* Activity */
.activity-list { list-style: none; margin: 0.5rem 0 0; padding: 0; }
.activity-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0;
    border-top: 1px solid var(--border);
}
.activity-item:first-child { border-top: 0; }
.activity-icon {
    flex-shrink: 0;
    width: 36px; height: 36px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: var(--surface-sunk);
    color: var(--text-2);
}
.activity-icon svg { width: 18px; height: 18px; }
.activity-icon.is-payment { background: var(--success-soft); color: var(--success); }
.activity-icon.is-document { background: var(--accent-soft); color: var(--accent); }
.activity-body { flex: 1; min-width: 0; }
.activity-title { font-weight: 500; font-size: 0.9375rem; margin: 0; overflow-wrap: anywhere; }
.activity-sub { font-size: 0.8125rem; color: var(--text-2); margin: 0; overflow-wrap: anywhere; }
.activity-amount { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; font-size: 0.9375rem; }
.activity-amount.is-payment { color: var(--success); }
.activity-action { font-size: 0.875rem; font-weight: 600; white-space: nowrap; text-decoration: none; padding: 0.375rem 0.75rem; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.activity-action:hover { color: var(--accent-hover); }
.activity-attachment { display: inline-flex; align-items: center; gap: 0.3rem; margin-top: 0.2rem; font-size: 0.8125rem; font-weight: 600; color: var(--accent); text-decoration: none; overflow-wrap: anywhere; }
.activity-attachment:hover { color: var(--accent-hover); text-decoration: underline; }
.activity-attachment-icon { display: inline-flex; flex-shrink: 0; }
.activity-attachment-icon svg { width: 14px; height: 14px; }
.empty { color: var(--text-2); font-size: 0.875rem; padding: 0.75rem 0; }

/* Pay */
.pay-amount { display: flex; justify-content: space-between; align-items: baseline; background: var(--surface-sunk); border-radius: var(--radius); padding: 0.75rem 0.875rem; margin: 0.75rem 0 1.25rem; }
.pay-amount span:last-child { font-size: 1.25rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.powered { font-size: 0.75rem; color: var(--text-3); text-align: center; margin: 0.75rem 0 0; }

/* Result */
.result-card { text-align: center; }
.result-icon { width: 56px; height: 56px; border-radius: 50%; margin: 0.25rem auto 1rem; display: flex; align-items: center; justify-content: center; background: var(--surface-sunk); color: var(--text-2); }
.result-icon svg { width: 28px; height: 28px; }
.result-icon.is-success { background: var(--success-soft); color: var(--success); }
.result-icon.is-error { background: var(--danger-soft); color: var(--danger); }
.result-details { text-align: left; background: var(--surface-sunk); border-radius: var(--radius); padding: 0.75rem 0.875rem; margin: 1rem 0; font-size: 0.875rem; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0.25rem 1rem; }
.result-details dt { color: var(--text-2); }
.result-details dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }

/* Next HOA meeting (overview side column) */
.meeting-title { font-weight: 600; margin: 0.5rem 0 0; }
#meeting-when { margin-bottom: 0.25rem; }
#meeting-join { margin: 0.75rem 0 0.5rem; text-decoration: none; }
#meeting-join:hover { color: var(--on-accent); }
.meeting-note { margin: 0.5rem 0; }

/* ARC requests */
.form-card { max-width: 600px; margin: 1.5rem auto; }

/* Meeting minutes (from Markdown) */
.meeting-minutes { margin-top: 0.75rem; padding-top: 0.75rem; border-top: 1px solid var(--border); }
.meeting-minutes p { margin: 0.15rem 0 0; }
.minutes-card { max-width: 760px; margin: 1.5rem auto; }
.minutes-body { line-height: 1.6; overflow-wrap: anywhere; }
.minutes-body h1, .minutes-body h2 { font-size: 1.125rem; margin: 1.5rem 0 0.5rem; }
.minutes-body h3, .minutes-body h4 { font-size: 1rem; margin: 1.25rem 0 0.4rem; }
.minutes-body p, .minutes-body ul, .minutes-body ol { margin: 0 0 0.75rem; }
.minutes-body ul, .minutes-body ol { padding-left: 1.5rem; }
.minutes-body li { margin: 0.2rem 0; }
.minutes-body table { border-collapse: collapse; font-size: 0.875rem; margin: 0 0 1rem; display: block; overflow-x: auto; }
.minutes-body th, .minutes-body td { border: 1px solid var(--border); padding: 0.4rem 0.6rem; text-align: left; vertical-align: top; }
.minutes-body blockquote { margin: 0 0 0.75rem; padding-left: 1rem; border-left: 3px solid var(--border-strong); color: var(--text-2); }
.minutes-body hr { border: 0; border-top: 1px solid var(--border); margin: 1.5rem 0; }
textarea {
    width: 100%;
    font: inherit;
    font-size: 1rem;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    padding: 0.7rem 0.8rem;
    resize: vertical;
    min-height: 120px;
}
textarea:focus, input[type="date"]:focus, input[type="tel"]:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type="date"], input[type="tel"] {
    width: 100%;
    font: inherit;
    font-size: 1rem;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    padding: 0.7rem 0.8rem;
    min-height: 46px;
}
.field-pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 1rem; }
@media (max-width: 480px) { .field-pair { grid-template-columns: minmax(0, 1fr); } }
.label-text { display: block; font-size: 0.875rem; font-weight: 500; margin-bottom: 0.375rem; }
.file-pick {
    display: block;
    border: 1.5px dashed var(--border-strong);
    border-radius: var(--radius);
    background: var(--surface-sunk);
    padding: 0.875rem 1rem;
    font-size: 0.9375rem;
    cursor: pointer;
}
.file-pick:hover { border-color: var(--accent); }
.file-pick:focus-within { outline: 3px solid var(--accent-soft); outline-offset: 2px; }
.file-pick input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.file-pick strong { color: var(--accent); }
.file-list { list-style: none; margin: 0.5rem 0 0; padding: 0; }
.file-list li { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; padding: 0.4rem 0; border-bottom: 1px solid var(--border); font-size: 0.875rem; }
.file-list .file-name { overflow-wrap: anywhere; }
.file-list .file-size { color: var(--text-3); white-space: nowrap; }
.contact-fields { border: 0; padding: 0; margin: 0 0 0.5rem; }
.contact-fields legend { font-size: 0.875rem; font-weight: 600; padding: 0; margin-bottom: 0.25rem; }
.badge-neutral { background: var(--info-soft); color: var(--info); }
.arc-item-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.5rem; }
.arc-description { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0 0 0.5rem; }
.arc-meta { font-size: 0.875rem; color: var(--text-2); margin: 0 0 0.5rem; }
.arc-status { font-size: 0.9375rem; margin: 0.5rem 0; }
.arc-comment { background: var(--surface-sunk); border-radius: var(--radius); padding: 0.75rem 0.875rem; font-size: 0.9375rem; white-space: pre-wrap; overflow-wrap: anywhere; margin: 0.5rem 0; }
.arc-comment .label { display: block; margin-bottom: 0.125rem; }
.arc-files-heading { font-size: 0.875rem; font-weight: 600; margin: 0.875rem 0 0.5rem; }
.arc-files { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 0.75rem; }
.arc-file { display: flex; flex-direction: column; gap: 0.375rem; text-decoration: none; color: var(--text); font-size: 0.8125rem; line-height: 1.3; }
.arc-file img, .arc-file-icon {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: var(--radius);
    border: 1px solid var(--border-strong);
    background: var(--surface-sunk);
}
.arc-file-icon { display: flex; align-items: center; justify-content: center; color: var(--accent); }
.arc-file-icon svg { width: 44px; height: 44px; }
.arc-file-name { overflow-wrap: anywhere; color: var(--accent); font-weight: 500; }
.arc-file:hover img, .arc-file:hover .arc-file-icon { border-color: var(--accent); }
.arc-file:hover .arc-file-name { text-decoration: underline; }
.arc-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1.25rem; margin-top: 1rem; }
.arc-withdraw { color: var(--danger); }
.arc-withdraw:hover { color: var(--danger); }
.file-list li.is-removing .file-name { text-decoration: line-through; color: var(--text-3); }

/* Email on file (overview side column) */
.email-current { font-weight: 600; margin: 0.25rem 0 0.125rem; overflow-wrap: anywhere; }
.email-current.muted { font-weight: 400; }
#email-form { margin-top: 0.75rem; }
.email-buttons { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; }
.email-remove { color: var(--danger); margin-left: auto; }
.email-remove:hover { color: var(--danger); }

