/* ==========================================================================
   FBM Credential Management System: Component Layer

   Loaded after theme.css. theme.css owns the design tokens and the app shell
   (sidebar, topbar, cards, tables, PIN modal); this file adds the pieces the
   views were written against but that were never defined anywhere: the form
   system, validation states, the authentication pages, and the small utility
   set the Razor markup uses.

   Before this file existed the views referenced ~130 Bootstrap-style class
   names while no Bootstrap stylesheet was ever linked, so every form in the
   app rendered unstyled.
   ========================================================================== */

/* ==========================================================================
   Page structure
   ========================================================================== */

.container {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
}

.container-fluid { width: 100%; }

.page-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.eyebrow {
    margin: 0 0 4px;
    color: var(--primary-700);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.page-title {
    margin: 0 0 4px;
    font-size: clamp(23px, 2.3vw, 30px);
    line-height: 1.15;
    font-weight: 800;
    letter-spacing: -0.025em;
    color: var(--text-primary);
}

.page-subtitle {
    margin: 0;
    color: var(--text-secondary);
    font-size: 14px;
}

/* ==========================================================================
   Cards
   ========================================================================== */

.card {
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    background: var(--surface-primary);
    box-shadow: var(--shadow-sm);
}

.card-pad { padding: 24px; }

.card-head,
.card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-default);
}

.card-head h2, .card-head h3,
.card-header h2, .card-header h3 {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
}

.card-body { padding: 24px; }

/* ==========================================================================
   Forms
   ========================================================================== */

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

.form-grid .full,
.field.full { grid-column: 1 / -1; }

.field {
    display: grid;
    gap: 7px;
    align-content: start;
    margin-bottom: 18px;
}

.form-grid .field { margin-bottom: 0; }

.form-label,
.field > label,
label {
    color: #334155;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.3;
}

.required,
.field-required {
    color: var(--danger);
    margin-left: 2px;
}

.form-control,
.form-select,
.input,
.select,
.textarea,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="url"],
input[type="date"],
input[type="search"],
input[type="tel"],
select,
textarea {
    width: 100%;
    min-height: 42px;
    padding: 10px 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    outline: none;
    color: var(--text-primary);
    background: var(--surface-primary);
    font-family: inherit;
    font-size: 15px;
    transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
    -webkit-appearance: none;
    appearance: none;
}

textarea,
.textarea {
    min-height: 104px;
    resize: vertical;
    line-height: 1.5;
}

.form-select,
select {
    padding-right: 38px;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='4 6 8 10 12 6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    cursor: pointer;
}

/* Custom dropdown component. The native select remains in the form as the
   submission and validation source of truth. */
.app-dropdown {
    position: relative;
    width: 100%;
    min-width: 0;
}

.app-dropdown-native {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    min-height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.app-dropdown-trigger {
    width: 100%;
    height: 42px;
    min-height: 42px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 9px 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    background: var(--surface-primary);
    font: inherit;
    font-size: 13px;
    font-weight: 400;
    text-align: left;
    cursor: pointer;
    transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.app-dropdown-trigger:hover {
    border-color: #94a3b8;
    background: #FFE2D9;
}

.app-dropdown-trigger:focus-visible,
.app-dropdown.is-open .app-dropdown-trigger {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 4px rgba(255, 112, 67, .16);
}

.app-dropdown.is-invalid .app-dropdown-trigger {
    border-color: var(--danger);
    background: var(--danger-bg);
}

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

.app-dropdown-chevron {
    width: 8px;
    height: 8px;
    flex: 0 0 auto;
    border-right: 2px solid var(--text-muted);
    border-bottom: 2px solid var(--text-muted);
    transform: rotate(45deg) translateY(-2px);
    transition: transform 160ms ease;
}

.app-dropdown.is-open .app-dropdown-chevron {
    transform: rotate(225deg) translate(-2px, -2px);
}

.app-dropdown-list {
    position: fixed;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 214px;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    padding: 7px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    background: #ffffff;
    box-shadow: var(--shadow-popup);
}

.app-dropdown-list[hidden] { display: none; }

.app-dropdown-option {
    flex: 0 0 auto;
    width: 100%;
    min-height: 34px;
    display: flex;
    align-items: center;
    padding: 7px 10px;
    border: 0;
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    background: transparent;
    font: inherit;
    font-size: 13px;
    font-weight: 400;
    line-height: 1.3;
    text-align: left;
    cursor: pointer;
    transition: background 130ms ease, color 130ms ease;
}

.app-dropdown-option:hover,
.app-dropdown-option:focus-visible {
    outline: none;
    color: var(--text-primary);
    background: #FFE2D9;
}

.app-dropdown-option.is-selected {
    color: #ffffff;
    background: #FF7043;
}

.app-dropdown-option:disabled {
    color: var(--text-disabled);
    cursor: not-allowed;
    opacity: .6;
}

.app-dropdown.is-disabled .app-dropdown-trigger {
    color: var(--text-muted);
    background: var(--surface-secondary);
    cursor: not-allowed;
}

.form-control:hover,
.form-select:hover,
input:hover,
select:hover,
textarea:hover { border-color: #94a3b8; }

.form-control:focus,
.form-select:focus,
.input:focus,
input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary-500);
    box-shadow: 0 0 0 4px rgba(255, 112, 67, 0.16);
}

.form-control::placeholder,
textarea::placeholder { color: var(--text-disabled); }

.form-control:disabled,
.form-control[readonly],
select:disabled,
textarea:disabled {
    background: var(--surface-secondary);
    color: var(--text-muted);
    cursor: not-allowed;
}

/* Help text and inline validation messages */
.hint,
.help-text {
    color: var(--text-muted);
    font-size: 12.5px;
    line-height: 1.45;
}

.field-error,
.error-text,
.text-danger,
.field-validation-error {
    color: #b91c1c;
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1.45;
}

/* Inline errors carry a small glyph so they read as a message rather than
   stray red body copy. :empty guards the placeholder spans ASP.NET renders
   even when a field is valid. */
.field-error:not(:empty)::before,
.field-validation-error:not(:empty)::before {
    content: "";
    display: inline-block;
    width: 13px;
    height: 13px;
    margin-right: 5px;
    vertical-align: -2px;
    background: no-repeat center / contain
        url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23b91c1c' stroke-width='2.5' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cline x1='12' y1='7' x2='12' y2='13'/%3E%3Cline x1='12' y1='17' x2='12.01' y2='17'/%3E%3C/svg%3E");
}

/* Invalid state rendered from server-side ModelState errors */
.form-control.input-validation-error,
.form-select.input-validation-error,
input.input-validation-error,
select.input-validation-error,
textarea.input-validation-error,
.form-control.is-invalid,
.input.error {
    border-color: var(--danger);
    background: var(--danger-bg);
}

.form-control.input-validation-error:focus,
input.input-validation-error:focus,
select.input-validation-error:focus,
textarea.input-validation-error:focus,
.form-control.is-invalid:focus {
    box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.16);
}

