/* ==========================================================================
   Family Connect Admin
   Colours and shapes follow the mobile app (src/theme/colors.ts):
   primary #4F46E5, primaryDark #3730A3, background #F8FAFC, surface #FFFFFF,
   text #111827 / #6B7280 / #9CA3AF, border #E5E7EB, error #DC2626, success #16A34A.
   ========================================================================== */

@font-face {
    font-family: "Inter";
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("../lib/inter/Inter-Regular.woff2") format("woff2");
}

@font-face {
    font-family: "Inter";
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url("../lib/inter/Inter-Medium.woff2") format("woff2");
}

@font-face {
    font-family: "Inter";
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url("../lib/inter/Inter-SemiBold.woff2") format("woff2");
}

@font-face {
    font-family: "Inter";
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url("../lib/inter/Inter-Bold.woff2") format("woff2");
}

:root {
    /* app palette */
    --primary: #4F46E5;
    --primary-dark: #3730A3;
    --primary-hover: #4338CA;
    --primary-50: #EEF2FF;
    --primary-100: #E0E7FF;
    --primary-200: #C7D2FE;
    --accent: #EC4899;            /* the heart in the app icon */
    --bg: #F8FAFC;
    --surface: #FFFFFF;
    --ink: #111827;
    --ink-2: #374151;
    --muted: #6B7280;
    --faint: #9CA3AF;
    --line: #E5E7EB;
    --line-soft: #F1F5F9;
    --input-bg: #F9FAFB;
    --success: #16A34A;
    --success-50: #F0FDF4;
    --warning: #D97706;
    --warning-50: #FFFBEB;
    --danger: #DC2626;
    --danger-50: #FEF2F2;
    --info: #0284C7;
    --info-50: #F0F9FF;

    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 2px rgba(17, 24, 39, .04);
    --shadow: 0 1px 3px rgba(17, 24, 39, .05), 0 4px 16px rgba(17, 24, 39, .04);
    --shadow-lg: 0 12px 40px rgba(55, 48, 163, .12);
    --sidebar-w: 264px;
    --topbar-h: 64px;

    /* Bootstrap variables */
    --bs-body-font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --bs-body-font-size: .9375rem;
    --bs-body-color: #111827;
    --bs-body-bg: #F8FAFC;
    --bs-border-color: #E5E7EB;
    --bs-secondary-color: #6B7280;
    --bs-primary: #4F46E5;
    --bs-primary-rgb: 79, 70, 229;
    --bs-success-rgb: 22, 163, 74;
    --bs-danger-rgb: 220, 38, 38;
    --bs-link-color: #4F46E5;
    --bs-link-color-rgb: 79, 70, 229;
    --bs-link-hover-color: #3730A3;
    --bs-link-hover-color-rgb: 55, 48, 163;
    --bs-border-radius: 10px;
    --bs-border-radius-sm: 8px;
    --bs-border-radius-lg: 12px;
    --bs-focus-ring-color: rgba(79, 70, 229, .25);
}

html {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background: var(--bg);
    color: var(--ink);
    font-feature-settings: "cv11", "ss01";
    letter-spacing: -.003em;
}

a {
    text-decoration: none;
}

code {
    color: var(--primary-dark);
    font-size: .82em;
}

.min-w-0 {
    min-width: 0;
}

/* ---------- buttons ---------- */

.btn {
    --bs-btn-font-weight: 600;
    --bs-btn-border-radius: 10px;
    --bs-btn-padding-y: .5rem;
    --bs-btn-padding-x: 1rem;
    transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s, transform .05s;
}

.btn:active {
    transform: translateY(1px);
}

.btn-sm {
    --bs-btn-padding-y: .32rem;
    --bs-btn-padding-x: .7rem;
    --bs-btn-font-size: .82rem;
    --bs-btn-border-radius: 8px;
}

.btn-lg {
    --bs-btn-padding-y: .75rem;
    --bs-btn-font-size: 1rem;
    --bs-btn-border-radius: 12px;
}

.btn-primary {
    --bs-btn-bg: var(--primary);
    --bs-btn-border-color: var(--primary);
    --bs-btn-hover-bg: var(--primary-hover);
    --bs-btn-hover-border-color: var(--primary-hover);
    --bs-btn-active-bg: var(--primary-dark);
    --bs-btn-active-border-color: var(--primary-dark);
    --bs-btn-disabled-bg: var(--primary);
    --bs-btn-disabled-border-color: var(--primary);
    --bs-btn-focus-shadow-rgb: 79, 70, 229;
    box-shadow: 0 1px 2px rgba(79, 70, 229, .25);
}

