/* =========================================================
   BARC HOUSE — PORTAL STYLESHEET
   Shared by the login, register, resident, maintenance and
   management pages. Same colours and type as the public site.
========================================================= */

:root {
    --paper: #f7f5f0;
    --surface: #ffffff;
    --ink: #1b1f24;
    --ink-2: #3a414b;
    --muted: #646b75;
    --line: #e6e1d6;
    --line-strong: #d6cfc0;
    --charcoal: #1f242b;
    --brass: #a8843f;
    --brass-ink: #7d6129;
    --brass-soft: #f2ebdc;

    /* Status colours */
    --amber: #b54708;
    --amber-soft: #fef0c7;
    --green: #2f7a4f;
    --green-soft: #e3f1e8;
    --red: #b42318;
    --red-soft: #fde8e7;
    --blue: #2e5aac;
    --blue-soft: #e8eefb;

    --font-display: "Fraunces", Georgia, "Times New Roman", serif;
    --font-body: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;

    --radius: 14px;
    --radius-sm: 8px;
    --shadow-sm: 0 1px 2px rgba(27, 31, 36, 0.05), 0 2px 8px rgba(27, 31, 36, 0.04);
    --shadow-lg: 0 30px 80px rgba(0, 0, 0, 0.22);
}


/* =========================================================
   BASE
========================================================= */

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

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

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.55;
    color: var(--ink-2);
    background: var(--paper);
    -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4 {
    margin: 0;
    color: var(--ink);
    font-weight: 600;
    line-height: 1.25;
}

p {
    margin: 0;
}

a {
    color: inherit;
}

button,
input,
select,
textarea {
    font: inherit;
    color: inherit;
}

button {
    cursor: pointer;
}

button:disabled {
    cursor: not-allowed;
    opacity: .6;
}

:focus-visible {
    outline: 2px solid var(--brass);
    outline-offset: 2px;
}

/* Spam protection: honeypot field kept off-screen (people never see it,
   bots fill it in), and room for the "I'm human" check */
.hp-field {
    position: absolute !important;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.captcha {
    min-height: 65px;
    margin: 4px 0 16px;
}

/* Keep the hidden attribute working on elements given a display style */
[hidden] {
    display: none !important;
}

.display {
    font-family: var(--font-display);
    font-weight: 500;
    letter-spacing: -0.015em;
}


/* =========================================================
   BUTTONS
   .btn variants, plus the class names the dashboard
   scripts already use, mapped onto the same styles.
========================================================= */

.btn,
.logout,
.login-button,
.register-button,
.back-button,
.back-home-button,
.success-ok-button,
.submit-button,
.request-button,
.delete-button,
.add-resident-button,
.save-resident-button,
.cancel-resident-button,
.details-button,
.edit-resident-button,
.approve-resident-button,
.activate-resident-button,
.deactivate-resident-button,
.delete-resident-button,
.approve-button,
.reject-button,
.fixed-button,
.close-details,
.application-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    padding: 0 16px;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color .2s ease, border-color .2s ease, color .2s ease;
}

/* Primary (dark) */
.btn-primary,
.login-button,
.register-button,
.success-ok-button,
.submit-button,
.request-button,
.add-resident-button,
.fixed-button,
.application-contacted-button {
    background: var(--ink);
    color: #fff;
}

.btn-primary:hover,
.login-button:hover,
.register-button:hover:not(:disabled),
.success-ok-button:hover,
.submit-button:hover,
.request-button:hover,
.add-resident-button:hover,
.fixed-button:hover,
.application-contacted-button:hover {
    background: #000;
}

/* Positive */
.approve-button,
.approve-resident-button,
.activate-resident-button,
.save-resident-button,
.application-approve-button {
    background: var(--green);
    color: #fff;
}

.approve-button:hover,
.approve-resident-button:hover,
.activate-resident-button:hover,
.save-resident-button:hover,
.application-approve-button:hover {
    background: #25633f;
}

/* Outline */
.btn-outline,
.back-button,
.back-home-button,
.cancel-resident-button,
.details-button,
.edit-resident-button,
.close-details,
.logout {
    background: var(--surface);
    border-color: var(--line-strong);
    color: var(--ink);
}

.btn-outline:hover,
.back-button:hover,
.back-home-button:hover,
.cancel-resident-button:hover,
.details-button:hover,
.edit-resident-button:hover,
.close-details:hover,
.logout:hover {
    border-color: var(--ink);
}

/* Password reset */
.reset-password-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 16px;
    border: 1px solid #e3d3ad;
    border-radius: 999px;
    background: var(--brass-soft);
    color: var(--brass-ink);
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    transition: border-color .2s ease;
}

.reset-password-button:hover {
    border-color: var(--brass);
}

/* Caution */
.deactivate-resident-button {
    background: var(--amber-soft);
    border-color: #f4d58d;
    color: var(--amber);
}

.deactivate-resident-button:hover {
    border-color: var(--amber);
}

/* Destructive */
.reject-button,
.delete-button,
.delete-resident-button,
.application-decline-button {
    background: var(--surface);
    border-color: #f2b8b5;
    color: var(--red);
}

.reject-button:hover,
.delete-button:hover,
.delete-resident-button:hover,
.application-decline-button:hover {
    background: var(--red-soft);
    border-color: var(--red);
}

.btn-block,
.login-button,
.register-button,
.back-button,
.back-home-button,
.success-ok-button {
    width: 100%;
    min-height: 48px;
    font-size: 15px;
}

.btn-sm {
    min-height: 34px;
    padding: 0 12px;
    font-size: 13px;
}


/* =========================================================
   FORMS
========================================================= */

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

.form-group label,
.field-label {
    display: block;
    margin-bottom: 7px;
    font-size: 14px;
    font-weight: 600;
    color: var(--ink);
}

