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

body {
    font-family: 'Segoe UI', Tahoma, Arial, sans-serif;
    background: #f5f7fa;
    color: #2d3748;
    min-height: 100vh;
    line-height: 1.5;
}

/* ---------- Navbar ---------- */
.navbar {
    background: #2d3748;
    color: #fff;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.nav-brand    { font-size: 1.25rem; font-weight: 600; }
.nav-links    { display: flex; gap: 1.5rem; align-items: center; }
.nav-links a  { color: #cbd5e0; text-decoration: none; transition: color 0.2s; }
.nav-links a:hover { color: #fff; }
.nav-user     { color: #a0aec0; font-size: 0.9rem; }
.logout-btn   { background: #e53e3e; color: #fff !important; padding: 0.4rem 0.9rem; border-radius: 4px; }
.logout-btn:hover { background: #c53030; }
.compact-toggle {
    background: rgba(255,255,255,0.1);
    color: #cbd5e0;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 4px;
    padding: 0.3rem 0.6rem;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
}
.compact-toggle:hover { background: rgba(255,255,255,0.2); color: #fff; }
body.compact-mode .compact-toggle { background: #3182ce; color: #fff; border-color: #3182ce; }

/* ---------- Layout ---------- */
.container {
    max-width: 1000px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    padding: 2rem;
    margin-bottom: 1.5rem;
}
.card h1      { margin-bottom: 1.5rem; color: #1a202c; font-size: 1.5rem; }
.card-header  { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.card-header h1 { margin-bottom: 0; }

.login-card {
    max-width: 420px;
    margin: 5rem auto;
}
.login-card input[type="text"],
.login-card input[type="password"],
.login-card input[type="email"] {
    min-width: 260px;
}

/* User management forms — wider username field */
.user-form input[type="text"],
.user-form input[type="email"] {
    min-width: 300px;
    max-width: 100%;
}

/* ---------- Forms ---------- */
.form-group { margin-bottom: 1.2rem; }
.form-group label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 500;
    color: #4a5568;
}
.form-group label small { color: #a0aec0; font-weight: 400; }
.form-group input,
.form-group select {
    width: 100%;
    padding: 0.65rem 0.85rem;
    border: 1px solid #cbd5e0;
    border-radius: 4px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #3182ce;
    box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.15);
}

.form-actions { display: flex; gap: 0.75rem; margin-top: 1rem; }

/* ---------- Buttons ---------- */
.btn {
    padding: 0.65rem 1.25rem;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: background 0.15s;
}
.btn-block     { width: 100%; }
.btn-primary   { background: #3182ce; color: #fff; }
.btn-primary:hover   { background: #2c5aa0; }
.btn-secondary { background: #e2e8f0; color: #2d3748; }
.btn-secondary:hover { background: #cbd5e0; }
.btn-danger    { background: #e53e3e; color: #fff; }
.btn-danger:hover    { background: #c53030; }
.btn-success   { background: #38a169; color: #fff; }
.btn-success:hover   { background: #2f855a; }
.btn-sm        { padding: 0.25rem 0.65rem; font-size: 0.8rem; }

/* ---------- Table ---------- */
.users-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.users-table th,
.users-table td {
    padding: 0.45rem 0.6rem;
    text-align: right;
    border-bottom: 1px solid #e2e8f0;
}
.users-table th {
    background: #f7fafc;
    font-weight: 600;
    color: #4a5568;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.users-table tr:hover { background: #f7fafc; }
.empty { text-align: center !important; color: #a0aec0; padding: 2rem !important; }

/* Compact Mode — denser tables (toggleable) */
body.compact-mode .users-table { font-size: 12px; }
body.compact-mode .users-table th,
body.compact-mode .users-table td { padding: 0.3rem 0.45rem; }
body.compact-mode .users-table th { font-size: 11px; }
body.compact-mode .badge,
body.compact-mode .rel-badge,
body.compact-mode .loc-chip { font-size: 0.7rem; padding: 0.08rem 0.4rem; }
body.compact-mode .btn-sm { padding: 0.18rem 0.5rem; font-size: 0.75rem; }
body.compact-mode .btn { padding: 0.45rem 0.9rem; font-size: 0.88rem; }
body.compact-mode .card { padding: 1.2rem 1.4rem; }
body.compact-mode .card h1 { font-size: 1.25rem; }

/* ---------- Badges ---------- */
.badge {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    border-radius: 10px;
    font-size: 0.74rem;
    font-weight: 500;
}
.badge-admin { background: #fed7d7; color: #c53030; }
.badge-user  { background: #bee3f8; color: #2c5aa0; }

/* ---------- Flash messages ---------- */
.flash {
    padding: 0.9rem 1.25rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    border-inline-start: 4px solid;
}
.flash-success { background: #c6f6d5; color: #22543d; border-color: #38a169; }
.flash-danger  { background: #fed7d7; color: #742a2a; border-color: #e53e3e; }
.flash-warning { background: #feebc8; color: #7b341e; border-color: #dd6b20; }
.flash-info    { background: #bee3f8; color: #2a4365; border-color: #3182ce; }

/* ---------- Misc ---------- */
.hint { margin-top: 1rem; color: #718096; font-size: 0.9rem; text-align: center; }
.hint code {
    background: #edf2f7;
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    font-family: Consolas, 'Courier New', monospace;
    direction: ltr;
    display: inline-block;
}
.muted { color: #a0aec0; font-weight: 400; }

/* ---------- Card header actions ---------- */
.card-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* ---------- Filter bar ---------- */
.filter-bar {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
    margin-bottom: 1.2rem;
    padding: 0.9rem;
    background: #f7fafc;
    border-radius: 6px;
    align-items: center;
}
.filter-input {
    padding: 0.45rem 0.6rem;
    border: 1px solid #cbd5e0;
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.9rem;
    background: #fff;
}
.filter-search { flex: 1; min-width: 200px; }

/* ---------- Table wrapper ---------- */
.table-wrap { overflow-x: auto; }
.ltr-cell { direction: ltr; text-align: right; font-family: Consolas, monospace; font-size: 0.9rem; }
.actions-cell { white-space: nowrap; }
.actions-cell form { margin-inline-start: 0.25rem; }

/* ---------- Member form ---------- */
.member-form fieldset {
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 1.2rem 1.4rem;
    margin-bottom: 1.2rem;
}
.member-form legend {
    padding: 0 0.6rem;
    font-weight: 600;
    color: #2b6cb0;
    font-size: 1rem;
}
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.9rem 1.2rem;
}
.form-group-wide { grid-column: span 2; }
.member-form textarea {
    width: 100%;
    padding: 0.6rem 0.8rem;
    border: 1px solid #cbd5e0;
    border-radius: 4px;
    font-family: inherit;
    font-size: 1rem;
    resize: vertical;
}

/* ---------- Upload zone ---------- */
.upload-form { max-width: 500px; }
.upload-zone {
    border: 2px dashed #cbd5e0;
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    background: #f7fafc;
    margin-bottom: 1rem;
    transition: border-color 0.2s;
}
.upload-zone:hover { border-color: #3182ce; }
.upload-zone input[type="file"] { display: block; margin: 0 auto; }
.upload-label { display: block; margin-top: 0.8rem; color: #718096; font-size: 0.9rem; }

/* ---------- Alias chips (import help) ---------- */
.alias-chip {
    display: inline-block;
    background: #edf2f7;
    color: #4a5568;
    padding: 0.15rem 0.55rem;
    border-radius: 12px;
    font-size: 0.8rem;
    margin: 0.15rem;
    direction: rtl;
}

/* ---------- Info list ---------- */
.info-list { padding-inline-start: 1.5rem; line-height: 1.9; color: #4a5568; }
.info-list li { margin-bottom: 0.3rem; }
.info-list strong { color: #2d3748; }
.info-list a { color: #3182ce; }

/* ---------- Row link ---------- */
.row-link { color: #2b6cb0; text-decoration: none; }
.row-link:hover { text-decoration: underline; }

/* ---------- Detail page ---------- */
.section-title {
    font-size: 1.05rem;
    color: #2b6cb0;
    margin: 1.2rem 0 0.6rem;
    padding-bottom: 0.3rem;
    border-bottom: 1px solid #e2e8f0;
}
.section-title-sm {
    font-size: 0.95rem;
    color: #4a5568;
    margin: 1rem 0 0.5rem;
    font-weight: 600;
}

.info-dl {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.5rem 1.2rem;
    margin: 0;
}
.info-dl dt { color: #718096; font-weight: 500; }
.info-dl dd { margin: 0; color: #2d3748; }

/* ---------- Attachments ---------- */
.attachments-box { margin-top: 0.5rem; }
.attachments-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}
.att-card {
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 0.6rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.att-thumb {
    display: block;
    width: 100%;
    height: 140px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}
.att-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.att-file {
    font-size: 1.4rem;
    font-weight: 600;
    color: #718096;
}
.att-meta { font-size: 0.85rem; color: #4a5568; }
.att-cat { font-weight: 500; color: #2b6cb0; margin-bottom: 0.2rem; }
.att-name { font-size: 0.75rem; color: #718096; word-break: break-all; margin-bottom: 0.3rem; }

.att-upload {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
    padding: 0.8rem;
    background: #edf2f7;
    border-radius: 6px;
    border: 1px dashed #cbd5e0;
}

/* ---------- Child card ---------- */
.child-card {
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 1rem 1.2rem;
    margin-bottom: 1rem;
}
.child-card .form-grid { margin-bottom: 0.5rem; }

/* ==========================================================
   Profile Dashboard
   ========================================================== */

/* ---------- Hero header ---------- */
.profile-header {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    background: linear-gradient(135deg, #2b6cb0 0%, #4299e1 100%);
    color: #fff;
    padding: 1.8rem 2rem;
    border-radius: 10px;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 12px rgba(43, 108, 176, 0.25);
}
.profile-avatar {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid rgba(255, 255, 255, 0.45);
    flex-shrink: 0;
    overflow: hidden;
}
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-initials {
    font-size: 2rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: 1px;
}
.profile-identity { flex: 1; min-width: 0; }
.profile-identity h1 {
    color: #fff;
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
}
.identity-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-top: 0.6rem;
    align-items: center;
}
.meta-chip {
    background: rgba(255, 255, 255, 0.18);
    padding: 0.3rem 0.75rem;
    border-radius: 14px;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.95);
}
.profile-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
    flex-wrap: wrap;
}
.btn-light {
    background: #fff;
    color: #2b6cb0;
    font-weight: 500;
}
.btn-light:hover { background: #ebf4ff; }
.btn-ghost {
    background: transparent;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.55);
}
.btn-ghost:hover { background: rgba(255, 255, 255, 0.12); }

/* ---------- Profile section ---------- */
.profile-section {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    padding: 1.4rem 1.8rem;
    margin-bottom: 1.2rem;
}
.section-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid #e2e8f0;
}
.section-head h2 {
    margin: 0;
    font-size: 1.05rem;
    color: #2b6cb0;
    font-weight: 600;
}
.section-actions {
    display: flex;
    gap: 0.4rem;
    align-items: center;
    flex-wrap: wrap;
}

/* ---------- Main info grouped ---------- */
.info-groups {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.2rem 2rem;
}
.info-group-full { grid-column: 1 / -1; }
.info-group h3 {
    font-size: 0.85rem;
    font-weight: 600;
    color: #718096;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 0 0.6rem;
    padding-bottom: 0.3rem;
    border-bottom: 1px dashed #e2e8f0;
}
.kv-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.4rem;
}
.kv {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.8rem;
    padding: 0.25rem 0;
    border-bottom: 1px dotted #edf2f7;
}
.kv:last-child { border-bottom: none; }
.kv-wide { grid-column: 1 / -1; }
.kv .k { color: #718096; font-size: 0.88rem; flex-shrink: 0; }
.kv .v { color: #2d3748; font-weight: 500; text-align: start; }
.notes-text {
    color: #4a5568;
    line-height: 1.7;
    white-space: pre-wrap;
    margin: 0;
}

/* ---------- Summary lines ---------- */
.summary-line {
    font-size: 1rem;
    color: #2d3748;
    line-height: 1.9;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0 0.25rem;
}
.summary-line strong { color: #1a202c; font-weight: 600; }
.summary-line .sep { color: #cbd5e0; margin: 0 0.5rem; }

/* ---------- Child card (dashboard variant) ---------- */
.child-card {
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1rem 1.2rem;
    margin-bottom: 1rem;
}
.child-card .view-mode {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}
.child-summary {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.8rem;
    flex: 1;
    min-width: 0;
}
.child-name { font-size: 1.05rem; color: #1a202c; }
.child-meta {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0 0.25rem;
    align-items: center;
    color: #4a5568;
    font-size: 0.9rem;
}
.child-meta .sep { color: #cbd5e0; margin: 0 0.4rem; }

.add-child-card {
    background: #edf2f7;
    border: 1px dashed #a0aec0;
    text-align: center;
}
.add-child-card .view-mode { justify-content: center; }

/* ---------- View / Edit toggle ---------- */
[data-section] .edit-mode { display: none; }
[data-section].editing > .view-mode,
[data-section].editing > .section-head .section-actions .view-mode { display: none; }
[data-section].editing > .edit-mode,
[data-section].editing > .section-head .section-actions .edit-mode { display: block; }
[data-section].editing > .section-head .section-actions .edit-mode { display: inline-flex; }

/* Attachments strip (always visible) */
.attachments-strip {
    margin-top: 1rem;
    padding-top: 0.8rem;
    border-top: 1px dashed #e2e8f0;
}

/* Empty state */
.empty-state {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.6rem 0;
}

/* ==========================================================
   v2 Dashboard — 2-column grid, family table, masked values
   ========================================================== */

/* ---------- 2-column grid ---------- */
.profile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
    gap: 1.2rem;
    margin-bottom: 1.2rem;
}
.profile-section-wide { grid-column: 1 / -1; }

/* ---------- Status badges (Active/Warning/Critical) ---------- */
.badge-active   { background: #c6f6d5; color: #22543d; }
.badge-warning  { background: #feebc8; color: #7b341e; }
.badge-critical { background: #fed7d7; color: #742a2a; }
.badge-inactive { background: #e2e8f0; color: #4a5568; }

/* ---------- Masked values ---------- */
.masked-value {
    color: #4a5568;
    letter-spacing: 0.05em;
    font-variant-numeric: tabular-nums;
}

/* ---------- Address hierarchy breadcrumb ---------- */
.address-hierarchy {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.2rem;
    padding: 0.4rem 0;
    font-size: 1rem;
}
.addr-crumb {
    background: #edf2f7;
    color: #2d3748;
    padding: 0.3rem 0.75rem;
    border-radius: 14px;
    font-weight: 500;
}
.addr-sep {
    color: #a0aec0;
    margin: 0 0.3rem;
    font-size: 1.1rem;
}

/* ---------- Empty card state (Attendance/FollowUp placeholders) ---------- */
.empty-card-state {
    padding: 1.5rem 1rem;
    text-align: center;
    color: #a0aec0;
}
.empty-card-state .icon {
    font-size: 2.2rem;
    margin-bottom: 0.4rem;
}
.empty-card-state p {
    margin: 0.2rem 0;
    font-size: 0.92rem;
}

/* ---------- Family table ---------- */
.family-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 0.3rem 0;
}
.family-table th {
    background: #f7fafc;
    padding: 0.6rem 0.8rem;
    text-align: right;
    font-size: 0.85rem;
    font-weight: 600;
    color: #4a5568;
    border-bottom: 2px solid #e2e8f0;
}
.family-table td {
    padding: 0.7rem 0.8rem;
    text-align: right;
    border-bottom: 1px solid #edf2f7;
    color: #2d3748;
    font-size: 0.92rem;
}
.family-table tr:hover td { background: #f7fafc; }
.family-table tr:last-child td { border-bottom: none; }
.family-table .name-cell { font-weight: 500; color: #1a202c; }

.rel-badge {
    display: inline-block;
    padding: 0.25rem 0.7rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
    white-space: nowrap;
}
.rel-spouse { background: #fed7e2; color: #97266d; }
.rel-child  { background: #bee3f8; color: #2c5282; }

/* ---------- Family edit-mode blocks ---------- */
.family-edit-block {
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1rem 1.2rem;
    margin-bottom: 1rem;
}
.family-add-block {
    background: #edf2f7;
    border: 1px dashed #a0aec0;
}
.block-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.8rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px dashed #cbd5e0;
}
.block-head h3 {
    margin: 0;
    font-size: 1rem;
    color: #2b6cb0;
}
.spouse-attachments-edit,
.child-attachments-edit {
    margin-top: 1rem;
    padding-top: 0.8rem;
    border-top: 1px dashed #cbd5e0;
}

/* ---------- Per-card View / Edit toggle ---------- */
[data-section] .edit-mode      { display: none; }
[data-section] .atts-edit-only { display: none; }
[data-section] .col-edit-only  { display: none; }

[data-section].editing > .view-mode,
[data-section].editing > .section-head .view-mode,
[data-section].editing .kv-multi-col.view-mode { display: none; }

[data-section].editing > .edit-mode,
[data-section].editing > .section-head .edit-mode,
[data-section].editing > .card-bottom-actions.edit-mode { display: block; }

/* edit-mode buttons in section header should stay inline */
[data-section].editing > .section-head .edit-mode { display: inline-block; }

/* Show atts-edit-only and table action col when section is editing */
[data-section].editing .atts-edit-only { display: inline-block; }
[data-section].editing .col-edit-only  { display: table-cell; }

/* Upload form needs flex when shown */
[data-section].editing .att-upload-inline { display: flex; }

.empty-attachments {
    grid-column: 1 / -1;
    text-align: center;
    padding: 1rem;
}

/* ---------- Status radio switch ---------- */
.status-switch {
    display: inline-flex;
    gap: 0;
    border: 1px solid #cbd5e0;
    border-radius: 6px;
    overflow: hidden;
}
.status-switch input[type="radio"] { display: none; }
.status-switch .status-opt {
    padding: 0.55rem 1.1rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: #4a5568;
    background: #fff;
    transition: all 0.15s;
    font-weight: 500;
    border-inline-end: 1px solid #cbd5e0;
}
.status-switch .status-opt:last-of-type { border-inline-end: none; }
.status-switch input[type="radio"]:checked + .status-opt-active {
    background: #c6f6d5;
    color: #22543d;
    font-weight: 600;
}
.status-switch input[type="radio"]:checked + .status-opt-inactive {
    background: #e2e8f0;
    color: #2d3748;
    font-weight: 600;
}

/* ---------- Address line (view mode) ---------- */
.address-line {
    font-size: 1rem;
    color: #2d3748;
    padding: 0.6rem 0.9rem;
    background: #f7fafc;
    border-radius: 6px;
    border-inline-start: 3px solid #3182ce;
    line-height: 1.7;
    margin: 0;
}
.address-sub-title {
    color: #2b6cb0;
    font-weight: 600;
    margin-top: 0.4rem;
    padding-top: 0.6rem;
    border-top: 1px dashed #cbd5e0;
    font-size: 0.95rem;
}
.family-table td {
    vertical-align: middle;
}

/* ---------- Main form save/cancel bar (bottom of edit mode) ---------- */
.main-form-actions {
    display: flex;
    gap: 0.6rem;
    justify-content: flex-end;
    padding: 1rem 1.5rem;
    background: #edf2f7;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    box-shadow: 0 -2px 6px rgba(0, 0, 0, 0.04);
    position: sticky;
    bottom: 1rem;
    z-index: 10;
}

/* ---------- Highlight target when scrolling to family form ---------- */
.family-edit-block.highlight {
    box-shadow: 0 0 0 3px #3182ce;
    transition: box-shadow 0.3s;
}

/* ---------- Notes text ---------- */
.profile-page .notes-text {
    background: #f7fafc;
    padding: 0.8rem 1rem;
    border-radius: 6px;
    border-inline-start: 3px solid #a0aec0;
    margin: 0;
}

/* ==========================================================
   v3 — Personal full-width, per-card toggles, compact atts, pins
   ========================================================== */

/* ---------- Multi-column data display in Personal (full-width) ---------- */
.kv-multi-col {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.5rem 1.5rem;
    padding: 0.5rem 0;
}
.kv-multi-col .kv {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.6rem;
    padding: 0.35rem 0;
    border-bottom: 1px dotted #edf2f7;
}
.form-grid-3col {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.form-grid-compact {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.6rem 1rem;
}

/* ---------- Card bottom actions (Save/Cancel) ---------- */
.card-bottom-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    margin-top: 1rem;
    padding-top: 0.8rem;
    border-top: 1px solid #e2e8f0;
}

/* ---------- Card attachments (compact list inside Personal/family blocks) ---------- */
.card-attachments {
    margin-top: 1.2rem;
    padding-top: 0.8rem;
    border-top: 1px dashed #cbd5e0;
}
.att-section-title {
    font-size: 0.95rem;
    color: #2b6cb0;
    margin: 0 0 0.6rem;
    font-weight: 600;
}

.att-list-compact {
    list-style: none;
    margin: 0 0 0.8rem;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}
.att-list-compact .att-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0.7rem;
    background: #f7fafc;
    border-radius: 5px;
    border: 1px solid #edf2f7;
    font-size: 0.92rem;
}
.att-list-compact .att-row:hover { background: #edf2f7; }
.att-cat-chip {
    background: #e6f4ea;
    color: #22543d;
    padding: 0.15rem 0.55rem;
    border-radius: 10px;
    font-size: 0.78rem;
    white-space: nowrap;
    flex-shrink: 0;
}
.att-name-link {
    color: #2b6cb0;
    text-decoration: none;
    flex: 1;
    word-break: break-all;
    direction: ltr;
    text-align: start;
}
.att-name-link:hover { text-decoration: underline; }
.att-icon-btn {
    background: #fff;
    border: 1px solid #cbd5e0;
    color: #4a5568;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.85rem;
    cursor: pointer;
    text-decoration: none;
    line-height: 1.4;
    transition: all 0.15s;
}
.att-icon-btn:hover { background: #edf2f7; border-color: #a0aec0; }
.att-icon-btn.att-delete:hover { background: #fed7d7; border-color: #e53e3e; color: #c53030; }
.att-empty { color: #a0aec0; font-style: italic; padding: 0.4rem 0; text-align: center; }

.att-upload-inline {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
    padding: 0.7rem;
    background: #edf2f7;
    border-radius: 5px;
    border: 1px dashed #cbd5e0;
}

/* ---------- Pin (📌) for family table — popover with attachments ---------- */
.att-pin {
    display: inline-block;
    margin-inline-start: 0.4rem;
    position: relative;
}
.att-pin-summary {
    display: inline-block;
    background: #fef3c7;
    color: #92400e;
    border-radius: 12px;
    padding: 0.1rem 0.5rem;
    font-size: 0.78rem;
    cursor: pointer;
    user-select: none;
    list-style: none;
    border: 1px solid #fde68a;
}
.att-pin-summary::-webkit-details-marker { display: none; }
.att-pin-summary:hover { background: #fde68a; }
.att-pin[open] .att-pin-summary { background: #fde68a; }

.att-pin-list {
    position: absolute;
    z-index: 100;
    top: calc(100% + 4px);
    inset-inline-start: 0;
    list-style: none;
    margin: 0;
    padding: 0.4rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.12);
    min-width: 280px;
}
.att-pin-list li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.4rem;
    border-bottom: 1px dotted #edf2f7;
    font-size: 0.85rem;
}
.att-pin-list li:last-child { border-bottom: none; }
.pin-cat {
    background: #e6f4ea;
    color: #22543d;
    padding: 0.1rem 0.45rem;
    border-radius: 8px;
    font-size: 0.72rem;
    white-space: nowrap;
}
.att-pin-list li a {
    color: #2b6cb0;
    text-decoration: none;
    flex: 1;
    direction: ltr;
    text-align: start;
    word-break: break-all;
}
.att-pin-list li a:hover { text-decoration: underline; }

/* ---------- Same-as-family-address checkbox ---------- */
.checkbox-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.6rem;
    background: #ebf4ff;
    border-radius: 5px;
    border: 1px solid #bee3f8;
    margin: 0.6rem 0 0.5rem;
    font-size: 0.93rem;
    color: #2c5282;
    cursor: pointer;
    user-select: none;
}
.checkbox-row input[type="checkbox"] {
    margin: 0;
    width: 16px; height: 16px;
    cursor: pointer;
}
.addr-fields-conditional {
    transition: opacity 0.2s;
}
.addr-fields-conditional.is-disabled {
    opacity: 0.45;
    pointer-events: none;
}

/* ---------- Family edit panels: tighten spacing ---------- */
.family-edit-block .form-grid { margin-bottom: 0.4rem; }

/* ---------- Hide v2 master-toggle styles (kept for back-compat) ---------- */
.main-form-actions { display: none; }

/* ---------- Inside/Outside Kuwait location chips ---------- */
.loc-chip {
    display: inline-block;
    padding: 0.1rem 0.5rem;
    border-radius: 10px;
    font-size: 0.72rem;
    font-weight: 500;
    margin-inline-start: 0.3rem;
    white-space: nowrap;
}
.loc-inside  { background: #c6f6d5; color: #22543d; }
.loc-outside { background: #feebc8; color: #7b341e; }

/* ---------- Members list — name column (3/4-part friendly, not too wide) ---------- */
.users-table .name-cell {
    width: auto;
    min-width: 180px;
    max-width: 240px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.users-table .name-cell a {
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Tighter actions in members/servants lists */
.actions-cell {
    white-space: nowrap;
    text-align: end;
}
.actions-cell .btn,
.actions-cell .btn-sm,
.actions-cell button {
    padding: 0.2rem 0.5rem !important;
    font-size: 0.78rem !important;
    margin-inline-start: 0.15rem;
    line-height: 1.3;
}
.actions-cell form { display: inline; }

/* ---------- Attendance — preset tabs ---------- */
.preset-tabs {
    display: flex;
    gap: 0.3rem;
    flex-wrap: wrap;
    padding: 0.3rem;
    background: #edf2f7;
    border-radius: 6px;
}
.preset-tab {
    padding: 0.4rem 0.9rem;
    border-radius: 4px;
    text-decoration: none;
    color: #4a5568;
    font-size: 0.9rem;
    transition: all 0.15s;
}
.preset-tab:hover { background: #fff; color: #2b6cb0; }
.preset-tab.is-active {
    background: #3182ce;
    color: #fff;
    font-weight: 500;
}

/* ---------- Stats grid (attendance statistics) ---------- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.2rem;
}
.stat-card.stat-primary  { border-inline-start-color: #3182ce; }
.stat-card.stat-info     { border-inline-start-color: #805ad5; }
.stat-card.stat-manual   { border-inline-start-color: #d69e2e; }
.stat-card.stat-file     { border-inline-start-color: #319795; }
.stat-card.stat-male     { border-inline-start-color: #2b6cb0; }
.stat-card.stat-female   { border-inline-start-color: #d53f8c; }
.stat-card.stat-family   { border-inline-start-color: #38a169; }

/* ---------- Attendance — stats bar ---------- */
.att-stats-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.2rem;
}
.stat-card {
    background: #fff;
    border-radius: 8px;
    padding: 1.2rem 1.5rem;
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
    border-inline-start: 4px solid #3182ce;
}
.stat-card.stat-today    { border-inline-start-color: #38a169; }
.stat-card.stat-warning  { border-inline-start-color: #dd6b20; }
.stat-num {
    font-size: 2rem;
    font-weight: 700;
    color: #2d3748;
    line-height: 1;
    margin-bottom: 0.4rem;
}
.stat-label {
    color: #718096;
    font-size: 0.9rem;
}

/* ---------- Code block (file format display) ---------- */
.code-block {
    background: #1a202c;
    color: #e2e8f0;
    padding: 1rem 1.2rem;
    border-radius: 6px;
    font-family: Consolas, 'Courier New', monospace;
    font-size: 0.85rem;
    overflow-x: auto;
    direction: ltr;
    text-align: start;
    line-height: 1.6;
}

/* ---------- Diff review (import_pending) ---------- */
.pending-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1.2rem 1.4rem;
    margin-bottom: 1.2rem;
    border-inline-start: 4px solid #dd6b20;
}
.pending-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.6rem;
    border-bottom: 1px dashed #e2e8f0;
}
.pending-head h3 { margin: 0; font-size: 1.05rem; color: #1a202c; }
.diff-section-title {
    margin: 1.2rem 0 0.5rem;
    font-size: 0.95rem;
    color: #2b6cb0;
    font-weight: 600;
}
.diff-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 0.4rem 0;
    background: #f7fafc;
    border-radius: 6px;
    overflow: hidden;
}
.diff-table th {
    background: #edf2f7;
    padding: 0.5rem 0.7rem;
    text-align: right;
    font-size: 0.85rem;
    color: #4a5568;
    border-bottom: 1px solid #cbd5e0;
}
.diff-table td {
    padding: 0.5rem 0.7rem;
    border-bottom: 1px solid #edf2f7;
    font-size: 0.9rem;
}
.diff-table tr:last-child td { border-bottom: none; }
.diff-table .diff-old {
    background: #fff5f5;
    color: #742a2a;
    text-decoration: line-through;
    text-decoration-color: rgba(116,42,42,0.3);
}
.diff-table .diff-new {
    background: #f0fff4;
    color: #22543d;
    font-weight: 500;
}
.diff-table code {
    background: #fff;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    font-size: 0.82rem;
    color: #4a5568;
}

.child-diff-block {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 5px;
    padding: 0.7rem 1rem;
    margin: 0.6rem 0;
}
.add-child-row {
    display: flex;
    gap: 0.6rem;
    align-items: center;
    padding: 0.6rem 0.9rem;
    background: #f0fff4;
    border-left: 3px solid #38a169;
    border-radius: 5px;
    margin: 0.4rem 0;
    cursor: pointer;
}
.add-child-row input[type="checkbox"] {
    width: 16px; height: 16px; margin: 0;
}

.pending-actions {
    display: flex;
    gap: 0.6rem;
    margin-top: 1.2rem;
    padding-top: 1rem;
    border-top: 1px solid #e2e8f0;
    justify-content: flex-end;
}

/* ---------- Follow-up history ---------- */
.followup-history {
    margin-top: 1rem;
    padding-top: 0.8rem;
    border-top: 1px dashed #cbd5e0;
}
.followup-history summary {
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0.3rem 0;
}
.followup-history-list {
    list-style: none;
    padding: 0;
    margin: 0.6rem 0 0;
}
.followup-history-list li {
    padding: 0.6rem 0.8rem;
    background: #f7fafc;
    border-radius: 5px;
    margin-bottom: 0.4rem;
    font-size: 0.9rem;
    border-inline-start: 3px solid #bee3f8;
}

/* ---------- Servants area blocks in form ---------- */
.area-block {
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 0.6rem 0.8rem;
}
.area-block .checkbox-row {
    background: transparent;
    border: none;
    margin: 0.2rem 0;
    padding: 0.2rem 0.3rem;
}

/* ---------- Follow-up task rows (color-coded urgency) ---------- */
.followup-row.followup-critical td:first-child { border-inline-start: 4px solid #e53e3e; }
.followup-row.followup-warning  td:first-child { border-inline-start: 4px solid #dd6b20; }
.followup-row.followup-no_data  td:first-child { border-inline-start: 4px solid #a0aec0; }
.followup-row.followup-active   td:first-child { border-inline-start: 4px solid #38a169; }

/* ---------- Permissions matrix ---------- */
.perm-matrix th, .perm-matrix td { font-size: 0.85rem; padding: 0.4rem 0.5rem; }
.perm-matrix input[type="checkbox"] { width: 18px; height: 18px; cursor: pointer; }

/* ---------- Smart Card Reader scanner ---------- */
.reader-card .scanner-zone {
    text-align: center;
    padding: 2rem 1.5rem;
    background: linear-gradient(135deg, #f0f9ff 0%, #ebf4ff 100%);
    border: 2px dashed #3182ce;
    border-radius: 10px;
    margin: 1rem 0;
}
.scanner-icon {
    font-size: 4rem;
    margin-bottom: 0.6rem;
    animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.08); }
}
.scanner-prompt { margin-bottom: 1.5rem; }
.scanner-prompt strong { font-size: 1.15rem; color: #2b6cb0; }
.scanner-prompt p { margin: 0.3rem 0 0; color: #4a5568; }

.scan-input {
    font-family: Consolas, 'Courier New', monospace !important;
    font-size: 1.6rem !important;
    letter-spacing: 0.25em;
    text-align: center !important;
    padding: 0.75rem 1rem !important;
    border: 2px solid #3182ce !important;
    background: #fff !important;
}
.scan-input:focus {
    border-color: #2b6cb0 !important;
    box-shadow: 0 0 0 4px rgba(49, 130, 206, 0.15) !important;
    outline: none;
}
.scanner-hint {
    margin-top: 1.2rem;
    padding: 0.6rem 0.9rem;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 5px;
    font-size: 0.85rem;
}

/* PC/SC status panel */
.pcsc-status {
    margin-top: 1rem;
    padding: 0.9rem 1.1rem;
    border-radius: 6px;
    font-size: 0.92rem;
    line-height: 1.6;
    text-align: start;
    border-inline-start: 4px solid;
}
.pcsc-status code {
    background: rgba(0,0,0,0.05);
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    font-family: Consolas, monospace;
    font-size: 0.85rem;
    direction: ltr;
    display: inline-block;
}
.pcsc-status hr { margin: 0.6rem 0; border: none; border-top: 1px solid rgba(0,0,0,0.1); }
.pcsc-pending { background: #ebf4ff; color: #2c5282; border-color: #3182ce; }
.pcsc-success { background: #c6f6d5; color: #22543d; border-color: #38a169; }
.pcsc-warning { background: #feebc8; color: #7b341e; border-color: #dd6b20; }
.pcsc-error   { background: #fed7d7; color: #742a2a; border-color: #e53e3e; }

/* ---------- QR scanner (mobile-first) ---------- */
.qr-scan-card { max-width: 640px; margin: 1rem auto; }
.scanner-prompt-text { margin-bottom: 1.2rem; }

/* Scan mode tabs (QR vs Civil ID OCR) */
.scan-tabs {
    display: flex;
    gap: 0.4rem;
    margin: 1rem 0 1.2rem;
    border-bottom: 2px solid #e2e8f0;
}
.scan-tab {
    flex: 1;
    padding: 0.7rem 1rem;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    color: #4a5568;
    transition: all 0.15s ease;
}
.scan-tab:hover { color: #2d3748; background: #f7fafc; }
.scan-tab.active {
    color: #3182ce;
    border-bottom-color: #3182ce;
    background: #ebf8ff;
}

/* OCR live camera pane */
.ocr-live-wrap {
    position: relative;
    margin: 1rem auto;
    max-width: 420px;
    border-radius: 8px;
    overflow: hidden;
    background: #1a202c;
}
#ocr-video {
    width: 100%;
    display: block;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: 8px;
}
.ocr-overlay-canvas {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    border-radius: 8px;
}
.qr-reader-wrap {
    margin: 1rem auto;
    max-width: 420px;
}
#qr-reader {
    width: 100%;
    min-height: 320px;
    background: #1a202c;
    border-radius: 8px;
    overflow: hidden;
}
#qr-reader video { border-radius: 8px; }
.qr-manual-entry {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px dashed #cbd5e0;
}
.qr-manual-entry summary { cursor: pointer; padding: 0.5rem 0; font-size: 0.95rem; }
.qr-tips {
    margin-top: 1.5rem;
    padding: 0.8rem 1rem;
    background: #ebf8ff;
    border-radius: 5px;
    border-inline-start: 3px solid #3182ce;
}

/* Inline QR on member detail */
.qr-inline .qr-member-box {
    display: flex;
    gap: 1.2rem;
    align-items: center;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1rem 1.2rem;
    max-width: 500px;
}
.qr-member-img {
    width: 140px; height: 140px;
    image-rendering: pixelated;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    background: #fff;
}
.qr-member-meta { flex: 1; }
.qr-member-meta .ltr-cell {
    font-family: Consolas, monospace;
    font-size: 0.9rem;
    direction: ltr;
}

/* Print: hide everything except the QR box */
@media print {
    body * { visibility: hidden; }
    .qr-member-box, .qr-member-box * { visibility: visible; }
    .qr-member-box {
        position: absolute; top: 1cm; left: 1cm;
        box-shadow: none; border: 1px solid #000;
    }
    .qr-member-box button, .qr-member-box a { display: none; }
}

/* Mobile: larger touch targets */
@media (max-width: 640px) {
    .qr-scan-card { padding: 1rem; }
    #qr-reader { min-height: 260px; }
    .qr-reader-wrap { max-width: 100%; }
    .scan-input { font-size: 1.2rem !important; letter-spacing: 0.15em; }
    .qr-inline .qr-member-box { flex-direction: column; text-align: center; }
}

/* Import methods selection */
.import-methods {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.2rem;
    margin-top: 1rem;
}
.import-method {
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1.2rem 1.4rem;
}
.import-method h3 {
    color: #2b6cb0;
    margin: 0 0 0.4rem;
    font-size: 1rem;
}
.import-method p { margin: 0 0 1rem; }

/* Override the app-level `card` rule so grid works inside container */
@media (max-width: 768px) {
    .profile-header {
        flex-direction: column;
        text-align: center;
    }
    .profile-actions { justify-content: center; }
    .profile-grid { grid-template-columns: 1fr; }
    .family-table { font-size: 0.85rem; }
    .family-table th, .family-table td { padding: 0.5rem 0.4rem; }
}

/* ============================================================
   Authentication Pages (Login, etc.)
   Standalone layout — does NOT extend base.html
   ============================================================ */
.auth-body {
    background: #1a202c;
    color: #2d3748;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Decorative background gradient + floating shapes */
.auth-bg {
    position: fixed;
    inset: 0;
    background:
        radial-gradient(circle at 15% 25%, rgba(49, 130, 206, 0.35) 0, transparent 45%),
        radial-gradient(circle at 85% 75%, rgba(56, 161, 105, 0.28) 0, transparent 45%),
        linear-gradient(135deg, #1a202c 0%, #2d3748 100%);
    z-index: 0;
}
.auth-bg-shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.55;
    pointer-events: none;
}
.auth-bg-shape.shape-1 { width: 380px; height: 380px; background: #3182ce; top: -90px; right: -90px; }
.auth-bg-shape.shape-2 { width: 320px; height: 320px; background: #38a169; bottom: -80px; left: -80px; }
.auth-bg-shape.shape-3 { width: 220px; height: 220px; background: #805ad5; top: 35%; left: 15%; opacity: 0.35; }

.auth-shell {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.auth-card {
    width: 100%;
    max-width: 440px;
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(8px);
    border-radius: 16px;
    padding: 2.5rem 2rem 1.75rem;
    box-shadow:
        0 25px 50px -12px rgba(0, 0, 0, 0.45),
        0 0 0 1px rgba(255, 255, 255, 0.05);
    animation: auth-fade-in 0.45s ease-out;
}
@keyframes auth-fade-in {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

.auth-header {
    text-align: center;
    margin-bottom: 1.75rem;
}
.auth-logo {
    width: 72px;
    height: 72px;
    margin: 0 auto 1rem;
    background: linear-gradient(135deg, #3182ce 0%, #2c5aa0 100%);
    color: #fff;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 25px -8px rgba(49, 130, 206, 0.55);
}
.auth-title {
    font-size: 1.5rem;
    color: #1a202c;
    margin: 0 0 0.35rem;
    font-weight: 700;
}
.auth-subtitle {
    color: #718096;
    font-size: 0.95rem;
    margin: 0;
}

.auth-form { display: flex; flex-direction: column; gap: 1.1rem; }

.auth-field { display: flex; flex-direction: column; gap: 0.45rem; }
.auth-field label {
    font-size: 0.88rem;
    font-weight: 600;
    color: #4a5568;
}

.auth-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}
.auth-input-icon {
    position: absolute;
    inset-inline-start: 0.85rem;
    color: #a0aec0;
    display: flex;
    align-items: center;
    pointer-events: none;
    transition: color 0.15s;
}
.auth-input-wrap input {
    width: 100%;
    padding: 0.85rem 2.6rem;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    font-size: 1rem;
    font-family: inherit;
    background: #f7fafc;
    color: #1a202c;
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.auth-input-wrap input::placeholder { color: #cbd5e0; }
.auth-input-wrap input:focus {
    outline: none;
    border-color: #3182ce;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(49, 130, 206, 0.15);
}
.auth-input-wrap input:focus + .auth-pw-toggle,
.auth-input-wrap input:focus ~ .auth-input-icon,
.auth-input-wrap:focus-within .auth-input-icon { color: #3182ce; }

.auth-pw-toggle {
    position: absolute;
    inset-inline-end: 0.65rem;
    background: none;
    border: none;
    cursor: pointer;
    color: #a0aec0;
    padding: 0.4rem;
    display: flex;
    align-items: center;
    border-radius: 6px;
    transition: color 0.15s, background 0.15s;
}
.auth-pw-toggle:hover { color: #3182ce; background: rgba(49, 130, 206, 0.1); }
.auth-pw-toggle.is-shown { color: #3182ce; }

.auth-submit {
    margin-top: 0.5rem;
    background: linear-gradient(135deg, #3182ce 0%, #2c5aa0 100%);
    color: #fff;
    border: none;
    padding: 0.95rem 1.25rem;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    box-shadow: 0 8px 20px -6px rgba(49, 130, 206, 0.5);
    transition: transform 0.12s, box-shadow 0.15s, filter 0.15s;
}
.auth-submit:hover { filter: brightness(1.08); box-shadow: 0 12px 28px -8px rgba(49, 130, 206, 0.65); }
.auth-submit:active { transform: translateY(1px); }
.auth-submit svg { transition: transform 0.15s; }
.auth-submit:hover svg { transform: translateX(-3px); }
[dir="rtl"] .auth-submit:hover svg { transform: translateX(3px); }

.auth-divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #a0aec0;
    font-size: 0.82rem;
    margin: 1.1rem 0;
}
.auth-divider::before,
.auth-divider::after {
    content: "";
    height: 1px;
    flex: 1;
    background: #e2e8f0;
}
.auth-google-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    padding: 0.85rem 1rem;
    border: 1px solid #cbd5e0;
    border-radius: 10px;
    background: #fff;
    color: #2d3748;
    text-decoration: none;
    font-weight: 600;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.12s;
}
.auth-google-btn:hover {
    border-color: #a0aec0;
    box-shadow: 0 8px 18px -12px rgba(45, 55, 72, 0.7);
    transform: translateY(-1px);
}
.auth-google-mark {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #4285f4;
    border: 1px solid #e2e8f0;
}

.auth-flash {
    padding: 0.75rem 0.9rem;
    border-radius: 8px;
    font-size: 0.92rem;
    margin-bottom: 1rem;
    border: 1px solid transparent;
}
.auth-flash-success { background: #f0fff4; color: #22543d; border-color: #c6f6d5; }
.auth-flash-danger  { background: #fff5f5; color: #742a2a; border-color: #fed7d7; }
.auth-flash-warning { background: #fffaf0; color: #7b341e; border-color: #feebc8; }
.auth-flash-info    { background: #ebf8ff; color: #2a4365; border-color: #bee3f8; }

.auth-footer {
    text-align: center;
    color: #a0aec0;
    font-size: 0.82rem;
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid #edf2f7;
}

/* ---- Responsive adjustments ---- */
@media (max-width: 480px) {
    .auth-shell { padding: 1rem 0.75rem; }
    .auth-card  { padding: 1.75rem 1.25rem 1.25rem; border-radius: 14px; }
    .auth-logo  { width: 60px; height: 60px; border-radius: 14px; }
    .auth-title { font-size: 1.3rem; }
    .auth-bg-shape.shape-3 { display: none; }
}
@media (max-height: 600px) {
    .auth-shell { align-items: flex-start; padding-top: 1.5rem; padding-bottom: 1.5rem; }
}