.btn-outline-primary {
    --bs-btn-color: var(--primary);
    --bs-btn-border-color: var(--primary-200);
    --bs-btn-hover-bg: var(--primary-50);
    --bs-btn-hover-color: var(--primary-dark);
    --bs-btn-hover-border-color: var(--primary-200);
    --bs-btn-active-bg: var(--primary-100);
    --bs-btn-active-color: var(--primary-dark);
    --bs-btn-active-border-color: var(--primary-200);
}

.btn-outline-secondary {
    --bs-btn-color: var(--ink-2);
    --bs-btn-bg: var(--surface);
    --bs-btn-border-color: var(--line);
    --bs-btn-hover-bg: var(--line-soft);
    --bs-btn-hover-color: var(--ink);
    --bs-btn-hover-border-color: #D1D5DB;
    --bs-btn-active-bg: #E5E7EB;
    --bs-btn-active-color: var(--ink);
    --bs-btn-active-border-color: #D1D5DB;
}

.btn-outline-danger {
    --bs-btn-color: var(--danger);
    --bs-btn-bg: var(--surface);
    --bs-btn-border-color: #FECACA;
    --bs-btn-hover-bg: var(--danger-50);
    --bs-btn-hover-color: #B91C1C;
    --bs-btn-hover-border-color: #FCA5A5;
    --bs-btn-active-bg: #FEE2E2;
    --bs-btn-active-color: #B91C1C;
    --bs-btn-active-border-color: #FCA5A5;
}

.btn-outline-success {
    --bs-btn-color: var(--success);
    --bs-btn-bg: var(--surface);
    --bs-btn-border-color: #BBF7D0;
    --bs-btn-hover-bg: var(--success-50);
    --bs-btn-hover-color: #15803D;
    --bs-btn-hover-border-color: #86EFAC;
    --bs-btn-active-bg: #DCFCE7;
    --bs-btn-active-color: #15803D;
    --bs-btn-active-border-color: #86EFAC;
}

.btn-danger {
    --bs-btn-bg: var(--danger);
    --bs-btn-border-color: var(--danger);
    --bs-btn-hover-bg: #B91C1C;
    --bs-btn-hover-border-color: #B91C1C;
}

.btn-success {
    --bs-btn-bg: var(--success);
    --bs-btn-border-color: var(--success);
    --bs-btn-hover-bg: #15803D;
    --bs-btn-hover-border-color: #15803D;
}

.btn-link {
    --bs-btn-color: var(--muted);
    --bs-btn-hover-color: var(--ink);
    --bs-btn-font-weight: 500;
}

.icon-btn {
    width: 40px;
    height: 40px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    color: var(--ink);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
}

/* ---------- forms (like the app inputs: light grey fill, rounded) ---------- */

.form-label {
    font-size: .82rem;
    font-weight: 600;
    color: var(--ink-2);
    margin-bottom: .35rem;
}

.form-label.small {
    font-size: .78rem;
}

.form-control,
.form-select {
    background-color: var(--input-bg);
    border-color: var(--line);
    border-radius: 10px;
    color: var(--ink);
    padding: .55rem .8rem;
}

.form-control-sm,
.form-select-sm {
    padding: .4rem .7rem;
    border-radius: 8px;
    font-size: .85rem;
}

.form-control-lg {
    padding: .75rem 1rem;
    font-size: 1rem;
    border-radius: 12px;
}

.form-control::placeholder {
    color: var(--faint);
}

.form-control:focus,
.form-select:focus {
    background-color: var(--surface);
    border-color: #A5B4FC;
    box-shadow: 0 0 0 4px rgba(79, 70, 229, .12);
}

.form-check-input {
    border-color: #D1D5DB;
}

.form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

.form-check-input:focus {
    box-shadow: 0 0 0 4px rgba(79, 70, 229, .12);
    border-color: #A5B4FC;
}

.form-text {
    color: var(--muted);
    font-size: .78rem;
}

.input-icon {
    position: relative;
}

.input-icon > i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--faint);
    pointer-events: none;
}

.input-icon > .form-control {
    padding-left: 2.6rem;
}

/* ---------- badges: soft pills ---------- */

.badge {
    font-weight: 600;
    font-size: .72rem;
    padding: .32em .65em;
    border-radius: 999px;
    letter-spacing: .01em;
}

