:root {
    --primary: #00ADEF;
    --primary-dark: #00508A;
    --primary-deep: #003A66;
    --primary-soft: #E6F7FD;
    --accent: #E99A27;
    --accent-dark: #8E4F00;
    --accent-soft: #FDF0DC;
    --cream: #FFF8F1;
    --sand: #FDEFE1;
    --navy: #002B4A;
    --ink: #22313F;
    --text: #4A5A68;
    --muted: #7A8794;
    --line: #E3E8EC;
    --input: #FBFCFD;
    --page: #F5F7F9;
    --white: #FFFFFF;
    --success: #1E8E5A;
    --danger: #C0392B;
    --radius: 8px;
    --radius-lg: 10px;
    --shadow: 0 10px 30px rgba(34, 49, 63, 0.08);
    --sidebar-width: 250px;
    --bs-primary: var(--primary);
    --bs-primary-rgb: 0, 173, 239;
    --bs-link-color: var(--primary-dark);
    --bs-link-color-rgb: 0, 80, 138;
    --bs-link-hover-color: var(--accent-dark);
    --bs-border-radius: var(--radius);
    --bs-border-color: var(--line);
}

body {
    font-family: 'Roboto', sans-serif;
    font-weight: 300;
    color: var(--text);
    background: var(--page);
    line-height: 1.6;
}

strong, b, dt, th { font-weight: 500; }

h1, h2, h3, h4, h5, h6 {
    font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif;
    color: var(--ink);
    font-weight: 700;
    line-height: 1.25;
}

a { text-decoration: none; }

[x-cloak] { display: none !important; }

/* Buttons */
.btn {
    border-radius: 6px;
    font-weight: 500;
    padding: 0.42rem 1rem;
    transition: all 0.2s ease;
}
.btn-sm { padding: 0.25rem 0.65rem; font-size: 0.83rem; }
.btn-lg { padding: 0.7rem 1.6rem; font-size: 1rem; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--white); }
.btn-primary:hover, .btn-primary:focus { background: var(--primary-dark); border-color: var(--primary-dark); color: var(--white); }
.btn-outline-primary { color: var(--primary-dark); border-color: var(--primary); }
.btn-outline-primary:hover, .btn-check:checked + .btn-outline-primary { background: var(--primary); border-color: var(--primary); color: var(--white); }
/* Website accent button: warm shadow + lift on hover */
.btn-accent { background: var(--accent); border-color: var(--accent); color: var(--ink); box-shadow: 0 8px 20px rgba(233, 154, 39, 0.3); }
.btn-accent:hover, .btn-accent:focus { background: var(--accent-dark); border-color: var(--accent-dark); color: var(--white); transform: translateY(-2px); }
.btn-deep { background: var(--primary-dark); border-color: var(--primary-dark); color: var(--white); }
.btn-deep:hover { background: var(--primary-deep); border-color: var(--primary-deep); color: var(--white); }

/* Forms */
.form-label { font-weight: 500; color: var(--ink); font-size: 0.88rem; margin-bottom: 0.25rem; }
.form-control, .form-select { border-radius: 6px; border-color: var(--line); background-color: var(--input); padding: 0.45rem 0.75rem; font-weight: 400; }
.form-control:focus, .form-select:focus { border-color: var(--primary); background-color: var(--white); box-shadow: 0 0 0 3px rgba(0, 173, 239, 0.15); }
.form-text { color: var(--muted); }
.form-check-input:checked { background-color: var(--primary); border-color: var(--primary); }

/* Labels and panels */
.eyebrow {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent-dark);
    margin-bottom: 0.4rem;
}

.panel {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 1.1rem 1.25rem;
}
.panel + .panel { margin-top: 1.1rem; }
/* Accent marker before every panel title */
.panel-title { font-size: 1rem; margin-bottom: 0.8rem; padding-left: 0.6rem; border-left: 3px solid var(--accent); line-height: 1.3; }
.panel-narrow { max-width: 640px; }
.panel-wide { max-width: 980px; }

.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem; margin-bottom: 1.1rem; }
.page-head h1 { font-size: 1.4rem; margin: 0; color: var(--primary-deep); }
.page-head p { margin: 0.25rem 0 0; color: var(--muted); }

