:root {
  color-scheme: light;
  --bg: #f4f3ef;
  --surface: #ffffff;
  --surface-soft: #f8f8f5;
  --surface-strong: #e7eee9;
  --text: #18221e;
  --text-soft: #607069;
  --border: #d9dfdb;
  --border-strong: #b8c5be;
  --accent: #234438;
  --accent-hover: #173329;
  --accent-soft: #dfeae4;
  --danger: #a33a3a;
  --danger-hover: #842c2c;
  --danger-soft: #f8e6e4;
  --warning: #8a621c;
  --warning-soft: #f8efd6;
  --success: #216345;
  --success-soft: #def1e7;
  --info: #315f82;
  --info-soft: #e3eef6;
  --shadow: 0 18px 48px rgba(31, 53, 44, 0.10);
  --radius-card: 16px;
  --radius-control: 10px;
  --sidebar-width: 252px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  min-height: 100dvh;
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 140;
  padding: 9px 12px;
  border-radius: var(--radius-control);
  color: #fff;
  background: var(--accent);
  transform: translateY(-160%);
  transition: transform 150ms ease;
}

.skip-link:focus {
  transform: translateY(0);
}

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

button {
  color: inherit;
}

button,
select {
  cursor: pointer;
}

button,
a,
input,
select {
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(35, 68, 56, 0.12);
}

[hidden] {
  display: none !important;
}