.text-bg-success {
    background: var(--success-50) !important;
    color: #15803D !important;
    box-shadow: inset 0 0 0 1px #BBF7D0;
}

.text-bg-danger {
    background: var(--danger-50) !important;
    color: #B91C1C !important;
    box-shadow: inset 0 0 0 1px #FECACA;
}

.text-bg-warning {
    background: var(--warning-50) !important;
    color: #B45309 !important;
    box-shadow: inset 0 0 0 1px #FDE68A;
}

.text-bg-secondary {
    background: #F3F4F6 !important;
    color: #4B5563 !important;
    box-shadow: inset 0 0 0 1px #E5E7EB;
}

.text-bg-primary {
    background: var(--primary-50) !important;
    color: var(--primary-dark) !important;
    box-shadow: inset 0 0 0 1px var(--primary-200);
}

.text-bg-light {
    background: var(--surface) !important;
    color: var(--muted) !important;
}

.text-bg-light.border {
    border-color: var(--line) !important;
}

.role-badge {
    background: var(--primary-50);
    color: var(--primary-dark);
    box-shadow: inset 0 0 0 1px var(--primary-200);
}

.action-badge {
    background: #F3F4F6;
    color: var(--ink-2);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-weight: 500;
    border-radius: 6px;
}

/* ---------- alerts ---------- */

.alert {
    border-radius: var(--radius);
    border: 1px solid transparent;
    font-size: .9rem;
    padding: .8rem 1rem;
}

.alert-success {
    background: var(--success-50);
    border-color: #BBF7D0;
    color: #166534;
}

.alert-danger {
    background: var(--danger-50);
    border-color: #FECACA;
    color: #991B1B;
}

.alert-warning {
    background: var(--warning-50);
    border-color: #FDE68A;
    color: #92400E;
}

.alert-info {
    background: var(--primary-50);
    border-color: var(--primary-200);
    color: var(--primary-dark);
}

/* ==========================================================================
   App shell: fixed white sidebar + top bar
   ========================================================================== */

.app-body {
    min-height: 100vh;
}

.sidebar {
    --bs-offcanvas-width: var(--sidebar-w);
    --bs-offcanvas-bg: var(--surface);
    background: var(--surface);
}

.sidebar-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: .5rem;
    height: var(--topbar-h);
    padding: 0 1.25rem;
    border-bottom: 1px solid var(--line-soft);
    flex: 0 0 auto;
}

.brand {
    display: flex;
    align-items: center;
    gap: .7rem;
    color: var(--ink);
}

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

.brand-logo {
    width: 38px;
    height: 38px;
    border-radius: 11px;
    box-shadow: 0 4px 12px rgba(79, 70, 229, .25);
}

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

.brand-name {
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: -.015em;
}

.brand-sub {
    font-size: .72rem;
    color: var(--muted);
    font-weight: 500;
}

.brand-tag {
    font-size: .66rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--primary);
    background: var(--primary-50);
    border-radius: 999px;
    padding: .12rem .5rem;
    vertical-align: middle;
}

.side-nav {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 1rem .85rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.side-heading {
    margin: 1.1rem .75rem .4rem;
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--faint);
}

.side-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .6rem .8rem;
    border-radius: 10px;
    color: var(--ink-2);
    font-size: .9rem;
    font-weight: 500;
    transition: background-color .12s, color .12s;
}

.side-link i {
    font-size: 1.1rem;
    width: 1.25rem;
    text-align: center;
    color: var(--faint);
    transition: color .12s;
}

.side-link:hover {
    background: var(--line-soft);
    color: var(--ink);
}

.side-link:hover i {
    color: var(--ink-2);
}

.side-link.active {
    background: var(--primary-50);
    color: var(--primary-dark);
    font-weight: 600;
}

.side-link.active i {
    color: var(--primary);
}


.sidebar-foot {
    flex: 0 0 auto;
    padding: .85rem;
    border-top: 1px solid var(--line-soft);
}

.side-user {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .55rem .6rem;
    border-radius: 12px;
    background: var(--bg);
}

.side-user-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.2;
}

