/* ==========================================================================
   SSO IdP — Enterprise UI
   Plain CSS (no framework, no build step). Loaded from layouts/app.blade.php
   ========================================================================== */

/* ---------- Design tokens ---------- */
:root {
    --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;

    --bg: #f5f6f8;
    --surface: #ffffff;
    --surface-muted: #f8f9fb;

    --border: #e4e7ec;
    --border-strong: #d0d5dd;

    --text: #101828;
    --text-soft: #344054;
    --muted: #667085;
    --muted-light: #98a2b3;

    --primary: #1d4ed8;
    --primary-hover: #1e40af;
    --primary-soft: #eff4ff;
    --primary-border: #c7d7fe;

    --success: #067647;
    --success-soft: #ecfdf3;
    --success-border: #abefc6;

    --warning: #b54708;
    --warning-soft: #fffaeb;
    --warning-border: #fedf89;

    --danger: #b42318;
    --danger-hover: #912018;
    --danger-soft: #fef3f2;
    --danger-border: #fecdca;

    --radius-sm: 6px;
    --radius: 8px;
    --radius-lg: 12px;

    --shadow-xs: 0 1px 2px rgba(16, 24, 40, 0.05);
    --shadow-sm: 0 1px 3px rgba(16, 24, 40, 0.08);
    --shadow-md: 0 4px 8px -2px rgba(16, 24, 40, 0.06), 0 2px 4px -2px rgba(16, 24, 40, 0.04);

    --header-h: 64px;
    --sidebar-w: 248px;
    --content-max: 1180px;
}

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

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1,
h2,
h3,
h4,
p {
    margin: 0;
}

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

a:hover {
    color: var(--primary-hover);
}

img,
svg {
    display: block;
    max-width: 100%;
}

button {
    font: inherit;
    color: inherit;
}

code {
    font-family: var(--font-mono);
    font-size: 0.92em;
}

::selection {
    background: #dbe4ff;
}

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

.skip-link {
    position: absolute;
    left: 16px;
    top: -60px;
    z-index: 100;
    padding: 8px 14px;
    background: var(--primary);
    color: #fff;
    border-radius: var(--radius);
    font-weight: 600;
    transition: top 0.15s ease;
}

.skip-link:focus {
    top: 12px;
    color: #fff;
}

/* ---------- Header ---------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 40;
    height: var(--header-h);
    background: rgba(255, 255, 255, 0.96);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(8px);
}

.site-header__inner {
    height: 100%;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 24px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    color: var(--text);
    font-size: 15px;
    font-weight: 650;
    letter-spacing: -0.01em;
}

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

.brand__mark {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    border-radius: 9px;
    background: var(--primary);
    color: #fff;
}

.brand__mark svg {
    width: 18px;
    height: 18px;
}

.brand__text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.header-spacer {
    flex: 1;
}

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

.menu-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text-soft);
    cursor: pointer;
}

.menu-toggle:hover {
    background: var(--surface-muted);
    color: var(--text);
}

.menu-toggle svg {
    width: 20px;
    height: 20px;
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
}

.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font-size: 13px;
    font-weight: 650;
    text-transform: uppercase;
}

.avatar--lg {
    width: 48px;
    height: 48px;
    font-size: 18px;
}

.user-chip__meta {
    min-width: 0;
    line-height: 1.25;
}

.user-chip__name {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.user-chip__email {
    display: block;
    max-width: 210px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
    color: var(--muted);
}

/* ---------- Shell ---------- */
.app-shell {
    flex: 1;
    display: flex;
    align-items: stretch;
    width: 100%;
}

.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    align-self: flex-start;
    position: sticky;
    top: var(--header-h);
    height: calc(100vh - var(--header-h));
    padding: 20px 14px 24px;
    overflow-y: auto;
    background: var(--surface);
    border-right: 1px solid var(--border);
}

.sidebar__head {
    display: none;
}

.sidebar__title {
    font-size: 13px;
    font-weight: 650;
    color: var(--text);
}

.sidebar__foot {
    margin-top: 24px;
    padding: 14px 10px 0;
    border-top: 1px solid var(--border);
    font-size: 11.5px;
    line-height: 1.5;
    color: var(--muted-light);
}