.tag {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: 500;
    background: var(--primary-soft);
    color: var(--primary-dark);
}
.tag-success { background: #E3F4EB; color: var(--success); }
.tag-muted { background: var(--sand); color: var(--accent-dark); }
.tag-warning { background: var(--accent-soft); color: var(--accent-dark); }
.tag-danger { background: #FBE7E5; color: var(--danger); }

/* Tables */
.table { --bs-table-color: var(--text); --bs-table-hover-bg: var(--primary-soft); margin-bottom: 0; }
.table > :not(caption) > * > * { padding: 0.5rem 0.75rem; }
.table thead th {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--primary-dark);
    background: var(--primary-soft);
    border-bottom: 2px solid var(--primary);
    white-space: normal;
}
.table td { vertical-align: middle; }
/* Striped rows on every table + a stronger hover */
.table > tbody > tr:nth-of-type(odd) > td { background: #F7FBFE; }
.table > tbody > tr:hover > td { background: var(--primary-soft); }
/* Keep it a real table cell (display:flex on a td breaks the row); space the inline buttons/forms instead */
.table-actions { text-align: right; white-space: nowrap; }
.table-actions > * { display: inline-block; vertical-align: middle; }
.table-actions > * + * { margin-left: 0.4rem; }

/* Tabs: underline style, no pills */
.tabs { display: flex; flex-wrap: wrap; gap: 1.25rem; border-bottom: 1px solid var(--line); margin-bottom: 1.1rem; padding: 0; list-style: none; }
.tabs button, .tabs a {
    background: none;
    border: 0;
    padding: 0.5rem 0;
    color: var(--muted);
    font-weight: 500;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}
.tabs button:hover, .tabs a:hover { color: var(--primary-dark); }
.tabs .active { color: var(--primary-dark); border-bottom-color: var(--accent); }

/* Alerts */
.alert { border-radius: var(--radius); border: 0; }
.alert-success { background: #E3F4EB; color: #145C3B; }
.alert-danger { background: #FBE7E5; color: #8A2A20; }

/* Pagination */
.pagination { --bs-pagination-color: var(--primary-dark); --bs-pagination-active-bg: var(--primary-dark); --bs-pagination-active-border-color: var(--primary-dark); --bs-pagination-border-radius: 6px; }

/* Guest (auth) pages */
.guest-body { background: var(--cream); }
.guest-topbar { background: var(--navy); color: rgba(255, 255, 255, 0.85); font-size: 0.85rem; padding: 0.5rem 0; }
.guest-topbar a { color: rgba(255, 255, 255, 0.85); }
.guest-topbar a:hover { color: var(--white); }
.guest-header { background: var(--white); border-bottom: 1px solid var(--line); padding: 0.8rem 0; }
.brand { display: inline-flex; align-items: center; gap: 0.6rem; color: var(--ink); font-weight: 700; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 1.05rem; }
.brand img { height: 42px; width: auto; }
.brand:hover { color: var(--primary-dark); }
.guest-main { padding: 2.5rem 0; }
.auth-card { max-width: 440px; margin: 0 auto; }
.auth-card h1 { font-size: 1.5rem; margin-bottom: 0.3rem; }
.auth-card .lead-text { color: var(--muted); margin-bottom: 1.5rem; }
.auth-foot { text-align: center; margin-top: 1.5rem; color: var(--muted); font-size: 0.9rem; }
.guest-footer { color: var(--muted); font-size: 0.85rem; padding: 1.5rem 0; text-align: center; }

.password-field { position: relative; }
.password-field .form-control { padding-right: 2.6rem; }
.password-toggle { position: absolute; top: 50%; right: 0.6rem; transform: translateY(-50%); background: none; border: 0; color: var(--muted); padding: 0.25rem; }
.password-toggle:hover { color: var(--primary-dark); }

/* Admin layout */
.admin-shell { display: flex; min-height: 100vh; }
.sidebar {
    width: var(--sidebar-width);
    background: var(--navy);
    color: rgba(255, 255, 255, 0.8);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}
.sidebar-brand { display: flex; align-items: center; gap: 0.6rem; padding: 1rem 1.25rem; color: var(--white); font-weight: 700; border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
.sidebar-brand img { height: 36px; width: auto; background: var(--white); border-radius: 6px; padding: 2px; }
.sidebar-brand:hover { color: var(--white); }
.sidebar-nav { padding: 0.75rem 0.6rem; flex: 1; overflow-y: auto; }
.sidebar-label { font-size: 0.68rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); padding: 0.8rem 0.75rem 0.3rem; }
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.42rem 0.7rem;
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.8);
    border-left: 3px solid transparent;
    font-size: 0.9rem;
}
.sidebar-link:hover { background: rgba(255, 255, 255, 0.06); color: var(--white); }
.sidebar-link.active { background: rgba(0, 173, 239, 0.18); color: var(--white); border-left-color: var(--accent); border-radius: 0 6px 6px 0; }
.sidebar-link i { font-size: 1rem; width: 1.2rem; text-align: center; color: var(--primary); }
.sidebar-link.active i, .sidebar-link:hover i { color: var(--accent); }

.admin-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.admin-topbar { background: var(--white); border-bottom: 3px solid var(--primary); height: 56px; display: flex; align-items: center; justify-content: space-between; padding: 0 1.5rem; position: sticky; top: 0; z-index: 1020; }
.admin-content { padding: 1.25rem 1.25rem; flex: 1; }
.user-menu .btn { display: inline-flex; align-items: center; gap: 0.5rem; color: var(--ink); padding: 0.35rem 0.6rem; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--primary-dark); color: var(--white); display: inline-flex; align-items: center; justify-content: center; font-size: 0.85rem; font-weight: 500; }

@media (max-width: 991.98px) {
    .sidebar { position: fixed; top: 0; bottom: 0; left: 0; z-index: 1040; transform: translateX(-100%); transition: transform 0.25s ease; }
    .sidebar.open { transform: translateX(0); }
    .sidebar-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.35); z-index: 1030; }
}