/* Server-side validation summary */
.validation-summary-errors {
    border: 1px solid var(--danger-border);
    border-left: 4px solid var(--danger);
    background: var(--danger-bg);
    color: #991b1b;
    border-radius: var(--radius-md);
    padding: 14px 16px;
    margin-bottom: 20px;
    font-size: 14px;
}

.validation-summary-errors ul { margin: 0; padding-left: 18px; }
.validation-summary-errors ul:empty { display: none; }
.validation-summary-errors li { margin: 2px 0; font-weight: 600; }
.validation-summary-valid { display: none; }

/* Checkboxes and radios */
.form-check,
.check-row {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
    line-height: 1.35;
}

.form-check-input,
input[type="checkbox"],
input[type="radio"] {
    width: 17px;
    height: 17px;
    min-height: 0;
    margin: 0;
    padding: 0;
    flex: 0 0 auto;
    accent-color: var(--primary-600);
    cursor: pointer;
}

.form-check-label,
.check-row label {
    margin: 0;
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
}

/* Password field with a reveal toggle */
.input-affix { position: relative; display: block; }
.input-affix > .form-control,
.input-affix > input { padding-right: 44px; }

/* Hide the browser's own reveal/clear buttons so only our toggle shows. */
.input-affix > input::-ms-reveal,
.input-affix > input::-ms-clear { display: none; }

.input-affix-btn {
    position: absolute;
    top: 50%;
    right: 6px;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: 150ms ease;
}

.input-affix-btn:hover {
    color: var(--primary-700);
    background: var(--primary-50);
}

.input-affix-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 112, 67, 0.28);
}

/* ==========================================================================
   Buttons: variants beyond the three in theme.css
   ========================================================================== */

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

.btn-outline:hover {
    border-color: var(--primary-300);
    background: var(--primary-50);
    color: var(--primary-800);
}

.btn-outline-primary {
    background: transparent;
    border-color: var(--primary-500);
    color: var(--primary-700);
}

.btn-outline-primary:hover { background: var(--primary-50); }

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

.btn-outline-secondary:hover {
    background: var(--surface-secondary);
    color: var(--text-primary);
}

.btn-outline-warning {
    background: transparent;
    border-color: var(--warning);
    color: #92400e;
}

.btn-outline-warning:hover { background: var(--warning-bg); }

