* {
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

:root {
  --bg: #0a0a0a;
  --bg-alt: #111;
  --surface: #1a1a1a;
  --surface-2: #222;
  --surface-3: #2a2a2a;
  --border: #333;
  --border-subtle: #272727;
  --text: #f0f0f0;
  --text-main: #e5e5e5;
  --text-muted: #888;
  --text-subtle: #aaa;
  --primary: #ff6f4d;
  --primary-hover: #ff845f;
  --primary-dim: rgba(255, 111, 77, 0.16);
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --transition: 150ms ease;
  --sidebar-w: 240px;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  height: 100%;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text-main);
  font-size: 14px;
  line-height: 1.5;
}

body {
  position: relative;
  background:
    linear-gradient(rgba(255, 111, 77, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 111, 77, 0.03) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    #141414;
  background-size: 100px 100px, 100px 100px, 20px 20px, 20px 20px;
  background-position: -8px -6px, -8px -6px, -8px -6px, -8px -6px;
  background-attachment: fixed;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 111, 77, 0.08), transparent 34%),
    linear-gradient(180deg, rgba(20, 20, 20, 0.08), rgba(20, 20, 20, 0.7));
}

::selection { background: var(--primary-dim); color: var(--primary); }
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #444; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #555; }

.hidden { display: none !important; }
.muted { color: var(--text-muted); }

a { color: var(--primary); cursor: pointer; text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-hover); }

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
h2 { font-size: 22px; }
h3 { font-size: 16px; color: var(--text); }

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 16px;
}
label.row {
  flex-direction: row;
  align-items: center;
  gap: 10px;
}
label.row input[type="checkbox"] { margin: 0; }

input, select, textarea {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 12px;
  border-radius: var(--radius-md);
  font-size: 13px;
  width: 100%;
  font-family: inherit;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  accent-color: var(--primary);
}
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-dim);
}
input::placeholder, textarea::placeholder { color: #555; }
input[readonly] { background: var(--surface); cursor: default; }
input[type="number"] {
  appearance: textfield;
  -moz-appearance: textfield;
}
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
}

select { cursor: pointer; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 7px 14px;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  transition: all var(--transition);
  user-select: none;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-3); border-color: #555; }
.btn:active { transform: scale(0.97); }

.btn.primary {
  background: var(--primary);
  border-color: transparent;
  color: #fff;
}
.btn.primary:hover { background: var(--primary-hover); }
.btn.primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn.danger { color: var(--danger); border-color: rgba(239, 68, 68, 0.3); }
.btn.danger:hover { background: rgba(239, 68, 68, 0.12); border-color: rgba(239, 68, 68, 0.5); }

.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--surface-2); }

.btn.small { padding: 5px 10px; font-size: 12px; border-radius: var(--radius-sm); }
.btn.block { width: 100%; }

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 100;
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 12px 20px;
  border-radius: var(--radius-lg);
  max-width: 400px;
  box-shadow: var(--shadow-md);
  font-size: 13px;
  font-weight: 500;
  animation: slideUp 0.25s ease-out;
}
.toast.ok { border-color: rgba(34, 197, 94, 0.4); }
.toast.err { border-color: rgba(239, 68, 68, 0.4); }

.error { color: var(--danger); font-size: 13px; min-height: 18px; margin-top: 10px; }

/* Auth Page */
.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: 400px;
  max-width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
}

.auth-brand {
  text-align: center;
  margin-bottom: 28px;
}
.auth-brand .brand-logo {
  display: block;
  width: 64px;
  height: 64px;
  margin: 0 auto 12px;
  object-fit: contain;
  filter: drop-shadow(0 10px 18px rgba(255, 111, 77, 0.22));
}
.auth-title { font-size: 20px; font-weight: 600; color: var(--text); }
.auth-sub { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

.auth-tabs {
  display: flex;
  gap: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 4px;
  margin-bottom: 24px;
}
.auth-tab {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 0;
  color: var(--text-muted);
  padding: 10px 8px;
  border-radius: calc(var(--radius-md) - 3px);
  cursor: pointer;
  font-weight: 700;
  font-family: inherit;
  font-size: 13px;
  line-height: 1;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  white-space: nowrap;
}
.auth-tab i { font-size: 12px; }
.auth-tab span { overflow: hidden; text-overflow: ellipsis; }
.auth-tab:hover { color: var(--text); }
.auth-tab.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

.divider {
  text-align: center;
  color: #555;
  font-size: 12px;
  margin: 20px 0;
  position: relative;
}
.divider::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--border);
}
.divider span { background: var(--surface); padding: 0 14px; position: relative; }