/* Member layout */
.member-header { background: var(--white); border-bottom: 3px solid var(--primary); position: sticky; top: 0; z-index: 1020; }
.member-header .navbar { padding: 0.4rem 0; }
.member-header .navbar-toggler { border: 0; font-size: 1.6rem; color: var(--ink); padding: 0.1rem 0.3rem; box-shadow: none; }
.member-nav .nav-link { color: var(--ink); font-weight: 500; padding: 0.5rem 0.9rem; border-bottom: 2px solid transparent; }
.member-nav .nav-link i { color: var(--primary); margin-right: 0.2rem; }
.member-nav .nav-link:hover { color: var(--accent-dark); }
.member-nav .nav-link.active { color: var(--primary-dark); border-bottom-color: var(--accent); }
.member-nav .dropdown-menu { border-color: var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 0.35rem 0; min-width: 14rem; }
.member-nav .dropdown-item { display: flex; align-items: center; gap: 0.6rem; padding: 0.45rem 1rem; color: var(--ink); border-left: 3px solid transparent; }
.member-nav .dropdown-item i { color: var(--primary); width: 1.1rem; text-align: center; }
.member-nav .dropdown-item:hover { background: var(--primary-soft); color: var(--primary-dark); }
.member-nav .dropdown-header { display: flex; align-items: center; gap: 0.6rem; padding: 0.35rem 1rem 0.2rem; font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--accent-dark); }
.member-nav .dropdown-header i { color: var(--primary); width: 1.1rem; text-align: center; font-size: 0.95rem; }
.member-nav .dropdown-subitem { padding-left: 2.7rem; }
.member-nav .dropdown-item.active, .member-nav .dropdown-item:active { background: var(--primary-soft); color: var(--primary-dark); border-left-color: var(--accent); font-weight: 500; }
@media (max-width: 991.98px) {
    .member-nav { padding: 0.5rem 0; border-top: 1px solid var(--line); margin-top: 0.4rem; }
    .member-nav .nav-link { border-bottom: 0; border-left: 3px solid transparent; }
    .member-nav .nav-link.active { border-left-color: var(--accent); }
    .member-nav .dropdown-menu { box-shadow: none; border: 0; padding: 0 0 0.3rem 1rem; }
}
.member-main { padding: 1rem 0 6rem; }
.member-main .page-head { margin-bottom: 0.9rem; }
.member-main .page-head h1 { font-size: 1.25rem; }
.member-main .page-head p { font-size: 0.92rem; }

.bottom-nav { position: fixed; bottom: 0; left: 0; right: 0; background: var(--white); border-top: 1px solid var(--line); display: flex; z-index: 1030; }
.bottom-nav a { flex: 1; text-align: center; padding: 0.5rem 0.25rem; color: var(--muted); font-size: 0.72rem; border-top: 2px solid transparent; }
.bottom-nav a i { display: block; font-size: 1.2rem; }
.bottom-nav a.active { color: var(--primary-dark); border-top-color: var(--accent); }

/* Dashboard bits */
.stat { background: var(--white); border: 1px solid var(--line); border-top: 3px solid var(--primary); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 0.8rem 1rem; height: 100%; }
/* Colourful tiles: brand colours in a fixed order across each row */
.row > :nth-child(4n+2) > .stat { border-top-color: var(--accent); }
.row > :nth-child(4n+3) > .stat { border-top-color: var(--primary-dark); }
.row > :nth-child(4n+4) > .stat { border-top-color: var(--accent-dark); }
.stat-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); font-weight: 600; }
.stat-value { font-size: 1.45rem; font-weight: 700; color: var(--ink); font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; }

.welcome { background: linear-gradient(135deg, var(--navy), var(--primary-dark) 70%, var(--primary)); color: rgba(255, 255, 255, 0.9); border-radius: var(--radius-lg); border-bottom: 4px solid var(--accent); padding: 1.25rem 1.4rem; }
.welcome h1, .welcome h2 { color: var(--white); }
.welcome .eyebrow { color: var(--accent); }

.empty-note { color: var(--muted); text-align: center; padding: 1.4rem 1rem; }

.matrix td, .matrix th { text-align: center; }
.matrix td:first-child, .matrix th:first-child { text-align: left; }
.matrix .group-row td, .table > tbody > tr.group-row > td { background: var(--page); font-weight: 600; color: var(--ink); text-align: left; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; }

/* Registration and forms */
.register-wrap { max-width: 860px; margin: 0 auto; }
.register-intro { margin-bottom: 1.5rem; }
.register-intro h1 { font-size: 1.75rem; }
.form-section-title { font-size: 1.1rem; margin: 2rem 0 1rem; padding-top: 1.5rem; border-top: 1px solid var(--line); }
.form-section-title .eyebrow { display: block; margin-bottom: 0.2rem; }
form > .form-section-title:first-of-type { margin-top: 0; padding-top: 0; border-top: 0; }