.btn-danger  { background: var(--danger); color: #ffffff; }
.btn-danger:hover  { background: #b91c1c; }
.btn-warning { background: var(--warning); color: #ffffff; }
.btn-warning:hover { background: #b45309; }
.btn-ghost   { background: var(--primary-50); color: var(--primary-800); }
.btn-ghost:hover { background: var(--primary-100); }

.btn:disabled,
.btn[disabled],
.btn.is-loading {
    color: var(--text-disabled);
    border-color: var(--border-default);
    background: var(--surface-secondary);
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
}

.btn:focus-visible,
.icon-button:focus-visible,
.menu-item:focus-visible,
a:focus-visible {
    outline: none;
    box-shadow: 0 0 0 4px rgba(255, 112, 67, 0.28);
}

.btn-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

/* Spinner shown while a form is submitting */
.btn .spinner {
    width: 15px;
    height: 15px;
    border-radius: 50%;
    border: 2px solid currentColor;
    border-right-color: transparent;
    animation: btn-spin 620ms linear infinite;
    display: none;
}

.btn.is-loading .spinner { display: inline-block; }
.btn.is-loading .btn-label { opacity: 0.75; }

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

/* ==========================================================================
   Alerts
   ========================================================================== */

.alert,
.alert-bar {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    padding: 14px 16px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    font-size: 14px;
    line-height: 1.5;
    background: var(--surface-secondary);
    color: var(--text-primary);
}

.alert svg,
.alert-bar svg { flex: 0 0 auto; margin-top: 1px; }

.alert-danger,
.alert-bar.danger,
.alert-bar.error {
    background: var(--danger-bg);
    border-color: var(--danger-border);
    color: #991b1b;
}

.alert-success,
.alert-bar.success {
    background: var(--success-bg);
    border-color: var(--success-border);
    color: #166534;
}

.alert-warning,
.alert-bar.warning {
    background: var(--warning-bg);
    border-color: var(--warning-border);
    color: #92400e;
}

.alert-info,
.alert-bar.info {
    background: var(--info-bg);
    border-color: var(--info-border);
    color: #1e3a8a;
}

/* ==========================================================================
   Tables
   ========================================================================== */

.table-wrap {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    border-radius: var(--radius-lg);
}

.table,
table.table,
.data,
table.data {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 14px;
}

.table th,
.data th {
    background: var(--surface-secondary);
    padding: 10px 16px;
    color: var(--text-secondary);
    font-weight: 700;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid var(--border-default);
    white-space: normal;
    overflow-wrap: normal;
    word-break: normal;
}

.table td,
.data td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-default);
    vertical-align: middle;
    font-weight: 400;
    overflow-wrap: normal;
    word-break: normal;
}

/* Keep every table-body value at normal weight, including nested links,
   badges, buttons and legacy <strong> elements. */
.custom-table tbody td,
.custom-table tbody td :where(*),
.table tbody td,
.table tbody td :where(*),
.data tbody td,
.data tbody td :where(*) {
    font-weight: 400;
}

/* Pills are atomic values: move the whole pill instead of splitting its text. */
.custom-table tbody td .badge,
.table tbody td .badge,
.data tbody td .badge {
    white-space: nowrap;
    overflow-wrap: normal;
    word-break: normal;
}

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

.table-hover tbody tr:hover,
.data tbody tr:hover,
.custom-table tbody tr:hover { background: var(--surface-hover); }

.align-middle { vertical-align: middle; }

/* Empty state */
.empty {
    padding: 44px 20px;
    text-align: center;
    color: var(--text-muted);
}

.empty h3 {
    margin: 12px 0 4px;
    color: var(--text-secondary);
    font-size: 16px;
}

/* ==========================================================================
   Badges: semantic variants
   ========================================================================== */

.badge-pill { border-radius: 9999px; }

.badge-success {
    background: var(--success-bg);
    color: #166534;
    border: 1px solid var(--success-border);
}

.badge-neutral,
.badge-default {
    background: var(--surface-secondary);
    color: var(--text-secondary);
    border: 1px solid var(--border-default);
}

/* ==========================================================================
   Credential detail / secret rows
   ========================================================================== */

.definition-grid {
    display: grid;
    grid-template-columns: minmax(160px, 220px) minmax(0, 1fr);
    gap: 10px 20px;
    font-size: 14px;
}

.definition-grid dt,
.definition-grid .label {
    color: var(--text-muted);
    font-weight: 600;
}

.definition-grid dd,
.definition-grid .data {
    margin: 0;
    color: var(--text-primary);
    word-break: break-word;
}

.secret-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 11px 0;
    border-bottom: 1px solid var(--divider);
}

.secret-row:last-child { border-bottom: 0; }

.secret-name {
    min-width: 170px;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 13.5px;
}

.secret-value {
    flex: 0 1 auto;
    min-width: 80px;
    max-width: min(60ch, 100%);
    font-family: Consolas, "Courier New", monospace;
    font-size: 14px;
    letter-spacing: 0.04em;
    color: var(--text-primary);
    word-break: break-all;
}

button.secret-value {
    padding: 2px 0;
    border: 0;
    background: transparent;
    text-align: left;
    cursor: pointer;
}

button.secret-value:hover,
button.secret-value:focus-visible {
    color: var(--primary-700);
}

.credential-definition-grid {
    grid-template-columns: repeat(4, minmax(150px, 1fr));
    gap: 18px 24px;
}

.credential-definition-grid > div {
    min-width: 0;
}

.credential-definition-grid dt {
    margin-bottom: 4px;
}

.credential-definition-grid .definition-wide {
    grid-column: 1 / -1;
}

.plain-value {
    flex: 0 1 auto;
    min-width: 0;
    max-width: min(60ch, 100%);
    font-size: 14px;
    color: var(--text-primary);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.detail-section-title {
    margin: 0 0 6px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.preserve-whitespace {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.icon-btn {
    width: 34px;
    height: 34px;
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    padding: 0;
    border: 1px solid var(--border-default);
    border-radius: 8px;
    color: var(--text-secondary);
    background: var(--surface-primary);
    cursor: pointer;
    transition: color 150ms ease, border-color 150ms ease, background 150ms ease;
}

.icon-btn:hover,
.icon-btn:focus-visible {
    color: var(--primary-700);
    border-color: var(--primary-300);
    background: var(--primary-50);
}

.credential-vault-table {
    min-width: 0;
    table-layout: auto;
}

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

.list-secret-cell {
    min-width: 0;
    white-space: nowrap;
}

.personal-vault-table {
    table-layout: fixed;
}

.personal-vault-table .personal-col-title { width: 17%; }
.personal-vault-table .personal-col-group { width: 9%; }
.personal-vault-table .personal-col-type { width: 11%; }
.personal-vault-table .personal-col-login { width: 19%; }
.personal-vault-table .personal-col-info { width: 19%; }
.personal-vault-table .personal-col-age { width: 9%; }
.personal-vault-table .personal-col-status { width: 9%; }
.personal-vault-table .personal-col-actions { width: 7%; }

.list-secret-reveal {
    max-width: 125px;
    padding: 5px 4px;
    border: 0;
    color: var(--text-primary);
    background: transparent;
    font: 500 13px/1.25 Consolas, "Courier New", monospace;
    text-align: left;
    vertical-align: middle;
    cursor: pointer;
}

.list-secret-reveal:hover,
.list-secret-reveal:focus-visible {
    color: var(--primary-700);
}

.list-secret-text {
    display: block;
    max-width: 116px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.list-login-cell,
.list-info-cell {
    min-width: 0;
}

.list-login-row {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
    line-height: 1.25;
}

.list-login-row + .list-login-row { margin-top: 2px; }

.list-login-value {
    min-width: 0;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
}

.list-login-row .list-secret-reveal { padding: 0; }

/* Bare copy icon, sized to the text line (no button chrome). */
.list-copy-icon {
    display: inline-flex;
    flex: 0 0 auto;
    padding: 0;
    border: 0;
    color: var(--text-muted);
    background: transparent;
    line-height: 0;
    cursor: pointer;
}

.list-copy-icon svg {
    width: 13px;
    height: 13px;
}

.list-copy-icon:hover,
.list-copy-icon:focus-visible {
    color: var(--primary-700);
}

.list-info-line {
    display: block;
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
    line-height: 1.35;
}

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

.list-secret-status {
    width: fit-content;
    max-width: calc(100% - 32px);
    margin: 10px 16px;
    padding: 7px 10px;
    border-radius: 8px;
    font-size: 12.5px;
}

.list-secret-status[hidden] { display: none; }

.modal-open { overflow: hidden; }

.secret-mfa-backdrop {
    position: fixed;
    inset: 0;
    z-index: 10020;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(10, 25, 38, .68);
    backdrop-filter: blur(6px);
}

.secret-mfa-backdrop[hidden] { display: none; }

.secret-mfa-card {
    position: relative;
    width: min(430px, 100%);
    padding: 30px;
    border: 1px solid var(--border-default);
    border-radius: 18px;
    color: var(--text-primary);
    background: var(--surface-primary);
    box-shadow: 0 24px 70px rgba(7, 24, 38, .28);
}

.secret-mfa-card h2 {
    margin: 7px 0 8px;
    font-size: 23px;
    letter-spacing: -.02em;
}

.secret-mfa-card > p {
    margin: 0 0 22px;
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.55;
}

.secret-mfa-icon {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    margin-bottom: 16px;
    border: 1px solid var(--primary-100);
    border-radius: 13px;
    color: var(--primary-700);
    background: var(--primary-50);
}

.secret-mfa-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 8px;
    color: var(--text-muted);
    background: transparent;
    cursor: pointer;
}

.secret-mfa-close:hover,
.secret-mfa-close:focus-visible {
    color: var(--text-primary);
    background: var(--surface-secondary);
}

.secret-mfa-code {
    text-align: center;
    font-size: 22px !important;
    font-weight: 600;
    letter-spacing: .32em;
    font-variant-numeric: tabular-nums;
}

.secret-mfa-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 22px;
}

.secret-mfa-actions .btn { min-width: 120px; }

.breadcrumb-back {
    width: 36px;
    height: 36px;
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    border: 1px solid var(--border-default);
    border-radius: 9px;
    color: var(--text-secondary);
    background: var(--surface-secondary);
    text-decoration: none;
}

.breadcrumb-back:hover,
.breadcrumb-back:focus-visible {
    color: var(--primary-700);
    border-color: var(--primary-200);
    background: var(--primary-50);
}

.type-section {
    min-width: 0;
    margin: 26px 0 0;
    padding: 18px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    background: var(--surface-primary);
}

.type-section > legend {
    float: none;
    width: auto;
    margin: 0 0 2px -6px;
    padding: 0 7px;
    color: var(--text-primary);
    background: var(--surface-primary);
    font-size: 16px;
    font-weight: 700;
    line-height: 1.3;
}

.type-section > .form-grid {
    margin-top: 12px;
}

.custom-fields-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 10px 0 14px;
}

.custom-fields-intro {
    margin: 0 0 2px;
    color: var(--text-secondary);
    font-size: 13px;
}

.custom-fields-count {
    color: var(--text-muted);
    font-size: 12px;
}

.custom-field-rows {
    display: grid;
    gap: 10px;
}

.custom-field-row {
    display: grid;
    grid-template-columns: minmax(150px, 0.8fr) minmax(190px, 1.2fr) auto 36px;
    gap: 12px;
    align-items: end;
    padding: 12px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    background: var(--surface-hover);
}

.custom-field-row .field {
    gap: 5px;
    margin: 0;
}

.custom-field-row .field > label {
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
}

.custom-field-row input[type="text"],
.custom-field-row input[type="password"] {
    min-height: 40px;
    padding: 9px 12px;
}

.custom-secret-toggle {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0 10px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    background: var(--surface-primary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.custom-secret-toggle:has(input:checked) {
    color: var(--primary-700);
    border-color: var(--primary-200);
    background: var(--primary-50);
}

.custom-field-row .cf-remove {
    margin-bottom: 3px;
}

.custom-field-row .cf-remove:hover,
.custom-field-row .cf-remove:focus-visible {
    color: var(--danger);
    border-color: var(--danger-border);
    background: var(--danger-bg);
}

.custom-fields-empty {
    min-height: 104px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 8px;
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-md);
    color: var(--text-muted);
    background: var(--surface-hover);
    font-size: 13px;
}

.custom-fields-empty[hidden] {
    display: none;
}

.custom-fields-empty-icon {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: var(--primary-600);
    background: var(--primary-50);
}

.custom-fields-note {
    display: flex;
    align-items: flex-start;
    gap: 7px;
    margin: 12px 0 0;
    color: var(--text-muted);
    font-size: 12px;
}

.custom-fields-note svg {
    flex: 0 0 auto;
    margin-top: 1px;
}

.type-section > h3 {
    margin: 0 0 16px;
    font-size: 15px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 14px;
    padding: 18px 20px;
    margin-bottom: 22px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    background: var(--surface-primary);
    box-shadow: var(--shadow-sm);
}

.filter-bar .field {
    margin-bottom: 0;
    min-width: 165px;
}

/* ==========================================================================
   Authentication pages
   ========================================================================== */

.auth-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.05fr 1fr;
    background: var(--app-background);
}

/* Brand panel */
.auth-aside {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 48px 52px;
    color: var(--menu-text);
    background:
        radial-gradient(circle at 18% 12%, rgba(255, 112, 67, 0.30), transparent 46%),
        radial-gradient(circle at 84% 88%, rgba(201, 227, 56, 0.16), transparent 44%),
        var(--menu-background);
}

.auth-aside::after {
    content: "";
    position: absolute;
    right: -140px;
    bottom: -170px;
    width: 420px;
    height: 420px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.07);
}

.auth-aside-brand {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 13px;
}

.auth-aside-body {
    position: relative;
    z-index: 1;
    max-width: 430px;
}

.auth-aside-body h2 {
    margin: 0 0 14px;
    color: #ffffff;
    font-size: clamp(26px, 2.7vw, 36px);
    line-height: 1.2;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.auth-aside-body p {
    margin: 0;
    color: var(--menu-text-muted);
    font-size: 15px;
    line-height: 1.65;
}

.auth-points {
    position: relative;
    z-index: 1;
    display: grid;
    gap: 15px;
    margin: 30px 0 0;
    padding: 0;
    list-style: none;
}

.auth-points li {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    color: var(--menu-text);
    font-size: 14px;
    line-height: 1.5;
}

.auth-points .tick {
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    margin-top: 1px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: rgba(201, 227, 56, 0.18);
    color: var(--secondary-400);
}

.auth-aside-foot {
    position: relative;
    z-index: 1;
    color: var(--menu-text-muted);
    font-size: 12.5px;
}

/* Form panel */
.auth-main {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    overflow-y: auto;
}

.auth-card {
    width: 100%;
    max-width: 424px;
    background: transparent;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
}

.auth-head { margin-bottom: 26px; }

.auth-head h1 {
    margin: 0 0 7px;
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.auth-head p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 14.5px;
}

.auth-form .field { margin-bottom: 17px; }

.auth-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    margin: 4px 0 22px;
}

.auth-meta-end {
    justify-content: flex-end;
}

.auth-link {
    color: var(--primary-700);
    font-size: 13.5px;
    font-weight: 600;
    text-decoration: none;
}

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

.auth-submit {
    width: 100%;
    min-height: 46px;
    font-size: 15px;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 24px 0;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.auth-divider::before,
.auth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--border-default);
}