.devcode {
  background: var(--primary-dim);
  border: 1px dashed rgba(255, 111, 77, 0.3);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-bottom: 16px;
  font-size: 12px;
  font-family: "SF Mono", Consolas, monospace;
}

/* Sidebar Layout */
#app-view {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 30;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 20px;
  font-weight: 600;
  font-size: 16px;
  color: var(--text);
  border-bottom: 1px solid var(--border);
}
.sidebar-logo {
  display: block;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  object-fit: contain;
}

.sidebar-nav {
  flex: 1;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}
.nav-item i { width: 18px; text-align: center; font-size: 15px; }
.nav-item:hover { color: var(--text); background: var(--surface-2); }
.nav-item.active { color: var(--primary); background: rgba(255, 111, 77, 0.14); }

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}
.sidebar-avatar {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  background: var(--primary);
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
}
.sidebar-user-info {
  min-width: 0;
}
.sidebar-username { font-size: 12px; font-weight: 500; color: var(--text); }
.sidebar-role { font-size: 11px; color: var(--text-muted); }

.logout-btn {
  flex-shrink: 0;
  color: var(--text-muted);
  border-color: transparent;
}
.logout-btn:hover { color: var(--danger); background: rgba(239, 68, 68, 0.1); border-color: transparent; }

/* Main content area */
.app-main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 32px 0;
}
.app-header h2 { font-size: 22px; font-weight: 600; color: var(--text); }

.main {
  flex: 1;
  padding: 20px 32px 80px;
  max-width: 1200px;
}

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

/* Stats Row */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 28px;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
}
.stat .ic { font-size: 18px; margin-bottom: 8px; color: var(--text-muted); }
.stat .num { font-size: 28px; font-weight: 600; color: var(--text); line-height: 1.2; }
.stat .lbl { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* Card */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.card + .card { margin-top: 16px; }

.card h3 {
  margin-bottom: 16px;
  font-size: 15px;
  color: var(--text);
}

.section-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

/* Grid helpers */
.grid { display: grid; gap: 12px; }
.cols-2 { grid-template-columns: repeat(2, 1fr); }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.cols-4 { grid-template-columns: repeat(4, 1fr); }

.row { display: flex; gap: 10px; align-items: center; }
.spread { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.mt { margin-top: 20px; }
.gap { gap: 10px; }

/* Tables */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
th {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--surface-2);
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: rgba(255, 111, 77, 0.045); }

.mono { font-family: "SF Mono", "Cascadia Code", Consolas, monospace; font-size: 12px; }

/* Badge */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  border: 1px solid transparent;
}
.badge.active, .badge.live { color: var(--success); border-color: rgba(34, 197, 94, 0.3); background: rgba(34, 197, 94, 0.08); }
.badge.banned, .badge.paused { color: var(--danger); border-color: rgba(239, 68, 68, 0.3); background: rgba(239, 68, 68, 0.08); }
.badge.expired { color: var(--warning); border-color: rgba(245, 158, 11, 0.3); background: rgba(245, 158, 11, 0.08); }
.badge.unused { color: #888; border-color: rgba(136, 136, 136, 0.3); background: rgba(136, 136, 136, 0.08); }
.badge.role { color: var(--primary); border-color: rgba(255, 111, 77, 0.3); background: var(--primary-dim); }

.role-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-width: 42px;
  padding: 3px 9px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 10px;
  line-height: 1.1;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.role-badge.admin {
  color: #ff8a66;
  border-color: rgba(255, 111, 77, 0.38);
  background: rgba(255, 111, 77, 0.14);
}

.role-badge.dev {
  color: #54d6a0;
  border-color: rgba(76, 195, 138, 0.34);
  background: rgba(76, 195, 138, 0.12);
}

.role-badge.user {
  color: #8fb9ff;
  border-color: rgba(143, 185, 255, 0.34);
  background: rgba(143, 185, 255, 0.12);
}

.mt-mini { margin-top: 6px; }

/* Tabs */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}
.tab {
  padding: 10px 18px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 13px;
  margin-bottom: -1px;
  transition: all var(--transition);
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: grid;
  place-items: center;
  z-index: 200;
  animation: fadeIn 0.15s ease-out;
}
.modal {
  width: 480px;
  max-width: 92vw;
  max-height: 85vh;
  overflow-y: auto;
}
.modal.modal-wide {
  width: min(760px, 94vw);
}
.modal .actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}
.modal h3 { margin-bottom: 16px; }

