/* Shared approved foundation: forms, buttons, sidebar, cards, alerts and dialogs. */
@font-face {
    font-family: Tajawal;
    src: url('../vendor/tajawal/Tajawal-Regular.ttf') format('truetype');
    font-weight: 400;
    font-display: swap;
}

@font-face {
    font-family: Tajawal;
    src: url('../vendor/tajawal/Tajawal-Medium.ttf') format('truetype');
    font-weight: 500;
    font-display: swap;
}

@font-face {
    font-family: Tajawal;
    src: url('../vendor/tajawal/Tajawal-Bold.ttf') format('truetype');
    font-weight: 700;
    font-display: swap;
}

html {
    overflow-x: clip;
}

body {
    margin: 0;
    background: var(--canvas);
    color: var(--ink);
    font: 400 var(--font-body)/1.6 Tajawal, system-ui, sans-serif;
}

a {
    color: var(--brand-purple);
    text-underline-offset: 3px;
}

a:hover {
    color: #5c0f6b;
}

button,
input,
select,
textarea {
    font-family: inherit;
}

button {
    cursor: pointer;
}

[hidden] {
    display: none !important;
}

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

h1,
h2,
h3,
h4,
p {
    overflow-wrap: anywhere;
}

h1 {
    font-size: var(--font-title);
    font-weight: 700;
    line-height: 1.3;
}

h2 {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.3;
}

h3,
h4 {
    font-size: 16px;
    line-height: 1.3;
}

p {
    margin-block-end: var(--space-3);
}

.text-muted {
    color: var(--muted) !important;
}

.ui-icon {
    width: 20px;
    height: 20px;
    display: inline-block;
    flex: none;
    vertical-align: middle;
}

.ui-icon.directional {
    transform: scaleX(1);
}

[dir=ltr] .ui-icon.directional {
    transform: scaleX(-1);
}

.skip-link {
    position: fixed;
    inset-block-start: -80px;
    inset-inline-start: 16px;
    padding: 12px 16px;
    background: var(--surface);
    z-index: 1100;
    border: 1px solid var(--brand-purple);
    border-radius: 8px;
}

.skip-link:focus {
    inset-block-start: 8px;
}

/* buttons.html: premium soft button family. */
.btn,
.screen-action {
    --bs-btn-font-size: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: var(--button-height);
    padding: 0 18px;
    border: 1px solid var(--brand-purple-200);
    border-radius: var(--radius-control);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    text-decoration: none;
    white-space: nowrap;
    transition: background .15s, box-shadow .15s;
}

.btn .ui-icon,
.screen-action .ui-icon {
    width: 16px;
    height: 16px;
}

.btn-primary {
    --bs-btn-color: #fff;
    --bs-btn-bg: var(--brand-purple);
    --bs-btn-border-color: var(--brand-purple);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: #5c0f6b;
    --bs-btn-hover-border-color: #5c0f6b;
    --bs-btn-active-bg: #5c0f6b;
    --bs-btn-active-border-color: #5c0f6b;
    --bs-btn-disabled-bg: var(--brand-purple);
    --bs-btn-disabled-border-color: var(--brand-purple);
    box-shadow: 0 1px 2px rgb(40 20 50 / 10%), 0 2px 6px -3px rgb(40 20 50 / 12%);
}

.btn-success {
    --bs-btn-color: #fff;
    --bs-btn-bg: var(--brand-dark-green);
    --bs-btn-border-color: var(--brand-dark-green);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--brand-dark-green);
    --bs-btn-hover-border-color: var(--brand-dark-green);
    --bs-btn-active-bg: var(--brand-dark-green);
    --bs-btn-active-border-color: var(--brand-dark-green);
}

.btn-outline-primary,
.btn-light,
.screen-action {
    color: var(--brand-purple);
    background: var(--surface);
    border-color: var(--brand-purple-200);
}

.btn-outline-primary:hover,
.btn-light:hover,
.screen-action:hover {
    color: var(--brand-purple);
    background: var(--brand-purple-50);
    border-color: var(--brand-purple-400);
}

.btn-link {
    color: var(--brand-purple);
    border-color: transparent;
    background: transparent;
}

.btn-sm,
.screen-action {
    min-height: 34px;
    padding-inline: 12px;
    font-size: 13px;
}