.side-user-name {
    font-weight: 600;
    font-size: .85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.side-user-role {
    font-size: .72rem;
    color: var(--muted);
}

/* avatar: indigo circle like the app's profile avatar */
.avatar {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .9rem;
    color: #fff;
    background: linear-gradient(135deg, #6366F1, var(--primary));
}

.avatar-sm {
    width: 32px;
    height: 32px;
    flex-basis: 32px;
    font-size: .75rem;
}

.main {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 1020;
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: 0 1rem;
    background: rgba(248, 250, 252, .85);
    backdrop-filter: saturate(180%) blur(8px);
    border-bottom: 1px solid var(--line);
}

.topbar-title {
    font-weight: 600;
    font-size: .95rem;
    color: var(--ink-2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.time-chip {
    align-items: center;
    gap: .4rem;
    font-size: .78rem;
    font-weight: 500;
    color: var(--muted);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: .35rem .75rem;
}

.user-button {
    display: flex;
    align-items: center;
    gap: .55rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: .2rem .75rem .2rem .2rem;
    background: var(--surface);
    font-size: .875rem;
    font-weight: 500;
    color: var(--ink);
}

.user-button:hover {
    border-color: #D1D5DB;
}

.user-button-name {
    max-width: 160px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dropdown-menu {
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: var(--shadow-lg);
    padding: .4rem;
    min-width: 260px;
    font-size: .9rem;
}

.dropdown-profile {
    display: flex;
    gap: .75rem;
    align-items: center;
    padding: .6rem .6rem .5rem;
}

.dropdown-item {
    border-radius: 8px;
    padding: .5rem .65rem;
    font-weight: 500;
}

.dropdown-item:active {
    background: var(--primary-50);
    color: var(--primary-dark);
}

.content {
    flex: 1 1 auto;
    padding: 1.5rem 1rem 2rem;
    max-width: 1440px;
    width: 100%;
}

.content-footer {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-top: 2.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--line);
    font-size: .76rem;
    color: var(--faint);
}

.content-footer img {
    border-radius: 5px;
    opacity: .85;
}

@media (min-width: 992px) {
    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        width: var(--sidebar-w);
        border-right: 1px solid var(--line);
        z-index: 1030;
        /* Bootstrap makes .offcanvas-lg transparent on large screens */
        background-color: var(--surface) !important;
    }

    .main {
        margin-left: var(--sidebar-w);
    }

    .topbar {
        padding: 0 2rem;
    }

    .content {
        padding: 2rem 2rem 2.5rem;
    }
}

/* ==========================================================================
   Page parts
   ========================================================================== */

.page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.page-head h1 {
    font-size: 1.65rem;
    font-weight: 700;
    letter-spacing: -.025em;
    margin: 0;
}

.page-sub {
    margin: .3rem 0 0;
    color: var(--muted);
    font-size: .92rem;
}

.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 1.35rem 1.5rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow-sm);
}

.panel.p-0 {
    overflow: hidden;
}

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

.panel-head h2 {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -.01em;
    margin: 0;
}

.panel-head h2 i {
    color: var(--primary);
}

.form-panel {
    max-width: 580px;
}

.form-panel-wide {
    max-width: 880px;
}

.filter-bar {
    padding: 1rem 1.25rem;
}

.danger-zone {
    border-color: #FECACA;
    background: linear-gradient(180deg, #FFFBFB, var(--surface) 40%);
}

.danger-zone h2 {
    color: #B91C1C;
}

/* stat cards like the app's tinted icon tiles */
.stat-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    height: 100%;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 1.1rem 1.25rem;
    box-shadow: var(--shadow-sm);
    transition: box-shadow .15s, transform .15s;
}

.stat-card:hover {
    box-shadow: var(--shadow);
}

.stat-icon {
    width: 46px;
    height: 46px;
    flex: 0 0 46px;
    border-radius: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    background: var(--primary-50);
    color: var(--primary);
}

.stat-icon.ok {
    background: var(--success-50);
    color: var(--success);
}

.stat-icon.bad {
    background: var(--danger-50);
    color: var(--danger);
}

.stat-icon.warn {
    background: var(--warning-50);
    color: var(--warning);
}

.stat-icon.sky {
    background: var(--info-50);
    color: var(--info);
}

.stat-label {
    display: block;
    font-size: .78rem;
    font-weight: 500;
    color: var(--muted);
}

.stat-value {
    font-size: 1.55rem;
    font-weight: 700;
    letter-spacing: -.025em;
    line-height: 1.25;
}

.stat-note {
    font-size: .76rem;
    color: var(--muted);
}

a.stat-note {
    color: var(--primary);
    font-weight: 600;
}

/* ---------- tables ---------- */

.table {
    --bs-table-hover-bg: #FAFAFF;
    --bs-table-border-color: var(--line-soft);
    margin-bottom: 0;
}

.data-table thead th {
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--muted);
    background: #FAFBFC;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}

.data-table td,
.data-table th {
    padding: .85rem 1.1rem;
}

.data-table tbody tr:last-child td {
    border-bottom: 0;
}

.data-table a.fw-semibold {
    color: var(--ink);
}

.data-table a.fw-semibold:hover {
    color: var(--primary);
}

.mini-table td,
.mini-table th {
    padding: .55rem .7rem;
    font-size: .875rem;
}

.mini-table thead th {
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--muted);
}