.form-group input,
.form-group select,
.form-group textarea,
.resident-search,
.resident-form-grid input,
textarea {
    width: 100%;
    min-height: 46px;
    padding: 11px 14px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: #fff;
    font-size: 15px;
    color: var(--ink);
    transition: border-color .2s ease, box-shadow .2s ease;
}

.form-group select {
    appearance: none;
    padding-right: 40px;
    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 1l5 5 5-5' fill='none' stroke='%23646b75' stroke-width='1.6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
}

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

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus,
.resident-search:focus,
.resident-form-grid input:focus,
textarea:focus {
    outline: none;
    border-color: var(--brass);
    box-shadow: 0 0 0 3px rgba(168, 132, 63, .18);
}

input::placeholder,
textarea::placeholder {
    color: #9aa0a8;
}

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

.field-help {
    margin-top: 6px;
    font-size: 13px;
    color: var(--muted);
}

.input-readonly {
    background: var(--paper) !important;
    color: var(--ink) !important;
    font-weight: 600;
    cursor: default;
}

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


/* =========================================================
   ALERTS
========================================================= */

.alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 20px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    font-size: 14px;
}

.alert i {
    margin-top: 3px;
}

.alert-error {
    background: var(--red-soft);
    border-color: #f6c9c5;
    color: var(--red);
}

.alert-success {
    background: var(--green-soft);
    border-color: #c4e2cf;
    color: var(--green);
}

.alert-info {
    background: var(--brass-soft);
    border-color: #e3d3ad;
    color: #5a4519;
}

/* register.html toggles these via className */
.message {
    display: none;
    margin-bottom: 20px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    font-size: 14px;
}

.message.success,
.message.error {
    display: block;
}

.message.success {
    background: var(--green-soft);
    border-color: #c4e2cf;
    color: var(--green);
}

.message.error {
    background: var(--red-soft);
    border-color: #f6c9c5;
    color: var(--red);
}


/* =========================================================
   AUTH LAYOUT (LOGIN + REGISTER)
========================================================= */

.auth {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.auth-visual {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 40px;
    color: #fff;
    background: var(--charcoal) url("/images/portal-hero.jpg") center / cover no-repeat;
    isolation: isolate;
}

.auth-visual::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(0deg, rgba(20, 23, 28, .88) 0%, rgba(20, 23, 28, .45) 55%, rgba(20, 23, 28, .3) 100%);
}

.auth-visual h2 {
    max-width: 440px;
    margin-bottom: 12px;
    font-family: var(--font-display);
    font-size: clamp(32px, 3.4vw, 44px);
    font-weight: 500;
    line-height: 1.1;
    color: #fff;
}

.auth-visual p {
    max-width: 420px;
    font-size: 16px;
    color: rgba(255, 255, 255, .8);
}

.auth-panel {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
}

/* "Back to Barc House", top corner of the form side */
.auth-top-link {
    position: absolute;
    top: 24px;
    right: 24px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    background: var(--surface);
    font-size: 14px;
    font-weight: 600;
    color: var(--ink);
    text-decoration: none;
    transition: border-color .2s ease;
}

.auth-top-link:hover {
    border-color: var(--ink);
}

.auth-link {
    justify-self: center;
    padding: 6px 4px;
    font-size: 14px;
    font-weight: 600;
    color: var(--brass-ink);
    text-decoration: none;
}

.auth-link:hover {
    text-decoration: underline;
}

.auth-card {
    width: 100%;
    max-width: 420px;
}

.auth-card.wide {
    max-width: 480px;
}

.auth-head {
    margin-bottom: 28px;
}

.auth-head h1 {
    margin-bottom: 6px;
    font-family: var(--font-display);
    font-size: 34px;
    font-weight: 500;
    letter-spacing: -0.015em;
}

.auth-head p {
    color: var(--muted);
}

.divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 24px 0;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .1em;
    color: #9aa0a8;
}

.divider::before,
.divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--line);
}

.auth-alt {
    display: grid;
    gap: 10px;
}

.auth-alt p {
    text-align: center;
    font-size: 14px;
    color: var(--muted);
}

.auth-note {
    display: flex;
    gap: 10px;
    margin-top: 24px;
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    background: var(--surface);
    border: 1px solid var(--line);
    font-size: 13.5px;
    color: var(--muted);
}

.auth-note i {
    margin-top: 3px;
    color: var(--brass);
}

.brand.auth-mobile-brand {
    display: none;
    margin-bottom: 32px;
}

@media (max-width: 900px) {
    .auth {
        grid-template-columns: 1fr;
    }

    .auth-visual {
        display: none;
    }

    .brand.auth-mobile-brand {
        display: flex;
    }

    .auth-panel {
        align-items: flex-start;
        padding-top: 88px;
    }

    .auth-top-link {
        top: 20px;
        right: 16px;
    }
}


/* =========================================================
   BRAND
========================================================= */

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.brand img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid var(--line);
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.brand-name {
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 500;
    color: var(--ink);
}

.brand-tag {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--muted);
}

.auth-visual .brand-name {
    color: #fff;
}

.auth-visual .brand-tag {
    color: rgba(255, 255, 255, .9);
}

.auth-visual .brand img {
    border-color: transparent;
}


/* =========================================================
   APP SHELL (DASHBOARDS)
========================================================= */

.topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    background: rgba(255, 255, 255, .94);
    backdrop-filter: saturate(1.4) blur(10px);
    -webkit-backdrop-filter: saturate(1.4) blur(10px);
    border-bottom: 1px solid var(--line);
}

.topbar-inner {
    max-width: 1200px;
    height: 68px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.topbar-actions form {
    margin: 0;
}

.role-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 999px;
    background: var(--brass-soft);
    color: var(--brass-ink);
    font-size: 13px;
    font-weight: 600;
}