.btn:disabled,
.btn.disabled,
.screen-action:disabled {
    background: #f1f1f3;
    color: #6f6f79;
    border-color: #e3e3e7;
    opacity: 1;
    cursor: not-allowed;
    box-shadow: none;
}

.btn:focus-visible,
.screen-action:focus-visible {
    outline: 2px solid var(--brand-purple);
    outline-offset: 2px;
    box-shadow: none;
}

.btn-danger,
.screen-action.danger {
    color: var(--danger);
    background: #fdf1f1;
    border-color: #f0bdb8;
}

.screen-action.green {
    color: var(--brand-dark-green);
    background: var(--brand-green-50);
    border-color: var(--brand-green-100);
}

.is-working {
    opacity: .75;
    cursor: wait;
}

.is-working::before {
    content: '';
    width: 14px;
    height: 14px;
    border: 2px solid currentColor;
    border-inline-end-color: transparent;
    border-radius: 50%;
    animation: button-spin .8s linear infinite;
}

@keyframes button-spin {
    to {
        transform: rotate(360deg);
    }
}

/* form-controls.html: control, label, choice and validation patterns. */
.field-group {
    margin-block-end: 16px;
    min-width: 0;
}

.form-label {
    display: block;
    color: var(--ink);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
    margin-block-end: 5px;
}

.required-marker {
    color: var(--danger);
    margin-inline-start: 4px;
}

.form-control,
.form-select {
    min-height: var(--control-height);
    height: var(--control-height);
    padding: 0 12px;
    border: 1px solid var(--border-control);
    border-radius: 8px;
    background-color: var(--surface);
    color: var(--ink);
    font-size: 14px;
    line-height: 1.5;
}

.form-control:hover,
.form-select:hover {
    border-color: var(--brand-lilac);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--brand-purple);
    background-color: var(--surface);
    color: var(--ink);
    box-shadow: 0 0 0 3px rgb(164 80 175 / 25%);
    outline: 0;
}

.form-control::placeholder {
    color: #7e7387;
    opacity: 1;
}

.form-control[readonly] {
    background: #f4f1f6;
    border-style: dashed;
    color: #4b4153;
}

.form-control:disabled,
.form-select:disabled {
    background: #f0edf2;
    border-color: #e4dee8;
    color: #8e8498;
    cursor: not-allowed;
}

textarea.form-control {
    height: auto;
    min-height: 96px;
    padding: 10px 12px;
    line-height: 1.6;
    resize: vertical;
}

.form-control.is-invalid,
.form-select.is-invalid {
    border-color: var(--danger);
    background-color: var(--danger-soft);
}

.form-text,
.invalid-feedback {
    font-size: 12px;
    line-height: 1.5;
    margin-block-start: 4px;
}

.form-text {
    color: var(--muted);
}

.invalid-feedback {
    color: var(--danger);
}

.invalid-feedback:empty {
    display: none !important;
}

.input-wrap {
    position: relative;
}

.input-wrap:has(.password-toggle) .form-control {
    padding-inline-end: 92px;
}

.password-toggle {
    position: absolute;
    inset-inline-end: 8px;
    top: 6px;
    min-height: 28px;
    padding: 0 6px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--brand-purple);
    font-size: 12px;
}

.password-toggle:hover {
    background: var(--brand-purple-50);
}

.password-toggle .ui-icon {
    width: 16px;
    height: 16px;
}

.form-check-input {
    width: 20px;
    height: 20px;
    border: 1.5px solid #8e8498;
    box-shadow: none;
    margin: 0;
    flex: none;
}

.form-check-input[type=checkbox] {
    border-radius: 5px;
}

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

.form-check-input:focus {
    border-color: var(--brand-purple);
    box-shadow: 0 0 0 3px rgb(164 80 175 / 25%);
}

.form-select {
    padding-inline-end: 36px;
}

.form-actions,
.social-form-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-block-start: 20px;
}

/* sidebar.html and DESIGN_SYSTEM.md §4.2: the shared shell. */
.brand {
    display: inline-flex;
    gap: 12px;
    align-items: center;
    color: var(--brand-purple);
    text-decoration: none;
    min-width: 0;
}

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

.brand-mark {
    display: grid;
    place-items: center;
    width: 54px;
    height: 54px;
    flex: none;
    background: var(--surface);
    border-radius: 14px;
    border: 1px solid rgb(113 20 132 / 12%);
    overflow: hidden;
}