.field { margin-bottom: 16px; }
.small-text { font-size: 11px; margin-top: 4px; }

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

.modal-head h3 {
  margin-bottom: 6px;
}

.modern-form label {
  margin-bottom: 0;
}

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

.option-grid.two {
  margin-top: 12px;
}

.field-group {
  margin-top: 18px;
  padding: 14px;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background: #121619;
}

.field-title {
  margin-bottom: 12px;
  color: var(--text);
  font-weight: 650;
}

.preset-grid,
.choice-grid {
  display: grid;
  gap: 10px;
}

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

.preset,
.choice-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #101315;
  color: var(--text-main);
}

.preset {
  min-height: 38px;
  cursor: pointer;
  font: inherit;
}

.preset.active,
.choice-card:has(input:checked) {
  border-color: rgba(255, 111, 77, 0.45);
  background: rgba(255, 111, 77, 0.12);
  color: #fff;
}

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

.choice-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 10px;
  padding: 12px;
  cursor: pointer;
}

.choice-card input {
  width: auto;
  min-height: auto;
  margin-top: 3px;
}

.choice-card span {
  color: var(--text);
  font-weight: 650;
}

.choice-card small {
  grid-column: 2;
  color: var(--text-muted);
  line-height: 1.45;
}

.inline-field {
  margin-top: 12px;
}

.config-summary {
  margin-top: 16px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 111, 77, 0.25);
  border-radius: 8px;
  background: rgba(255, 111, 77, 0.08);
  color: var(--text-main);
}

.result-box {
  max-height: 320px;
  overflow: auto;
}

.code-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
  font-family: "SF Mono", "Cascadia Code", Consolas, monospace;
  white-space: pre-wrap;
  word-break: break-all;
  font-size: 12px;
  line-height: 1.5;
  max-height: 300px;
  overflow: auto;
}

/* Checkbox */
input[type="checkbox"] {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border: 1.5px solid #555;
  border-radius: 4px;
  background: var(--surface-2);
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  padding: 0;
  transition: all var(--transition);
}
input[type="checkbox"]:hover { border-color: var(--primary); }
input[type="checkbox"]:checked { background: var(--primary); border-color: var(--primary); }
input[type="checkbox"]:checked::after {
  content: "✓";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

/* Progress bar */
.progress {
  height: 4px;
  background: var(--surface-3);
  border-radius: 4px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #ffb347);
  border-radius: 4px;
  transition: width 0.3s ease;
}

/* Divider */
hr { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }

/* Info rows */
.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 13px;
}
.info-row:last-child { border-bottom: 0; }
.info-row .label { color: var(--text-muted); }
.info-row .value { color: var(--text); font-weight: 500; }

/* Key preview */
.key-preview {
  font-family: "SF Mono", Consolas, monospace;
  font-size: 12px;
  color: var(--text-muted);
}

/* Copy button inline */
.copy-btn {
  background: none;
  border: 0;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 6px;
  font-size: 12px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}
.copy-btn:hover { color: var(--primary); background: var(--primary-dim); }

/* SDK integration */
.sdk-lang-select {
  min-width: 180px;
}