.page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 36px 24px 64px;
}

.page.narrow {
    max-width: 760px;
}

.page-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 28px;
}

.page-head h1 {
    margin-bottom: 4px;
    font-family: var(--font-display);
    font-size: clamp(28px, 3.4vw, 38px);
    font-weight: 500;
    letter-spacing: -0.015em;
}

.page-head p {
    color: var(--muted);
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    font-size: 14px;
    font-weight: 500;
    color: var(--muted);
    text-decoration: none;
}

.back-link:hover {
    color: var(--ink);
}

@media (max-width: 600px) {
    .topbar-inner {
        padding: 0 16px;
    }

    .page {
        padding: 28px 16px 48px;
    }

    .role-pill,
    .brand-tag,
    .topbar-actions .btn span,
    .topbar-actions .logout span {
        display: none;
    }
}


/* =========================================================
   CARDS + SECTIONS
========================================================= */

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

.card > h2,
.card > h3,
.card-title {
    margin-bottom: 16px;
    font-size: 17px;
    font-weight: 600;
}

.card-sub {
    margin-top: -10px;
    margin-bottom: 18px;
    color: var(--muted);
}

/* Collapsible section headers (management) */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin: -24px;
    padding: 20px 24px;
    cursor: pointer;
    user-select: none;
    border-radius: var(--radius);
    transition: background-color .2s ease;
}

.section-header:hover {
    background: #fcfbf8;
}

.section-header h2 {
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 500;
}

.section-header h2 i {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    background: var(--brass-soft);
    color: var(--brass-ink);
    font-size: 15px;
}

/* "3 new" tag on a section header */
.new-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px 4px 9px;
    border-radius: 999px;
    background: var(--red);
    color: #fff;
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .02em;
    line-height: 1.2;
}

.new-badge::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #fff;
    animation: new-badge-pulse 1.8s ease-in-out infinite;
}

@keyframes new-badge-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: .35; }
}

@media (prefers-reduced-motion: reduce) {
    .new-badge::before {
        animation: none;
    }
}

.section-arrow {
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    border: 1px solid var(--line);
    font-size: 11px;
    color: var(--muted);
}

.section-content {
    margin-top: 44px;
}

.collapsed {
    display: none !important;
}

.empty {
    padding: 28px 0;
    text-align: center;
    color: var(--muted);
}


/* =========================================================
   STATS
========================================================= */

.stats,
.summary-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.summary-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.stat-card,
.summary-card {
    position: relative;
    padding: 16px 18px;
    border-radius: 12px;
    background: var(--paper);
    border: 1px solid var(--line);
}

.summary-card {
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.stat-title,
.summary-card p {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--muted);
}

.stat-title::before,
.summary-card p::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--line-strong);
}

.stat-number,
.summary-card h3 {
    font-family: var(--font-display);
    font-size: 32px;
    font-weight: 500;
    line-height: 1.1;
    color: var(--ink);
}

/* Colour the dot, keep numbers in ink for a calmer read */
.stat-card:has(.submitted-number) .stat-title::before,
.submitted-card p::before {
    background: #f0a33a;
}

.stat-card:has(.approved-number) .stat-title::before,
.approved-card p::before {
    background: var(--green);
}

.stat-card:has(.rejected-number) .stat-title::before {
    background: var(--red);
}

.stat-card:has(.fixed-number) .stat-title::before,
.stat-card:has(.contacted-number) .stat-title::before,
.fixed-card p::before {
    background: var(--blue);
}

.stat-card:has(.total-number) .stat-title::before,
.total-card p::before {
    background: var(--ink);
}

@media (max-width: 1000px) {
    .stats {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 700px) {
    .stats,
    .summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}


/* =========================================================
   STATUS BADGES + TEXT
========================================================= */

.status-badge,
.house-badge,
.status,
.application-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .02em;
    white-space: nowrap;
}

.house-badge,
.reset-status {
    background: var(--brass-soft);
    color: var(--brass-ink);
}

.reset-status {
    margin-left: 4px;
}

.reset-status i {
    font-size: 10px;
}

.active-status,
.status-approved,
.application-status-approved {
    background: var(--green-soft);
    color: var(--green);
}

.inactive-status,
.status-rejected,
.application-status-declined {
    background: var(--red-soft);
    color: var(--red);
}

.pending-status,
.status-submitted,
.application-status-new {
    background: var(--amber-soft);
    color: var(--amber);
}

.status-fixed,
.application-status-contacted {
    background: var(--blue-soft);
    color: var(--blue);
}

.rejection-reason,
.history-rejected {
    color: var(--red);
}

.fixed-time,
.history-fixed {
    color: var(--blue);
}


/* =========================================================
   REQUEST + APPLICATION CARDS (MANAGEMENT)
========================================================= */

.request,
.application,
.maintenance-request {
    margin-top: 12px;
    padding: 20px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: var(--surface);
}

.request h3,
.application h3,
.maintenance-request h4 {
    margin-bottom: 12px;
    font-size: 17px;
    font-weight: 600;
}

.request > p,
.application > p {
    margin: 6px 0;
    font-size: 14px;
}

.request > p strong,
.application > p strong {
    font-weight: 600;
    color: var(--ink);
}

.requester-info,
.application-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 4px 20px;
    margin-bottom: 14px;
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    background: var(--paper);
    font-size: 14px;
}

.requester-info p,
.application-info p {
    margin: 2px 0;
}

.requester-info strong,
.application-info strong {
    font-weight: 600;
    color: var(--ink);
}

.application-message {
    margin-bottom: 14px;
    padding: 12px 16px;
    border-left: 3px solid var(--brass);
    border-radius: 4px;
    background: var(--paper);
    font-size: 14px;
}

.request button,
.application button {
    margin: 10px 8px 0 0;
}