.brand-mark img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.brand strong {
    display: block;
    font-size: 19px;
    line-height: 1.25;
    font-weight: 700;
}

.brand small {
    display: block;
    font-size: 12px;
    color: var(--muted);
    margin-block-start: 3px;
}

.app-frame {
    display: grid;
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
    min-height: 100dvh;
}

.sidebar {
    background: var(--surface);
    border-inline-end: 1px solid rgb(113 20 132 / 10%);
    display: flex;
    flex-direction: column;
    padding: 0;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 18px;
    background: var(--gradient-purple-soft);
}

.sidebar-brand .btn-close {
    margin-inline-start: auto;
}

.sidebar-section-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 700;
    color: var(--brand-dark-green);
    background: var(--brand-dark-green-50);
    margin: 16px 12px 6px;
    padding: 7px 12px;
    border-radius: 8px;
}

.sidebar-section-label::before {
    content: '';
    width: 4px;
    height: 14px;
    background: var(--brand-green);
    border-radius: 2px;
}

.sidebar-nav {
    padding-inline: 12px;
}

.sidebar-nav .nav-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 42px;
    margin-block-end: 2px;
    padding: 10px 12px;
    border-radius: 10px;
    color: var(--ink);
    font-size: 14px;
    line-height: 1.45;
    font-weight: 500;
    text-decoration: none;
}

.sidebar-nav .nav-item .ui-icon {
    width: 20px;
    height: 20px;
    color: var(--brand-dark-green);
}

.sidebar-nav .nav-item:hover {
    background: var(--brand-purple-50);
    color: var(--brand-purple);
}

.sidebar-nav .nav-item.active {
    background: var(--gradient-purple-soft);
    color: var(--brand-purple);
    font-weight: 700;
    box-shadow: inset 0 0 0 1px rgb(113 20 132 / 12%);
}

.sidebar-nav .nav-item.active::before {
    content: '';
    position: absolute;
    inset-inline-start: 6px;
    inset-block: 10px;
    width: 3px;
    border-radius: 3px;
    background: var(--brand-purple);
}

.sidebar-nav .nav-item.active .ui-icon {
    color: var(--brand-purple);
}

.sidebar-group > .sidebar-section-label {
    margin-inline: 0;
}

.sidebar-group > .sidebar-section-label .ui-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.sidebar-group-links {
    margin-inline-start: 21px;
    padding-inline-start: 6px;
    border-inline-start: 2px solid var(--brand-green-100);
}

.sidebar-group-links .nav-item {
    min-height: 40px;
    font-size: 13px;
}

.nav-item.disabled {
    opacity: .6;
    cursor: default;
}

.nav-lock {
    margin-inline-start: auto;
}

.nav-active-dot {
    display: none;
}

.sidebar-bottom {
    margin-block-start: auto;
    padding: 16px 24px;
    border-block-start: 1px solid var(--border);
    color: var(--muted);
    font-size: 12px;
}

.sidebar-bottom p {
    margin: 8px 0;
}

.sidebar-bottom small {
    font-size: 12px;
}

.privacy-emblem {
    color: var(--brand-dark-green);
}

.app-content {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.topbar {
    height: 60px;
    min-height: 60px;
    padding-inline: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: var(--surface);
    border-block-end: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar-start,
.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.topbar-crumb {
    color: var(--muted);
    font-size: 12px;
}

.topbar-divider {
    height: 24px;
    border-inline-start: 1px solid var(--border);
}

.language-button,
.logout-button,
.icon-button,
.menu-toggle {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    min-height: 38px;
    border: 0;
    border-radius: 8px;
    background: var(--brand-purple-50);
    color: var(--brand-purple);
    font-size: 13px;
    padding: 0 10px;
    text-decoration: none;
}

.icon-button,
.menu-toggle {
    width: 38px;
    padding: 0;
}

.language-button:hover,
.logout-button:hover,
.icon-button:hover {
    background: var(--brand-lilac-100);
}

.icon-button:disabled {
    color: var(--muted);
    background: var(--surface-muted);
    cursor: not-allowed;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--brand-purple-50);
    display: grid;
    place-items: center;
    color: var(--brand-purple);
    font-size: 12px;
    font-weight: 700;
}

.user-label {
    font-size: 13px;
    color: var(--muted);
}

.workspace-main {
    flex: 1;
    padding: 20px;
    min-width: 0;
}

.workspace-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 20px;
    color: var(--muted);
    font-size: 12px;
    border-block-start: 1px solid var(--border);
}

