.password-field { position: relative; min-width: 0; }
.password-field > .field { width: 100%; box-sizing: border-box; padding-inline-end: 48px; }
.password-field input::-ms-reveal { display: none; }
.password-toggle { position: absolute; inset-block: 1px; inset-inline-end: 1px; width: 42px; display: grid; place-items: center; border: 0; border-radius: 7px; background: transparent; color: var(--muted); cursor: pointer; }
.password-toggle:focus-visible { outline: 2px solid currentColor; outline-offset: -3px; }
.password-field input[type="password"] + button .eye-slash { display: none; }

:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --text: #182235;
  --muted: #667085;
  --line: #e4e7ec;
  --primary: #f97316;
  --primary-dark: #c2410c;
  --green: #16a34a;
  --red: #dc2626;
  --blue: #2563eb;
  --amber: #d97706;
  --shadow: 0 12px 28px rgba(15, 23, 42, .08);
}

* { box-sizing: border-box; }
body { margin: 0; font-family: Arial, Helvetica, sans-serif; background: var(--bg); color: var(--text); }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.auth-body { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: linear-gradient(135deg, #f8fafc, #fff7ed); }
.auth-shell { width: min(980px, 100%); display: grid; grid-template-columns: 1fr 430px; gap: 20px; }
.auth-brand, .auth-card { background: rgba(255,255,255,.92); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); padding: 32px; }
.auth-brand { display: flex; flex-direction: column; justify-content: center; }
.auth-brand h1 { margin: 20px 0 8px; font-size: 40px; }
.auth-brand p, .muted { color: var(--muted); }
.brand-mark { width: 58px; height: 58px; border-radius: 8px; background: var(--primary); color: white; display: grid; place-items: center; font-weight: 800; }
.brand-mark.small { width: 36px; height: 36px; font-size: 14px; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 244px 1fr; }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 18px; color: white; background: #111827; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; margin-bottom: 22px; }
.nav-list { display: grid; gap: 6px; }
.nav-link { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 8px; color: #cbd5e1; }
.nav-link.active, .nav-link:hover { background: rgba(249,115,22,.16); color: white; }
.material-symbols-rounded { font-size: 20px; vertical-align: middle; }
.main-area { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 24px; border-bottom: 1px solid var(--line); background: rgba(245,247,251,.92); backdrop-filter: blur(12px); }
.topbar h1 { margin: 2px 0 0; font-size: 24px; }
.eyebrow { margin: 0; color: var(--muted); text-transform: uppercase; font-size: 12px; letter-spacing: .06em; }
.top-actions, .toolbar, .actions, .table-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.content { padding: 24px; padding-bottom: 90px; }
.user-pill { border: 1px solid var(--line); background: white; border-radius: 999px; padding: 8px 12px; color: var(--muted); }

.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.metric-card, .card { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); padding: 16px; }
.metric-card { display: grid; gap: 6px; }
.metric-card span { color: var(--muted); font-size: 13px; }
.metric-card strong { font-size: 26px; }
.card { margin-bottom: 16px; }
.card-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.card-title { margin: 0; font-size: 18px; }

.field, .select, textarea { width: 100%; min-height: 40px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: white; color: var(--text); }
.field.narrow { max-width: 120px; }
.label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; font-weight: 700; }
.check { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-grid.compact { margin-top: 12px; max-width: 720px; }
.form-grid .full { grid-column: 1 / -1; }
.stack { display: grid; gap: 12px; }

.btn, .icon-btn { min-height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid var(--line); border-radius: 8px; background: white; color: var(--text); padding: 9px 12px; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: white; }
.btn.danger { background: var(--red); border-color: var(--red); color: white; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.small { min-height: 32px; padding: 7px 9px; font-size: 12px; margin: 4px 0; }
.icon-btn { width: 40px; padding: 0; }
.alert { display: grid; grid-template-columns: 22px 1fr 32px; align-items: center; gap: 10px; padding: 12px 12px; border-radius: 8px; margin-bottom: 14px; border: 1px solid var(--line); background: white; box-shadow: 0 8px 20px rgba(15,23,42,.06); transition: opacity .18s ease, transform .18s ease; }
.alert.is-hiding { opacity: 0; transform: translateY(-4px); }
.alert.error { color: #991b1b; background: #fef2f2; border-color: #fecaca; }
.alert.success { color: #166534; background: #f0fdf4; border-color: #bbf7d0; }
.alert.info { color: #1d4ed8; background: #eff6ff; border-color: #bfdbfe; }
.alert.warning { color: #92400e; background: #fffbeb; border-color: #fde68a; }
.alert-icon { font-size: 21px; }
.alert-message { line-height: 1.35; }
.alert-close { width: 32px; height: 32px; border: 0; border-radius: 8px; background: transparent; color: currentColor; display: grid; place-items: center; padding: 0; }
.alert-close:hover { background: rgba(15,23,42,.08); }

.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; min-width: 760px; }
.data-table th, .data-table td { padding: 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.data-table th { background: var(--surface-2); color: var(--muted); text-transform: uppercase; font-size: 12px; }
.data-table tr:hover td { background: #fcfcfd; }
.data-table tr.selected-row td { background: #fff7ed; }
.compact-table { min-width: 520px; }
.wide-cell { min-width: 360px; }
.inline-form { margin: 0; }
.table-actions { gap: 6px; }
.table-actions .btn { margin: 0; }
.block { display: block; margin-top: 4px; }
.badge { display: inline-flex; border-radius: 999px; padding: 4px 9px; background: var(--surface-2); color: var(--muted); font-size: 12px; font-weight: 700; }
.badge.active { background: #dcfce7; color: #166534; }
.badge.expired, .badge.suspended { background: #fee2e2; color: #991b1b; }
.badge.blue { background: #dbeafe; color: #1d4ed8; }
.audit-json { max-width: 420px; max-height: 130px; overflow: auto; white-space: pre-wrap; margin: 0; font-size: 12px; color: var(--muted); }
.empty-state { text-align: center; padding: 52px 18px; background: white; border: 1px dashed var(--line); border-radius: 8px; }
.sub-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.sub-tab { min-height: 40px; display: inline-flex; align-items: center; gap: 8px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; background: white; color: var(--muted); font-weight: 700; }
.sub-tab.active, .sub-tab:hover { color: var(--primary-dark); border-color: rgba(249,115,22,.35); background: #fff7ed; }
.selected-summary { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); margin-bottom: 12px; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 10px 0 18px; flex-wrap: wrap; }
.pagination-meta { color: var(--muted); font-size: 13px; }
.btn.disabled { opacity: .45; pointer-events: none; }
.mobile-nav { display: none; }

@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .content { padding: 16px; padding-bottom: 92px; }
  .grid.two, .metrics, .form-grid, .auth-shell { grid-template-columns: 1fr; }
  .auth-brand { display: none; }
  .toolbar { align-items: stretch; }
  .toolbar > * { flex: 1 1 100%; }
  .mobile-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: grid; grid-template-columns: repeat(5, 1fr); background: white; border-top: 1px solid var(--line); }
  .mobile-nav a { display: grid; place-items: center; gap: 2px; padding: 8px 4px; color: var(--muted); }
  .mobile-nav a.active { color: var(--primary); }
  .mobile-nav small { font-size: 10px; }
}
.account-toolbar, .account-toolbar > form, .account-actions { display:flex; gap:.6rem; flex-wrap:wrap; align-items:flex-start; }
.account-toolbar { justify-content:space-between; }
.account-toolbar input.field { width:auto; max-width:100%; }
.account-editor summary { cursor:pointer; }
.account-form { margin-top:.75rem; max-width:22rem; padding:.8rem; border:1px solid #cbd5e1; border-radius:.75rem; white-space:normal; }
.account-form [role=alert] { color:#ad2639; }
@media (max-width:760px) {
  .account-directory table, .account-directory tbody, .account-directory tr { display:block; min-width:0; }
  .account-directory thead { position:absolute; clip-path:inset(100%); }
  .account-directory tr { padding:.75rem 0; border-bottom:1px solid #cbd5e1; }
  .account-directory tbody th, .account-directory td { display:block; white-space:normal; overflow-wrap:anywhere; }
  .account-directory td[data-label]::before { content:attr(data-label) " · "; font-weight:600; }
}