/* Animations */
@keyframes slideUp {
  from { opacity: 0; transform: translateY(100%); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.stat { animation: fadeUp 0.3s ease-out; }
.stat:nth-child(2) { animation-delay: 0.05s; }
.stat:nth-child(3) { animation-delay: 0.1s; }
.stat:nth-child(4) { animation-delay: 0.15s; }

/* Responsive */
@media (max-width: 900px) {
  .sidebar { width: 56px; }
  .sidebar-brand span:last-child,
  .sidebar-name,
  .sidebar-user-info,
  .nav-item span { display: none; }
  .sidebar-nav .nav-item { justify-content: center; padding: 10px; }
  .sidebar-nav .nav-item i { margin: 0; }
  .app-main { margin-left: 56px; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .cols-4, .cols-3 { grid-template-columns: 1fr 1fr; }
  .main { padding: 16px; }
  .app-header { padding: 16px 16px 0; }
}
@media (max-width: 540px) {
  .sidebar { width: 0; overflow: hidden; border: 0; }
  .app-main { margin-left: 0; }
  .stats-row { grid-template-columns: 1fr 1fr; }
  .cols-2 { grid-template-columns: 1fr; }
}

/* Professional operations UI refresh */
:root {
  --bg: #0d0f10;
  --bg-alt: #111416;
  --surface: #16191b;
  --surface-2: #1e2225;
  --surface-3: #272d31;
  --border: #2d3338;
  --border-subtle: #23282c;
  --text: #f4f6f7;
  --text-main: #dce2e6;
  --text-muted: #8d99a3;
  --text-subtle: #b5c0c8;
  --primary: #ff6f4d;
  --primary-hover: #ff845f;
  --primary-dim: rgba(255, 111, 77, 0.16);
  --success: #4cc38a;
  --warning: #d89b38;
  --danger: #e45f5f;
  --radius-sm: 5px;
  --radius-md: 7px;
  --radius-lg: 8px;
  --radius-xl: 8px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 12px 28px rgba(0, 0, 0, 0.28);
}

body[data-theme="light"] {
  --bg: #f6f7f9;
  --bg-alt: #ffffff;
  --surface: #ffffff;
  --surface-2: #eef1f4;
  --surface-3: #e4e8ec;
  --border: #cfd6dd;
  --border-subtle: #dde3e8;
  --text: #161a1d;
  --text-main: #232a30;
  --text-muted: #64707b;
  --text-subtle: #3d4852;
  --primary-dim: rgba(255, 111, 77, 0.14);
  --shadow-md: 0 14px 30px rgba(25, 32, 38, 0.12);
}

body {
  background:
    linear-gradient(rgba(255, 111, 77, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 111, 77, 0.03) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    #141414;
  background-size: 100px 100px, 100px 100px, 20px 20px, 20px 20px;
  background-position: -8px -6px, -8px -6px, -8px -6px, -8px -6px;
  background-attachment: fixed;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 111, 77, 0.08), transparent 34%),
    linear-gradient(180deg, rgba(20, 20, 20, 0.08), rgba(20, 20, 20, 0.7));
  opacity: 1;
  z-index: 0;
}

body > * {
  position: relative;
  z-index: 1;
}

#modal-root {
  position: relative;
  z-index: 200;
}

.global-controls {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 160;
  display: flex;
  align-items: center;
  gap: 8px;
}

body.app-mode .global-controls {
  top: auto;
  right: auto;
  left: 18px;
  bottom: 96px;
  width: calc(var(--sidebar-w) - 36px);
  padding: 10px;
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  background: rgba(18, 21, 23, 0.84);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.025);
  backdrop-filter: blur(14px);
}

body.app-mode .global-controls .control-btn {
  flex: 1;
  justify-content: center;
}

body.app-mode .global-controls .custom-select {
  flex: 0 0 86px;
  width: 86px;
  min-width: 86px;
}

body.app-mode .global-controls .custom-select-menu {
  inset: auto 0 calc(100% + 8px) 0;
}

.control-btn,
.control-select {
  width: auto;
  min-height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: rgba(22, 25, 27, 0.86);
  color: var(--text);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(12px);
}

.control-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  cursor: pointer;
}

.control-select {
  padding: 0 10px;
}

body[data-theme="light"] .control-btn,
body[data-theme="light"] .control-select {
  background: rgba(255, 255, 255, 0.9);
}

body[data-theme="light"].app-mode .global-controls {
  background: rgba(255, 255, 255, 0.86);
  border-color: var(--border);
}

h1, h2, h3, h4 {
  letter-spacing: 0;
}

h2 {
  font-size: 24px;
  font-weight: 650;
}

.auth-wrap {
  background:
    linear-gradient(180deg, rgba(255, 125, 82, 0.05), transparent 42%),
    var(--bg);
}

.auth-card {
  width: 430px;
  padding: 34px;
  background: #171a1d;
  border-color: #31383f;
  box-shadow: var(--shadow-md);
}

.auth-brand .brand-logo,
.sidebar-logo {
  background: transparent;
  border-radius: 0;
}

.auth-brand .brand-logo {
  width: 96px;
  height: 96px;
  margin: 0 auto 16px;
}

.sidebar-logo {
  width: 58px;
  height: 58px;
  margin: 0;
}

.auth-title {
  font-size: 24px;
  color: #ff7c57;
  letter-spacing: 0;
}

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

.auth-tabs {
  padding: 4px;
  gap: 4px;
  background: #14181b;
  border-radius: 8px;
}

.auth-tab {
  min-height: 42px;
  padding: 0 10px;
  border-radius: 6px;
}

