/* =====================================================================
   Tenant Administration Portal - design system
   Clean light theme, white cards, subtle shadows, indigo primary.
   ===================================================================== */

:root {
    --primary:        #3949ab;
    --primary-dark:   #283593;
    --primary-light:  #e8eaf6;
    --primary-soft:   #f4f5fd;

    --success:        #2e7d32;
    --success-soft:   #e8f5e9;
    --danger:         #c62828;
    --danger-soft:    #fdecea;
    --warning:        #ed6c02;
    --warning-soft:   #fff4e5;
    --info:           #0277bd;
    --info-soft:      #e3f2fd;
    --muted:          #616161;
    --muted-soft:     #f0f0f0;

    --text:           #1f2430;
    --text-soft:      #5b6270;
    --text-faint:     #8a92a3;
    --border:         #e3e6ed;
    --border-strong:  #cdd2de;
    --surface:        #ffffff;
    --canvas:         #f5f6fa;

    --radius:         10px;
    --radius-sm:      6px;
    --radius-lg:      14px;
    --shadow-sm:      0 1px 2px rgba(24, 30, 51, .06);
    --shadow:         0 2px 8px rgba(24, 30, 51, .07);
    --shadow-lg:      0 12px 32px rgba(24, 30, 51, .16);

    --sidebar-width:  256px;
    --sidebar-narrow: 68px;
    --topbar-height:  60px;

    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

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

html, body {
    margin: 0;
    padding: 0;
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.5;
    color: var(--text);
    background: var(--canvas);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.3; }
h1 { font-size: 21px; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
h4 { font-size: 13px; }
p  { margin: 0 0 10px; }

/* ---------------------------------------------------------------------
   App shell
   --------------------------------------------------------------------- */

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

.sidebar {
    width: var(--sidebar-width);
    flex: 0 0 var(--sidebar-width);
    background: #1c2237;
    color: #c9cee0;
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 40;
    transition: width .18s ease, transform .18s ease;
    overflow: hidden;
}

.sidebar__brand {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 18px;
    border-bottom: 1px solid rgba(255,255,255,.08);
    flex: 0 0 auto;
}
.sidebar__logo {
    width: 30px; height: 30px; flex: 0 0 30px;
    border-radius: 8px;
    background: linear-gradient(135deg, #5c6bc0, #3949ab);
    color: #fff;
    display: grid; place-items: center;
    font-weight: 700; font-size: 13px;
}
.sidebar__title { font-size: 14px; font-weight: 600; color: #fff; white-space: nowrap; }
.sidebar__subtitle { font-size: 11px; color: #8b93ad; white-space: nowrap; }

.sidebar__nav { flex: 1 1 auto; overflow-y: auto; padding: 12px 0 24px; }
.sidebar__group { padding: 14px 18px 4px; font-size: 10.5px; letter-spacing: .09em;
    text-transform: uppercase; color: #6f7796; font-weight: 700; white-space: nowrap; }
.sidebar__link {
    display: flex; align-items: center; gap: 11px;
    padding: 9px 18px; margin: 1px 8px;
    border-radius: var(--radius-sm);
    color: #c2c8dd; font-size: 13.5px; white-space: nowrap;
}
.sidebar__link:hover { background: rgba(255,255,255,.07); color: #fff; text-decoration: none; }
.sidebar__link.is-active { background: var(--primary); color: #fff; font-weight: 600; }
.sidebar__link svg { flex: 0 0 17px; width: 17px; height: 17px; }

.app.is-collapsed .sidebar { width: var(--sidebar-narrow); }
.app.is-collapsed .sidebar__title,
.app.is-collapsed .sidebar__subtitle,
.app.is-collapsed .sidebar__group,
.app.is-collapsed .sidebar__link span { display: none; }
.app.is-collapsed .sidebar__link { justify-content: center; padding: 10px 0; }
.app.is-collapsed .main { margin-left: var(--sidebar-narrow); }

.main {
    flex: 1 1 auto;
    margin-left: var(--sidebar-width);
    min-width: 0;
    display: flex;
    flex-direction: column;
    transition: margin-left .18s ease;
}

.topbar {
    height: var(--topbar-height);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 20px;
    position: sticky;
    top: 0;
    z-index: 30;
}
.topbar__spacer { flex: 1 1 auto; }
.topbar__tenant {
    display: flex; flex-direction: column; line-height: 1.25;
    padding: 4px 12px; border-left: 3px solid var(--primary);
    background: var(--primary-soft); border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.topbar__tenant strong { font-size: 13px; }
.topbar__tenant span { font-size: 11px; color: var(--text-soft); font-family: var(--mono); }

.icon-button {
    width: 34px; height: 34px;
    display: grid; place-items: center;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-soft);
    cursor: pointer;
    position: relative;
}
.icon-button:hover { background: var(--muted-soft); color: var(--text); }
.icon-button__dot {
    position: absolute; top: 5px; right: 5px;
    min-width: 15px; height: 15px; padding: 0 3px;
    border-radius: 8px; background: var(--danger); color: #fff;
    font-size: 9.5px; font-weight: 700; display: grid; place-items: center;
}

.profile { position: relative; }
.profile__button {
    display: flex; align-items: center; gap: 9px;
    background: transparent; border: 1px solid var(--border);
    border-radius: 40px; padding: 4px 12px 4px 4px; cursor: pointer;
    font-family: inherit; font-size: 13px; color: var(--text);
}
.profile__button:hover { border-color: var(--border-strong); background: var(--muted-soft); }
.profile__avatar {
    width: 27px; height: 27px; border-radius: 50%;
    background: var(--primary); color: #fff;
    display: grid; place-items: center; font-size: 11px; font-weight: 700;
}
.profile__meta { text-align: left; line-height: 1.2; }
.profile__meta strong { display: block; font-size: 12.5px; font-weight: 600; }
.profile__meta span { font-size: 10.5px; color: var(--text-faint); }

.dropdown {
    position: absolute; right: 0; top: calc(100% + 8px);
    min-width: 220px; background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow-lg); padding: 6px; z-index: 60; display: none;
}
.dropdown.is-open { display: block; }
.dropdown__header { padding: 10px 12px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.dropdown__header strong { display: block; font-size: 13px; }
.dropdown__header span { font-size: 11.5px; color: var(--text-soft); word-break: break-all; }
.dropdown__item {
    display: flex; align-items: center; gap: 9px;
    padding: 8px 12px; border-radius: var(--radius-sm);
    color: var(--text); font-size: 13px; cursor: pointer;
    background: none; border: 0; width: 100%; text-align: left; font-family: inherit;
}
.dropdown__item:hover { background: var(--muted-soft); text-decoration: none; }
.dropdown__item--danger { color: var(--danger); }

.page { flex: 1 1 auto; padding: 20px; max-width: 100%; }
.page__head {
    display: flex; align-items: flex-start; gap: 16px;
    flex-wrap: wrap; margin-bottom: 18px;
}
.page__head-main { flex: 1 1 320px; min-width: 0; }
.page__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.page__meta { font-size: 12px; color: var(--text-faint); margin-top: 3px; }

.breadcrumbs { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-faint); margin-bottom: 5px; }
.breadcrumbs a { color: var(--text-soft); }
.breadcrumbs span[aria-current] { color: var(--text); font-weight: 500; }

/* ---------------------------------------------------------------------
   Cards, grids
   --------------------------------------------------------------------- */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 16px;
}
.card__head {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    padding: 14px 16px; border-bottom: 1px solid var(--border);
}
.card__head h2, .card__head h3 { flex: 1 1 auto; min-width: 0; }
.card__subtitle { font-size: 12px; color: var(--text-faint); font-weight: 400; margin-top: 2px; }
.card__body { padding: 16px; }
.card__body--flush { padding: 0; }
.card__foot { padding: 12px 16px; border-top: 1px solid var(--border); background: #fbfbfd;
    border-radius: 0 0 var(--radius) var(--radius); }

.grid { display: grid; gap: 14px; }
.grid--kpi   { grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); }
.grid--2     { grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); }
.grid--3     { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid--form  { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }

.kpi {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 14px 15px;
    box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
}
.kpi::after {
    content: ''; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--info);
}
.kpi--success::after { background: var(--success); }
.kpi--danger::after  { background: var(--danger); }
.kpi--warning::after { background: var(--warning); }
.kpi--muted::after   { background: var(--border-strong); }
.kpi--info::after    { background: var(--info); }
.kpi__label { font-size: 11.5px; color: var(--text-soft); font-weight: 500; text-transform: uppercase; letter-spacing: .04em; }
.kpi__value { font-size: 27px; font-weight: 700; letter-spacing: -.02em; margin-top: 5px; }
.kpi__note { font-size: 11px; color: var(--warning); margin-top: 4px; }

/* ---------------------------------------------------------------------
   Buttons, forms
   --------------------------------------------------------------------- */

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    padding: 8px 14px; border-radius: var(--radius-sm);
    border: 1px solid var(--border-strong); background: var(--surface);
    color: var(--text); font: 500 13px var(--font); cursor: pointer;
    white-space: nowrap; transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--muted-soft); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn svg { width: 15px; height: 15px; }
.btn--primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn--primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn--danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn--danger:hover { background: #a01f1f; }
.btn--ghost { border-color: transparent; background: transparent; }
.btn--ghost:hover { background: var(--muted-soft); }
.btn--sm { padding: 5px 10px; font-size: 12px; }
.btn--block { width: 100%; }

.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.field__label { font-size: 12.5px; font-weight: 600; color: var(--text-soft); }
.field__label .req { color: var(--danger); }
.field__hint { font-size: 11.5px; color: var(--text-faint); }
.field__error { font-size: 11.5px; color: var(--danger); }

.input, .select, .textarea {
    width: 100%; padding: 8px 11px;
    border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    background: var(--surface); color: var(--text);
    font: 400 13.5px var(--font);
}
.input:focus, .select:focus, .textarea:focus {
    outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(57,73,171,.13);
}
.input.is-invalid, .select.is-invalid { border-color: var(--danger); }
.textarea { min-height: 74px; resize: vertical; }
.input-group { display: flex; gap: 6px; }
.input-group .input { flex: 1 1 auto; }

.checkbox, .radio { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.checkbox input, .radio input { width: 15px; height: 15px; accent-color: var(--primary); cursor: pointer; }

.switch { position: relative; display: inline-block; width: 38px; height: 21px; flex: 0 0 38px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch__slider {
    position: absolute; cursor: pointer; inset: 0;
    background: var(--border-strong); border-radius: 21px; transition: background .16s;
}
.switch__slider::before {
    content: ''; position: absolute; height: 15px; width: 15px; left: 3px; bottom: 3px;
    background: #fff; border-radius: 50%; transition: transform .16s; box-shadow: var(--shadow-sm);
}
.switch input:checked + .switch__slider { background: var(--primary); }
.switch input:checked + .switch__slider::before { transform: translateX(17px); }
.switch input:disabled + .switch__slider { opacity: .45; cursor: not-allowed; }

/* ---------------------------------------------------------------------
   Badges, chips
   --------------------------------------------------------------------- */

.badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 2px 9px; border-radius: 30px;
    font-size: 11.5px; font-weight: 600; white-space: nowrap;
    background: var(--muted-soft); color: var(--muted);
}
.badge--success { background: var(--success-soft); color: var(--success); }
.badge--danger  { background: var(--danger-soft);  color: var(--danger); }
.badge--warning { background: var(--warning-soft); color: var(--warning); }
.badge--info    { background: var(--info-soft);    color: var(--info); }
.badge--muted   { background: var(--muted-soft);   color: var(--muted); }
.badge--primary { background: var(--primary-light); color: var(--primary-dark); }

.chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 3px 10px; border-radius: 30px; border: 1px solid var(--border-strong);
    font-size: 12px; background: var(--surface);
}
.chip button { border: 0; background: none; cursor: pointer; color: var(--text-faint); padding: 0; line-height: 1; }

.mono { font-family: var(--mono); font-size: 12px; }

/* ---------------------------------------------------------------------
   Tabs
   --------------------------------------------------------------------- */

.tabs {
    display: flex; gap: 2px; overflow-x: auto;
    border-bottom: 1px solid var(--border); margin-bottom: 16px;
    scrollbar-width: thin;
}
.tabs__item {
    padding: 9px 15px; border: 0; background: none; cursor: pointer;
    font: 500 13px var(--font); color: var(--text-soft);
    border-bottom: 2px solid transparent; white-space: nowrap;
}
.tabs__item:hover { color: var(--text); }
.tabs__item.is-active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

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

.dt { display: flex; flex-direction: column; }
.dt__toolbar {
    display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap;
    padding: 12px 14px; border-bottom: 1px solid var(--border); background: #fbfbfd;
    border-radius: var(--radius) var(--radius) 0 0;
}
.dt__filter { display: flex; flex-direction: column; gap: 3px; min-width: 145px; }
.dt__filter label { font-size: 11px; font-weight: 600; color: var(--text-faint); text-transform: uppercase; letter-spacing: .04em; }
.dt__filter .input, .dt__filter .select { padding: 6px 9px; font-size: 12.5px; }
.dt__filter--search { flex: 1 1 220px; min-width: 180px; }
.dt__toolbar-actions { display: flex; gap: 6px; margin-left: auto; align-items: flex-end; }

.dt__scroll { overflow-x: auto; max-height: 68vh; }
.dt table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.dt thead th {
    position: sticky; top: 0; z-index: 2;
    background: #f3f4f9; color: var(--text-soft);
    text-align: left; font-weight: 600; font-size: 11.5px;
    text-transform: uppercase; letter-spacing: .04em;
    padding: 10px 12px; border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.dt thead th.is-sortable { cursor: pointer; user-select: none; }
.dt thead th.is-sortable:hover { color: var(--primary); }
.dt thead th .sort-arrow { opacity: .35; margin-left: 4px; }
.dt thead th.is-sorted .sort-arrow { opacity: 1; color: var(--primary); }
.dt tbody td {
    padding: 9px 12px; border-bottom: 1px solid var(--border);
    vertical-align: middle; color: var(--text);
}
.dt tbody tr:hover td { background: var(--primary-soft); }
.dt tbody tr:last-child td { border-bottom: 0; }
.dt td.dt__actions { white-space: nowrap; text-align: right; }
.dt td .truncate { display: inline-block; max-width: 240px; overflow: hidden;
    text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }

.dt__state { padding: 44px 20px; text-align: center; color: var(--text-faint); }
.dt__state h3 { font-size: 14px; color: var(--text-soft); margin-bottom: 4px; }
.dt__state--error h3 { color: var(--danger); }
.dt__foot {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    padding: 11px 14px; border-top: 1px solid var(--border); background: #fbfbfd;
    border-radius: 0 0 var(--radius) var(--radius);
}
.dt__count { font-size: 12.5px; color: var(--text-soft); }
.dt__pager { display: flex; gap: 4px; margin-left: auto; align-items: center; }
.dt__pager button {
    min-width: 31px; height: 30px; padding: 0 8px;
    border: 1px solid var(--border-strong); background: var(--surface);
    border-radius: var(--radius-sm); cursor: pointer; font: 500 12.5px var(--font); color: var(--text);
}
.dt__pager button:hover:not(:disabled) { background: var(--muted-soft); }
.dt__pager button.is-active { background: var(--primary); border-color: var(--primary); color: #fff; }
.dt__pager button:disabled { opacity: .4; cursor: not-allowed; }

.spinner {
    width: 26px; height: 26px; margin: 0 auto 10px;
    border: 2.5px solid var(--border); border-top-color: var(--primary);
    border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------------
   Modal, toast
   --------------------------------------------------------------------- */

.modal-backdrop {
    position: fixed; inset: 0; background: rgba(21,26,42,.5);
    display: grid; place-items: center; padding: 20px; z-index: 90;
}
.modal {
    background: var(--surface); border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg); width: min(680px, 100%);
    max-height: 88vh; display: flex; flex-direction: column;
}
.modal--wide { width: min(1000px, 100%); }
.modal__head {
    display: flex; align-items: flex-start; gap: 12px;
    padding: 16px 18px; border-bottom: 1px solid var(--border);
}
.modal__head h2 { flex: 1 1 auto; }
.modal__body { padding: 18px; overflow-y: auto; flex: 1 1 auto; }
.modal__foot {
    display: flex; justify-content: flex-end; gap: 8px;
    padding: 13px 18px; border-top: 1px solid var(--border); background: #fbfbfd;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg); flex-wrap: wrap;
}

.toast-stack { position: fixed; top: 16px; right: 16px; z-index: 120;
    display: flex; flex-direction: column; gap: 8px; max-width: 380px; }
.toast {
    display: flex; align-items: flex-start; gap: 10px;
    background: var(--surface); border: 1px solid var(--border);
    border-left: 3px solid var(--info);
    border-radius: var(--radius); box-shadow: var(--shadow-lg);
    padding: 11px 13px; font-size: 13px;
    animation: toast-in .18s ease;
}
.toast--success { border-left-color: var(--success); }
.toast--danger  { border-left-color: var(--danger); }
.toast--warning { border-left-color: var(--warning); }
.toast strong { display: block; margin-bottom: 2px; }
@keyframes toast-in { from { opacity: 0; transform: translateX(14px); } }

.alert {
    display: flex; gap: 10px; align-items: flex-start;
    padding: 11px 13px; border-radius: var(--radius);
    background: var(--info-soft); color: #01579b; font-size: 13px;
    border: 1px solid rgba(2,119,189,.18); margin-bottom: 14px;
}
.alert--warning { background: var(--warning-soft); color: #8a4b00; border-color: rgba(237,108,2,.22); }
.alert--danger  { background: var(--danger-soft);  color: #8f1d1d; border-color: rgba(198,40,40,.2); }
.alert--success { background: var(--success-soft); color: #1b5e20; border-color: rgba(46,125,50,.2); }

/* ---------------------------------------------------------------------
   Definition lists, timeline
   --------------------------------------------------------------------- */

.dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px 20px; }
.dl__item { min-width: 0; }
.dl__label { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-faint); font-weight: 600; }
.dl__value { font-size: 13.5px; margin-top: 2px; word-break: break-word; }

.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ''; position: absolute; left: 6px; top: 4px; bottom: 4px; width: 2px; background: var(--border); }
.timeline__item { position: relative; padding-bottom: 16px; }
.timeline__dot {
    position: absolute; left: -21px; top: 3px; width: 12px; height: 12px;
    border-radius: 50%; background: var(--info); border: 2px solid var(--surface); box-shadow: 0 0 0 2px var(--border);
}
.timeline__dot--success { background: var(--success); }
.timeline__dot--danger  { background: var(--danger); }
.timeline__dot--warning { background: var(--warning); }
.timeline__dot--muted   { background: var(--border-strong); }
.timeline__title { font-size: 13.5px; font-weight: 600; }
.timeline__meta  { font-size: 11.5px; color: var(--text-faint); }
.timeline__detail{ font-size: 12.5px; color: var(--text-soft); margin-top: 3px; }

/* ---------------------------------------------------------------------
   Charts
   --------------------------------------------------------------------- */

.chart { width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart__legend { display: flex; flex-wrap: wrap; gap: 10px 16px; margin-top: 10px; font-size: 12px; color: var(--text-soft); }
.chart__legend-item { display: inline-flex; align-items: center; gap: 6px; }
.chart__swatch { width: 10px; height: 10px; border-radius: 3px; flex: 0 0 10px; }
.chart__empty { padding: 40px 12px; text-align: center; color: var(--text-faint); font-size: 13px; }

/* ---------------------------------------------------------------------
   Matrix
   --------------------------------------------------------------------- */

.matrix { overflow-x: auto; }
.matrix table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.matrix th, .matrix td { padding: 9px 11px; border-bottom: 1px solid var(--border); }
.matrix thead th {
    position: sticky; top: 0; background: #f3f4f9; z-index: 2;
    font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em;
    color: var(--text-soft); text-align: center; white-space: nowrap;
}
.matrix thead th:first-child, .matrix tbody td:first-child { text-align: left; position: sticky; left: 0; background: var(--surface); z-index: 1; }
.matrix thead th:first-child { background: #f3f4f9; z-index: 3; }
.matrix tbody td { text-align: center; }
.matrix tbody tr:hover td { background: var(--primary-soft); }
.matrix tbody tr:hover td:first-child { background: var(--primary-soft); }

/* ---------------------------------------------------------------------
   Auth pages
   --------------------------------------------------------------------- */

.auth {
    min-height: 100vh; display: grid; place-items: center; padding: 24px;
    background: linear-gradient(160deg, #eef0f8 0%, #f6f7fb 60%);
}
.auth__card {
    width: min(420px, 100%); background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius-lg);
    box-shadow: var(--shadow); padding: 30px 28px;
}
.auth__brand { display: flex; align-items: center; gap: 11px; margin-bottom: 22px; }
.auth__logo {
    width: 42px; height: 42px; border-radius: 11px;
    background: linear-gradient(135deg, #5c6bc0, #3949ab); color: #fff;
    display: grid; place-items: center; font-weight: 700; font-size: 16px;
}
.auth__title { font-size: 19px; font-weight: 600; }
.auth__subtitle { font-size: 12.5px; color: var(--text-soft); }
.auth__foot { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border);
    font-size: 12.5px; color: var(--text-soft); text-align: center; }

.choose { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.choose__card {
    display: block; padding: 22px; border: 1px solid var(--border);
    border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm);
    color: var(--text);
}
.choose__card:hover { border-color: var(--primary); box-shadow: var(--shadow); text-decoration: none; }

/* ---------------------------------------------------------------------
   Utilities
   --------------------------------------------------------------------- */

.u-flex   { display: flex; }
.u-between{ justify-content: space-between; }
.u-center { align-items: center; }
.u-gap-sm { gap: 6px; }
.u-gap    { gap: 12px; }
.u-wrap   { flex-wrap: wrap; }
.u-right  { text-align: right; }
.u-muted  { color: var(--text-faint); }
.u-soft   { color: var(--text-soft); }
.u-small  { font-size: 12px; }
.u-bold   { font-weight: 600; }
.u-mt     { margin-top: 14px; }
.u-mb     { margin-bottom: 14px; }
.u-mb-0   { margin-bottom: 0; }
.u-nowrap { white-space: nowrap; }
.u-hidden { display: none !important; }
.u-break  { word-break: break-all; }

.sidebar-backdrop { display: none; }

/* ---------------------------------------------------------------------
   Responsive
   --------------------------------------------------------------------- */

@media (max-width: 1024px) {
    .sidebar { transform: translateX(-100%); width: var(--sidebar-width); }
    .app.is-mobile-open .sidebar { transform: translateX(0); box-shadow: var(--shadow-lg); }
    .main, .app.is-collapsed .main { margin-left: 0; }
    .app.is-mobile-open .sidebar-backdrop {
        display: block; position: fixed; inset: 0; background: rgba(21,26,42,.45); z-index: 35;
    }
    .app.is-collapsed .sidebar__title,
    .app.is-collapsed .sidebar__subtitle,
    .app.is-collapsed .sidebar__group,
    .app.is-collapsed .sidebar__link span { display: initial; }
    .app.is-collapsed .sidebar__link { justify-content: flex-start; padding: 9px 18px; }
}

@media (max-width: 720px) {
    .page { padding: 14px; }
    .topbar { padding: 0 12px; gap: 8px; }
    .topbar__tenant { display: none; }
    .profile__meta { display: none; }
    .dt__toolbar { padding: 10px; }
    .dt__filter { min-width: 130px; flex: 1 1 130px; }
    .dt__toolbar-actions { margin-left: 0; width: 100%; }
    .grid--kpi { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
    .kpi__value { font-size: 22px; }
}

/* ---------------------------------------------------------------------
   Print-friendly view
   --------------------------------------------------------------------- */

@media print {
    .sidebar, .topbar, .dt__toolbar, .dt__foot, .page__actions,
    .toast-stack, .tabs, .no-print { display: none !important; }
    .main { margin-left: 0 !important; }
    body { background: #fff; }
    .card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
    .dt__scroll { max-height: none; overflow: visible; }
    .dt thead th { position: static; background: #eee !important; -webkit-print-color-adjust: exact; }
    a[href]::after { content: ''; }
    .print-header { display: block !important; margin-bottom: 12px; }
}
.print-header { display: none; }