.reject-button {
    margin-left: 0;
}


/* =========================================================
   RESIDENT TABLE (MANAGEMENT)
========================================================= */

.resident-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.resident-controls {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.search-wrap {
    position: relative;
    flex: 1;
    max-width: 420px;
}

.search-wrap i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    font-size: 14px;
}

.search-wrap .resident-search {
    padding-left: 38px;
}

.resident-count {
    margin-right: auto;
    font-size: 14px;
    color: var(--muted);
}

.resident-form-container {
    flex-basis: 100%;
    margin-bottom: 8px;
    padding: 20px;
    border-radius: 12px;
    background: var(--paper);
    border: 1px solid var(--line);
}

.resident-form-container h3 {
    margin-bottom: 14px;
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 500;
}

.resident-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.resident-form-buttons {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

.resident-table-container {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 12px;
}

.resident-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

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

.resident-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}

.resident-table tbody tr:last-child td {
    border-bottom: none;
}

.resident-table tbody tr:not(.resident-details-row):hover {
    background: #fcfbf8;
}

.resident-table td:last-child {
    min-width: 280px;
}

.resident-table td:last-child button {
    min-height: 32px;
    padding: 0 12px;
    margin: 2px 4px 2px 0;
    font-size: 12.5px;
}

.resident-details-row td {
    padding: 16px;
    background: var(--paper);
}

.resident-details {
    padding: 20px;
    border-radius: 12px;
    background: var(--surface);
    border: 1px solid var(--line);
}

.resident-details h3 {
    margin-bottom: 14px;
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 500;
}

.resident-info-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 18px;
}

.resident-info-item {
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    background: var(--paper);
}

.resident-info-item strong {
    display: block;
    margin-bottom: 2px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--muted);
}

.maintenance-history h4 {
    margin-bottom: 10px;
    font-size: 15px;
}

.history-item {
    margin-bottom: 8px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    font-size: 14px;
}

.history-item p {
    margin: 3px 0;
}

.close-details {
    margin-top: 12px;
}

@media (max-width: 700px) {
    .resident-form-grid,
    .resident-info-grid {
        grid-template-columns: 1fr;
    }

    .search-wrap {
        max-width: none;
    }
}


/* =========================================================
   RESIDENT DASHBOARD
========================================================= */

.details {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.detail {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    background: var(--paper);
}

.detail strong {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--muted);
}

.detail span {
    font-weight: 500;
    color: var(--ink);
    overflow-wrap: anywhere;
}

.maintenance-cta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    background: var(--charcoal);
    border-color: var(--charcoal);
    color: rgba(255, 255, 255, .78);
}

.maintenance-cta h3 {
    margin-bottom: 4px;
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 500;
    color: #fff;
}

.maintenance-cta .request-button {
    background: #fff;
    color: var(--ink);
}

.maintenance-cta .request-button:hover {
    background: var(--brass-soft);
}

.request-info {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 20px;
    font-size: 14px;
    color: var(--muted);
}

.request-info strong {
    font-weight: 600;
    color: var(--ink-2);
}

.maintenance-request .rejection-reason,
.fixed-info {
    margin-top: 12px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    font-size: 14px;
}

.maintenance-request .rejection-reason {
    background: var(--red-soft);
}

.fixed-info {
    background: var(--blue-soft);
    color: var(--blue);
}

.delete-button {
    margin-top: 14px;
}

@media (max-width: 600px) {
    .details {
        grid-template-columns: 1fr;
    }
}


/* =========================================================
   MODAL (REGISTER SUCCESS)
========================================================= */

.success-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 100;
    justify-content: center;
    align-items: center;
    padding: 20px;
    background: rgba(14, 16, 20, .55);
}

.success-popup {
    width: 100%;
    max-width: 420px;
    padding: 36px 28px 28px;
    border-radius: var(--radius);
    background: var(--surface);
    text-align: center;
    box-shadow: var(--shadow-lg);
}

.success-icon {
    width: 56px;
    height: 56px;
    display: grid;
    place-items: center;
    margin: 0 auto 18px;
    border-radius: 50%;
    background: var(--green-soft);
    color: var(--green);
    font-size: 22px;
}

.success-popup h2 {
    margin-bottom: 10px;
    font-family: var(--font-display);
    font-size: 26px;
    font-weight: 500;
}

.success-popup p {
    margin: 6px 0;
    color: var(--muted);
}

.username-display {
    margin: 18px 0;
    padding: 14px;
    border-radius: var(--radius-sm);
    background: var(--paper);
    border: 1px dashed var(--line-strong);
    font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
    font-size: 18px;
    font-weight: 700;
    color: var(--ink);
}

.username-display.small {
    margin: 6px 0 4px;
    padding: 10px;
    font-size: 15px;
}

.temp-password-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 6px 0 14px;
}

.temp-password-row .username-display {
    flex: 1;
    margin: 0;
    letter-spacing: .06em;
}

.username-label {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--muted);
    margin-top: 16px !important;
}


/* =========================================================
   BARC HOUSE WEBSITE LOOK
   Same colours and fonts as the public site (css/house.css):
   teal and cream, yellow main buttons, Syne headings, Barlow
   text, and the brush-script "Barc House" wordmark.
   Everything above stays as the base; this block restyles it.
========================================================= */

:root {
    --teal: #006863;
    --teal-deep: #00504c;
    --teal-tint: #deedeb;
    --cream: #e8e1d5;
    --cream-light: #f4efe6;
    --yellow: #e7c648;
    --peach: #e0855f;
    --peach-ink: #9c4a24;

    --paper: var(--cream-light);
    --surface: #ffffff;
    --ink: #1f2525;
    --ink-2: #3a4141;
    --muted: #5b6363;
    --line: #ddd4c4;
    --line-strong: #cbbfa9;
    --charcoal: #232929;

    /* Old brass accents now follow the teal */
    --brass: var(--teal);
    --brass-ink: var(--teal-deep);
    --brass-soft: var(--teal-tint);

    --font-display: "Syne", "Segoe UI", sans-serif;
    --font-body: "Barlow", system-ui, -apple-system, "Segoe UI", sans-serif;
    --font-script: "Mr Dafoe", "Brush Script MT", cursive;

    --radius: 18px;
}