.auth-tab.active {
  background: #24292d;
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 111, 77, 0.12);
}

input, select, textarea {
  min-height: 38px;
  background: #111416;
  border-color: #30373d;
}

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

.btn {
  min-height: 36px;
  border-color: #323a40;
  background: #20252a;
}

.btn.primary {
  background: var(--primary);
  box-shadow: 0 10px 24px rgba(255, 111, 77, 0.22);
}

.btn.danger {
  background: rgba(228, 95, 95, 0.08);
}

.sidebar {
  background: #121517;
  border-right-color: #252b30;
}

.sidebar-brand {
  min-height: 104px;
  padding: 22px 20px;
}

.sidebar-name {
  font-size: 18px;
  font-weight: 750;
  letter-spacing: 0;
}

.sidebar-nav {
  padding: 12px 10px;
}

.nav-item {
  min-height: 40px;
  border-radius: 7px;
  color: #a6b0b8;
}

.nav-item.active {
  color: #fff;
  background: rgba(255, 111, 77, 0.12);
  box-shadow: inset 3px 0 0 var(--primary);
}

.sidebar-footer {
  min-height: 70px;
}

.sidebar-avatar {
  background: #26313d;
  border: 1px solid #344252;
}

.app-main {
  background: var(--bg);
}

.app-header {
  padding: 24px 36px 0;
}

.main {
  width: 100%;
  max-width: 1440px;
  padding: 26px 36px 88px;
}

.page-head {
  min-height: 44px;
  margin-bottom: 22px;
}

.grid {
  gap: 14px;
}

.card {
  border-radius: 8px;
  border-color: #2c3338;
  background: var(--surface);
  box-shadow: 0 1px 0 rgba(255,255,255,0.025);
}

.stat {
  min-height: 126px;
  display: grid;
  grid-template-columns: 42px 1fr;
  grid-template-areas:
    "icon num"
    "icon label";
  align-items: center;
  column-gap: 14px;
  padding: 18px;
}

.stat .ic {
  grid-area: icon;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: rgba(255, 111, 77, 0.15);
  color: var(--primary);
  font-size: 16px;
  margin: 0;
}

.stat.good .ic {
  background: rgba(76, 195, 138, 0.12);
  color: var(--success);
}

.stat.warn .ic {
  background: rgba(216, 155, 56, 0.14);
  color: var(--warning);
}

.stat.bad .ic {
  background: rgba(228, 95, 95, 0.13);
  color: var(--danger);
}

.stat .num {
  grid-area: num;
  font-size: 30px;
  line-height: 1;
}

.stat .lbl {
  grid-area: label;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 11px;
}

.table-wrap {
  border-color: var(--border-subtle);
  background: #111416;
}

table {
  min-width: 760px;
}

th {
  background: #1a1f22;
  color: #98a4ad;
  letter-spacing: 0.04em;
}

td {
  color: var(--text-main);
}

tbody tr:hover {
  background: rgba(255, 111, 77, 0.045);
}

.badge {
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 10px;
}

.tabs {
  gap: 6px;
  border-bottom: 0;
  background: #111416;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 5px;
}

.tab {
  border: 0;
  margin: 0;
  border-radius: 6px;
}

.tab.active {
  background: var(--surface-3);
  color: var(--primary);
}

.modal-backdrop {
  background: rgba(2, 4, 6, 0.78);
}

.modal {
  border-color: #394047;
}

.code-box {
  background: #0f1214;
  border-color: #2e363c;
}

.sdk-hero {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 111, 77, 0.12), transparent 34%),
    #14181b;
}

.sdk-hero h3 {
  font-size: 22px;
  margin: 4px 0 6px;
}

.eyebrow {
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.sdk-count {
  min-width: 92px;
  min-height: 76px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 111, 77, 0.24);
  border-radius: 8px;
  color: #fff;
  font-size: 34px;
  font-weight: 750;
  background: rgba(255, 111, 77, 0.12);
}

.sdk-count span {
  display: block;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

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

.sdk-info-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 10px;
  align-items: center;
  padding: 16px;
}