.sidebar-collapsed {
    --sidebar-width: 72px;
}

.sidebar-collapsed .sidebar-brand {
    padding: 12px;
}

.sidebar-collapsed .sidebar .brand-mark {
    width: 48px;
    height: 48px;
}

.sidebar-collapsed .sidebar .brand>span:last-child,
.sidebar-collapsed .sidebar-section-label,
.sidebar-collapsed .sidebar-bottom,
.sidebar-collapsed .nav-lock {
    display: none;
}

.sidebar-collapsed .sidebar-nav {
    padding: 8px;
}

.sidebar-collapsed .sidebar .nav-item {
    font-size: 0;
    gap: 0;
    justify-content: center;
}

.sidebar-collapsed .sidebar-group-links {
    margin-inline-start: 0;
    padding-inline-start: 2px;
}

/* page-header.html: white compact surface, breadcrumb and leading accent. */
.page-heading {
    position: relative;
    background: var(--surface);
    border: 1px solid rgb(113 20 132 / 10%);
    border-radius: 12px;
    padding: 16px 24px;
    margin-block-end: 16px;
    box-shadow: 0 10px 22px -16px rgb(113 20 132 / 20%);
}

.page-heading::before {
    content: '';
    position: absolute;
    inset-inline-start: 0;
    inset-block: 16px;
    width: 3px;
    border-radius: 3px;
    background: linear-gradient(var(--brand-purple-600), var(--brand-green-400));
}

.breadcrumb {
    margin: 0 0 6px;
    gap: 8px;
    font-size: 12px;
    line-height: 1.4;
}

.breadcrumb-item,
.breadcrumb-item a {
    color: var(--muted);
}

.breadcrumb-item.active {
    color: var(--brand-purple);
    font-weight: 600;
}

.breadcrumb-item+.breadcrumb-item {
    padding-inline-start: 0;
}

.breadcrumb-item+.breadcrumb-item::before {
    padding-inline-end: 8px;
    color: var(--brand-purple-400);
}

.heading-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
}

.heading-row h1 {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    line-height: 1.3;
}

.heading-row p {
    margin: 4px 0 0;
    font-size: 14px;
    color: var(--muted);
}

/* cards-kpis.html: white cards, information and horizontal quick actions. */
/* data-tables reference: footer stays within the table frame, outside its scroll area. */
.data-table-frame {
    overflow: hidden;
    border: 1px solid var(--border-card);
    border-radius: 12px;
    background: var(--surface);
}

.data-table-frame > .table-responsive,
.data-table-frame > .screen-table-wrap {
    border: 0;
    border-radius: 0;
}

.table-responsive {
    overflow-x: unset;

}

.table-responsive[data-table-scroll] {
    overflow-x: auto;
    overflow-y: hidden;
}

.table-responsive[data-table-scroll]:focus-visible {
    outline: 2px solid var(--brand-purple);
    outline-offset: -2px;
}

.table-footer {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 11px 14px;
    border-block-start: 1px solid var(--border);
    color: var(--muted);
    background: var(--surface);
    font-size: 12px;
}

.table-footer-spacer {
    flex: 1;
}

.table-page-size {
    margin: 0;
}

.table-page-size label {
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.table-page-size select {
    width: 72px;
    min-height: 32px;
    height: 32px;
    padding-inline-start: 10px;
    padding-inline-end: 28px;
    font: inherit;
}

.table-page-buttons {
    display: flex;
    align-items: center;
}

.table-page-buttons > * {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 6px;
    border: 1px solid var(--border-card);
    border-radius: 7px;
    background: var(--surface);
    color: var(--brand-purple);
    text-decoration: none;
    font: inherit;
}

.table-page-buttons .on {
    color: var(--surface);
    background: var(--brand-purple);
}

.table-page-buttons button:disabled {
    opacity: .5;
    cursor: not-allowed;
}

.table-page-buttons a:hover {
    background: var(--brand-purple-50);
}

@media (max-width: 700px) {
    .table-footer {
        flex-wrap: wrap;
    }

    .table-footer-spacer {
        display: none;
    }

    .table-footer-summary {
        flex-basis: 100%;
    }
}

.surface-card,
.module-card,
.welcome-card {
    background: var(--surface);
    border: 1px solid var(--border-card);
    border-radius: 12px;
    padding: 16px;
    min-width: 0;
    margin-block-end: 12px;
}

.section-title {
    margin: 0 0 12px;
    font-size: 16px;
    font-weight: 600;
}

.section-description {
    margin: -4px 0 16px;
    font-size: 13px;
}

.welcome-card {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
}

.welcome-card h2 {
    margin: 4px 0 8px;
    font-size: 18px;
}

.welcome-card p {
    margin: 0;
    color: var(--muted);
}

.eyebrow {
    color: var(--brand-dark-green);
    font-size: 12px;
    font-weight: 700;
}

.welcome-art,
.module-icon,
.empty-symbol,
.auth-seal {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: var(--brand-purple-50);
    color: var(--brand-purple);
    flex: none;
}

.welcome-art .ui-icon {
    width: 24px;
    height: 24px;
}

.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    margin-block: 20px 12px;
}

