:root {
  --bg-deep: #0c0a12;
  --bg-card: #16121f;
  --bg-elevated: #1e1a2a;
  --border: rgba(255, 255, 255, 0.08);
  --text: #f4f2f8;
  --muted: #9d96b0;
  --accent: #7c5cff;
  --accent-soft: rgba(124, 92, 255, 0.22);
  --accent-2: #3dd9c4;
  --danger: #ff6b8a;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  --font: "DM Sans", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-width: 380px;
  max-width: 440px;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg-deep);
}

body {
  background-image:
    radial-gradient(ellipse 120% 80% at 50% -20%, rgba(124, 92, 255, 0.35), transparent),
    radial-gradient(ellipse 80% 50% at 100% 0%, rgba(61, 217, 196, 0.12), transparent);
  background-attachment: fixed;
}

.app {
  padding: 18px 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 100%;
}

.hero {
  padding: 14px 16px;
  background: linear-gradient(135deg, var(--bg-card), var(--bg-elevated));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.hero-brand {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), #5a8cff);
  color: #fff;
  font-size: 18px;
  flex-shrink: 0;
}

.hero h1 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.tagline {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.privacy {
  margin: 12px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.4;
}

.privacy strong {
  color: var(--accent-2);
  font-weight: 600;
}

.tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.tab {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 10px 6px;
  border-radius: 8px;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}

.tab:hover {
  color: var(--text);
}

.tab.is-active {
  color: var(--text);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px rgba(124, 92, 255, 0.35);
}

.panels {
  flex: 1;
}

.panel {
  display: none;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.panel.is-visible {
  display: flex;
}

.panel-title {
  margin: 0 0 4px;
  font-size: 1rem;
  font-weight: 600;
}

.hint {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field .label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
}

.field .opt {
  font-weight: 400;
  color: var(--muted);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-deep);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field textarea {
  font-family: var(--mono);
  font-size: 0.75rem;
  line-height: 1.5;
  resize: vertical;
  min-height: 120px;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: rgba(124, 92, 255, 0.55);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.micro {
  font-size: 0.72rem;
  color: var(--muted);
}

.micro code {
  font-family: var(--mono);
  font-size: 0.68rem;
  background: var(--bg-elevated);
  padding: 1px 5px;
  border-radius: 4px;
}

.row-pass {
  display: flex;
  gap: 6px;
  align-items: stretch;
}

.row-pass input {
  flex: 1;
}

.row-inline {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.row-inline .label {
  flex: 1 1 100%;
}

.row-inline select {
  width: auto;
  min-width: 160px;
}

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

.btn-primary,
.btn-secondary,
.btn-save,
.btn-ghost {
  font-family: inherit;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: transform 0.12s, box-shadow 0.12s, opacity 0.12s;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  margin-top: 4px;
  padding: 14px 18px;
  border: none;
  font-size: 0.95rem;
  font-weight: 700;
  color: #0c0a12;
  background: linear-gradient(135deg, var(--accent-2), #7ae8dc);
  box-shadow: 0 8px 28px rgba(61, 217, 196, 0.35);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 12px 36px rgba(61, 217, 196, 0.45);
}

.btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-secondary {
  padding: 9px 14px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 600;
}

.btn-secondary:hover {
  border-color: rgba(124, 92, 255, 0.4);
}

.btn-save {
  padding: 10px 18px;
  border: none;
  background: linear-gradient(135deg, var(--accent), #5a8cff);
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
}

.btn-save:hover {
  transform: translateY(-1px);
}

.btn-ghost {
  padding: 0 12px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  font-size: 1rem;
  line-height: 1;
}

.btn-ghost:hover {
  background: var(--bg-deep);
}

.btn-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(12, 10, 18, 0.25);
  border-top-color: #0c0a12;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

.log {
  margin-top: 8px;
  padding: 12px;
  min-height: 56px;
  max-height: 160px;
  overflow-y: auto;
  border-radius: var(--radius-sm);
  background: var(--bg-deep);
  border: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 0.72rem;
  line-height: 1.5;
  color: var(--muted);
  white-space: pre-wrap;
  word-break: break-word;
}

.log.is-error {
  color: var(--danger);
  border-color: rgba(255, 107, 138, 0.35);
}

.log.is-success {
  color: var(--accent-2);
}

.footer {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 4px;
}

.save-status {
  font-size: 0.78rem;
  color: var(--muted);
}

.save-status.is-ok {
  color: var(--accent-2);
}