body {
    font-size: 16px;
}

h1,
h2,
h3,
.page-head h1,
.auth-head h1,
.section-header h2,
.success-popup h2,
.resident-form-container h3,
.resident-details h3,
.maintenance-cta h3 {
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: -0.02em;
}

/* Wordmark */
.brand-name {
    font-family: var(--font-script);
    font-size: 28px;
    font-weight: 400;
    letter-spacing: 0;
    line-height: .9;
}

.brand-tag {
    letter-spacing: .22em;
}


/* ---------- Buttons ---------- */

.btn,
.logout,
.login-button,
.register-button,
.back-button,
.back-home-button,
.success-ok-button,
.submit-button,
.request-button,
.delete-button,
.add-resident-button,
.save-resident-button,
.cancel-resident-button,
.details-button,
.edit-resident-button,
.approve-resident-button,
.activate-resident-button,
.deactivate-resident-button,
.delete-resident-button,
.reset-password-button,
.approve-button,
.reject-button,
.fixed-button,
.close-details,
.application-button {
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: .02em;
}

/* Main calls to action: yellow, like "Apply now" on the website */
.login-button,
.register-button,
.maintenance-cta .request-button {
    background: var(--yellow);
    color: var(--ink);
    box-shadow: 0 5px 0 rgba(0, 0, 0, .14);
}

.login-button:hover,
.register-button:hover:not(:disabled),
.maintenance-cta .request-button:hover {
    background: #f0d469;
}

/* Other primary buttons: teal */
.btn-primary,
.success-ok-button,
.submit-button,
.request-button,
.add-resident-button,
.fixed-button,
.application-contacted-button {
    background: var(--teal);
    color: #fff;
}

.btn-primary:hover,
.success-ok-button:hover,
.submit-button:hover,
.request-button:hover,
.add-resident-button:hover,
.fixed-button:hover,
.application-contacted-button:hover {
    background: var(--teal-deep);
}


/* ---------- Top bar: teal ---------- */

.topbar {
    background: var(--teal);
    border-bottom: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

.topbar .brand-name {
    color: #fff;
}

.topbar .brand-tag {
    color: rgba(255, 255, 255, .9);
}

.topbar .brand img {
    border-color: transparent;
}

.topbar .role-pill {
    background: var(--yellow);
    color: var(--ink);
}

.topbar .logout,
.topbar .btn-outline {
    background: transparent;
    border-color: rgba(255, 255, 255, .45);
    color: #fff;
}

.topbar .logout:hover,
.topbar .btn-outline:hover {
    border-color: #fff;
    background: rgba(255, 255, 255, .08);
}

/* Three-colour stripe under the bar, as on the website */
.topbar::after {
    content: "";
    display: block;
    height: 4px;
    background: linear-gradient(90deg,
        var(--teal-deep) 0 33.33%,
        var(--yellow) 33.33% 66.66%,
        var(--peach) 66.66% 100%);
}


/* ---------- Dashboard pieces ---------- */

.card,
.summary-card,
.facts-card {
    border-radius: var(--radius);
}

.section-header h2 i {
    border-radius: 50%;
    background: var(--teal);
    color: #fff;
}

.stat-card {
    background: var(--cream-light);
}

/* "3 new" tags in the website's peach */
.new-badge {
    background: var(--peach-ink);
}

.house-badge,
.reset-status {
    background: var(--teal-tint);
    color: var(--teal-deep);
}

.resident-table th {
    background: var(--cream-light);
}

/* Resident "Something need fixing?" banner: teal with a yellow button */
.maintenance-cta {
    background: var(--teal);
    border-color: var(--teal);
}

.apply-aside {
    background: var(--teal);
}


/* ---------- Login / sign-up: the website's teal students panel ---------- */

.auth-visual {
    justify-content: flex-start;
    gap: clamp(28px, 6vh, 56px);
    padding-bottom: 0;
    background:
        url("/images/students-cutout.webp") center bottom / 118% auto no-repeat,
        radial-gradient(ellipse 70% 45% at 50% 85%, rgba(255, 255, 255, .14), transparent 70%),
        linear-gradient(180deg, var(--teal) 0%, #005c58 100%);
}

/* No dark photo wash on the teal panel */
.auth-visual::before {
    display: none;
}

.auth-visual h2 {
    color: #fff;
    font-size: clamp(30px, 3.2vw, 42px);
}

.auth-visual p {
    color: rgba(255, 255, 255, .86);
}

.auth-visual .brand-name {
    font-size: 34px;
}

/* Cream form side */
.auth-panel {
    background: var(--cream-light);
}

.auth-link {
    color: var(--teal-deep);
}

.auth-top-link {
    border-color: var(--line-strong);
}


/* =========================================================
   APPLICANTS AND DOCUMENTS
   Sign-in tabs, the applicant checklist, document rows and
   management's document pop-ups.
========================================================= */

/* ---------- Sign-in tabs ---------- */

.auth-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    margin-bottom: 26px;
    padding: 4px;
    border-radius: 14px;
    background: var(--cream);
}

.auth-tabs button {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 6px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--ink-2);
    font: 600 13px/1.2 var(--font-body);
    cursor: pointer;
}

.auth-tabs button i {
    font-size: 15px;
    color: var(--teal);
}

