:root {
  --bg: #090d18;
  --bg-soft: #0f172a;
  --panel: rgba(18, 27, 49, 0.92);
  --panel-strong: #111a31;
  --line: rgba(148, 163, 184, 0.18);
  --text: #f4f7fb;
  --muted: #9ba8bf;
  --muted-2: #71809a;
  --accent: #4f7dff;
  --accent-2: #78a6ff;
  --danger: #ef4444;
  --success: #22c55e;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
  --radius: 20px;
  --radius-sm: 12px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--bg); }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 18% 10%, rgba(79, 125, 255, 0.22), transparent 30%),
    radial-gradient(circle at 85% 16%, rgba(30, 64, 175, 0.22), transparent 36%),
    linear-gradient(135deg, #070b14 0%, #10172a 48%, #080c17 100%);
}

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

button { cursor: pointer; }

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

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 13px;
  color: var(--text);
  background: rgba(8, 13, 24, 0.68);
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

input:focus, select:focus, textarea:focus {
  border-color: rgba(120, 166, 255, 0.75);
  box-shadow: 0 0 0 3px rgba(79, 125, 255, 0.18);
  background: rgba(8, 13, 24, 0.9);
}

textarea { resize: vertical; }

label {
  display: grid;
  gap: 8px;
  color: #dbe4f2;
  font-size: 0.92rem;
  font-weight: 650;
}

code {
  display: block;
  overflow-wrap: anywhere;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  color: #dce8ff;
  background: rgba(4, 8, 16, 0.54);
}

.hidden { display: none !important; }

.noscript {
  margin: 24px;
  padding: 18px;
  border-radius: 14px;
  color: #fff;
  background: #991b1b;
}

.toast {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 1000;
  min-width: 260px;
  max-width: min(380px, calc(100vw - 36px));
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--text);
  background: rgba(15, 23, 42, 0.96);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(-10px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 34px;
}

.auth-shell {
  width: min(1050px, 100%);
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  border: 1px solid var(--line);
  border-radius: 28px;
  overflow: hidden;
  background: rgba(11, 17, 31, 0.75);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.auth-panel { padding: 42px; }

.brand-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 620px;
  background:
    linear-gradient(160deg, rgba(79, 125, 255, 0.22), transparent 45%),
    rgba(5, 10, 20, 0.55);
}

.auth-logo {
  width: min(300px, 78%);
  max-height: 170px;
  object-fit: contain;
  object-position: left center;
  margin-bottom: 34px;
  filter: drop-shadow(0 20px 35px rgba(0, 0, 0, 0.4));
}

.brand-panel h1, .auth-form h2 {
  margin: 0;
  letter-spacing: -0.04em;
}

.brand-panel h1 { font-size: clamp(2.4rem, 6vw, 4.8rem); }

.brand-panel p {
  max-width: 520px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 1.06rem;
  line-height: 1.65;
}

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

.security-list span {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  color: #dce7ff;
  background: rgba(255, 255, 255, 0.04);
}

.action-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: rgba(17, 24, 39, 0.62);
}

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