/* Member status */
.status-card { display: flex; flex-wrap: wrap; gap: 1.25rem; align-items: center; }
.status-photo { width: 72px; height: 72px; border-radius: 8px; object-fit: cover; background: var(--primary-soft); color: var(--primary-dark); display: inline-flex; align-items: center; justify-content: center; font-size: 2rem; flex-shrink: 0; }
.status-meta { color: rgba(255, 255, 255, 0.8); font-size: 0.9rem; }
.status-meta strong { color: var(--white); }
.tier { display: inline-block; padding: 0.2rem 0.6rem; border-radius: 3px; font-size: 0.8rem; font-weight: 600; }
.tier-confirmed { background: #E3F4EB; color: var(--success); }
.tier-associate { background: var(--accent-soft); color: var(--accent-dark); }

/* Member home */
.welcome-strip { display: flex; flex-wrap: wrap; align-items: center; gap: 0.9rem; padding: 0.8rem 1.1rem; }
.welcome-strip .status-photo { width: 48px; height: 48px; font-size: 1.4rem; }
.welcome-photo { position: relative; display: inline-block; flex-shrink: 0; }
.welcome-photo > i { position: absolute; right: -5px; bottom: -5px; width: 20px; height: 20px; border-radius: 50%; background: var(--accent); color: var(--ink); font-size: 0.68rem; display: flex; align-items: center; justify-content: center; }
.welcome-photo:hover > i { background: var(--white); }

.photo-square { display: flex; align-items: center; justify-content: center; width: 100%; max-width: 260px; aspect-ratio: 1 / 1; margin: 0 auto; object-fit: cover; border-radius: var(--radius); border: 1px solid var(--line); background: var(--primary-soft); color: var(--primary-dark); font-size: 4rem; }
.photo-crop-box { width: 100%; max-width: 320px; aspect-ratio: 1 / 1; margin: 0 auto; background: var(--navy); border-radius: var(--radius); overflow: hidden; }
.photo-crop-box img { display: block; max-width: 100%; }
.photo-crop-box .cropper-view-box { outline: 2px solid var(--accent); outline-color: var(--accent); }
.photo-crop-box .cropper-modal { background: var(--navy); opacity: 0.55; }
.photo-picker { max-width: 320px; }
.photo-picker .photo-square { margin: 0; max-width: 200px; }
.panel#photo .photo-picker { margin: 0 auto; }
.panel#photo .photo-picker .photo-square { margin: 0 auto; max-width: 260px; }
.photo-picker .photo-error { display: none; }
.photo-picker.is-invalid .photo-error { display: block; }
.photo-picker.is-invalid .photo-square { border-color: var(--danger); }
.photo-editor-actions { display: flex; gap: 0.5rem; }
.photo-editor-actions .btn { flex: 1; }
.photo-pick-buttons { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1rem; }
.photo-pick-buttons .btn { flex: 1 1 140px; margin: 0; white-space: nowrap; }
/* Camera capture only makes sense on touch devices (phones/tablets); hide it where there is a mouse. */
@media (hover: hover) and (pointer: fine) {
    .touch-only { display: none !important; }
}
.photo-zoom { display: flex; align-items: center; gap: 0.5rem; max-width: 320px; margin: 0.6rem auto 0.2rem; }
.photo-zoom .form-range { flex: 1; }
.welcome-strip h1 { font-size: 1.15rem; margin: 0 0 0.1rem; display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.welcome-strip .tier { font-size: 0.72rem; }
.welcome-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.welcome-actions .btn-light { background: var(--white); border-color: var(--white); color: var(--primary-dark); font-weight: 500; }
.welcome-actions .btn-light:hover { background: var(--primary-soft); color: var(--primary-deep); }
.welcome-actions .btn-accent { box-shadow: none; }

.stat-link { display: block; color: var(--text); transition: border-color 0.15s ease, transform 0.15s ease; }
.stat-link:hover { color: var(--text); transform: translateY(-2px); border-color: var(--primary); }
.stat-link .stat-value { font-size: 1.15rem; line-height: 1.3; }
.stat-link small { color: var(--muted); font-size: 0.8rem; }
.stat-value.is-ok { color: var(--success); }
.stat-value.is-due { color: var(--accent-dark); }
.stat-value.is-bad { color: var(--danger); }

/* Broadcasts: SMS balance */
.sms-units { margin: 0.2rem 0 0.6rem 1.6rem; padding: 0.45rem 0.7rem; background: var(--primary-soft); border-left: 3px solid var(--primary); border-radius: 4px; font-size: 0.88rem; color: var(--ink); }
.panel > .sms-units.mb-3 { margin-left: 0; }
.sms-units-short { background: #FBE7E5; border-left-color: var(--danger); color: var(--danger); }

/* Bootstrap only hides panes that are direct children of .tab-content; settings panes sit inside a <form>. */
.tab-pane:not(.active) { display: none; }

/* Template editors: variables key in the right column */
@media (min-width: 992px) {
    .tag-key { position: sticky; top: 72px; }
}
.tag-key-list { margin: 0; }
.tag-key-list > div { padding: 0.5rem 0; border-bottom: 1px solid var(--line); }
.tag-key-list > div:last-child { border-bottom: 0; padding-bottom: 0; }
.tag-key-list dt { font-weight: 400; margin-bottom: 0.1rem; }
.tag-insert { display: inline-flex; align-items: center; gap: 0.35rem; border: 1px solid var(--line); background: var(--primary-soft); color: #B4245D; font-family: SFMono-Regular, Consolas, monospace; font-size: 0.85rem; padding: 0.1rem 0.45rem; border-radius: 4px; cursor: pointer; }
.tag-insert i { color: var(--primary); font-size: 0.8rem; }
.tag-insert:hover { border-color: var(--primary); background: var(--white); }
.tag-insert.inserted { border-color: var(--success); }
.tag-key-list dd { margin: 0; font-size: 0.88rem; color: var(--ink); line-height: 1.4; }
.tag-key-list dd small { display: block; color: var(--muted); margin-top: 0.15rem; }

.kin-row { border: 1px solid var(--line); border-left: 3px solid var(--primary); border-radius: var(--radius); padding: 0.7rem 0.9rem 0.9rem; margin-bottom: 0.75rem; background: var(--white); }
.kin-row-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.4rem; }
.kin-row-title { font-size: 0.78rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--primary-dark); }

.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 0.8rem; }

.todo-list { list-style: none; padding: 0; margin: 0; }
.todo-list li { display: flex; align-items: center; gap: 0.75rem; padding: 0.55rem 0 0.55rem 0.7rem; border-bottom: 1px solid var(--line); border-left: 3px solid var(--primary); font-size: 0.93rem; color: var(--ink); }
.todo-list li:last-child { border-bottom: 0; }
.todo-list li > i { font-size: 1.1rem; color: var(--primary); }
.todo-list .todo-warning { border-left-color: var(--accent); }
.todo-list .todo-warning > i { color: var(--accent-dark); }
.todo-list .todo-danger { border-left-color: var(--danger); }
.todo-list .todo-danger > i { color: var(--danger); }

.alert-mini { list-style: none; padding: 0; margin: 0; }
.alert-mini li { display: flex; align-items: center; gap: 0.6rem; padding: 0.45rem 0; border-bottom: 1px solid var(--line); font-size: 0.92rem; }
.alert-mini li:last-child { border-bottom: 0; }
.alert-mini li > i { color: var(--primary-dark); }
.alert-mini a { color: var(--ink); }
.alert-mini a:hover { color: var(--accent-dark); }
.alert-mini li.unread a { font-weight: 600; }
.alert-mini small { color: var(--muted); white-space: nowrap; }

.steps-list { list-style: none; padding: 0; margin: 0; counter-reset: step; }
.steps-list li { position: relative; padding-left: 2.4rem; margin-bottom: 0.9rem; }
.steps-list li::before { counter-increment: step; content: counter(step); position: absolute; left: 0; top: 0; width: 1.7rem; height: 1.7rem; border-radius: 50%; background: var(--primary-dark); color: var(--white); font-size: 0.85rem; display: flex; align-items: center; justify-content: center; }
.steps-list li.done::before { background: var(--success); content: '\2713'; }

.detail-list { display: grid; grid-template-columns: 150px 1fr; gap: 0.35rem 1rem; margin: 0; }
.detail-list dt { color: var(--muted); font-weight: 400; font-size: 0.9rem; }
.detail-list dd { margin: 0; color: var(--ink); }

.plate { display: inline-block; font-family: 'Courier New', monospace; font-weight: 700; letter-spacing: 0.05em; background: #FFF6D6; border: 1px solid #E6C65C; color: var(--ink); padding: 0.1rem 0.5rem; border-radius: 3px; }

.list-plain { list-style: none; padding: 0; margin: 0; }
.list-plain li { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 0.55rem 0; border-bottom: 1px solid var(--line); }
.list-plain li:last-child { border-bottom: 0; }

.note-item { border-left: 3px solid var(--accent); padding: 0.4rem 0 0.4rem 0.8rem; margin-bottom: 0.9rem; }
.note-item small { color: var(--muted); }

.filters { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }
.filters .form-control, .filters .form-select { width: auto; min-width: 160px; }
.filters .form-control[type="search"] { min-width: 240px; }

.member-cell { display: flex; align-items: center; gap: 0.7rem; }
.member-cell img, .member-cell .status-photo { width: 38px; height: 38px; font-size: 1rem; border-radius: 6px; object-fit: cover; }
.member-cell small { display: block; color: var(--muted); }

.row-issue, .table > tbody > tr.row-issue > td { background: #FBE7E5; }
.row-match, .table > tbody > tr.row-match > td { background: #E3F4EB; }
.sidebar-count { margin-left: auto; background: var(--accent); color: var(--ink); font-size: 0.72rem; font-weight: 600; padding: 0.05rem 0.45rem; border-radius: 3px; }

/* Registration wizard */
.form-section-title i { color: var(--accent-dark); margin-right: 0.35rem; }
.wizard .wizard-step { display: none; }
.wizard .wizard-step.active { display: block; }
.wizard .form-section-title { margin-top: 0; padding-top: 0; border-top: 0; }
.wizard-progress { display: flex; list-style: none; padding: 0; margin: 0 auto 1.75rem; max-width: 560px; }
.wizard-progress li { flex: 1; position: relative; text-align: center; color: var(--muted); font-size: 0.85rem; }
.wizard-progress li::before { content: ''; position: absolute; top: 1.1rem; left: -50%; width: 100%; height: 2px; background: var(--line); z-index: 0; }
.wizard-progress li:first-child::before { display: none; }
.wizard-progress li.done::before, .wizard-progress li.active::before { background: var(--primary-dark); }
.wizard-num { position: relative; z-index: 1; width: 2.2rem; height: 2.2rem; border-radius: 50%; background: var(--white); border: 2px solid var(--line); display: flex; align-items: center; justify-content: center; margin: 0 auto 0.4rem; font-weight: 600; color: var(--muted); }
.wizard-progress li.active { color: var(--primary-dark); font-weight: 500; }
.wizard-progress li.active .wizard-num { background: var(--primary-dark); border-color: var(--primary-dark); color: var(--white); }
.wizard-progress li.done .wizard-num { background: var(--success); border-color: var(--success); color: var(--white); }
.wizard-nav { display: flex; justify-content: space-between; gap: 0.75rem; margin-top: 2rem; padding-top: 1.25rem; border-top: 1px solid var(--line); }

.plan-box { background: var(--cream); border: 1px solid var(--accent-soft); border-radius: var(--radius); padding: 1rem 1.25rem; }
.plan-lines { list-style: none; padding: 0; margin: 0; }
.plan-lines li { display: flex; justify-content: space-between; gap: 1rem; padding: 0.35rem 0; font-size: 0.92rem; }
.plan-lines .plan-total { border-top: 1px solid var(--accent-soft); margin-top: 0.3rem; padding-top: 0.6rem; }

/* Plan choice */
.plan-options { display: grid; gap: 0.75rem; }
.plan-option { display: flex; gap: 0.75rem; align-items: flex-start; border: 1px solid var(--line); border-radius: var(--radius); padding: 0.9rem 1rem; cursor: pointer; }
.plan-option:has(input:checked) { border-color: var(--primary-dark); background: var(--primary-soft); }
.plan-option input { margin-top: 0.35rem; }
.plan-option-body { flex: 1; }

/* Public directory */
.public-body { background: var(--page); }
.public-header { background: var(--white); border-bottom: 3px solid var(--primary); position: sticky; top: 0; z-index: 1020; }
.public-header .navbar { padding: 0.7rem 0; }
.public-header .navbar-toggler { border: 0; font-size: 1.6rem; color: var(--ink); }
.public-nav .nav-link { color: var(--ink); font-weight: 400; padding: 0.5rem 0.9rem; border-bottom: 2px solid transparent; }
.public-nav .nav-link:hover { color: var(--accent-dark); }
.public-nav .nav-link.active { color: var(--primary-dark); font-weight: 500; border-bottom-color: var(--accent); }
.public-footer { background: var(--navy); color: rgba(255, 255, 255, 0.8); font-size: 0.9rem; padding: 1.5rem 0; margin-top: 3rem; }
.public-footer a { color: rgba(255, 255, 255, 0.85); }
.public-footer a:hover { color: var(--white); }

.directory-hero { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: rgba(255, 255, 255, 0.92); padding: 3.5rem 0; }
.directory-hero h1 { color: var(--white); font-size: 2.6rem; margin-bottom: 0.75rem; }
.directory-hero p { font-size: 1.1rem; margin-bottom: 2rem; }
.search-card { background: var(--white); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 1.5rem; max-width: 900px; margin: 0 auto; position: relative; text-align: left; }
.search-card .input-group-text { background: var(--page); color: var(--primary-dark); border-color: var(--line); }
.directory-results { padding: 2.5rem 0 2rem; }
.profile-hero + .directory-results { padding-top: 2rem; }
.results-title { color: var(--primary-dark); font-size: 1.4rem; margin: 0; }

/* Directory: sort + grid/list switch, grid tiles */
.results-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; }
.results-sort { display: flex; align-items: center; gap: 0.5rem; }
.results-sort .form-select { width: auto; min-width: 11rem; }
.view-toggle { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--white); }
.view-toggle a { display: inline-flex; align-items: center; justify-content: center; width: 2.3rem; height: 2.1rem; color: var(--muted); font-size: 1.05rem; }
.view-toggle a + a { border-left: 1px solid var(--line); }
.view-toggle a:hover { color: var(--primary-dark); }
.view-toggle a.active { background: var(--primary-soft); color: var(--primary-dark); box-shadow: inset 0 -2px 0 var(--accent); }
.driver-tile { display: flex; flex-direction: column; align-items: center; text-align: center; height: 100%; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 1.25rem 1rem 1rem; transition: border-color 0.15s ease, transform 0.15s ease; }
.driver-tile:hover { border-color: var(--primary); transform: translateY(-2px); }
.driver-tile .driver-photo { width: 84px; height: 84px; font-size: 2.2rem; }
.driver-tile h3 { font-size: 1.05rem; margin: 0.75rem 0 0.35rem; }
.driver-tile h3 a { color: var(--ink); }
.driver-tile h3 a:hover { color: var(--primary-dark); }
.driver-tile-actions { display: flex; gap: 0.5rem; width: 100%; margin-top: auto; padding-top: 0.9rem; }
.driver-tile-actions .btn { flex: 1; }

.driver-card { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 1rem; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 1.25rem 1.5rem; margin-bottom: 1rem; }
.driver-card-main { display: flex; gap: 1rem; align-items: center; }
.driver-card h3 { font-size: 1.15rem; margin-bottom: 0.35rem; }
.driver-card-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.driver-photo { width: 64px; height: 64px; border-radius: 8px; object-fit: cover; flex-shrink: 0; }
.driver-photo-empty { display: inline-flex; align-items: center; justify-content: center; background: var(--primary-soft); color: var(--primary-dark); font-size: 1.8rem; }
.driver-meta { display: flex; flex-wrap: wrap; gap: 0.4rem 0.8rem; align-items: center; margin-bottom: 0.35rem; font-size: 0.9rem; }

.stars-line { display: flex; align-items: center; gap: 0.4rem; }
.stars { color: var(--accent); letter-spacing: 0.05em; }

.empty-state { text-align: center; padding: 3rem 1.5rem; }
.empty-state > i { font-size: 3.5rem; color: var(--muted); opacity: 0.5; }
.empty-state h3, .empty-state h1 { margin-top: 0.75rem; }

.profile-hero { background: linear-gradient(135deg, var(--primary-deep), var(--primary-dark)); color: rgba(255, 255, 255, 0.85); padding: 1.75rem 0 2.25rem; }
.profile-hero h1 { color: var(--white); font-size: 1.9rem; margin: 0.35rem 0; }
.profile-hero .driver-meta strong { color: var(--white); }
.back-link { color: rgba(255, 255, 255, 0.8); font-size: 0.9rem; display: inline-block; margin-bottom: 1rem; }
.back-link:hover { color: var(--white); }
.profile-head { display: flex; flex-wrap: wrap; gap: 1.25rem; align-items: center; }
.profile-photo { width: 110px; height: 110px; border-radius: var(--radius-lg); object-fit: cover; border: 3px solid rgba(255, 255, 255, 0.85); font-size: 3rem; }
.verified-badge { display: inline-block; background: #E3F4EB; color: var(--success); font-size: 0.8rem; font-weight: 600; padding: 0.2rem 0.6rem; border-radius: 3px; }

.rating-big { font-size: 3rem; font-weight: 700; color: var(--ink); line-height: 1; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; }
.aspect-bars { list-style: none; padding: 0; margin: 0; }
.aspect-bars li { display: grid; grid-template-columns: 110px 1fr 32px; gap: 0.6rem; align-items: center; font-size: 0.9rem; margin-bottom: 0.5rem; }
.aspect-track { height: 8px; background: var(--page); border-radius: 4px; overflow: hidden; }
.aspect-fill { display: block; height: 100%; background: var(--accent); width: 0; }
.aspect-1 { width: 10%; } .aspect-2 { width: 20%; } .aspect-3 { width: 30%; } .aspect-4 { width: 40%; } .aspect-5 { width: 50%; }
.aspect-6 { width: 60%; } .aspect-7 { width: 70%; } .aspect-8 { width: 80%; } .aspect-9 { width: 90%; } .aspect-10 { width: 100%; }

/* Driver profile: summary + tabs */
@media (min-width: 992px) {
    .profile-summary { position: sticky; top: 90px; }
}
.profile-summary-links { display: flex; flex-direction: column; align-items: flex-start; gap: 0.35rem; margin-top: 1rem; padding-top: 0.9rem; border-top: 1px solid var(--line); font-size: 0.92rem; }
.profile-summary-links .btn-link { font-size: 0.92rem; text-decoration: none; }
.profile-tabs { margin-bottom: 1rem; scroll-margin-top: 90px; }
.profile-tabs button { font-size: 1rem; }
.tab-count { display: inline-block; background: var(--primary-soft); color: var(--primary-dark); font-size: 0.75rem; font-weight: 600; padding: 0 0.4rem; border-radius: 3px; margin-left: 0.2rem; }
.reviews-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1rem; padding-bottom: 0.8rem; border-bottom: 1px solid var(--line); }
.reviews-toolbar .form-select { width: auto; min-width: 9rem; }

.review-item { padding: 1rem 0; border-bottom: 1px solid var(--line); }
.review-item:first-of-type { padding-top: 0; }
.review-item:last-of-type { border-bottom: 0; }

.star-input { display: inline-flex; flex-direction: row-reverse; gap: 0.2rem; }
.star-input input { position: absolute; opacity: 0; pointer-events: none; }
.star-input label { cursor: pointer; color: #D5DBE1; }
.star-input-lg label { font-size: 2rem; }
.star-input-sm label { font-size: 1.2rem; }
.star-input label:hover, .star-input label:hover ~ label, .star-input input:checked ~ label { color: var(--accent); }
.star-input input:focus-visible + label { outline: 2px solid var(--primary); outline-offset: 2px; }

/* Compliance */
.compliance-lights { list-style: none; padding: 0; margin: 0; }
.compliance-lights li { display: flex; align-items: center; gap: 0.6rem; padding: 0.45rem 0; border-bottom: 1px solid var(--line); font-size: 0.92rem; }
.compliance-lights li:last-child { border-bottom: 0; }
.compliance-lights small { color: var(--muted); white-space: nowrap; }
.light-dot { width: 10px; height: 10px; border-radius: 50%; background: #C9D1D8; flex-shrink: 0; }
.light-ok .light-dot { background: var(--success); }
.light-due .light-dot { background: var(--accent); }
.light-expired .light-dot { background: var(--danger); }
.light-expired small { color: var(--danger); }
.renewal-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1.25rem; }
.summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0.75rem; margin-bottom: 1.5rem; }
.summary-tile { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.9rem 1rem; color: var(--ink); }
.summary-tile:hover { border-color: var(--primary); }
.summary-tile.active { border-color: var(--primary-dark); box-shadow: inset 0 -3px 0 var(--accent); }
.summary-tile strong { display: block; font-size: 0.9rem; margin-bottom: 0.3rem; }
.summary-tile span { font-size: 0.82rem; color: var(--muted); }
.summary-tile .num-expired { color: var(--danger); font-weight: 600; }
.summary-tile .num-due { color: var(--accent-dark); font-weight: 600; }

/* Service desk */
.emergency-bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.75rem; background: var(--accent-soft); border: 1px solid #F3D29F; color: var(--accent-dark); border-radius: var(--radius); padding: 0.75rem 1rem; margin-bottom: 1.5rem; font-weight: 500; }
.type-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0.75rem; }
.type-option { cursor: pointer; }
.type-option input { position: absolute; opacity: 0; pointer-events: none; }
.type-option span { display: flex; flex-direction: column; gap: 0.25rem; height: 100%; border: 1px solid var(--line); border-radius: var(--radius); padding: 0.9rem 1rem; }
.type-option i { font-size: 1.4rem; color: var(--primary-dark); }
.type-option small { color: var(--muted); font-size: 0.8rem; }
.type-option input:checked + span { border-color: var(--primary-dark); background: var(--primary-soft); box-shadow: inset 0 -3px 0 var(--accent); }
.type-option input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }
.timeline { list-style: none; padding: 0 0 0 1.1rem; margin: 0; border-left: 2px solid var(--line); }
.timeline-item { position: relative; padding: 0 0 1.25rem 0.75rem; }
.timeline-item::before { content: ''; position: absolute; left: -1.53rem; top: 0.35rem; width: 0.75rem; height: 0.75rem; border-radius: 50%; background: var(--white); border: 2px solid var(--primary); }
.timeline-staff::before { background: var(--primary-dark); border-color: var(--primary-dark); }
.timeline-internal { background: #FFFBF2; border-radius: 6px; padding: 0.5rem 0.75rem; margin-bottom: 0.75rem; }
.timeline-internal::before { border-color: var(--accent); }
.timeline-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; font-size: 0.9rem; margin-bottom: 0.25rem; }
.timeline-meta small { color: var(--muted); }
.timeline-body { color: var(--ink); }