.auth-sso {
    width: 100%;
    min-height: 46px;
    background: var(--surface-primary);
    border-color: var(--border-strong);
    color: var(--text-primary);
    font-size: 14.5px;
}

.auth-sso:hover {
    border-color: var(--primary-300);
    background: var(--primary-50);
}

.auth-foot {
    margin-top: 26px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

.auth-note {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 22px;
    padding: 12px 14px;
    border: 1px solid var(--info-border);
    border-radius: var(--radius-md);
    background: var(--info-bg);
    color: #1e3a8a;
    font-size: 13px;
    line-height: 1.5;
}

/* Invitation acceptance */
.auth-kicker {
    display: block;
    margin-bottom: 7px;
    color: var(--primary-700);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.invitation-head { margin-bottom: 20px; }
.setup-progress {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    margin: 0 0 20px;
    padding: 0;
    list-style: none;
}
.setup-progress::before {
    content: "";
    position: absolute;
    top: 17px;
    left: 17px;
    right: 17px;
    height: 1px;
    background: var(--border-default);
}
.setup-progress li {
    position: relative;
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
    color: var(--text-muted);
    font-size: 12px;
}
.setup-progress li:last-child { justify-content: flex-end; }
.setup-progress-number {
    width: 34px;
    height: 34px;
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    border: 1px solid var(--border-default);
    border-radius: 50%;
    color: var(--text-muted);
    background: var(--surface-primary);
    font-weight: 700;
}
.setup-progress li.active { color: var(--text-primary); }
.setup-progress li.active .setup-progress-number {
    border-color: var(--primary-500);
    color: #ffffff;
    background: var(--primary-500);
    box-shadow: 0 0 0 4px var(--primary-50);
}
.setup-progress strong,
.setup-progress small { display: block; }
.setup-progress strong { color: inherit; font-size: 12.5px; }
.setup-progress small { margin-top: 1px; font-size: 11px; }
.invitation-account {
    display: flex;
    align-items: center;
    gap: 11px;
    margin-bottom: 20px;
    padding: 12px 14px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    background: var(--surface-secondary);
}
.invitation-account-icon {
    width: 34px;
    height: 34px;
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    border-radius: var(--radius-sm);
    color: var(--primary-700);
    background: var(--primary-50);
}
.invitation-account small,
.invitation-account strong { display: block; }
.invitation-account small { margin-bottom: 2px; color: var(--text-muted); font-size: 11px; }
.invitation-account strong { color: var(--text-primary); font-size: 13.5px; overflow-wrap: anywhere; }
.invitation-next-step { margin-top: 18px; }
.invitation-next-step > svg { flex: 0 0 auto; margin-top: 2px; }

/* TOTP / PIN code entry */
.code-input {
    text-align: center;
    font-family: Consolas, "Courier New", monospace;
    font-size: 26px;
    font-weight: 700;
    letter-spacing: 0.42em;
    text-indent: 0.42em;
    padding: 12px;
}

.qr-panel {
    display: grid;
    place-items: center;
    gap: 14px;
    padding: 22px;
    margin-bottom: 20px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    background: var(--surface-secondary);
}

.qr-panel img,
.qr-panel svg {
    width: 190px;
    height: 190px;
    display: block;
    border-radius: var(--radius-md);
    background: #ffffff;
    padding: 10px;
    box-shadow: var(--shadow-sm);
}

.qr-secret {
    display: flex;
    align-items: center;
    gap: 9px;
    flex-wrap: wrap;
    justify-content: center;
}

.qr-secret code {
    padding: 7px 11px;
    border-radius: var(--radius-sm);
    background: var(--surface-primary);
    border: 1px solid var(--border-default);
    font-family: Consolas, "Courier New", monospace;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.11em;
    color: var(--primary-800);
    word-break: break-all;
}

/* Password strength meter */
.pw-meter {
    display: grid;
    gap: 6px;
    margin-top: 2px;
}

.pw-meter-track { display: flex; gap: 4px; }

.pw-meter-track span {
    flex: 1;
    height: 4px;
    border-radius: 2px;
    background: var(--surface-tertiary);
    transition: background 200ms ease;
}

.pw-meter[data-score="1"] .pw-meter-track span:nth-child(-n+1) { background: #dc2626; }
.pw-meter[data-score="2"] .pw-meter-track span:nth-child(-n+2) { background: #f59e0b; }
.pw-meter[data-score="3"] .pw-meter-track span:nth-child(-n+3) { background: #eab308; }
.pw-meter[data-score="4"] .pw-meter-track span { background: #16a34a; }

.pw-meter-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
}

/* ==========================================================================
   Utilities
   ========================================================================== */

.d-flex   { display: flex; }
.d-block  { display: block; }
.d-none   { display: none; }
.h-100    { height: 100%; }
.w-100    { width: 100%; }
.flex-wrap { flex-wrap: wrap; }
.align-items-center      { align-items: center; }
.align-items-start       { align-items: flex-start; }
.justify-content-between { justify-content: space-between; }
.justify-content-center  { justify-content: center; }
.justify-content-end     { justify-content: flex-end; }
.text-center { text-align: center; }
.text-end    { text-align: right; }
.text-muted  { color: var(--text-muted); }
.text-success { color: #166534; }
.text-white  { color: #ffffff; }
.text-dark   { color: var(--text-primary); }
.text-decoration-none { text-decoration: none; }
.small       { font-size: 13px; }
.fw-bold, .font-weight-bold { font-weight: 700; }
.font-weight-semibold { font-weight: 600; }
.font-monospace { font-family: Consolas, "Courier New", monospace; }
.user-select-all { user-select: all; }
.border-0    { border: 0 !important; }
.shadow-sm   { box-shadow: var(--shadow-sm); }
.stack       { display: grid; gap: 16px; }

/* Standalone compact content should sit on the page's visual centerline. The
   width remains fluid on small screens, while grid/list cards keep their own
   full-width layouts. */
.content-narrow {
    width: min(560px, 100%);
    margin-inline: auto;
}
.content-narrow-sm { width: min(460px, 100%); }

/* Compact standalone forms should fit a normal desktop viewport without a
   cosmetic page scrollbar. Smaller viewports still scroll naturally; content
   is never clipped with overflow:hidden. */
@media (min-width: 993px) {
    .content:has(> .page-head + .content-narrow) {
        padding-top: 20px;
        padding-bottom: 20px;
    }

    .content:has(> .page-head + .content-narrow) > .page-head {
        margin-bottom: 16px;
    }

    .content-narrow { gap: 12px; }

    .content-narrow:not(.content-narrow-sm) > .card.card-pad {
        padding: 20px;
    }

    .content-narrow:not(.content-narrow-sm) .field {
        margin-bottom: 12px !important;
    }
}

.m-0  { margin: 0; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 16px; }
.mb-4 { margin-bottom: 24px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.mt-4 { margin-top: 24px; }
.me-1, .mr-1 { margin-right: 4px; }
.me-2, .mr-2 { margin-right: 8px; }
.mx-auto { margin-left: auto; margin-right: auto; }

.p-0 { padding: 0; }
.p-3 { padding: 16px; }
.p-4 { padding: 24px; }
.py-3 { padding-top: 16px; padding-bottom: 16px; }
.py-4 { padding-top: 24px; padding-bottom: 24px; }

.h2 { font-size: 26px; font-weight: 800; }
.h4 { font-size: 19px; font-weight: 700; }
.h5 { font-size: 16px; font-weight: 700; }
.display-4 { font-size: 40px; font-weight: 800; letter-spacing: -0.03em; }

.bg-light     { background: var(--surface-secondary); }
.bg-primary   { background: var(--primary-600); color: #fff; }
.bg-secondary { background: var(--surface-tertiary); }
.bg-info      { background: var(--info-bg); color: var(--info); }
.bg-warning   { background: var(--warning-bg); color: #92400e; }

/* Legacy 12-column helpers still referenced by a few views. */
.row {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
}

.row > .col-md-4 { flex: 1 1 260px; min-width: 0; }
.row > .col-md-8 { flex: 2 1 420px; min-width: 0; }
.g-4 { gap: 24px; }

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 992px) {
    .auth-shell { grid-template-columns: 1fr; }
    .auth-aside { display: none; }
    .form-grid  { grid-template-columns: 1fr; }
    .definition-grid {
        grid-template-columns: 1fr;
        gap: 4px 0;
    }
    .definition-grid dt,
    .definition-grid .label { margin-top: 10px; }
}

@media (max-width: 640px) {
    .content { padding: 18px 14px; }
    .card-pad,
    .card-body { padding: 18px; }
    .page-head {
        flex-direction: column;
        gap: 14px;
    }
    .auth-main { padding: 28px 18px; }
    .secret-name { min-width: 100%; }
    .btn-row .btn { flex: 1 1 auto; }
    .custom-fields-toolbar {
        align-items: flex-start;
        flex-direction: column;
    }
    .custom-field-row {
        grid-template-columns: minmax(0, 1fr) 36px;
    }
    .custom-field-label,
    .custom-field-value {
        grid-column: 1 / -1;
    }
    .custom-secret-toggle { grid-column: 1; }
    .custom-field-row .cf-remove { grid-column: 2; }
}

@media (max-width: 1100px) {
    .credential-definition-grid { grid-template-columns: repeat(2, minmax(150px, 1fr)); }
}

@media (max-width: 640px) {
    .credential-definition-grid { grid-template-columns: 1fr; }
    .credential-definition-grid .definition-wide { grid-column: auto; }
}

/* ==========================================================================
   Professional application patterns
   ========================================================================== */

.page-head-main { min-width: 0; max-width: 780px; }
.page-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}
.page-title-row { display: flex; align-items: center; gap: 14px; }
.page-title-row .page-title { margin-bottom: 2px; }
.title-icon {
    width: 38px;
    height: 38px;
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    border: 1px solid var(--primary-100);
    border-radius: var(--radius-md);
    color: var(--primary-700);
    background: var(--primary-50);
}
.section-stack { display: grid; gap: 24px; }
.form-shell {
    width: min(760px, 100%);
    margin-inline: auto;
}
.card-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
    padding: 16px 24px;
    border-top: 1px solid var(--border-default);
    background: var(--surface-hover);
}
.card-kicker {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
}
.card-description { margin: 4px 0 0; color: var(--text-muted); font-size: 13px; }
.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 14px;
}
.summary-item {
    padding: 16px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    background: var(--surface-hover);
}
.summary-label {
    display: block;
    margin-bottom: 6px;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
}
.summary-value {
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 700;
    overflow-wrap: anywhere;
}
.summary-number {
    display: block;
    font-size: 28px;
    line-height: 1.1;
    letter-spacing: -.025em;
}
.user-search {
    display: grid;
    grid-template-columns: minmax(240px, 1fr) auto;
    gap: 12px;
    align-items: end;
}
.user-search .field { margin: 0; }
.user-search .filter-actions .btn { min-width: 110px; }
.user-cell {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
}
.user-avatar-sm {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 50%;
    color: var(--primary-800);
    background: var(--primary-50);
    border: 1px solid var(--primary-100);
    font-size: 13px;
    font-weight: 800;
}
.role-editor {
    display: grid;
    grid-template-columns: minmax(145px, 1fr) auto;
    align-items: center;
    gap: 8px;
    min-width: 0;
}
.role-editor select { min-height: 38px; padding-top: 7px; padding-bottom: 7px; }
.role-editor .btn { min-height: 38px; }
.user-table td { padding-top: 13px; padding-bottom: 13px; }
.user-table-shell {
    margin: 0;
    border-top: 1px solid var(--border-default);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    overflow: visible;
}
.user-table-shell .user-table {
    overflow: hidden;
    border-radius: inherit;
}
.user-table th:first-child,
.user-table td:first-child { width: 25%; }
.user-table th:nth-child(2),
.user-table td:nth-child(2) { width: 36%; }
.user-table th:nth-child(3),
.user-table td:nth-child(3) { width: 12%; }
.user-table th:nth-child(4),
.user-table td:nth-child(4) { width: 8%; }
.user-table th:nth-child(5),
.user-table td:nth-child(5) { width: 9%; }
.user-table th:last-child,
.user-table td:last-child { width: 10%; }
.user-table th { padding-top: 10px; padding-bottom: 10px; }
.user-table td { padding-top: 12px; padding-bottom: 12px; }
.user-table tbody tr:hover { background: var(--surface-secondary); }
.role-editor .app-dropdown-trigger {
    min-height: 38px;
    padding-top: 7px;
    padding-bottom: 7px;
}
.filter-panel {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-default);
    background: var(--surface-secondary);
}
.filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
    gap: 14px;
    align-items: end;
}
.filter-grid .field { margin: 0; gap: 6px; }
.filter-grid:has(.field-search) {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
}
.filter-grid:has(.field-search) .field { flex: 0 0 170px; }
.filter-grid:has(.field-search) .field-check { flex: 0 0 auto; }
.filter-grid:has(.field-search) .field-search { flex: 1 1 260px; min-width: 220px; }
.filter-grid:has(.field-search) .filter-actions { grid-column: auto; }
.filter-grid label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .045em;
}
.filter-grid .field-check {
    min-height: 42px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
}
.filter-grid .field-check .check-row {
    width: 100%;
    min-height: 42px;
    padding: 9px 0;
}
.filter-actions {
    display: flex;
    align-items: center;
    justify-self: start;
    gap: 8px;
}
.filter-grid .filter-actions:has(.btn + .btn) {
    grid-column: span 2;
}
.filter-actions .btn {
    flex: 0 0 auto;
    min-width: 112px;
    min-height: 42px;
    padding: 9px 16px;
}
.table-title {
    color: var(--text-primary);
    font-weight: 750;
    text-decoration: none;
}
.table-title:hover { color: var(--primary-700); }
.table-meta { display: block; margin-top: 4px; color: var(--text-muted); font-size: 12px; }
.table-cell-muted { color: var(--text-muted); font-size: 13px; }
.table-cell-code { font-family: Consolas, "Courier New", monospace; font-size: 12px; }
.table-actions { width: 1%; white-space: nowrap; text-align: right; }
.empty-state {
    display: grid;
    justify-items: center;
    gap: 10px;
    padding: 48px 24px;
    color: var(--text-muted);
    text-align: center;
}
.empty-state-icon {
    width: 54px;
    height: 54px;
    display: grid;
    place-items: center;
    color: var(--primary-600);
    border: 1px solid var(--primary-100);
    border-radius: 50%;
    background: var(--primary-50);
}
.empty-state h3 { margin: 0; color: var(--text-primary); font-size: 16px; }
.empty-state p { max-width: 540px; margin: 0; font-size: 14px; }
.action-menu { position: relative; display: inline-block; }
.action-menu > summary {
    min-width: 98px;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 7px 12px;
    list-style: none;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    background: var(--surface-primary);
    font-size: 13px;
    font-weight: 400;
    cursor: pointer;
    user-select: none;
}
.action-menu > summary::-webkit-details-marker { display: none; }
.action-menu > summary:hover,
.action-menu[open] > summary {
    color: var(--primary-800);
    border-color: var(--primary-300);
    background: #FFE2D9;
}
.action-menu > summary::after {
    content: "";
    width: 6px;
    height: 6px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(45deg) translateY(-2px);
}
.action-menu-dots > summary {
    min-width: 34px;
    width: 34px;
    height: 34px;
    min-height: 34px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
}
.action-menu-dots > summary::after {
    display: none;
}
.action-menu-popover {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 30;
    width: 210px;
    padding: 6px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    background: #ffffff;
    box-shadow: var(--shadow-popup);
}
.js .action-menu-popover { position: fixed; }
.action-menu-popover form { margin: 0; }
.action-menu-item {
    width: 100%;
    min-height: 38px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border: 0;
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    background: transparent;
    font: inherit;
    font-size: 13px;
    font-weight: 400;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}
.action-menu-item:hover,
.action-menu-item:focus-visible {
    outline: none;
    color: var(--text-primary);
    background: #FFE2D9;
}
.action-menu-item.danger { color: var(--danger); }
.action-menu-item.danger:hover,
.action-menu-item.danger:focus-visible {
    color: #ffffff;
    background: #FF7043;
}
.action-menu-divider { height: 1px; margin: 5px 4px; background: var(--border-default); }
.private-vault-banner {
    padding: 24px;
    color: #ffffff;
    border-radius: var(--radius-lg);
    background:
        radial-gradient(circle at top right, rgba(255, 112, 67, .22), transparent 38%),
        linear-gradient(135deg, var(--menu-background-secondary), var(--menu-background));
    box-shadow: var(--shadow-card);
}
.private-vault-banner .eyebrow { color: var(--secondary-400); }
.private-vault-banner .page-title { color: #ffffff; }
.private-vault-banner .page-subtitle { color: #bfd0d9; }
.danger-zone {
    border-color: var(--danger-border);
    background: linear-gradient(180deg, #fff, var(--danger-bg));
}
.danger-zone .card-head { border-bottom-color: var(--danger-border); }
.prose-card {
    max-width: 900px;
    margin-inline: auto;
}
.prose-card h2 { margin: 28px 0 8px; font-size: 18px; }
.prose-card h2:first-child { margin-top: 0; }
.prose-card p, .prose-card li { color: var(--text-secondary); }
.mobile-menu-toggle,
.sidebar-backdrop { display: none; }

.pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 20px;
    border-top: 1px solid var(--border-default);
}
.pager-summary {
    margin: 0;
    color: var(--text-secondary);
    font-size: 13px;
}
.pager-links {
    display: flex;
    align-items: center;
    gap: 10px;
}
.pager-link,
.pager-current {
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
}
.pager-link {
    border: 1px solid var(--border-strong);
    color: var(--text-primary);
    background: #ffffff;
    font-weight: 600;
    text-decoration: none;
}
.pager-link:hover,
.pager-link:focus-visible {
    border-color: var(--primary-500);
    color: var(--primary-700);
    outline: none;
}
.pager-link.disabled {
    color: var(--text-muted);
    background: var(--surface-subtle);
    cursor: not-allowed;
    opacity: .7;
}
.pager-link.active {
    border-color: var(--primary-500);
    color: #ffffff;
    background: var(--primary-500);
    cursor: default;
}
.pager-link.page-number { min-width: 36px; padding-inline: 9px; }
.pager-current {
    color: var(--text-secondary);
    font-weight: 500;
}

@media (max-width: 760px) {
    .page-actions { width: 100%; justify-content: flex-start; }
    .page-actions .btn { flex: 1 1 auto; }
    .filter-actions { grid-column: 1 / -1; }
    .card-head,
    .card-header,
    .card-panel-header { align-items: flex-start; }
    .custom-table th,
    .custom-table td,
    .table th,
    .table td { padding-left: 14px; padding-right: 14px; }
    .user-search { grid-template-columns: 1fr; }
    .role-editor { min-width: 0; }
    .pager { align-items: stretch; flex-direction: column; }
    .pager-links { justify-content: space-between; }
}

@media (max-width: 992px) {
    .mobile-menu-toggle { display: inline-grid; }
    .sidebar-backdrop.is-open { display: block; }
}

.attachment-viewer-backdrop {
    position: fixed;
    inset: 0;
    z-index: 10010;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(10, 25, 38, .68);
    backdrop-filter: blur(6px);
}

.attachment-viewer-backdrop[hidden] { display: none; }

.attachment-viewer-card {
    width: min(960px, 100%);
    max-height: calc(100vh - 40px);
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-default);
    border-radius: 18px;
    color: var(--text-primary);
    background: var(--surface-primary);
    box-shadow: 0 24px 70px rgba(7, 24, 38, .28);
    overflow: hidden;
}

.attachment-viewer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px 14px 22px;
    border-bottom: 1px solid var(--border-default);
}

.attachment-viewer-head h2 {
    margin: 0;
    font-size: 17px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.attachment-viewer-actions { display: flex; align-items: center; gap: 8px; }
.attachment-viewer-actions .secret-mfa-close { position: static; }

.attachment-viewer-status { margin: 0; padding: 24px; color: var(--text-muted); text-align: center; }
.attachment-viewer-status[hidden] { display: none; }
.attachment-viewer-status.is-error { color: var(--danger-600, #b42318); }

.attachment-viewer-body {
    display: grid;
    place-items: center;
    min-height: 0;
    overflow: auto;
}

.attachment-viewer-image { max-width: 100%; max-height: calc(100vh - 140px); object-fit: contain; }
.attachment-viewer-frame { width: 100%; height: calc(100vh - 140px); border: 0; }
.attachment-viewer-note { padding: 32px; color: var(--text-muted); }