.section-heading h2 {
    margin: 0 0 4px;
}

.section-heading p {
    color: var(--muted);
    margin: 0;
    font-size: 13px;
}

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

.module-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 0;
}

.module-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.module-icon {
    width: 36px;
    height: 36px;
}

.module-icon .ui-icon {
    width: 20px;
    height: 20px;
}

.icon-shelter,
.icon-projects {
    color: var(--brand-dark-green);
    background: var(--brand-green-50);
}

.module-card h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 4px 0 0;
}

.module-card p {
    font-size: 13px;
    color: var(--muted);
    margin: 0;
}

.module-card small {
    font-size: 12px;
    color: var(--muted);
}

.module-card .btn {
    justify-content: space-between;
    width: 100%;
    min-height: 42px;
    margin-block-start: auto;
}

.module-divider {
    border-block-start: 1px solid var(--border);
    margin-block: 4px;
}

.availability-badge,
.intake-mode,
.screen-preview,
.social-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.4;
    color: var(--muted);
    background: var(--surface-muted);
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 24px 16px;
    border: 1px solid var(--border-card);
    border-radius: 12px;
    background: var(--surface);
    margin-block: 12px;
}

.empty-symbol {
    margin-block-end: 8px;
}

.empty-state h3 {
    font-size: 16px;
    margin: 0 0 8px;
}

.empty-state p {
    color: var(--muted);
    font-size: 13px;
    margin: 0 0 12px;
    max-width: 560px;
}

.provision-card {
    max-width: 760px;
}

.filter-bar,
.screen-search,
.social-filter {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.filter-bar {
    position: relative;
}

.filter-bar>.ui-icon {
    position: absolute;
    inset-inline-start: 12px;
    color: var(--brand-lilac);
    pointer-events: none;
    width: 16px;
    height: 16px;
}

.filter-bar input {
    padding-inline-start: 36px;
    width: 240px;
}

/* Corrected data-table reference: no new bulk operations or export features. */
.access-table,
.screen-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    font-size: 13px;
    text-align: start;
}