svg {
  width: 19px;
  height: 19px;
  stroke-width: 1.8;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.login-shell {
  display: grid;
  min-height: 100dvh;
  place-items: center;
  padding: 28px 18px;
  background:
    radial-gradient(circle at 15% 20%, rgba(35, 68, 56, 0.08), transparent 34%),
    radial-gradient(circle at 86% 82%, rgba(162, 105, 91, 0.08), transparent 32%),
    var(--bg);
}

.login-panel {
  width: min(100%, 430px);
  padding: 42px;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.brand-mark {
  display: grid;
  width: 52px;
  height: 52px;
  margin-bottom: 28px;
  place-items: center;
  border-radius: 14px;
  color: #f8fbf9;
  background: var(--accent);
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.brand-mark-small {
  width: 38px;
  height: 38px;
  margin: 0;
  border-radius: 11px;
  font-size: 18px;
}

.section-kicker {
  margin: 0 0 7px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.login-panel h1,
.page-heading h1,
.modal-header h2 {
  margin: 0;
  letter-spacing: -0.035em;
  line-height: 1.12;
  text-wrap: balance;
}

.login-panel h1 {
  font-size: clamp(30px, 7vw, 40px);
}

.login-copy {
  margin: 12px 0 30px;
  color: var(--text-soft);
}

.form-stack {
  display: grid;
  gap: 18px;
}

.field {
  display: grid;
  min-width: 0;
  gap: 7px;
}

.field > span {
  color: #34453e;
  font-size: 13px;
  font-weight: 700;
}

.field small {
  color: var(--text-soft);
  font-size: 12px;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-control);
  color: var(--text);
  background: var(--surface);
  outline: none;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

textarea {
  min-height: 88px;
  resize: vertical;
}

input::placeholder,
textarea::placeholder {
  color: #87928d;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible,
button:focus-visible {
  outline: 3px solid rgba(35, 68, 56, 0.24);
  outline-offset: 2px;
}

.button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 15px;
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  font-size: 14px;
  font-weight: 750;
  line-height: 1.2;
  white-space: nowrap;
  transition: background-color 150ms ease, border-color 150ms ease, transform 100ms ease;
}

.button:active:not(:disabled),
.icon-button:active:not(:disabled),
.nav-item:active:not(:disabled) {
  transform: translateY(1px);
}

.button:disabled,
.icon-button:disabled {
  cursor: not-allowed;
  opacity: 0.56;
}

.button-primary {
  color: #f8fbf9;
  background: var(--accent);
}

.button-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

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

.button-secondary:hover:not(:disabled) {
  border-color: #93a69c;
  background: var(--surface-soft);
}

.button-danger {
  color: #fff9f8;
  background: var(--danger);
}

.button-danger:hover:not(:disabled) {
  background: var(--danger-hover);
}

.button-block {
  width: 100%;
}

.icon-button {
  display: inline-grid;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  place-items: center;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  background: var(--surface);
}

.form-error {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid #dfaaa4;
  border-radius: var(--radius-control);
  color: #7b2929;
  background: var(--danger-soft);
  font-size: 13px;
}

.security-note {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 22px 0 0;
  color: var(--text-soft);
  font-size: 12px;
}

.security-note svg {
  width: 16px;
  height: 16px;
  color: var(--success);
}

.admin-layout {
  min-height: 100dvh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  display: flex;
  width: var(--sidebar-width);
  flex-direction: column;
  padding: 22px 16px 16px;
  border-right: 1px solid var(--border);
  background: #fbfcfa;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 11px;
}

.sidebar-brand > div:last-child {
  display: grid;
}

.sidebar-brand strong {
  letter-spacing: -0.02em;
}

.sidebar-brand span {
  color: var(--text-soft);
  font-size: 11px;
}

.sidebar-nav {
  display: grid;
  gap: 5px;
  margin-top: 34px;
}

.nav-item {
  display: flex;
  width: 100%;
  min-height: 44px;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border: 0;
  border-radius: var(--radius-control);
  color: #50615a;
  background: transparent;
  font-size: 14px;
  font-weight: 700;
  text-align: left;
}

.nav-item:hover {
  background: #eff3f0;
}

.nav-item.is-active {
  color: var(--accent);
  background: var(--accent-soft);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.user-avatar {
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  color: var(--accent);
  background: var(--accent-soft);
  font-weight: 800;
}

.sidebar-user-copy {
  display: grid;
  min-width: 0;
  flex: 1;
}

.sidebar-user-copy strong,
.sidebar-user-copy span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-user-copy strong {
  font-size: 13px;
}

.sidebar-user-copy span {
  color: var(--text-soft);
  font-size: 11px;
}

.main-content {
  min-width: 0;
  margin-left: var(--sidebar-width);
  padding: 42px clamp(20px, 4vw, 60px) 70px;
}

.app-view {
  width: min(100%, 1380px);
  margin: 0 auto;
}

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 30px;
}

.page-heading h1 {
  font-size: clamp(28px, 3vw, 36px);
}

.page-heading p:not(.section-kicker) {
  max-width: 64ch;
  margin: 9px 0 0;
  color: var(--text-soft);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.quick-action {
  display: grid;
  min-width: 0;
  min-height: 72px;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 13px 15px;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  color: var(--text);
  background: var(--surface);
  text-align: left;
  transition: border-color 150ms ease, background-color 150ms ease, transform 100ms ease;
}

.quick-action:hover {
  border-color: var(--border-strong);
  background: var(--surface-soft);
}

.quick-action:active {
  transform: translateY(1px);
}

.quick-action > svg:first-child {
  width: 22px;
  height: 22px;
  color: var(--accent);
}

.quick-action span {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.quick-action strong,
.quick-action small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quick-action small {
  color: var(--text-soft);
  font-size: 11px;
}

.onboarding-panel {
  margin-top: 22px;
  padding: 20px;
  border: 1px solid #c8d9d0;
  border-radius: var(--radius-card);
  background: var(--accent-soft);
}

.onboarding-panel h2,
.onboarding-panel p {
  margin: 0;
}

.onboarding-panel h2 {
  font-size: 18px;
}

.onboarding-panel p {
  margin-top: 5px;
  color: var(--text-soft);
  font-size: 13px;
}

.onboarding-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 15px;
}

.onboarding-step {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border-radius: var(--radius-control);
  background: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  font-weight: 700;
}

.onboarding-step.is-done {
  color: var(--success);
}

.metric-card {
  min-height: 130px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--surface);
}

.metric-card strong {
  display: block;
  margin-top: 18px;
  font-variant-numeric: tabular-nums;
  font-size: 30px;
  letter-spacing: -0.04em;
  line-height: 1;
}

.metric-card span {
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 650;
}

.metric-card small {
  display: block;
  margin-top: 10px;
  overflow: hidden;
  color: var(--text-soft);
  font-size: 10px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-card.is-alert {
  border-color: #dfc981;
  background: #fffaf0;
}

.metric-card.is-danger {
  border-color: #e2b3ad;
  background: #fff8f7;
}

.content-section {
  margin-top: 32px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--surface);
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.section-heading h2,
.security-panel h2,
.form-block h3 {
  margin: 0;
  letter-spacing: -0.02em;
}

.section-heading h2 {
  font-size: 20px;
}

.section-heading p,
.form-block p {
  margin: 4px 0 0;
  color: var(--text-soft);
  font-size: 13px;
}

.compact-list {
  display: grid;
}

.compact-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.4fr) minmax(100px, 0.7fr) minmax(150px, 0.8fr);
  align-items: center;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid #e7ebe8;
}

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

.compact-row strong,
.compact-row span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.compact-row > span:last-child {
  color: var(--warning);
  font-variant-numeric: tabular-nums;
  font-weight: 750;
  text-align: right;
}

.empty-state {
  display: grid;
  min-height: 160px;
  place-items: center;
  padding: 28px;
  color: var(--text-soft);
  text-align: center;
}

.empty-state svg {
  width: 28px;
  height: 28px;
  margin-bottom: 8px;
  color: var(--border-strong);
}

.toolbar {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  margin-bottom: 18px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--surface);
}

.toolbar-split {
  justify-content: space-between;
}

.account-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(145px, 0.35fr) minmax(120px, 0.28fr) auto;
}

.field-compact {
  gap: 5px;
}

.field-compact > span {
  font-size: 11px;
}

.search-field {
  position: relative;
  display: flex;
  min-width: 240px;
  flex: 1;
  align-items: center;
}

.search-field svg {
  position: absolute;
  left: 13px;
  width: 17px;
  height: 17px;
  color: var(--text-soft);
  pointer-events: none;
}

.search-field input {
  padding-left: 40px;
}

.field-inline {
  width: min(100%, 220px);
}

.table-shell {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--surface);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: auto;
}