.sdk-info-card span {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.sdk-info-card code {
  grid-column: 1 / -1;
  overflow: hidden;
  color: var(--text);
  font-family: "SF Mono", Consolas, monospace;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sdk-info-card .btn {
  grid-row: 1;
  grid-column: 2;
  width: 34px;
  padding: 0;
}

.credentials-card {
  padding: 24px;
}

.keyauth-card {
  padding: 24px;
  border-color: rgba(255, 111, 77, 0.32);
  background:
    linear-gradient(135deg, rgba(255, 111, 77, 0.09), transparent 38%),
    var(--surface);
}

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

.keyauth-snippet {
  margin: 16px 0 0;
  max-height: 360px;
}

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

.credentials-head h3 {
  font-size: 20px;
  margin: 0 0 6px;
}

.snippet-toggle {
  flex: 0 0 auto;
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
  white-space: nowrap;
}

.snippet-toggle input {
  width: auto;
  min-height: auto;
}

.credentials-list {
  display: grid;
  gap: 10px;
}

.credential-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  min-height: 74px;
  padding: 14px 14px 14px 18px;
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent),
    #121619;
  box-shadow: inset 3px 0 0 rgba(255, 111, 77, 0.36);
}

.credential-row span {
  display: block;
  margin-bottom: 8px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 750;
}

.credential-row code {
  display: block;
  max-width: 100%;
  overflow: auto hidden;
  color: var(--text);
  font-family: "SF Mono", "Cascadia Code", Consolas, monospace;
  font-size: 14px;
  font-weight: 750;
  white-space: nowrap;
}

.credential-row .btn {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 10px;
}

.credential-snippet {
  margin: 14px 0 0;
}

.sdk-workbench {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: #101315;
}

.sdk-language-panel {
  padding: 16px;
  border-right: 1px solid var(--border-subtle);
  background: #121619;
}

.sdk-panel-title {
  margin-bottom: 12px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sdk-lang-grid {
  display: grid;
  gap: 8px;
}

.sdk-lang {
  display: grid;
  gap: 2px;
  width: 100%;
  padding: 11px 12px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--text-main);
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.sdk-lang:hover {
  background: rgba(255, 255, 255, 0.035);
}

.sdk-lang.active {
  border-color: rgba(255, 111, 77, 0.35);
  background: rgba(255, 111, 77, 0.12);
  color: #fff;
}

.sdk-lang small {
  color: var(--text-muted);
  font-family: "SF Mono", Consolas, monospace;
  font-size: 11px;
}

.sdk-code-panel {
  min-width: 0;
  padding: 16px;
}

.sdk-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 14px;
}

.sdk-toolbar h3 {
  margin-bottom: 3px;
}

.sdk-code {
  min-height: 470px;
  max-height: 560px;
  margin: 0;
  overflow: auto;
}

.sdk-guide {
  margin-top: 14px;
}

.sdk-guide h4 {
  margin: 0 0 8px;
}

.sdk-guide .code-box {
  margin: 0;
}

.sdk-note .code-box {
  margin: 12px 0 0;
}

.section-head {
  margin-bottom: 4px;
}

.section-head h3 {
  margin: 0 0 6px;
}

.field-help {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 450;
  line-height: 1.45;
}

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

.settings-switches label {
  min-height: 48px;
  padding: 12px;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--text);
  margin: 0;
}

.switch-card {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
}

.switch-card input {
  width: auto;
  min-height: auto;
  margin-top: 3px;
}

.switch-card strong {
  display: block;
  color: var(--text);
  font-size: 14px;
  margin-bottom: 5px;
}

.switch-card small {
  display: block;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.45;
}

.config-help {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.75fr);
  gap: 18px;
  align-items: start;
}

.config-help h3 {
  margin: 0 0 6px;
}

.config-scope-grid {
  display: grid;
  gap: 8px;
}

.config-scope-grid div {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 8px;
  align-items: center;
  min-height: 38px;
  padding: 9px 10px;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-main);
  font-size: 12px;
}

.config-scope-grid i {
  color: var(--primary);
}

.advanced-signing {
  padding: 0;
  overflow: hidden;
}

.advanced-signing summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  cursor: pointer;
  list-style: none;
}

.advanced-signing summary::-webkit-details-marker {
  display: none;
}

.advanced-signing summary h3 {
  margin: 0 0 4px;
}

.advanced-signing > p,
.advanced-signing > pre {
  margin-left: 20px;
  margin-right: 20px;
}

.advanced-signing > pre {
  margin-bottom: 20px;
}

.advanced-chevron {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  color: var(--text-muted);
  transition: transform var(--transition), color var(--transition), border-color var(--transition);
}

.advanced-signing[open] .advanced-chevron {
  color: var(--primary);
  border-color: rgba(255, 111, 77, 0.38);
  transform: rotate(180deg);
}

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