.auth-tabs button[aria-selected="true"] {
    background: #fff;
    color: var(--ink);
    box-shadow: 0 1px 3px rgba(0, 0, 0, .12);
}

.auth-tabs button:focus-visible {
    outline: 2px solid var(--teal);
    outline-offset: 2px;
}

.auth-alt p a {
    color: var(--teal-deep);
    font-weight: 600;
}


/* ---------- Progress ---------- */

.progress-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
}

.progress-head h3 {
    margin: 0;
}

.progress-count {
    font-weight: 600;
    color: var(--teal-deep);
}

.progress-bar {
    height: 10px;
    margin: 14px 0 12px;
    border-radius: 999px;
    background: var(--cream);
    overflow: hidden;
}

.progress-bar span {
    display: block;
    height: 100%;
    width: 0;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--teal), #2f8f73);
    transition: width .4s ease;
}

.stage-banner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: var(--teal-tint);
    border-color: transparent;
}

.stage-banner h3 {
    margin: 0 0 4px;
}

.stage-banner p {
    margin: 0;
    max-width: 640px;
}

.stage-banner.stage-final {
    background: var(--teal);
    color: #fff;
}

.stage-banner.stage-final h3,
.stage-banner.stage-final p {
    color: #fff;
}

.stage-banner.stage-final .request-button {
    background: var(--yellow);
    color: var(--ink);
}


/* ---------- Checklist ---------- */

.checklist {
    display: grid;
    gap: 10px;
    margin-top: 18px;
}

.check-item {
    padding: 16px 18px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
}

.check-main {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: start;
    gap: 12px;
}

.check-dot {
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    margin-top: 1px;
    border: 2px solid var(--line-strong);
    border-radius: 50%;
    font-size: 11px;
    color: #fff;
}

.check-done .check-dot {
    border-color: var(--teal);
    background: var(--teal);
}

.check-not-needed .check-dot {
    border-color: var(--line-strong);
    background: var(--line-strong);
}

.check-done .check-dot::before,
.check-not-needed .check-dot::before {
    content: "\f00c";
    font: 900 11px "Font Awesome 6 Free";
}

.check-waiting .check-dot {
    border-color: var(--yellow);
    background: #fbf1c6;
}

.check-redo .check-dot {
    border-color: var(--peach-ink);
}

.check-text h4 {
    margin: 0 0 2px;
    font-size: 16px;
    color: var(--ink);
}

.check-text p,
.check-note {
    margin: 0;
    font-size: 14px;
    color: var(--muted);
}

.check-note {
    margin: 10px 0 0 34px;
    font-style: italic;
}

.check-status {
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--cream);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    color: var(--ink-2);
}

.check-waiting .check-status {
    background: #fbf1c6;
    color: #7a5c00;
}

.check-redo .check-status {
    background: #fbe3d8;
    color: var(--peach-ink);
}

.check-done .check-status {
    background: var(--teal-tint);
    color: var(--teal-deep);
}

.check-not-needed {
    opacity: .75;
}

.check-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin: 12px 0 0 34px;
}

.check-actions:empty {
    display: none;
}

.check-optional {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    cursor: pointer;
}

.check-optional input {
    width: 17px;
    height: 17px;
    accent-color: var(--teal);
}


/* ---------- Document rows ---------- */

.doc-list {
    display: grid;
    gap: 8px;
    margin: 12px 0 0 34px;
}

.card > .doc-list,
.doc-panel .doc-list {
    margin-left: 0;
}

.doc-subhead {
    margin: 22px 0 0;
    font-size: 15px;
    color: var(--ink);
}

.doc-row {
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    align-items: center;
    gap: 10px 12px;
    padding: 10px 12px;
    border-radius: 10px;
    background: var(--cream-light);
}

.doc-row > i {
    font-size: 18px;
    color: var(--teal);
}

.doc-form {
    background: var(--teal-tint);
}

.doc-name {
    display: grid;
    min-width: 0;
    overflow-wrap: anywhere;
    font-weight: 600;
    color: var(--ink);
}

.doc-name a {
    color: var(--teal-deep);
}

.doc-name small {
    font-weight: 400;
    color: var(--muted);
}

.doc-note {
    margin-top: 4px;
    font-weight: 400;
    color: var(--peach-ink);
}

.doc-row-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
}

.review-chip {
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.review-waiting {
    background: #fbf1c6;
    color: #7a5c00;
}

.review-accepted {
    background: var(--teal-tint);
    color: var(--teal-deep);
}

.review-rejected {
    background: #fbe3d8;
    color: var(--peach-ink);
}

.icon-button {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: #fff;
    color: var(--muted);
    cursor: pointer;
}

.icon-button:hover {
    border-color: var(--peach-ink);
    color: var(--peach-ink);
}

@media (max-width: 640px) {

    .check-main {
        grid-template-columns: auto 1fr;
    }

    .check-status {
        grid-column: 2;
        justify-self: start;
    }

    .doc-list,
    .check-actions,
    .check-note {
        margin-left: 0;
    }

    .doc-row {
        grid-template-columns: auto 1fr;
    }

    .doc-row > .review-chip,
    .doc-row > .btn,
    .doc-row > .icon-button,
    .doc-row > .doc-row-actions {
        grid-column: 2;
        justify-self: start;
    }

    .auth-tabs button {
        font-size: 12px;
    }
}


/* ---------- Management pop-ups ---------- */

.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 110;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 4vh 16px;
    overflow-y: auto;
    background: rgba(14, 16, 20, .55);
}

.modal-panel {
    position: relative;
    width: 100%;
    max-width: 760px;
    padding: 28px;
    border-radius: var(--radius);
    background: #fff;
    box-shadow: var(--shadow-lg);
}

.modal-panel h2 {
    margin: 0 44px 4px 0;
    font-size: 24px;
}

.modal-close {
    position: absolute;
    top: 18px;
    right: 18px;
}