.data-table th,
.data-table td {
  padding: 13px 15px;
  border-bottom: 1px solid #e7ebe8;
  text-align: left;
  vertical-align: middle;
}

.data-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: #56675f;
  background: var(--surface-soft);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.data-table tbody tr[data-account-row] {
  cursor: pointer;
}

.data-table tbody tr[data-account-row]:focus-visible {
  outline: 3px solid rgba(35, 68, 56, 0.24);
  outline-offset: -3px;
}

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

.data-table tbody tr:hover td {
  background: #fbfcfb;
}

.data-table td {
  font-size: 13px;
}

.primary-cell {
  display: grid;
  gap: 2px;
}

.primary-cell strong {
  color: var(--text);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.primary-cell span {
  color: var(--text-soft);
  font-size: 11px;
}

.cell-actions {
  width: 1%;
  white-space: nowrap;
  text-align: right !important;
}

.row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 7px;
}

.table-action {
  min-height: 34px;
  padding: 6px 10px;
  font-size: 12px;
}

.status-badge {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  padding: 4px 9px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.status-active,
.status-used {
  border-color: #a8cfba;
  color: var(--success);
  background: var(--success-soft);
}

.status-trial,
.status-neutral {
  border-color: #b9cedd;
  color: var(--info);
  background: var(--info-soft);
}

.status-expiring {
  border-color: #ddc16a;
  color: var(--warning);
  background: var(--warning-soft);
}

.status-expired,
.status-suspended {
  border-color: #e1aaa4;
  color: var(--danger);
  background: var(--danger-soft);
}

.status-unused {
  border-color: var(--border-strong);
  color: #44564e;
  background: #edf1ee;
}

.plan-name {
  font-weight: 800;
}

.plan-vip {
  color: #764a16;
}

.tabular {
  font-variant-numeric: tabular-nums;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-height: 52px;
}

.pagination span {
  color: var(--text-soft);
  font-size: 12px;
}

.expiry-copy {
  display: grid;
  gap: 2px;
}

.expiry-copy small {
  color: var(--text-soft);
  font-size: 10px;
  font-weight: 700;
}

.expiry-copy small.is-urgent {
  color: var(--warning);
}

.mobile-header,
.sidebar-backdrop,
.mobile-bottom-nav,
.mobile-logout-button {
  display: none;
}

.security-panel {
  padding: 26px;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--surface);
}

.security-status {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
}

.security-status p {
  margin: 5px 0 0;
  color: var(--text-soft);
}

.security-icon {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 14px;
  color: var(--accent);
  background: var(--accent-soft);
}

.security-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.mfa-enrollment {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 26px;
  margin-top: 24px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--surface-soft);
}

.qr-shell {
  display: grid;
  width: 190px;
  height: 190px;
  place-items: center;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  background: #fff;
}