/* Alerts / broadcasts */
.alert-item { display: flex; gap: 0.9rem; background: var(--white); border: 1px solid var(--line); border-left: 4px solid var(--primary); border-radius: var(--radius); padding: 1rem 1.1rem; margin-bottom: 0.75rem; }
.alert-item > i { font-size: 1.4rem; color: var(--primary-dark); }
.alert-type-alert { border-left-color: var(--danger); }
.alert-type-alert > i { color: var(--danger); }
.alert-type-policy { border-left-color: var(--accent); }
.alert-type-policy > i { color: var(--accent-dark); }
.alert-unread { background: #FFFDF8; }
.alert-item-head { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.sms-preview { background: var(--page); border-radius: 10px 10px 10px 2px; padding: 0.8rem 1rem; font-size: 0.92rem; color: var(--ink); max-width: 420px; }
.nav-count { display: inline-block; background: var(--accent); color: var(--ink); font-size: 0.7rem; font-weight: 600; padding: 0 0.35rem; border-radius: 3px; margin-left: 0.2rem; }

/* Donations */
.choice-group { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.choice-group .btn-outline-secondary { flex: 1 1 0; color: var(--ink); border-color: var(--line); }
.choice-group .btn-outline-secondary.active, .choice-group .btn-outline-secondary:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-dark); }
.donation-status { max-width: 560px; margin: 0 auto; text-align: center; padding: 2rem; }
.donation-status-icon { display: block; font-size: 2.6rem; color: var(--primary); margin-bottom: 0.75rem; }

/* Overview queues */
.section-title { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--accent-dark); font-weight: 600; margin: 0 0 0.75rem; }
.queue-card { display: flex; flex-direction: column; gap: 0.2rem; height: 100%; background: var(--white); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 0.75rem 1rem; color: var(--ink); }
.queue-card:hover { border-color: var(--primary); border-left-color: var(--accent-dark); color: var(--ink); }
.queue-head { font-weight: 500; font-size: 0.92rem; }
.queue-head i { color: var(--primary); margin-right: 0.4rem; }
.queue-urgent .queue-head i { color: var(--danger); }
.queue-count { font-size: 1.55rem; color: var(--primary-deep); font-weight: 700; line-height: 1.1; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; }
.queue-card small { color: var(--muted); }
.queue-urgent { border-left-color: var(--danger); }
.queue-clear { border-left-color: var(--line); }
.queue-clear .queue-count { font-size: 1rem; font-weight: 500; color: var(--muted); padding: 0.4rem 0; }