.eyebrow {
  width: fit-content;
  border: 1px solid rgba(120, 166, 255, 0.3);
  border-radius: 999px;
  padding: 7px 11px;
  color: #cfe0ff;
  background: rgba(79, 125, 255, 0.12);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.auth-form h2 { font-size: clamp(1.8rem, 4vw, 2.75rem); }

.muted { color: var(--muted); line-height: 1.55; }

.auth-footer {
  margin-top: 32px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  background: rgba(7, 11, 20, 0.52);
}

.auth-footer p { margin: 8px 0 0; color: var(--muted); line-height: 1.55; }

.primary, .secondary, .ghost, .danger, .file-button, .icon-btn {
  border: 0;
  border-radius: 12px;
  padding: 12px 16px;
  font-weight: 800;
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}

.primary {
  color: white;
  background: linear-gradient(135deg, #3f6dff, #78a6ff);
  box-shadow: 0 12px 28px rgba(79, 125, 255, 0.28);
}

.secondary, .file-button, .icon-btn {
  border: 1px solid var(--line);
  color: #e7eefc;
  background: rgba(255, 255, 255, 0.055);
}

.ghost {
  border: 1px solid var(--line);
  color: #dbe7ff;
  background: transparent;
}

.danger {
  color: white;
  background: linear-gradient(135deg, #dc2626, #ef4444);
}

.primary:hover, .secondary:hover, .ghost:hover, .danger:hover, .file-button:hover, .icon-btn:hover {
  transform: translateY(-1px);
}

.small { padding: 10px 12px; font-size: 0.85rem; }
.full { width: 100%; }

.field-hint { color: var(--muted-2); line-height: 1.4; }

.strength-wrap {
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
}

.strength-bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #ef4444, #f59e0b, #22c55e);
  transition: width 0.18s ease;
}

.app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 292px 1fr;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 26px;
  padding: 24px;
  border-right: 1px solid var(--line);
  background: rgba(7, 12, 23, 0.82);
  backdrop-filter: blur(18px);
}

.side-brand {
  display: flex;
  align-items: center;
  gap: 13px;
  min-height: 66px;
}

.side-brand img {
  width: 82px;
  height: 52px;
  object-fit: contain;
}

.side-brand strong { display: block; letter-spacing: -0.02em; }
.side-brand small { color: var(--muted); }

.nav { display: grid; gap: 9px; }

.nav-item {
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 13px 14px;
  color: #c7d4ea;
  text-align: left;
  background: transparent;
  font-weight: 800;
}

.nav-item:hover, .nav-item.active {
  border-color: rgba(120, 166, 255, 0.25);
  color: white;
  background: rgba(79, 125, 255, 0.14);
}

.side-footer {
  margin-top: auto;
  display: grid;
  gap: 12px;
}

.save-state {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.9rem;
}

.content { padding: 30px; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.topbar h2 { margin: 0; font-size: clamp(1.7rem, 3vw, 2.5rem); letter-spacing: -0.04em; }
.topbar p { margin: 6px 0 0; color: var(--muted); }

.top-actions { display: flex; gap: 12px; align-items: center; }
.search { min-width: min(340px, 36vw); }

.view { display: none; }
.view.active { display: block; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.stat-card, .panel, .modal-card {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(14px);
}

.stat-card {
  border-radius: var(--radius);
  padding: 20px;
}

.stat-card span { color: var(--muted); font-weight: 750; }
.stat-card strong { display: block; margin-top: 12px; font-size: 2.2rem; letter-spacing: -0.05em; }

.panel {
  border-radius: var(--radius);
  padding: 22px;
}

.panel.narrow { max-width: 760px; }

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

.panel-head h3 { margin: 0; font-size: 1.35rem; letter-spacing: -0.02em; }
.panel-head p { margin: 6px 0 0; color: var(--muted); line-height: 1.45; }

.filter-row {
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 12px;
  margin-bottom: 18px;
}

.cards-list { display: grid; gap: 12px; }

.card {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.04);
}

.card-main {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: start;
}

.card h4 {
  margin: 0 0 8px;
  font-size: 1.06rem;
  letter-spacing: -0.02em;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 0.88rem;
}

.meta span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 9px;
  background: rgba(0, 0, 0, 0.15);
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.empty-state {
  border: 1px dashed rgba(148, 163, 184, 0.26);
  border-radius: 16px;
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

.checks { display: grid; gap: 10px; margin: 12px 0; }
.checks label, .check-line { display: flex; align-items: center; gap: 10px; font-weight: 650; color: #dbe4f2; }
.checks input, .check-line input { width: auto; }

.generated-box {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin: 16px 0;
}

.setting-box {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 17px;
  margin-top: 16px;
  background: rgba(255, 255, 255, 0.035);
}

.setting-box p { color: var(--muted); line-height: 1.5; }
.danger-zone { border-color: rgba(239, 68, 68, 0.25); background: rgba(239, 68, 68, 0.06); }

.actions-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.file-button { display: inline-flex; align-items: center; width: auto; }
.file-button input { display: none; }

.modal {
  width: min(900px, calc(100vw - 32px));
  border: 0;
  padding: 0;
  color: var(--text);
  background: transparent;
}

.modal::backdrop { background: rgba(0, 0, 0, 0.65); backdrop-filter: blur(4px); }

.modal-card {
  border-radius: 24px;
  padding: 24px;
}

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

.modal-head h3 { margin: 0; font-size: 1.35rem; }
.modal-head p { margin: 6px 0 0; color: var(--muted); }

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

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

.inline-input {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
}

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

@media (max-width: 980px) {
  .auth-shell { grid-template-columns: 1fr; }
  .brand-panel { min-height: auto; }
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .nav { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .nav-item { text-align: center; }
  .side-footer { grid-template-columns: 1fr auto; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topbar { flex-direction: column; align-items: stretch; }
  .top-actions { width: 100%; }
  .search { min-width: 0; }
}

@media (max-width: 680px) {
  .auth-screen { padding: 18px; }
  .auth-panel { padding: 24px; }
  .security-list, .stats-grid, .filter-row, .form-grid { grid-template-columns: 1fr; }
  .content { padding: 18px; }
  .top-actions, .panel-head, .card-main, .generated-box, .inline-input { grid-template-columns: 1fr; display: grid; }
  .nav { grid-template-columns: 1fr 1fr; }
  .card-actions { justify-content: stretch; }
  .card-actions button { width: 100%; }
}

.text-center { display: inline-flex; justify-content: center; text-decoration: none; }
.auth-form a.primary { color: #fff; }