.qr-shell img,
.qr-shell svg {
  width: 100%;
  height: 100%;
}

.inline-form {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.loading-overlay,
.modal-backdrop[open] {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(17, 29, 24, 0.46);
  overscroll-behavior: contain;
}

.modal-backdrop {
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  border: 0;
  color: inherit;
}

.modal-backdrop::backdrop {
  background: transparent;
}

.loading-overlay {
  z-index: 100;
}

.loading-card {
  display: grid;
  width: min(100%, 320px);
  gap: 10px;
  padding: 22px;
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.loading-card span {
  margin-top: 6px;
  color: var(--text-soft);
  font-size: 12px;
}

.loading-line {
  width: 60%;
  height: 10px;
  border-radius: 999px;
  background: #dfe5e1;
  animation: loading-pulse 1.2s ease-in-out infinite alternate;
}

.loading-line-wide {
  width: 90%;
}

@keyframes loading-pulse {
  to { opacity: 0.42; }
}

.modal-card {
  width: min(100%, 540px);
  max-height: calc(100dvh - 36px);
  overflow: auto;
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: 0 28px 80px rgba(15, 28, 22, 0.24);
  overscroll-behavior: contain;
}

.modal-card-wide {
  width: min(100%, 760px);
}

.modal-card-small {
  width: min(100%, 430px);
  text-align: center;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  font-size: 24px;
}

.modal-subtitle {
  margin: 6px 0 0;
  color: var(--text-soft);
  font-size: 13px;
}

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

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

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
}

.one-time-warning {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  margin-bottom: 16px;
  padding: 13px;
  border: 1px solid #dec576;
  border-radius: var(--radius-control);
  color: #654810;
  background: var(--warning-soft);
}

.one-time-warning p {
  margin: 0;
  font-size: 13px;
}

.one-time-warning svg {
  flex: 0 0 auto;
}

.raw-key-list {
  max-height: 300px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
}

.raw-key-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

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

.raw-key-row code {
  overflow: hidden;
  color: #223f35;
  font-family: "Cascadia Mono", "Consolas", monospace;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.raw-key-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.confirmation-check {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-top: 20px;
  font-size: 13px;
  font-weight: 650;
}

.confirmation-check input {
  width: 18px;
  min-height: 18px;
  margin-top: 1px;
}

.license-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 22px;
}

.license-summary-item {
  padding: 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  background: var(--surface-soft);
}

.license-summary-item span {
  display: block;
  color: var(--text-soft);
  font-size: 11px;
}

.license-summary-item strong {
  display: block;
  margin-top: 4px;
  font-size: 13px;
}

.form-block {
  padding: 18px 0;
  border-top: 1px solid var(--border);
}

.form-block:first-of-type {
  border-top: 0;
}

.form-block h3 {
  margin-bottom: 13px;
  font-size: 16px;
}

.align-start {
  justify-self: start;
}

.danger-block {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.confirm-icon {
  display: grid;
  width: 48px;
  height: 48px;
  margin: 0 auto 14px;
  place-items: center;
  border-radius: 50%;
  color: var(--danger);
  background: var(--danger-soft);
}

.modal-card-small h2 {
  margin: 0;
}

.modal-card-small p {
  margin: 10px 0 22px;
  color: var(--text-soft);
}

.toast-region {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 120;
  display: grid;
  width: min(380px, calc(100% - 36px));
  gap: 9px;
}

.toast {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-control);
  background: var(--surface);
  box-shadow: var(--shadow);
  font-size: 13px;
}

.toast.is-error {
  border-left-color: var(--danger);
}

.toast.is-success {
  border-left-color: var(--success);
}

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

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

@media (max-width: 820px) {
  .sidebar {
    display: none;
  }

  .sidebar-backdrop {
    display: none !important;
  }

  .mobile-header {
    position: sticky;
    top: 0;
    z-index: 15;
    display: flex;
    min-height: calc(58px + env(safe-area-inset-top));
    align-items: center;
    justify-content: space-between;
    padding: calc(8px + env(safe-area-inset-top)) 16px 8px;
    border-bottom: 1px solid var(--border);
    background: rgba(251, 252, 250, 0.96);
    backdrop-filter: blur(12px);
  }

  #mobile-menu-button {
    display: none;
  }

  .mobile-logout-button {
    display: inline-grid;
  }

  .mobile-bottom-nav {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 30;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 2px;
    padding: 7px 8px calc(7px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.97);
    box-shadow: 0 -10px 30px rgba(31, 53, 44, 0.08);
    backdrop-filter: blur(16px);
  }

  .mobile-nav-item {
    display: grid;
    min-width: 0;
    min-height: 48px;
    place-items: center;
    align-content: center;
    gap: 3px;
    padding: 4px 2px;
    border: 0;
    border-radius: 9px;
    color: var(--text-soft);
    background: transparent;
    font-size: 10px;
    font-weight: 750;
    line-height: 1;
  }

  .mobile-nav-item svg {
    width: 20px;
    height: 20px;
  }

  .mobile-nav-item.is-active {
    color: var(--accent);
    background: var(--accent-soft);
  }

  .main-content {
    margin-left: 0;
    padding: 26px 16px calc(96px + env(safe-area-inset-bottom));
  }

  .page-heading {
    align-items: flex-start;
  }

  .data-table thead {
    display: none;
  }

  .data-table,
  .data-table tbody,
  .data-table tr,
  .data-table td {
    display: block;
    width: 100%;
  }

  .data-table tbody tr[data-account-row]:focus-visible {
    border-radius: var(--radius-control);
    outline-offset: -2px;
  }

  .data-table tr {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
  }

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

  .data-table td {
    display: grid;
    grid-template-columns: minmax(105px, 0.8fr) minmax(0, 1.3fr);
    gap: 10px;
    padding: 7px 0;
    border: 0;
    text-align: left !important;
  }

  .data-table td::before {
    content: attr(data-label);
    color: var(--text-soft);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }

  .row-actions {
    justify-content: flex-start;
  }

  .row-actions .button {
    width: 100%;
  }

  .compact-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .compact-row > span:last-child {
    text-align: left;
  }

  .account-toolbar {
    grid-template-columns: minmax(0, 1fr) minmax(126px, 0.45fr);
    align-items: end;
  }

  .account-toolbar .search-field {
    grid-column: 1 / -1;
  }

  .account-toolbar #account-search-button {
    grid-column: 1 / -1;
  }

  .modal-backdrop {
    place-items: end center;
    padding: 0;
  }

  .modal-card,
  .modal-card-wide,
  .modal-card-small {
    width: 100%;
    max-height: min(92dvh, 860px);
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 22px 22px 0 0;
    padding-bottom: calc(22px + env(safe-area-inset-bottom));
    text-align: left;
  }

  .modal-card-small .confirm-icon {
    margin-left: 0;
  }

  .toast-region {
    bottom: calc(78px + env(safe-area-inset-bottom));
  }
}

