:root {
  color-scheme: dark;
  --bg: #07030d;
  --surface: #14091d;
  --surface-2: #1e0c2b;
  --line: rgba(225, 190, 255, 0.15);
  --text: #faf6ff;
  --muted: #b7a9c3;
  --accent: #c653ff;
  --accent-2: #8d2cff;
  --ok: #6ee7a8;
  --bad: #ff938f;
  --radius: 24px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-width: 0; background: var(--bg); }
body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 20% -10%, rgba(155, 44, 255, .22), transparent 36rem),
    radial-gradient(circle at 90% 20%, rgba(198, 83, 255, .12), transparent 34rem),
    var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
}

a { color: inherit; }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
:where(button, a, input, select, textarea):focus { outline: none; }
:where(button, a, input, select, textarea):focus-visible {
  outline: none;
  border-radius: 12px;
  box-shadow: 0 0 0 3px rgba(198, 83, 255, .5);
}

.app-header {
  min-height: 76px;
  padding: 12px max(20px, calc((100vw - 1180px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(7, 3, 13, .82);
  backdrop-filter: blur(18px);
}

.app-header nav { display: flex; gap: 20px; }
.app-header nav a { color: var(--muted); text-decoration: none; font-weight: 650; }
.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none; font-weight: 900; letter-spacing: .12em; }
.brand img, .page-logo { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 24px rgba(198, 83, 255, .3); }

.app-shell { width: min(calc(100% - 40px), 1180px); min-height: calc(100vh - 156px); margin: 0 auto; padding: 64px 0 80px; }
footer { min-height: 80px; padding: 28px 20px; text-align: center; color: var(--muted); border-top: 1px solid var(--line); }

h1, h2, h3 { margin-top: 0; line-height: 1.12; letter-spacing: -.035em; }
h1 { margin-bottom: 18px; font-size: clamp(2rem, 5vw, 3.75rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); }
h3 { margin-top: 30px; }
p { color: var(--muted); }
.eyebrow { display: block; margin-bottom: 12px; color: #df8fff; font-size: .8rem; font-weight: 900; letter-spacing: .18em; }
.muted, small { color: var(--muted); }
.center { text-align: center; }
.center .page-logo { width: 92px; height: 92px; margin-bottom: 24px; }

.panel {
  margin-bottom: 24px;
  padding: clamp(24px, 4vw, 40px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(145deg, rgba(31, 13, 44, .94), rgba(15, 7, 23, .94));
  box-shadow: 0 24px 70px rgba(0, 0, 0, .22);
}
.panel.narrow { width: min(100%, 620px); margin-inline: auto; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 22px; }
.panel-heading h2 { margin-bottom: 8px; }
.panel-heading p { margin: 0; }
.grid { display: grid; gap: 24px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.dashboard-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 34px; }
.dashboard-head p { margin-bottom: 0; }

.stack { display: grid; gap: 20px; margin-top: 30px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: end; }
label { display: grid; gap: 8px; color: #ede3f5; font-weight: 700; }
input, select, textarea {
  width: 100%;
  min-height: 48px;
  padding: 11px 14px;
  border: 1px solid rgba(225, 190, 255, .2);
  border-radius: 12px;
  background: rgba(5, 2, 9, .6);
  color: var(--text);
}
textarea { min-height: 112px; resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
.form-grid .wide { grid-column: 1 / -1; }
.source-form { margin: 26px 0 34px; }
.check { display: flex; align-items: center; gap: 10px; }
.check input { width: 20px; min-height: 20px; }
.copy-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }

.button {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 11px 20px;
  border: 0;
  border-radius: 13px;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  color: #fff;
  text-decoration: none;
  font-weight: 850;
  cursor: pointer;
  box-shadow: 0 12px 30px rgba(157, 44, 255, .25);
}
.button:hover { filter: brightness(1.08); }
.button.ghost { border: 1px solid var(--line); background: rgba(255,255,255,.04); box-shadow: none; }
.button.compact { min-height: 40px; padding: 8px 14px; font-size: .9rem; }
.text-button { padding: 0; border: 0; background: transparent; color: #dda0ff; text-decoration: underline; cursor: pointer; }
.text-button.danger { color: var(--bad); }
.form-foot { margin-top: 24px; text-align: center; }
.login-divider { display: flex; align-items: center; gap: 12px; margin: 22px 0; color: var(--muted); }
.login-divider::before, .login-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.passkey-status { min-height: 1.5em; margin: 12px 0 0; text-align: center; }

.notice { margin: 18px 0; padding: 14px 16px; border: 1px solid; border-radius: 13px; }
.notice.success { border-color: rgba(110, 231, 168, .35); background: rgba(110, 231, 168, .08); color: var(--ok); }
.notice.error { border-color: rgba(255, 147, 143, .35); background: rgba(255, 147, 143, .08); color: var(--bad); }
.status { display: inline-flex; margin-bottom: 18px; padding: 7px 12px; border-radius: 999px; font-size: .86rem; font-weight: 850; }
.status.ok { background: rgba(110, 231, 168, .1); color: var(--ok); }
.status.bad { background: rgba(255, 147, 143, .1); color: var(--bad); }
.status.active { margin: 0; background: rgba(110, 231, 168, .1); color: var(--ok); }
.status.inactive { margin: 0; background: rgba(255, 147, 143, .1); color: var(--bad); }
.status.pending { margin: 0; background: rgba(198, 83, 255, .12); color: #dda0ff; }
.status.warning { margin: 0; background: rgba(255, 199, 105, .1); color: #ffd39a; }

dl { margin: 24px 0; }
dl div { display: flex; justify-content: space-between; gap: 20px; padding: 12px 0; border-bottom: 1px solid var(--line); }
dt { color: var(--muted); }
dd { margin: 0; font-weight: 750; text-align: right; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 24px; }
.stats article { padding: 22px; border: 1px solid var(--line); border-radius: 18px; background: rgba(24, 10, 34, .85); }
.stats strong { display: block; font-size: 2rem; }
.stats span { color: var(--muted); }

.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 14px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: .82rem; text-transform: uppercase; letter-spacing: .08em; }
.inline-form, .actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.inline-form input, .inline-form select { width: auto; min-width: 130px; }
.actions form { margin: 0; }
.actions .text-button { min-height: 44px; padding: 8px 4px; display: inline-flex; align-items: center; }

@media (max-width: 820px) {
  .grid.two, .form-grid, .stats { grid-template-columns: 1fr; }
  .dashboard-head { align-items: stretch; flex-direction: column; }
  .panel-heading { align-items: stretch; flex-direction: column; }
  .app-shell { width: min(calc(100% - 24px), 1180px); padding-top: 34px; }
  .panel { padding: 22px; border-radius: 18px; }
  .copy-row { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .app-header nav a:first-child { display: none; }
  .brand span { font-size: .9rem; }
  .inline-form { align-items: stretch; flex-direction: column; }
  .inline-form input, .inline-form select, .inline-form .button { width: 100%; }
}

@media (max-width: 280px) {
  body { font-size: 14px; }
  h1 { overflow-wrap: anywhere; }
  .app-header { padding-inline: 8px; gap: 8px; }
  .app-header nav { display: none; }
  .brand { gap: 7px; letter-spacing: .06em; }
  .brand img { width: 38px; height: 38px; }
  .app-shell { width: calc(100% - 12px); padding-top: 20px; }
  .panel { padding: 15px 12px; border-radius: 15px; }
  th, td { padding-inline: 8px; }
}