.modal-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 16px;
}

.modal-grid .full {
    grid-column: 1 / -1;
}

.modal-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.link-box {
    display: flex;
    gap: 8px;
    align-items: center;
    margin: 8px 0 4px;
}

.link-box input {
    flex: 1;
    min-width: 0;
    padding: 10px 12px;
    border: 1px dashed var(--line-strong);
    border-radius: 10px;
    background: var(--cream-light);
    font: 13px ui-monospace, Consolas, monospace;
}

.applicant-card {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px 20px;
    align-items: center;
    padding: 16px 18px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
}

.applicant-card + .applicant-card {
    margin-top: 10px;
}

.applicant-card h3 {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin: 0 0 4px;
    font-size: 18px;
}

.applicant-card h3 .stage-chip {
    margin-left: 0;
}

.applicant-card .meta {
    margin: 0;
    font-size: 14px;
    color: var(--muted);
}

.applicant-card .progress-bar {
    margin: 10px 0 0;
    max-width: 360px;
    height: 8px;
}

.stage-chip {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 10px;
    border-radius: 999px;
    background: var(--cream);
    font-size: 12px;
    font-weight: 600;
    vertical-align: middle;
}

.stage-chip.final {
    background: var(--teal);
    color: #fff;
}

.stage-chip.moved {
    background: var(--teal-tint);
    color: var(--teal-deep);
}

.stage-chip.is-new {
    background: #fbe3d8;
    color: var(--peach-ink);
}

/* ---------- Barc House pop-ups (replace the browser's boxes) ---------- */

.bh-dialog-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(0, 40, 38, .55);
    animation: bh-fade .15s ease-out;
}

.bh-dialog {
    position: relative;
    width: 100%;
    max-width: 440px;
    padding: 34px 28px 24px;
    overflow: hidden;
    border-radius: 20px;
    background: var(--cream-light);
    text-align: center;
    box-shadow: 0 30px 80px rgba(0, 0, 0, .3);
    animation: bh-rise .18s ease-out;
}

/* The website's three-colour stripe along the top */
.bh-dialog::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 6px;
    background: linear-gradient(90deg,
        var(--teal) 0 33.33%,
        var(--yellow) 33.33% 66.66%,
        var(--peach) 66.66% 100%);
}

.bh-dialog-icon {
    display: grid;
    place-items: center;
    width: 58px;
    height: 58px;
    margin: 0 auto 14px;
    border-radius: 50%;
    background: var(--teal);
    color: #fff;
    font-size: 22px;
    box-shadow: 0 0 0 6px var(--teal-tint);
}

.bh-dialog.is-danger .bh-dialog-icon {
    background: var(--peach-ink);
    box-shadow: 0 0 0 6px #fbe3d8;
}

.bh-dialog h2 {
    margin: 0 0 8px;
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--ink);
}

.bh-dialog-text {
    margin: 0 0 4px;
    color: var(--ink-2);
    line-height: 1.55;
}

.bh-dialog-field textarea {
    width: 100%;
    min-height: 92px;
    margin-top: 14px;
    padding: 12px 14px;
    border: 1px solid var(--line-strong);
    border-radius: 12px;
    background: #fff;
    color: var(--ink);
    font: 15px/1.5 var(--font-body);
    resize: vertical;
}

.bh-dialog-field textarea:focus {
    outline: none;
    border-color: var(--teal);
    box-shadow: 0 0 0 3px var(--teal-tint);
}

.bh-dialog-error {
    margin: 8px 0 0;
    color: var(--peach-ink);
    font-size: 14px;
    text-align: left;
}

.bh-dialog-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-top: 22px;
}

.bh-dialog-buttons .btn {
    min-width: 120px;
}

/* Three choices: one per line, main choice on top */
.bh-dialog-buttons.is-stacked {
    flex-direction: column-reverse;
    align-items: stretch;
    gap: 8px;
}

.bh-dialog-buttons.is-stacked .btn {
    width: 100%;
    justify-content: center;
}

.bh-dialog .bh-danger {
    border: 0;
    background: var(--red);
    color: #fff;
}

.bh-dialog .bh-danger:hover {
    background: #8f1c13;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

@keyframes bh-fade {
    from { opacity: 0; }
}

@keyframes bh-rise {
    from { opacity: 0; transform: translateY(10px) scale(.98); }
}

@media (prefers-reduced-motion: reduce) {
    .bh-dialog-overlay,
    .bh-dialog {
        animation: none;
    }
}


/* ---------- Maintenance photos ---------- */

.field-label .optional {
    font-weight: 400;
    color: var(--muted);
}

.form-group .photo-picker {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 0;
    padding: 16px 18px;
    border: 2px dashed var(--line-strong);
    border-radius: 14px;
    background: #fff;
    cursor: pointer;
    transition: border-color .15s, background .15s;
}

.form-group .photo-picker:hover,
.photo-picker:focus-within {
    border-color: var(--teal);
    background: var(--teal-tint);
}

.photo-picker > i {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    flex: none;
    border-radius: 50%;
    background: var(--teal);
    color: #fff;
    font-size: 18px;
}

.photo-picker span {
    display: grid;
    gap: 2px;
}

.photo-picker strong {
    color: var(--ink);
}

.photo-picker small {
    color: var(--muted);
    font-weight: 400;
}

/* Keyboard focus lands on the hidden file input */
#photo:focus-visible + .photo-picker {
    outline: 2px solid var(--teal);
    outline-offset: 2px;
}

.photo-preview {
    position: relative;
    width: fit-content;
    max-width: 100%;
}

.photo-preview img {
    display: block;
    max-width: 100%;
    max-height: 280px;
    border-radius: 14px;
    border: 1px solid var(--line);
}

.photo-remove {
    position: absolute;
    top: 8px;
    right: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .2);
}