.nav-section + .nav-section {
    margin-top: 18px;
}

.nav-label {
    padding: 0 10px 8px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted-light);
}

.nav-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 2px;
    padding: 9px 10px;
    border-radius: var(--radius);
    color: var(--text-soft);
    font-size: 13.5px;
    font-weight: 500;
    transition: background 0.15s ease, color 0.15s ease;
}

.nav-link:hover {
    background: var(--surface-muted);
    color: var(--text);
}

.nav-link svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    color: var(--muted);
    transition: color 0.15s ease;
}

.nav-link:hover svg {
    color: var(--text-soft);
}

.nav-link.active {
    background: var(--primary-soft);
    color: var(--primary);
    font-weight: 600;
}

.nav-link.active svg {
    color: var(--primary);
}

.nav-link.active::before {
    content: "";
    position: absolute;
    left: -14px;
    top: 8px;
    bottom: 8px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--primary);
}

.main-content {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 28px 28px 40px;
}

.main-content--guest {
    padding-top: 52px;
    padding-bottom: 56px;
}

.page {
    width: 100%;
    min-width: 0;
    max-width: var(--content-max);
}

.page--narrow {
    max-width: 440px;
    margin: 0 auto;
}

.page--home {
    max-width: 580px;
    margin: 0 auto;
}

/* ---------- Page header ---------- */
.page-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.page-head__title {
    font-size: 22px;
    font-weight: 650;
    line-height: 1.3;
    letter-spacing: -0.02em;
    color: var(--text);
}

.page-head__sub {
    margin-top: 4px;
    font-size: 13.5px;
    color: var(--muted);
}

.page-head__actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* ---------- Card ---------- */
.card {
    padding: 24px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
}

.card + .card {
    margin-top: 16px;
}

.card--limited {
    max-width: 640px;
    width: 100%;
}

.card--form {
    max-width: 860px;
}

.card__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    padding-bottom: 16px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.card__title {
    font-size: 15px;
    font-weight: 650;
    letter-spacing: -0.01em;
    color: var(--text);
}

.card__sub {
    margin-top: 3px;
    font-size: 12.5px;
    color: var(--muted);
}

/* ---------- Auth / centered cards ---------- */
.card--auth {
    padding: 28px;
}

.auth-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-bottom: 22px;
}

.auth-brand__mark {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    margin-bottom: 12px;
    border-radius: var(--radius-lg);
    background: var(--primary);
    color: #fff;
    box-shadow: var(--shadow-sm);
}

.auth-brand__mark svg {
    width: 24px;
    height: 24px;
}

.auth-title {
    font-size: 20px;
    font-weight: 650;
    line-height: 1.3;
    letter-spacing: -0.02em;
    color: var(--text);
}

.auth-sub {
    margin-top: 4px;
    font-size: 13px;
    color: var(--muted);
    line-height: 1.5;
}

.auth-note {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    font-size: 12px;
    line-height: 1.55;
    color: var(--muted);
    text-align: center;
}

.chip-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 12px;
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 38px;
    padding: 8px 14px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    background: var(--primary);
    color: #fff;
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.btn:hover {
    background: var(--primary-hover);
    color: #fff;
    text-decoration: none;
}

.btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.28);
}

.btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.btn--secondary {
    background: var(--surface);
    border-color: var(--border-strong);
    color: var(--text-soft);
}

.btn--secondary:hover {
    background: var(--surface-muted);
    border-color: var(--muted-light);
    color: var(--text);
}

.btn--ghost {
    background: transparent;
    border-color: transparent;
    color: var(--text-soft);
}

.btn--ghost:hover {
    background: var(--surface-muted);
    color: var(--text);
}

.btn--danger {
    background: var(--danger);
    color: #fff;
}

.btn--danger:hover {
    background: var(--danger-hover);
    color: #fff;
}

.btn--danger-outline {
    background: var(--surface);
    border-color: var(--danger-border);
    color: var(--danger);
}

.btn--danger-outline:hover {
    background: var(--danger-soft);
    border-color: #f97066;
    color: var(--danger);
}

.btn--sm {
    min-height: 30px;
    padding: 5px 10px;
    border-radius: var(--radius-sm);
    font-size: 12.5px;
}