.settings-wide {
  grid-column: 1 / -1;
}

.settings-title {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.settings-title h3 {
  margin-bottom: 4px;
}

.profile-row {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 18px;
}

.profile-avatar {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  flex: 0 0 64px;
  border: 1px solid rgba(255, 111, 77, 0.3);
  border-radius: 8px;
  background: rgba(255, 111, 77, 0.12);
  color: #fff;
  font-size: 24px;
  font-weight: 750;
}

.profile-meta {
  display: grid;
  gap: 3px;
}

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

.verify-grid {
  display: grid;
  gap: 14px;
}

.verify-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background: #121619;
}

.verify-item p {
  margin: 4px 0 0;
}

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

.connector-card {
  padding: 16px;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background: #121619;
}

.connector-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  margin-bottom: 12px;
  border-radius: 8px;
  background: rgba(255, 111, 77, 0.14);
  color: var(--primary);
}

.connector-card h4 {
  margin: 0 0 12px;
}

.connector-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.connector-panel {
  margin-top: 16px;
  padding: 14px;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.025);
}

.connector-preview {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background: var(--bg-alt);
}

.notify-row {
  margin: 16px 0 0;
}

.empty-state {
  padding: 28px;
  border: 1px dashed #343c43;
  border-radius: 8px;
  background: #121618;
  text-align: center;
}

.empty-title {
  color: var(--text);
  font-weight: 650;
}

.empty-detail {
  color: var(--text-muted);
  margin-top: 6px;
}

body[data-theme="light"]::before {
  background-image:
    linear-gradient(rgba(255, 111, 77, 0.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 111, 77, 0.09) 1px, transparent 1px),
    linear-gradient(rgba(20, 26, 31, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(20, 26, 31, 0.05) 1px, transparent 1px);
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.62), rgba(0, 0, 0, 0.14));
}

body[data-theme="light"] .auth-card,
body[data-theme="light"] .sidebar,
body[data-theme="light"] .card,
body[data-theme="light"] .modal,
body[data-theme="light"] .table-wrap,
body[data-theme="light"] .tabs,
body[data-theme="light"] .field-group,
body[data-theme="light"] .verify-item,
body[data-theme="light"] .connector-card,
body[data-theme="light"] .credential-row,
body[data-theme="light"] .empty-state {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}

body[data-theme="light"] input,
body[data-theme="light"] select,
body[data-theme="light"] textarea {
  background: #ffffff;
  color: var(--text);
  border-color: var(--border);
}

body[data-theme="light"] th,
body[data-theme="light"] .table-wrap,
body[data-theme="light"] .tabs,
body[data-theme="light"] .connector-preview {
  background: var(--surface-2);
}

body[data-theme="light"] tbody tr:hover,
body[data-theme="light"] .nav-item:hover {
  background: rgba(255, 111, 77, 0.09);
}

select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 38px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--text-muted) 50%),
    linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 50%,
    calc(100% - 12px) 50%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

select:hover {
  border-color: rgba(255, 111, 77, 0.38);
}

select option {
  background: var(--surface-2);
  color: var(--text);
  font-size: 13px;
}

select option:checked,
select option:hover {
  background: var(--surface-3);
  color: var(--text);
}

.native-select-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.custom-select {
  position: relative;
  width: 100%;
  min-width: 150px;
}

.custom-select-trigger {
  width: 100%;
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 14px 0 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent),
    #171c20;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  text-align: left;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.custom-select-trigger i {
  flex: 0 0 auto;
  color: var(--text-muted);
  font-size: 11px;
  transition: transform var(--transition), color var(--transition);
}

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

.custom-select.open .custom-select-trigger,
.custom-select-trigger:hover {
  border-color: rgba(255, 111, 77, 0.5);
  box-shadow: 0 0 0 3px rgba(255, 111, 77, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.custom-select.open .custom-select-trigger i {
  color: var(--primary);
  transform: rotate(180deg);
}

.custom-select-menu {
  position: absolute;
  inset: calc(100% + 8px) 0 auto 0;
  z-index: 180;
  display: none;
  max-height: 250px;
  overflow: auto;
  padding: 7px;
  border: 1px solid rgba(255, 111, 77, 0.22);
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(255, 111, 77, 0.055), transparent),
    #12171a;
  box-shadow: 0 20px 46px rgba(0, 0, 0, 0.42);
}

.custom-select.open .custom-select-menu {
  display: grid;
  gap: 3px;
}

.custom-select-option {
  width: 100%;
  min-height: 38px;
  padding: 0 12px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--text-main);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  text-align: left;
}