.row-muted td {
    color: var(--faint);
}

.details-cell {
    max-width: 380px;
    word-break: break-word;
}

/* ---------- tabs (pill segmented control) ---------- */

.status-tabs {
    display: inline-flex;
    flex-wrap: wrap;
    gap: .25rem;
    padding: .25rem;
    margin-bottom: 1rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
}

.status-tab {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    padding: .42rem .9rem;
    border-radius: 9px;
    color: var(--muted);
    font-size: .85rem;
    font-weight: 500;
}

.status-tab:hover {
    background: var(--line-soft);
    color: var(--ink);
}

.status-tab.active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 1px 2px rgba(79, 70, 229, .3);
}

.status-tab .count {
    font-size: .72rem;
    font-weight: 600;
    background: rgba(17, 24, 39, .06);
    border-radius: 999px;
    padding: 0 .45rem;
}

.status-tab.active .count {
    background: rgba(255, 255, 255, .22);
}

/* ---------- people ---------- */

.user-initials {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: .78rem;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #818CF8, var(--primary));
}

.user-initials.deleted {
    background: #E5E7EB;
    color: var(--faint);
}

.user-avatar-lg {
    width: 60px;
    height: 60px;
    flex: 0 0 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #6366F1, var(--primary));
    box-shadow: 0 6px 18px rgba(79, 70, 229, .25);
}

.info-list {
    display: grid;
    grid-template-columns: 9.5rem 1fr;
    gap: .6rem 1rem;
    margin: 0;
    font-size: .9rem;
}

.info-list dt {
    color: var(--muted);
    font-weight: 500;
}

.info-list dd {
    margin: 0;
    word-break: break-word;
}

/* ---------- permissions ---------- */

.perm-box {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.1rem;
    background: var(--bg);
}

.perm-note {
    font-size: .85rem;
    color: var(--primary-dark);
    background: var(--primary-50);
    border: 1px solid var(--primary-200);
    border-radius: 10px;
    padding: .55rem .8rem;
    margin-bottom: .9rem;
}

.perm-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem 1.5rem;
}

.perm-group-title {
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--faint);
    margin-bottom: .45rem;
}

.perm-item {
    margin-bottom: .5rem;
}

.perm-item .form-check-label {
    font-weight: 500;
    font-size: .9rem;
}

.perm-help {
    display: block;
    font-size: .76rem;
    font-weight: 400;
    color: var(--muted);
}

.perm-cell {
    max-width: 320px;
}

.perm-chip {
    display: inline-block;
    font-size: .72rem;
    font-weight: 500;
    background: var(--line-soft);
    color: var(--ink-2);
    border-radius: 999px;
    padding: .12rem .55rem;
    margin: 0 .2rem .25rem 0;
    white-space: nowrap;
}

/* ---------- dashboard ---------- */

.health-panel {
    position: relative;
    overflow: hidden;
    border-left: 0;
}

.health-panel::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    background: var(--success);
}

.health-panel.health-warn::before {
    background: #F59E0B;
}

.health-panel.health-bad::before {
    background: var(--danger);
}

.health-panel.health-unknown::before {
    background: var(--faint);
}

.health-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .9rem 1.5rem;
}

.health-head h2 {
    font-size: 1rem;
    font-weight: 700;
}

.health-icon {
    width: 46px;
    height: 46px;
    border-radius: 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    background: var(--success-50);
    color: var(--success);
}

.health-warn .health-icon {
    background: var(--warning-50);
    color: #F59E0B;
}

.health-bad .health-icon {
    background: var(--danger-50);
    color: var(--danger);
}

.health-unknown .health-icon {
    background: #F3F4F6;
    color: var(--faint);
}

.health-title {
    color: var(--muted);
    font-size: .88rem;
}