.btn--success {
    background: var(--success);
    color: #fff;
}

.btn--success:hover {
    background: #05603a;
    color: #fff;
}

.btn--block {
    width: 100%;
}

.btn--icon {
    width: 36px;
    min-height: 36px;
    padding: 0;
}

/* ---------- Forms ---------- */
.form-group {
    margin-bottom: 16px;
}

.label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-soft);
}

.label .hint {
    font-weight: 400;
    font-size: 12px;
    color: var(--muted);
}

.input,
.select,
.textarea {
    width: 100%;
    min-height: 38px;
    padding: 8px 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.input::placeholder,
.textarea::placeholder {
    color: var(--muted-light);
}

.input:hover,
.select:hover,
.textarea:hover {
    border-color: var(--muted-light);
}

.input:focus,
.select:focus,
.textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.14);
}

.input[disabled],
.select[disabled],
.textarea[disabled] {
    background: var(--surface-muted);
    color: var(--muted);
    cursor: not-allowed;
}

.select {
    padding-right: 34px;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px;
}

.textarea {
    min-height: 76px;
    resize: vertical;
}

.textarea--code {
    font-family: var(--font-mono);
    font-size: 12.5px;
}

.textarea--single {
    min-height: 38px;
}

.check {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    font-size: 13.5px;
    line-height: 1.45;
    color: var(--text-soft);
    cursor: pointer;
}

.check input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 2px 0 0;
    flex-shrink: 0;
    accent-color: var(--primary);
    cursor: pointer;
}

.check__text {
    min-width: 0;
}

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

.field-help {
    margin-top: 5px;
    font-size: 12px;
    line-height: 1.5;
    color: var(--muted);
}

.form-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 20px;
}

.form-actions--split {
    justify-content: space-between;
}

.divider {
    margin: 22px 0;
    border: 0;
    border-top: 1px solid var(--border);
}

/* ---------- Alerts ---------- */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 16px;
    padding: 11px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-muted);
    color: var(--text-soft);
    font-size: 13px;
    line-height: 1.55;
}

.alert:last-child {
    margin-bottom: 0;
}

.alert__body {
    min-width: 0;
}

.alert__title {
    display: block;
    margin-bottom: 2px;
    font-weight: 650;
}

.alert__icon {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    margin-top: 1px;
}

.alert__icon svg {
    width: 18px;
    height: 18px;
}

.alert ul {
    margin: 4px 0 0;
    padding-left: 18px;
}

.alert li + li {
    margin-top: 2px;
}

.alert--success {
    background: var(--success-soft);
    border-color: var(--success-border);
    color: #085d3a;
}

.alert--warning {
    background: var(--warning-soft);
    border-color: var(--warning-border);
    color: #93370d;
}

.alert--danger {
    background: var(--danger-soft);
    border-color: var(--danger-border);
    color: #912018;
}

.alert--info {
    background: var(--primary-soft);
    border-color: var(--primary-border);
    color: #1849a9;
}

/* legacy alias */
.notice {
    margin-bottom: 16px;
    padding: 11px 14px;
    border: 1px solid var(--success-border);
    border-radius: var(--radius);
    background: var(--success-soft);
    color: #085d3a;
    font-size: 13px;
}

/* ---------- Badges ---------- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #f2f4f7;
    color: var(--text-soft);
    font-size: 11.5px;
    font-weight: 600;
    line-height: 1.5;
    white-space: nowrap;
    vertical-align: middle;
}

.badge--info {
    background: var(--primary-soft);
    border-color: var(--primary-border);
    color: var(--primary);
}

.badge--success {
    background: var(--success-soft);
    border-color: var(--success-border);
    color: var(--success);
}

.badge--warning {
    background: var(--warning-soft);
    border-color: var(--warning-border);
    color: var(--warning);
}

.badge--danger {
    background: var(--danger-soft);
    border-color: var(--danger-border);
    color: var(--danger);
}

.badge--neutral {
    background: #f2f4f7;
    border-color: var(--border);
    color: var(--text-soft);
}

/* legacy aliases */
.badge.ok {
    background: var(--success-soft);
    border-color: var(--success-border);
    color: var(--success);
}