/* The photo on a request card (resident and management) */
.request-photo {
    display: inline-block;
    margin-top: 10px;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--line);
    line-height: 0;
}

button.request-photo {
    padding: 0;
    background: none;
    cursor: zoom-in;
}

.request-photo img {
    display: block;
    width: 160px;
    height: 110px;
    object-fit: cover;
    transition: transform .2s;
}

.request-photo:hover img {
    transform: scale(1.04);
}

.request-photo.request-photo-wide {
    display: block;
    width: fit-content;
    max-width: 100%;
    margin: 18px auto 0;
}

.request-photo-wide img {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 65vh;
    object-fit: contain;
}


/* ---------- Dashboard: To do list ---------- */

.todo-card {
    border-color: transparent;
    background: var(--teal);
    color: #fff;
}

.todo-title {
    margin: 0 0 10px;
    font-size: 20px;
    color: #fff;
}

.todo-list {
    display: grid;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.todo-list button {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 16px;
    border: 0;
    border-radius: 12px;
    background: rgba(255, 255, 255, .12);
    color: #fff;
    font: 600 16px/1.3 var(--font-body);
    text-align: left;
    cursor: pointer;
}

.todo-list button:hover,
.todo-list button:focus-visible {
    background: var(--yellow);
    color: var(--ink);
    outline: none;
}

.todo-empty {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 0;
    font-size: 16px;
    color: rgba(255, 255, 255, .9);
}

.todo-empty i {
    color: var(--yellow);
}


/* ---------- Dashboard: filter tabs ---------- */

.new-badge {
    white-space: nowrap;
}

.filter-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0 0 16px;
}

.filter-tabs button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    color: var(--ink-2);
    font: 600 14px/1 var(--font-body);
    cursor: pointer;
}

.filter-tabs button b {
    font-weight: 700;
    color: var(--teal-deep);
}

.filter-tabs button b:empty {
    display: none;
}

.filter-tabs button[aria-selected="true"] {
    border-color: var(--teal);
    background: var(--teal);
    color: #fff;
}

.filter-tabs button[aria-selected="true"] b {
    color: var(--yellow);
}


/* ---------- Dashboard: compact cards ---------- */

.item-list {
    display: grid;
    gap: 10px;
}

.item-list .applicant-card + .applicant-card {
    margin-top: 0;
}

.item-card .meta + .meta {
    margin-top: 4px;
}

.item-card .meta a {
    color: var(--teal-deep);
}

.item-note {
    margin: 8px 0 0;
    color: var(--peach-ink);
    font-size: 14px;
}

.item-card.is-answered {
    opacity: .7;
}

.section-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 22px 0 10px;
}

.section-row h3 {
    margin: 0 !important;
}


/* ---------- Residents table: fewer buttons ---------- */

.resident-name {
    display: block;
    color: var(--ink);
}

.resident-email {
    display: block;
    color: var(--muted);
    font-size: 13px;
}

.resident-table td:last-child {
    min-width: 0;
}

.row-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
}

.more-menu {
    position: relative;
}

.more-menu summary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 32px;
    padding: 0 12px;
    font-size: 12.5px;
    list-style: none;
    cursor: pointer;
}

.more-menu summary::-webkit-details-marker {
    display: none;
}

.more-menu summary i {
    font-size: 10px;
}

/* Placed by the page script (fixed), so the table's
   scroll area can't cut it off */
.more-list {
    position: fixed;
    z-index: 60;
    display: grid;
    min-width: 190px;
    margin-top: 6px;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 12px 30px rgba(0, 0, 0, .14);
}

.resident-table .more-list button {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    padding: 9px 12px;
    border: 0;
    border-radius: 8px;
    background: none;
    color: var(--ink);
    font: 500 14px/1.2 var(--font-body);
    text-align: left;
    cursor: pointer;
}

.resident-table .more-list button:hover {
    background: var(--cream-light);
}

.resident-table .more-list button i {
    width: 16px;
    color: var(--teal);
}

.resident-table .more-list .is-danger,
.resident-table .more-list .is-danger i {
    color: var(--red);
}

/* Applications: age outside the usual range (a quiet note for management) */
.stage-chip.age-flag {
    background: #f9eeda;
    color: #7a5c00;
    cursor: help;
}

/* Enquiries */
.enquiry-message {
    margin: 10px 0 0;
    padding: 12px 14px;
    border-radius: 10px;
    background: var(--cream-light);
    white-space: pre-line;
    overflow-wrap: anywhere;
    color: var(--ink-2);
}

.enquiry-card.is-answered {
    opacity: .7;
}

.doc-panel h3 {
    margin: 22px 0 8px;
    font-size: 17px;
}

.doc-upload-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 14px;
    padding: 16px;
    border-radius: 14px;
    background: var(--cream-light);
}

.doc-upload-form .full {
    grid-column: 1 / -1;
}

.doc-upload-form label {
    display: grid;
    gap: 4px;
    font-size: 13px;
    font-weight: 600;
}

.doc-upload-form input,
.doc-upload-form select,
.modal-grid input,
.modal-grid select,
.modal-grid textarea {
    padding: 9px 10px;
    border: 1px solid var(--line-strong);
    border-radius: 9px;
    background: #fff;
    font: inherit;
    font-weight: 400;
}

.modal-grid label {
    display: grid;
    gap: 4px;
    font-size: 13px;
    font-weight: 600;
}

.modal-grid textarea {
    min-height: 220px;
    resize: vertical;
    line-height: 1.5;
}

.doc-upload-form .inline {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 400;
}

@media (max-width: 640px) {

    .modal-panel {
        padding: 22px 18px;
    }

    .modal-grid,
    .doc-upload-form,
    .applicant-card {
        grid-template-columns: 1fr;
    }
}