.health-counts {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem 2rem;
}

.health-counts > div {
    display: flex;
    flex-direction: column;
}

.health-counts strong {
    font-size: 1.05rem;
}

.chart-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    margin-bottom: .75rem;
}

.chart-title {
    font-weight: 700;
}

.chart-total {
    font-size: .78rem;
    color: var(--muted);
}

.bar-chart {
    width: 100%;
    height: auto;
    display: block;
}

/* ---------- feedback ---------- */

.feedback-message {
    white-space: pre-wrap;
    word-break: break-word;
    font-size: .95rem;
    line-height: 1.6;
}

.report-box {
    max-height: 540px;
    overflow: auto;
    background: #0F172A;
    color: #E2E8F0;
    border-radius: var(--radius);
    padding: 1rem 1.1rem;
    font-size: .78rem;
    line-height: 1.55;
    white-space: pre-wrap;
    word-break: break-word;
    margin: 0;
}

.validation-box.validation-summary-valid {
    display: none;
}

.validation-box ul {
    margin: 0;
    padding-left: 1.1rem;
}

/* ==========================================================================
   Sign-in and error pages
   ========================================================================== */

.plain-body {
    min-height: 100vh;
    background: var(--bg);
}

.auth-shell {
    display: flex;
    min-height: 100vh;
}

.auth-brand {
    display: none;
    position: relative;
    overflow: hidden;
    flex: 0 0 44%;
    max-width: 640px;
    color: #fff;
    background:
        radial-gradient(600px 400px at 15% 10%, rgba(255, 255, 255, .16), transparent 60%),
        radial-gradient(500px 500px at 90% 100%, rgba(236, 72, 153, .28), transparent 60%),
        linear-gradient(150deg, #6366F1 0%, #4F46E5 45%, #3730A3 100%);
}

.auth-brand-inner {
    position: relative;
    max-width: 420px;
    margin: auto;
    padding: 3rem;
}

.auth-logo {
    width: 72px;
    height: 72px;
    border-radius: 20px;
    box-shadow: 0 12px 30px rgba(17, 24, 39, .25);
    margin-bottom: 1.75rem;
}

.auth-brand h2 {
    font-size: 2.1rem;
    font-weight: 700;
    letter-spacing: -.03em;
    margin-bottom: .6rem;
}

.auth-brand p {
    font-size: 1.05rem;
    color: rgba(255, 255, 255, .82);
    margin-bottom: 2rem;
}

.auth-points {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: .85rem;
}

.auth-points li {
    display: flex;
    align-items: center;
    gap: .75rem;
    font-size: .92rem;
    color: rgba(255, 255, 255, .9);
}

.auth-points i {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, .14);
}

.auth-main {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.auth-mobile-brand {
    display: flex;
    align-items: center;
    gap: .6rem;
    margin-bottom: 1.75rem;
    font-weight: 700;
    font-size: 1.15rem;
}

.auth-mobile-brand img {
    border-radius: 12px;
    box-shadow: 0 6px 16px rgba(79, 70, 229, .25);
}

.auth-card,
.plain-card {
    width: 100%;
    max-width: 420px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 2.25rem 2rem;
    box-shadow: var(--shadow);
}

.auth-card h1 {
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -.025em;
    margin-bottom: .35rem;
}

.auth-sub {
    color: var(--muted);
    font-size: .92rem;
    margin-bottom: 1.75rem;
}

.plain-icon {
    width: 60px;
    height: 60px;
    border-radius: 16px;
    margin: 0 auto 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    background: var(--primary-50);
    color: var(--primary);
}

.plain-icon.bad {
    background: var(--danger-50);
    color: var(--danger);
}

.plain-code {
    font-size: 1.15rem;
    font-weight: 700;
}

.plain-footer {
    margin-top: 1.5rem;
    text-align: center;
    font-size: .78rem;
    color: var(--faint);
}

@media (min-width: 992px) {
    .auth-brand {
        display: flex;
    }

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

/* phones: stat cards stack the icon above the number */
@media (max-width: 575.98px) {
    .stat-card {
        flex-direction: column;
        align-items: flex-start;
        gap: .6rem;
        padding: 1rem;
    }

    .stat-icon {
        width: 38px;
        height: 38px;
        flex-basis: 38px;
        font-size: 1.1rem;
    }

    .page-head h1 {
        font-size: 1.4rem;
    }

    .panel {
        padding: 1.1rem;
    }
}