.custom-select-option:hover {
  background: rgba(255, 111, 77, 0.1);
  color: #fff;
}

.custom-select-option.active {
  background: rgba(255, 111, 77, 0.18);
  color: #fff;
  box-shadow: inset 3px 0 0 var(--primary);
}

.global-controls .custom-select {
  width: 92px;
  min-width: 92px;
}

.global-controls .custom-select-trigger {
  min-height: 36px;
  border-radius: 10px;
  padding: 0 10px;
}

body[data-theme="light"] .custom-select-trigger {
  background: #ffffff;
  color: var(--text);
}

body[data-theme="light"] .custom-select-menu {
  background: #ffffff;
  border-color: rgba(255, 111, 77, 0.28);
  box-shadow: 0 20px 42px rgba(25, 32, 38, 0.18);
}

body[data-theme="light"] .custom-select-option:hover,
body[data-theme="light"] .custom-select-option.active {
  color: var(--text);
}

.badge {
  text-transform: none;
  letter-spacing: 0;
}

th,
.stat .lbl,
.eyebrow,
.sdk-panel-title,
.sdk-count span,
.sdk-info-card span {
  text-transform: none;
  letter-spacing: 0;
}

@media (max-width: 900px) {
  .main {
    padding: 18px 18px 72px;
  }

  .cols-2,
  .cols-3,
  .cols-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sdk-info-grid,
  .sdk-workbench,
  .keyauth-values,
  .settings-grid,
  .connector-grid {
    grid-template-columns: 1fr;
  }

  .option-grid,
  .choice-grid {
    grid-template-columns: 1fr;
  }

  .sdk-language-panel {
    border-right: 0;
    border-bottom: 1px solid var(--border-subtle);
  }

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

  .stat {
    min-height: 112px;
  }
}

@media (max-width: 540px) {
  .sidebar {
    width: 56px;
    overflow: visible;
    border-right: 1px solid var(--border);
  }

  .app-main {
    margin-left: 56px;
  }

  .cols-2,
  .cols-3,
  .cols-4 {
    grid-template-columns: 1fr;
  }

  .auth-card {
    padding: 24px;
  }

  .sdk-hero,
  .sdk-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .sdk-info-grid,
  .sdk-lang-grid {
    grid-template-columns: 1fr;
  }

  .settings-switches {
    grid-template-columns: 1fr;
  }

  .config-help {
    grid-template-columns: 1fr;
  }

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

  .page-head,
  .row.spread {
    align-items: flex-start;
    flex-direction: column;
  }

  .row.gap.wrap {
    width: 100%;
  }

  .row.gap.wrap > * {
    width: 100%;
  }
}

/* Final UI hardening: native checks and stronger brand mark */
input[type="checkbox"],
input[type="radio"] {
  -webkit-appearance: auto !important;
  -moz-appearance: auto !important;
  appearance: auto !important;
  accent-color: var(--primary);
  width: 18px !important;
  height: 18px !important;
  min-width: 18px !important;
  min-height: 18px !important;
  padding: 0 !important;
  margin: 0;
  border: 0 !important;
  border-radius: initial;
  background: transparent !important;
  box-shadow: none;
  flex: 0 0 auto;
  cursor: pointer;
  vertical-align: middle;
}

input[type="checkbox"]::after,
input[type="radio"]::after {
  content: none !important;
}

input[type="checkbox"]:focus,
input[type="radio"]:focus {
  outline: none;
  box-shadow: 0 0 0 3px var(--primary-dim);
}

.choice-card input,
.switch-card input,
label.row input[type="checkbox"],
label.row input[type="radio"] {
  margin-top: 3px;
}

.auth-brand .brand-logo {
  width: 128px;
  height: 128px;
  margin-bottom: 18px;
}

.sidebar-brand {
  min-height: 132px;
  padding: 24px 20px;
}

.sidebar-logo {
  width: 78px;
  height: 78px;
  flex-basis: 78px;
}

.sidebar-name {
  font-size: 20px;
}

@media (max-width: 900px) {
  .sidebar-brand {
    min-height: 76px;
    padding: 16px 10px;
  }

  .sidebar-logo {
    width: 34px;
    height: 34px;
    flex-basis: 34px;
  }
}