.badge.off {
    background: var(--danger-soft);
    border-color: var(--danger-border);
    color: var(--danger);
}

/* ---------- Code ---------- */
.code {
    display: inline-block;
    padding: 2px 6px;
    border: 1px solid var(--border);
    border-radius: 5px;
    background: var(--surface-muted);
    color: var(--text-soft);
    font-family: var(--font-mono);
    font-size: 12px;
    word-break: break-all;
}

.code--highlight {
    padding: 3px 7px;
    border-color: var(--warning-border);
    background: var(--warning-soft);
    color: #93370d;
    font-size: 13px;
}

/* ---------- Tables ---------- */
.table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
}

.table {
    width: 100%;
    min-width: 680px;
    border-collapse: collapse;
    font-size: 13px;
}

.table--wide {
    min-width: 980px;
}

.table--wide th,
.table--wide td {
    padding-left: 12px;
    padding-right: 12px;
}

.table th {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    background: var(--surface-muted);
    color: var(--muted);
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-align: left;
    text-transform: uppercase;
    white-space: nowrap;
}

.table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    color: var(--text-soft);
    vertical-align: middle;
}

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

.table tbody tr:hover {
    background: #fafbfc;
}

.table .cell-strong {
    color: var(--text);
    font-weight: 600;
}

.table .cell-muted {
    color: var(--muted);
    font-size: 12.5px;
}

/* generic cell helpers */
.cell-strong {
    color: var(--text);
    font-weight: 600;
}

.cell-muted {
    color: var(--muted);
    font-size: 12.5px;
}

.table .cell-actions {
    text-align: right;
    white-space: nowrap;
}

.table .cell-nowrap {
    white-space: nowrap;
}

.table .cell-truncate {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.table .cell-stack > span,
.table .cell-stack > div {
    display: block;
}

.empty {
    padding: 32px 16px;
    text-align: center;
    color: var(--muted);
    font-size: 13px;
}

.empty__title {
    display: block;
    margin-bottom: 3px;
    color: var(--text-soft);
    font-weight: 600;
}

/* ---------- Row actions ---------- */
.row-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    white-space: nowrap;
}

.inline-form {
    display: inline;
    margin: 0;
}

.link-action {
    padding: 0;
    border: 0;
    background: none;
    color: var(--primary);
    font: inherit;
    font-size: 12.5px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
}

.link-action:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

.link-action--success {
    color: var(--success);
}

.link-action--success:hover {
    color: #085d3a;
}

.link-action--danger {
    color: var(--danger);
}

.link-action--danger:hover {
    color: var(--danger-hover);
}

/* ---------- Stats ---------- */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.stat-card {
    padding: 16px 18px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    box-shadow: var(--shadow-xs);
}

.stat-card__label {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    color: var(--muted);
}

.stat-card__dot {
    width: 7px;
    height: 7px;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--muted-light);
}

.stat-card__dot--ok {
    background: var(--success);
}

.stat-card__dot--off {
    background: var(--warning);
}

.stat-card__dot--bg {
    background: var(--primary);
}

.stat-card__value {
    margin-top: 6px;
    color: var(--text);
    font-size: 26px;
    font-weight: 650;
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
}

/* ---------- Data list ---------- */
.data-list {
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
}

.data-list__item {
    display: grid;
    grid-template-columns: 180px minmax(0, 1fr);
    border-top: 1px solid var(--border);
}

.data-list__item:first-child {
    border-top: 0;
}

.data-list__label {
    padding: 10px 14px;
    background: var(--surface-muted);
    color: var(--muted);
    font-size: 12.5px;
}

.data-list__value {
    min-width: 0;
    padding: 10px 14px;
    color: var(--text);
    font-size: 13.5px;
    word-break: break-word;
}

/* ---------- Welcome / dashboard ---------- */
.welcome {
    display: flex;
    align-items: center;
    gap: 14px;
    padding-bottom: 18px;
    margin-bottom: 18px;
    border-bottom: 1px solid var(--border);
}

.welcome__title {
    font-size: 17px;
    font-weight: 650;
    letter-spacing: -0.01em;
    color: var(--text);
}