/* Report charts */
.chart-panel { height: 100%; }
.chart-box { position: relative; height: 280px; }
.chart-box-horizontal { height: 300px; }
.chart-table { margin-top: 0.75rem; font-size: 0.88rem; }
.chart-table summary { color: var(--primary-dark); cursor: pointer; }
.chart-table table { margin: 0.5rem 0 0; font-variant-numeric: tabular-nums; }

/* Login page test accounts (non-live only) */
.demo-logins { margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--line); }
.demo-logins-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 0.25rem 1rem; margin-bottom: 0.5rem; }
.demo-logins-head small { color: var(--muted); }
.demo-logins-group { font-size: 0.78rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; margin: 0.75rem 0 0.4rem; }
.demo-logins-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 0.5rem; }
.demo-login { display: flex; flex-direction: column; align-items: flex-start; gap: 0.1rem; text-align: left; background: var(--white); border: 1px solid var(--line); border-radius: 6px; padding: 0.5rem 0.7rem; font-size: 0.85rem; color: var(--ink); }
.demo-login span { color: var(--muted); font-size: 0.8rem; }
.demo-login:hover, .demo-login.active { border-color: var(--primary); background: var(--primary-soft); }

/* Overview widgets */
.welcome-slim { padding: 1rem 1.4rem; }
.welcome-slim small { color: rgba(255, 255, 255, 0.75); }
.kpi { display: flex; flex-direction: column; }
.kpi .stat-value { margin: 0.1rem 0 0.15rem; }
.delta { font-size: 0.78rem; font-weight: 500; }
.delta-up { color: var(--success); }
.delta-down { color: var(--danger); }
.delta-flat { color: var(--muted); font-weight: 400; }
.sparkline-box { position: relative; height: 46px; margin-top: auto; padding-top: 0.5rem; }
.chart-box-sm { height: 230px; }
.chart-box-xs { height: 120px; }
.chart-box-segmented { height: 110px; }
.mini-figures { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; margin-bottom: 0.75rem; }
.mini-figures div { background: var(--primary-soft); border-radius: 6px; padding: 0.55rem 0.75rem; }
.mini-figures div:nth-child(2) { background: var(--accent-soft); }
.mini-figures div:nth-child(3) { background: var(--sand); }
.mini-figures strong { display: block; font-size: 1.35rem; color: var(--primary-deep); font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; }
.mini-figures span { font-size: 0.78rem; color: var(--muted); }
.feed-panel { height: 100%; }
.feed-list { list-style: none; margin: 0; padding: 0; }
.feed-list li { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.75rem; padding: 0.45rem 0; border-bottom: 1px solid var(--line); font-size: 0.9rem; }
.feed-list li:last-child { border-bottom: 0; }
.feed-list small { display: block; color: var(--muted); font-size: 0.78rem; }
.feed-side { color: var(--muted); font-size: 0.75rem; white-space: nowrap; }