.access-table th,
.screen-table th {
    background: linear-gradient(180deg, #f9f3fb, #f1e4f5);
    color: var(--brand-purple);
    font-size: 13px;
    font-weight: 700;
    padding: 10px 12px;
    white-space: nowrap;
    border-block-end: 1px solid var(--brand-purple-200);
    text-align: start;
}

.access-table td,
.screen-table td {
    padding: 10px 12px;
    border-block-end: 1px solid #f1ecf4;
    vertical-align: middle;
    font-size: 13px;
}

.access-table tbody tr:hover,
.screen-table tbody tr:hover {
    background: #fbf7fc;
}

.access-table tbody tr:last-child td,
.screen-table tbody tr:last-child td {
    border-block-end: 0;
}

.table-responsive {
    border: 1px solid var(--border-card);
    border-radius: 12px;
}

.access-table {
    margin: 0;
}

/* alerts-notifications.html: light semantic surfaces and restrained toasts. */
.alert {
    --alert-color: var(--info);
    --alert-surface: var(--info-soft);
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 8px;
    padding: 12px;
    border: 1px solid var(--border);
    border-inline-start: 3px solid var(--alert-color);
    border-radius: 8px;
    color: var(--ink);
    background: var(--alert-surface);
}

.alert-danger {
    --alert-color: var(--danger);
    --alert-surface: var(--danger-soft);
}

.error-summary {
    display: block;
}

.error-summary strong {
    color: var(--danger);
}

.error-summary p {
    margin: 4px 0;
    font-size: 13px;
}

.error-summary ul {
    margin: 8px 0 0;
    padding-inline-start: 20px;
}

.error-summary a {
    color: var(--danger);
}

.status-toast {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px;
    box-shadow: 0 1px 3px rgb(31 23 38 / 12%);
    margin-block-end: 12px;
}

.status-toast>.ui-icon {
    color: var(--success);
    margin-block-start: 2px;
}

.status-toast p {
    flex: 1;
    margin: 0;
    font-size: 13px;
}

.status-toast .btn-close {
    flex: none;
}

/* modals/modals.html: bounded scrolling, fixed header/footer and exact surfaces. */
.modal-dialog {
    max-width: 560px;
}

.modal-content,
.confirm-dialog {
    background: var(--surface);
    border: 1px solid #e9dcec;
    border-radius: 16px;
    box-shadow: var(--shadow-modal);
}

.modal-content {
    max-height: calc(100dvh - 48px);
    overflow: hidden;
}

.modal-content>form {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.modal-header,
.dialog-header {
    flex: none;
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 14px 16px 12px;
    border-block-end: 1px solid #f0e6f2;
}

.modal-title,
.dialog-header h2 {
    font-size: 16px !important;
    font-weight: 700;
    margin: 0;
}

.modal-body,
.dialog-body {
    padding: 14px 16px;
    font-size: 14px;
    line-height: 1.7;
    min-height: 0;
    overflow: auto;
    scrollbar-width: thin;
    scrollbar-color: #b9aebd transparent;
}

.modal-footer,
.dialog-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 16px;
    border-block-start: 1px solid #f0e6f2;
    background: #fcfafd;
    flex: none;
}

.modal-footer .btn,
.dialog-actions .btn {
    min-height: 38px;
}

.modal-footer>* {
    margin: 0;
}

.confirm-dialog {
    padding: 0;
    width: min(400px, calc(100% - 24px));
}

.confirm-dialog::backdrop {
    background: rgb(31 23 38 / 35%);
}

.confirm-dialog .dialog-body p {
    margin: 0;
}

.dialog-header .ui-icon {
    color: var(--brand-purple);
}

/* Authentication and system states use the approved form and information-card patterns. */
.auth-page {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    background:
        radial-gradient(ellipse at 8% 18%, var(--brand-lilac-100), transparent 48%),
        radial-gradient(ellipse at 94% 85%, var(--brand-green-100), transparent 46%),
        var(--brand-lilac-50);
}

.auth-topbar {
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 24px;
    background: transparent;
    border-block-end: 0;
}

.auth-grid {
    flex: 1;
    width: 100%;
    max-width: 520px;
    margin-inline: auto;
    padding: 32px 20px;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
    align-content: center;
    align-items: start;
}

.auth-form-panel,
.auth-story {
    background: var(--surface);
    border: 1px solid var(--border-card);
    border-radius: 12px;
    padding: 24px;
    min-width: 0;
}

.auth-form-inner h1 {
    margin: 8px 0;
    font-size: 22px;
}

.auth-form-panel {
    position: relative;
    padding: 32px;
    border-block-start: 3px solid var(--brand-dark-green-100);
    box-shadow: 0 8px 24px rgb(60 20 70 / 5%);
}

.auth-form-inner::before {
    content: "";
    display: block;
    width: 80px;
    height: 80px;
    margin: 0 auto 16px;
    background: url('../images/himayah-logo.png') center / contain no-repeat;
}

.auth-form-inner > .eyebrow {
    display: block;
    text-align: center;
    color: var(--brand-dark-green);
}

.auth-form-inner h1,
.auth-form-inner > .auth-intro {
    text-align: center;
}

.auth-page .form-control {
    min-height: 48px;
    background-color: var(--surface);
    border-color: var(--border-control);
}

.auth-page .form-control:focus {
    border-color: var(--brand-lilac);
    box-shadow: 0 0 0 3px var(--brand-purple-50);
}

.auth-page .password-toggle {
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 32px;
}

[dir="rtl"] .auth-page .input-wrap:has(.password-toggle) .form-control {
    padding-left: 100px;
    padding-right: 12px;
}

[dir="ltr"] .auth-page .input-wrap:has(.password-toggle) .form-control {
    padding-right: 100px;
    padding-left: 12px;
}

.auth-form-panel .btn[type="submit"] {
    min-height: 46px;
    box-shadow: 0 4px 12px rgb(113 20 132 / 12%);
}

[dir="ltr"] .auth-form-panel .btn[type="submit"] > .ui-icon {
    transform: scaleX(-1);
}

.auth-intro {
    color: var(--muted);
    margin-block-end: 24px;
}

.auth-form-links {
    display: flex;
    justify-content: flex-end;
    margin-block: 8px 16px;
    font-size: 13px;
}

.auth-form-links a,
.back-link {
    color: var(--brand-purple);
    font-weight: 500;
    text-decoration: none;
}

.auth-form-links a:hover,
.back-link:hover {
    color: #5c0f6b;
    text-decoration: underline;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-block-start: 16px;
}

.auth-story {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.story-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--brand-dark-green);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--brand-green);
}