.welcome__sub {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 4px;
    font-size: 12.5px;
    color: var(--muted);
}

.app-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 12px;
}

.app-tile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    color: inherit;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.app-tile:hover {
    border-color: var(--primary-border);
    box-shadow: var(--shadow-sm);
    color: inherit;
    text-decoration: none;
}

.app-tile__icon {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    border-radius: var(--radius);
    background: var(--primary-soft);
    color: var(--primary);
}

.app-tile__icon svg {
    width: 18px;
    height: 18px;
}

.app-tile__body {
    min-width: 0;
    flex: 1;
}

.app-tile__name {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text);
    font-size: 13.5px;
    font-weight: 600;
}

.app-tile__meta {
    display: block;
    margin-top: 1px;
    color: var(--muted);
    font-size: 12px;
}

.app-tile__arrow {
    flex-shrink: 0;
    color: var(--muted-light);
}

.app-tile__arrow svg {
    width: 16px;
    height: 16px;
}

/* ---------- Toolbar ---------- */
.toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.toolbar .input {
    flex: 1 1 220px;
    min-width: 0;
}

.toolbar .select {
    width: auto;
    min-width: 132px;
}

/* ---------- Endpoints (home) ---------- */
.endpoint-list {
    display: grid;
    gap: 8px;
    margin: 18px 0;
}

.endpoint {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-muted);
}

.endpoint__label {
    color: var(--text-soft);
    font-size: 12px;
    font-weight: 600;
}

.endpoint__code {
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 11.5px;
    word-break: break-all;
}

/* ---------- Consent / scopes ---------- */
.consent-head {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.consent-client {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 18px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-muted);
}

.consent-client__name {
    color: var(--text);
    font-size: 14px;
    font-weight: 650;
}

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

.scope-list {
    margin: 14px 0 0;
    padding: 0;
    list-style: none;
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
}

.scope-item {
    padding: 11px 14px;
}

.scope-item + .scope-item {
    border-top: 1px solid var(--border);
}

.scope-item:hover {
    background: #fafbfc;
}

.scope-item strong {
    color: var(--text);
    font-size: 13px;
}

.scope-desc {
    display: block;
    margin-top: 1px;
    color: var(--muted);
    font-size: 12.5px;
}

/* ---------- Credential / warning card ---------- */
.card--warning {
    background: var(--warning-soft);
    border-color: var(--warning-border);
}

.card--warning .card__title {
    color: #93370d;
}

.card--warning .card__sub {
    color: #b54708;
}

.card--warning .data-list {
    background: var(--surface);
}

.credential-head {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.credential-head__icon {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    border: 1px solid var(--warning-border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--warning);
}

.credential-head__icon svg {
    width: 18px;
    height: 18px;
}

/* ---------- Danger zone ---------- */
.danger-zone {
    border: 1px solid var(--danger-border);
    border-radius: 10px;
    background: var(--surface);
    overflow: hidden;
}

.danger-zone > summary {
    padding: 12px 14px;
    background: var(--danger-soft);
    color: var(--danger);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    list-style: none;
}

.danger-zone > summary::-webkit-details-marker {
    display: none;
}

.danger-zone > summary::before {
    content: "+";
    display: inline-block;
    width: 16px;
    font-weight: 700;
}

.danger-zone[open] > summary::before {
    content: "−";
}

.danger-zone__body {
    padding: 14px;
}

/* ---------- Pagination ---------- */
.pagination-wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 16px;
}

.pagination-meta {
    color: var(--muted);
    font-size: 12.5px;
}

.logout-form {
    margin: 0;
}

.pagination {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    margin: 0;
    padding: 0;
    list-style: none;
}

.page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-width: 34px;
    height: 34px;
    padding: 0 9px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: var(--surface);
    color: var(--text-soft);
    font-size: 13px;
    font-weight: 500;
}

.page-link:hover {
    border-color: var(--border-strong);
    background: var(--surface-muted);
    color: var(--text);
    text-decoration: none;
}

.page-item.active .page-link {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
    font-weight: 600;
}

.page-item.disabled .page-link {
    color: var(--muted-light);
    background: var(--surface-muted);
    pointer-events: none;
}