@media (max-width: 620px) {
  .login-panel {
    padding: 28px 22px;
  }

  .page-heading {
    display: grid;
    gap: 16px;
  }

  .page-heading .button {
    justify-self: start;
  }

  .form-grid,
  .form-grid-three,
  .license-summary {
    grid-template-columns: 1fr;
  }

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

  .metric-card {
    min-height: 106px;
    padding: 15px;
  }

  .metric-card strong {
    margin-top: 13px;
    font-size: 26px;
  }

  .quick-actions,
  .onboarding-steps {
    grid-template-columns: 1fr;
  }

  .toolbar,
  .toolbar-split,
  .inline-form,
  .danger-block {
    align-items: stretch;
    flex-direction: column;
  }

  .search-field,
  .field-inline {
    width: 100%;
    min-width: 0;
  }

  .security-status {
    grid-template-columns: auto 1fr;
  }

  .security-status .status-badge {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .mfa-enrollment {
    grid-template-columns: 1fr;
  }

  .qr-shell {
    width: min(100%, 220px);
    height: auto;
    aspect-ratio: 1;
    justify-self: center;
  }

  .modal-card {
    padding: 20px;
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
  }

  .license-summary {
    display: flex;
    margin-right: -20px;
    margin-left: -20px;
    padding: 0 20px 6px;
    overflow-x: auto;
    scroll-snap-type: x proximity;
  }

  .license-summary-item {
    min-width: 150px;
    scroll-snap-align: start;
  }

  .modal-actions,
  .raw-key-toolbar {
    display: grid;
    grid-template-columns: 1fr;
  }

  .modal-actions .button,
  .raw-key-toolbar .button {
    width: 100%;
  }
}

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