/* Searchable dropdowns (Tom Select, bootstrap5 theme) matched to our inputs */
.ts-wrapper .ts-control { border-radius: 6px; border-color: var(--line); background-color: var(--input); padding: 0.45rem 0.75rem; min-height: calc(1.5em + 0.9rem + 2px); font-weight: 400; }
.ts-wrapper.focus .ts-control { border-color: var(--primary); background-color: var(--white); box-shadow: 0 0 0 3px rgba(0, 173, 239, 0.15); }
.ts-wrapper.is-invalid .ts-control { border-color: var(--danger); }
.ts-dropdown { border-color: var(--line); border-radius: 6px; box-shadow: var(--shadow); font-weight: 400; z-index: 1060; }
.ts-dropdown .dropdown-input { border-color: var(--line); border-radius: 4px; margin: 0.4rem; width: calc(100% - 0.8rem); padding: 0.35rem 0.6rem; }
.ts-dropdown .active { background: var(--primary-soft); color: var(--primary-dark); }
.ts-dropdown .no-results { padding: 0.5rem 0.75rem; color: var(--muted); }
.ts-wrapper.multi .ts-control > div { background: var(--primary-soft); color: var(--primary-dark); border-radius: 3px; }
.filters .ts-wrapper { width: auto; min-width: 170px; }
.form-control-sm + .ts-wrapper .ts-control, .ts-wrapper.form-select-sm .ts-control { padding: 0.25rem 0.5rem; min-height: 0; font-size: 0.85rem; }