.page-item.ellipsis .page-link {
    min-width: 24px;
    border-color: transparent;
    background: transparent;
    pointer-events: none;
}

/* ---------- Small utilities ---------- */
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-5 { margin-top: 20px; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-5 { margin-bottom: 20px; }
.ml-2 { margin-left: 8px; }
.text-sm { font-size: 12.5px; }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }

.auth-note--plain {
    margin-top: 14px;
    padding-top: 0;
    border-top: 0;
}

/* ---------- Footer ---------- */
.site-footer {
    padding: 16px 24px;
    background: var(--surface);
    border-top: 1px solid var(--border);
}

.site-footer__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
    max-width: var(--content-max);
    margin: 0 auto;
    color: var(--muted-light);
    font-size: 12px;
}

.site-footer__links {
    display: flex;
    gap: 16px;
}

.site-footer__links a {
    color: var(--muted);
    text-decoration: none;
}

.site-footer__links a:hover,
.site-footer__links a:focus-visible {
    color: var(--primary);
    text-decoration: underline;
}

/* ---------- Drawer overlay ---------- */
.drawer-overlay {
    position: fixed;
    inset: 0;
    z-index: 45;
    background: rgba(16, 24, 40, 0.45);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

body.drawer-open .drawer-overlay {
    opacity: 1;
    visibility: visible;
}

body.drawer-open {
    overflow: hidden;
}

/* ---------- Responsive ---------- */
@media (max-width: 991px) {
    .site-header__inner {
        padding: 0 16px;
    }

    .menu-toggle {
        display: inline-flex;
    }

    .app-shell {
        flex-direction: column;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 50;
        width: min(290px, 86vw);
        height: 100vh;
        max-height: none;
        padding: 0 14px 24px;
        border-right: 1px solid var(--border);
        transform: translateX(-100%);
        transition: transform 0.22s ease;
    }

    body.drawer-open .sidebar {
        transform: translateX(0);
    }

    .sidebar__head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        height: var(--header-h);
        margin-bottom: 14px;
        padding: 0 6px;
        position: sticky;
        top: 0;
        z-index: 1;
        background: var(--surface);
        border-bottom: 1px solid var(--border);
    }

    .sidebar__foot {
        margin-top: 20px;
    }

    .main-content {
        padding: 22px 18px 32px;
    }

    .main-content--guest {
        padding-top: 36px;
    }
}

@media (max-width: 767px) {
    .stat-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

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

    .page-head__title {
        font-size: 20px;
    }

    .toolbar .input,
    .toolbar .select,
    .toolbar .btn {
        width: 100%;
        flex: 1 1 100%;
    }

    .user-chip__email {
        display: none;
    }

    .table {
        min-width: 640px;
    }

    .table--wide {
        min-width: 900px;
    }
}

@media (max-width: 560px) {
    .site-header__inner {
        gap: 10px;
        padding: 0 12px;
    }

    .brand__text {
        max-width: 42vw;
    }

    .brand__badge {
        display: none;
    }

    .logout-form .btn {
        width: 38px;
        min-height: 38px;
        padding: 0;
    }

    .logout-form .btn__label {
        display: none;
    }

    .user-chip__meta {
        display: none;
    }

    .main-content {
        padding: 18px 12px 28px;
    }

    .main-content--guest {
        padding-top: 28px;
    }

    .card {
        padding: 18px;
    }

    .card--auth {
        padding: 22px 18px;
    }

    .stat-grid {
        gap: 10px;
    }

    .stat-card {
        padding: 14px;
    }

    .stat-card__value {
        font-size: 22px;
    }

    .data-list__item {
        grid-template-columns: minmax(0, 1fr);
        padding: 10px 14px;
        gap: 2px;
    }

    .data-list__label {
        padding: 0;
        background: transparent;
        font-size: 12px;
    }

    .data-list__value {
        padding: 0;
        font-size: 13.5px;
    }

    .form-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .form-actions .btn {
        width: 100%;
    }

    .welcome {
        align-items: flex-start;
    }

    .site-footer {
        padding: 14px 16px;
    }

    .site-footer__inner {
        justify-content: center;
        text-align: center;
    }

    .pagination-wrap {
        justify-content: center;
    }

    .pagination-label {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}