.auth-story h2 {
    margin: 0;
    font-size: 18px;
}

.auth-story>p {
    margin: 0;
    color: var(--muted);
}

.story-pillars {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 13px;
}

.story-pillars>span {
    padding-block: 8px;
    border-block-start: 1px solid var(--border);
}

.auth-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 16px 24px;
    border-block-start: 0;
    color: var(--muted);
    font-size: 12px;
}

.error-page {
    max-width: 560px;
    margin: 48px auto;
    padding: 24px;
    text-align: center;
    background: var(--surface);
    border: 1px solid var(--border-card);
    border-radius: 12px;
}

.error-page .brand {
    margin-block-end: 24px;
}

.error-code {
    color: var(--brand-purple);
    font-size: 32px;
    font-weight: 700;
    margin-block-end: 8px;
}

.error-page h1 {
    font-size: 22px;
}

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

.review-ribbon {
    background: var(--brand-purple-50);
    border: 1px solid var(--brand-purple-200);
    border-radius: 8px;
    padding: 8px 12px;
    color: var(--brand-purple);
    font-size: 12px;
}

@media (min-width:992px) {
    .sidebar.offcanvas-lg {
        position: sticky !important;
        height: 100dvh !important;
        background-color: var(--surface) !important;
    }
    .sidebar {
        position: sticky;
        top: 0;
        height: 100dvh;
        overflow-y: auto;
        scrollbar-width: thin;
    }
}

@media (max-width:991px) {
    .app-frame {
        display: block;
    }

    .sidebar {
        width: 256px !important;
    }

    .topbar-crumb {
        display: none;
    }

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

@media (max-width:767px) {
    :root {
        --control-height: 44px;
        --button-height: 44px;
    }

    .workspace-main {
        padding: 12px;
    }

    .topbar {
        padding-inline: 12px;
    }

    .topbar-start,
    .topbar-actions {
        gap: 8px;
    }

    .topbar .user-label,
    .topbar-divider {
        display: none;
    }

    .topbar .language-button {
        font-size: 12px;
        padding-inline: 8px;
    }

    .page-heading {
        padding: 16px;
    }

    .heading-row {
        align-items: flex-start;
        gap: 12px;
    }

    .heading-row>.btn {
        width: 100%;
    }

    .module-grid,
    .auth-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .auth-grid {
        padding: 16px 12px;
        gap: 12px;
    }

    .auth-form-panel,
    .auth-story {
        padding: 16px;
    }

    .auth-topbar,
    .auth-footer {
        padding: 12px;
    }

    .auth-topbar .brand small {
        max-width: 150px;
    }

    .filter-bar {
        width: 100%;
    }

    .filter-bar input {
        flex: 1;
        min-width: 0;
        width: 100%;
    }

    .filter-bar .btn {
        min-height: 44px;
    }

    .btn-sm,
    .screen-action {
        min-height: 44px;
    }

    .modal-dialog {
        margin: 12px;
        max-width: none;
    }

    .modal-content {
        max-height: calc(100dvh - 24px);
    }

    .modal-footer .btn,
    .dialog-actions .btn {
        min-height: 44px;
    }

    .error-page {
        margin: 24px 12px;
        padding: 16px;
    }

    .workspace-footer {
        padding: 12px;
    }
}

@media (prefers-reduced-motion:reduce) {

    *,
    *::before,
    *::after {
        animation-duration: .01ms !important;
        transition-duration: .01ms !important;
        scroll-behavior: auto !important;
    }
}
