:root {
  color-scheme: light;
  --color-background: #f1f5f9;
  --color-surface: #ffffff;
  --color-surface-hover: #e2e8f0;
  --color-primary: #7e22ce;
  --color-primary-hover: #6b21a8;
  --color-border: #94a3b8;
  --color-border-hover: #64748b;
  --color-text: #020617;
  --color-text-muted: #334155;
  --color-danger: #be123c;
  --color-success: #166534;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --color-background: #080314;
    --color-surface: #110826;
    --color-surface-hover: #1c0f3d;
    --color-primary: #a855f7;
    --color-primary-hover: #9333ea;
    --color-border: #2a174f;
    --color-border-hover: #4c1d95;
    --color-text: #ffffff;
    --color-text-muted: #c4b5fd;
    --color-danger: #fb7185;
    --color-success: #86efac;
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  color: var(--color-text);
  background:
    radial-gradient(circle at 10% 0%, rgba(126, 34, 206, 0.2), transparent 34%),
    radial-gradient(circle at 90% 0%, rgba(168, 85, 247, 0.18), transparent 30%),
    var(--color-background);
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--color-border);
  backdrop-filter: blur(8px);
  background: color-mix(in srgb, var(--color-background) 86%, transparent);
}

.brand-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: linear-gradient(120deg, var(--color-primary), #d946ef);
  box-shadow: 0 0 20px rgba(168, 85, 247, 0.45);
}

.eyebrow {
  margin: 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(120deg, var(--color-primary), #d946ef);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

h2 {
  margin: 0 0 6px;
  font-size: 22px;
  letter-spacing: -0.02em;
}

.page {
  max-width: 1080px;
  margin: 30px auto 56px;
  padding: 0 18px;
}

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 18px;
  padding: 22px;
  box-shadow: 0 22px 36px rgba(2, 6, 23, 0.15);
}

.hidden {
  display: none;
}

.muted {
  margin: 0;
  color: var(--color-text-muted);
}

.stack {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

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

.full {
  grid-column: 1 / -1;
}

.create-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

label {
  display: block;
  margin-bottom: 7px;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 11px;
  font-weight: 600;
}

input,
select {
  width: 100%;
  color: var(--color-text);
  background: var(--color-background);
  border: 1px solid var(--color-border);
  border-radius: 11px;
  padding: 11px 12px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
}

input:focus,
select:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.2);
}

button {
  border: 0;
  cursor: pointer;
  font-weight: 700;
  border-radius: 11px;
  padding: 10px 14px;
  color: #fff;
  background: linear-gradient(90deg, var(--color-primary), #d946ef);
  transition: transform 0.12s, filter 0.2s, opacity 0.2s;
}

button:hover {
  filter: brightness(1.05);
}

button:active {
  transform: translateY(1px);
}

button:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.3);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.7;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
}

.btn-icon svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.btn.is-loading .btn-label {
  opacity: 0.85;
}

.btn.is-loading .btn-icon svg {
  animation: spin 0.9s linear infinite;
}

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

button.secondary {
  color: var(--color-text);
  background: var(--color-surface-hover);
  border: 1px solid var(--color-border);
}

button.danger {
  background: linear-gradient(90deg, #e11d48, #be123c);
}

.error {
  margin-top: 12px;
  color: #f43f5e;
  font-size: 14px;
}

.generated {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 11px;
  border: 1px solid color-mix(in srgb, var(--color-success) 50%, var(--color-border));
  color: color-mix(in srgb, var(--color-success) 80%, var(--color-text));
  background: color-mix(in srgb, var(--color-success) 15%, var(--color-surface));
}

.generated code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

.table-wrap {
  margin-top: 18px;
  overflow-x: auto;
  border: 1px solid var(--color-border);
  border-radius: 14px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--color-border);
  font-size: 14px;
}

th {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  background: color-mix(in srgb, var(--color-surface-hover) 65%, transparent);
}

tbody tr:hover {
  background: color-mix(in srgb, var(--color-surface-hover) 70%, transparent);
}

.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.actions .btn {
  padding: 8px 11px;
  min-height: 34px;
  font-size: 12px;
  border-radius: 9px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 4px 10px;
  border: 1px solid var(--color-border);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.status-badge.active {
  color: #15803d;
  border-color: rgba(22, 163, 74, 0.45);
  background: rgba(34, 197, 94, 0.15);
}

.status-badge.suspended {
  color: #e11d48;
  border-color: rgba(244, 63, 94, 0.4);
  background: rgba(244, 63, 94, 0.14);
}

@media (max-width: 840px) {
  .grid {
    grid-template-columns: 1fr;
  }

  .create-foot {
    align-items: flex-start;
    flex-direction: column;
  }

  .head {
    flex-direction: column;
    align-items: flex-start;
  }
}
