:root {
  --bg: #070707;
  --surface: #0d0d0d;
  --panel: #111111;
  --panel-2: #151515;
  --panel-3: #1a1a1a;
  --line: #292929;
  --line-soft: #202020;
  --text: #f4f2ec;
  --text-soft: #d0cdc4;
  --muted: #918f88;
  --gold: #c7a24b;
  --gold-light: #dfc36d;
  --gold-deep: #8b6b28;
  --gold-soft: rgba(199,162,75,.10);
  --danger: #e28787;
  --danger-bg: #211313;
  --success: #8ec8a8;
  --success-bg: #101d15;
  --warning: #d8b867;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 24px 70px rgba(0,0,0,.28);
  --focus: 0 0 0 3px rgba(199,162,75,.16);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 50% -18%, rgba(199,162,75,.08), transparent 30rem),
    var(--bg);
}
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { touch-action: manipulation; }
a { color: var(--gold-light); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg { display: block; }
::selection { background: rgba(199,162,75,.28); color: var(--text); }
:focus-visible { outline: none; box-shadow: var(--focus); border-color: var(--gold-deep) !important; }

#app { min-height: 100vh; }

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr);
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px 18px;
  border-right: 1px solid var(--line-soft);
  background: rgba(9,9,9,.97);
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 6px 20px;
}
.brand img { width: 43px; height: 52px; object-fit: contain; }
.brand strong { display: block; font-size: 16px; letter-spacing: .02em; }
.brand span { color: var(--muted); font-size: 12px; }

.nav { display: grid; gap: 5px; margin-top: 8px; }
.nav a, .nav button {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 11px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: #b7b4ac;
  padding: 10px 11px;
  text-align: left;
  cursor: pointer;
}
.nav a:hover, .nav button:hover, .nav a.active {
  background: #151515;
  color: var(--text);
  text-decoration: none;
}
.nav a.active {
  border-color: #2b281f;
  box-shadow: inset 2px 0 0 var(--gold);
}
.nav-icon { width: 17px; height: 17px; flex: 0 0 auto; color: #8d8a83; }
.nav a.active .nav-icon { color: var(--gold-light); }
.sidebar-bottom { position: absolute; left: 18px; right: 18px; bottom: 18px; display: grid; gap: 10px; }

.main { min-width: 0; }
.topbar {
  min-height: 68px;
  border-bottom: 1px solid var(--line-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 30px;
  background: rgba(7,7,7,.78);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar .identity { min-width: 0; display: flex; align-items: center; gap: 11px; }
.user-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center;
  border: 1px solid #3b3320; background: #17140d;
  color: var(--gold-light); font-size: 13px; font-weight: 800;
}
.topbar .identity strong { display: block; overflow: hidden; text-overflow: ellipsis; }
.topbar .identity span { color: var(--muted); font-size: 12px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.content { max-width: 1080px; margin: 0 auto; padding: 34px 30px 72px; }

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
}
.auth-card {
  width: min(440px, 100%);
  background: rgba(16,16,16,.97);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 28px 30px 30px;
}
.auth-toolbar {
  display: flex;
  justify-content: flex-end;
  min-height: 30px;
  margin: -4px -4px 2px;
}
.auth-brand { text-align: center; margin-bottom: 22px; }
.auth-brand img { width: 70px; height: 82px; object-fit: contain; margin: auto; }
.auth-brand h1 { margin: 11px 0 4px; font-size: 21px; }
.auth-brand p { margin: 0; color: var(--muted); font-size: 13px; }
.auth-title { margin: 0 0 6px; text-align: center; font-size: 20px; }
.auth-subtitle { margin: 0 0 20px; text-align: center; color: var(--muted); font-size: 13px; line-height: 1.55; }
.auth-footer {
  margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line-soft);
  display: flex; justify-content: center; gap: 14px; font-size: 11px; color: var(--muted);
}
.auth-footer a { color: var(--muted); }
.auth-footer a:hover { color: var(--text-soft); }

h1 { font-size: 27px; margin: 0 0 7px; letter-spacing: -.025em; }
h2 { font-size: 17px; margin: 0 0 16px; }
h3 { font-size: 14px; margin: 0; }
p.lead { color: var(--muted); margin: 0 0 28px; line-height: 1.55; }
.section-head {
  display: flex; gap: 18px; align-items: flex-start; justify-content: space-between; margin-bottom: 22px;
}

.grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 16px; }
.grid-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 20px;
}
.card + .card { margin-top: 16px; }
.card h3 { margin: 0 0 8px; font-size: 15px; }
.card p { color: var(--muted); margin: 0; line-height: 1.5; font-size: 13px; }
.card-header {
  display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 15px;
}
.card-header h2 { margin: 0; }
.stat { min-height: 112px; display: flex; flex-direction: column; justify-content: space-between; }
.stat strong { display: block; font-size: 24px; }
.stat span { color: var(--muted); font-size: 12px; }

.status-card {
  display: flex; align-items: center; gap: 13px;
}
.status-icon {
  width: 38px; height: 38px; border-radius: 11px;
  display: grid; place-items: center;
  background: #17150f; border: 1px solid #39321f; color: var(--gold-light);
}
.status-icon svg { width: 19px; height: 19px; }
.status-card strong { display: block; font-size: 14px; }
.status-card small { display: block; color: var(--muted); margin-top: 3px; }

.form { display: grid; gap: 15px; }
.field { display: grid; gap: 7px; }
label { color: #cfcdc6; font-size: 12px; font-weight: 650; }
.input-wrap { position: relative; }
.input-wrap input { padding-right: 46px; }
.input-action {
  position: absolute; right: 5px; top: 50%; transform: translateY(-50%);
  width: 36px; height: 34px; border: 0; border-radius: 8px;
  background: transparent; color: var(--muted); cursor: pointer;
  display: grid; place-items: center;
}
.input-action:hover { color: var(--text); background: #171717; }
.input-action svg { width: 17px; height: 17px; }

input, textarea, select {
  width: 100%;
  border: 1px solid #343434;
  background: #0a0a0a;
  color: var(--text);
  border-radius: 10px;
  padding: 11px 12px;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
input:hover, textarea:hover, select:hover { border-color: #414141; }
input:focus, textarea:focus, select:focus {
  border-color: var(--gold-deep);
  box-shadow: var(--focus);
  background: #0c0c0c;
}
input::placeholder { color: #67655f; }

.btn {
  border: 1px solid var(--gold-deep);
  border-radius: 10px;
  min-height: 42px;
  background: linear-gradient(180deg, #d0ad57, #a87e2c);
  color: #101010;
  font-weight: 760;
  padding: 10px 14px;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  transition: filter .15s ease, transform .08s ease, border-color .15s ease;
}
.btn:hover { filter: brightness(1.04); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn-secondary {
  border: 1px solid #343434;
  background: #151515;
  color: var(--text);
}
.btn-secondary:hover { border-color: #474747; background: #181818; }
.btn-danger { border-color: #603636; background: #221313; color: #efaaaa; }
.btn-block { width: 100%; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-icon { width: 19px; height: 19px; flex: 0 0 auto; }

.social-stack { display: grid; gap: 10px; }
.social-btn {
  min-height: 46px;
  border: 1px solid #343434;
  background: #111;
  color: var(--text);
  border-radius: 10px;
  padding: 0 14px;
  display: grid;
  grid-template-columns: 24px 1fr 24px;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-weight: 650;
}
.social-btn:hover { background: #161616; border-color: #484848; }
.social-btn .social-icon { width: 20px; height: 20px; color: #dedbd3; }
.social-btn .chevron { width: 16px; height: 16px; color: #666; justify-self: end; }

.divider {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  color: #74736f;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .075em;
  margin: 18px 0;
}
.divider::before, .divider::after { content: ""; height: 1px; background: var(--line-soft); }

.notice {
  border: 1px solid #3a3424;
  background: #17150e;
  border-radius: 10px;
  padding: 11px 12px;
  color: #d7c994;
  font-size: 12px;
  line-height: 1.5;
  margin-bottom: 12px;
}
.notice.error { border-color: #523030; background: var(--danger-bg); color: #e9a0a0; }
.notice.success { border-color: #2c4a39; background: var(--success-bg); color: #9bd0b2; }

.list { display: grid; gap: 10px; }
.list-item {
  display: flex; gap: 14px; align-items: center; justify-content: space-between;
  border: 1px solid var(--line); border-radius: 11px; padding: 13px 14px; background: #101010;
}
.list-item .meta { min-width: 0; }
.list-item strong { display: block; font-size: 13px; overflow: hidden; text-overflow: ellipsis; }
.list-item small { display: block; margin-top: 4px; color: var(--muted); }
.provider-row { display: flex; align-items: center; gap: 12px; min-width: 0; }
.provider-logo {
  width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
  background: #171717; border: 1px solid #2e2e2e; color: #d8d5cd; flex: 0 0 auto;
}
.provider-logo svg { width: 19px; height: 19px; }

.badge {
  display: inline-flex; align-items: center; border: 1px solid #433a24; background: #19160f;
  color: #d7bd72; border-radius: 999px; padding: 4px 8px; font-size: 10px; white-space: nowrap;
}
.badge.muted { border-color: #323232; background: #161616; color: #aaa; }
.badge.good { border-color: #2d503c; background: #0f1c15; color: #8ed0aa; }
.badge.bad { border-color: #573737; background: #201313; color: #e5a0a0; }

.kv { display: grid; grid-template-columns: 190px minmax(0,1fr); gap: 10px 14px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; color: var(--text-soft); }
.copy-row { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; }
.copy-row code { overflow: hidden; text-overflow: ellipsis; }
.icon-btn {
  width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px;
  border: 1px solid #333; background: #141414; color: #aaa; cursor: pointer;
}
.icon-btn:hover { color: var(--text); border-color: #484848; }
.icon-btn svg { width: 15px; height: 15px; }

.password-meter { display: grid; gap: 6px; margin-top: 1px; }
.password-meter-track { height: 4px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.password-meter-track i { height: 4px; border-radius: 999px; background: #262626; }
.password-meter[data-score="1"] i:nth-child(-n+1),
.password-meter[data-score="2"] i:nth-child(-n+2),
.password-meter[data-score="3"] i:nth-child(-n+3),
.password-meter[data-score="4"] i:nth-child(-n+4) { background: var(--gold); }
.password-meter small { color: var(--muted); font-size: 10px; }

.language-picker {
  display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; font-weight: 650;
}
.language-picker select {
  width: auto; min-width: 66px; padding: 6px 26px 6px 9px; border-radius: 8px;
  border-color: #333; background-color: #111; color: var(--text); cursor: pointer;
}
.language-picker.compact span:empty { display: none; }

.muted { color: var(--muted); }
.small { font-size: 12px; }
.empty {
  border: 1px dashed #333; border-radius: 12px; padding: 24px;
  text-align: center; color: var(--muted); background: #0d0d0d;
}

.toast-host {
  position: fixed; right: 18px; bottom: 18px; z-index: 100;
  display: grid; gap: 8px; width: min(360px, calc(100vw - 36px));
}
.toast {
  border: 1px solid #343434; border-radius: 11px; background: #151515;
  box-shadow: 0 14px 40px rgba(0,0,0,.36); padding: 12px 13px;
  display: flex; gap: 10px; align-items: flex-start; font-size: 12px;
}
.toast.success { border-color: #2e503d; }
.toast.error { border-color: #5c3535; }
.toast svg { width: 17px; height: 17px; flex: 0 0 auto; margin-top: 1px; }

.loading-page {
  min-height: 100vh;
  background: var(--bg);
}
.skeleton { position: relative; overflow: hidden; background: #171717; border-radius: 8px; }
.skeleton::after {
  content: ""; position: absolute; inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.035), transparent);
  animation: shimmer 1.25s infinite;
}
.skeleton-line { height: 12px; }
.skeleton-line.lg { height: 18px; }
.skeleton-line.sm { height: 9px; }
.skeleton-circle { border-radius: 50%; }
.skeleton-button { height: 44px; border-radius: 10px; }
.skeleton-card { min-height: 112px; border: 1px solid #222; background: #101010; border-radius: var(--radius); padding: 20px; }
.skeleton-auth {
  width: min(440px, 100%); border: 1px solid #222; border-radius: 18px;
  background: #101010; padding: 30px; box-shadow: var(--shadow);
}
.skeleton-stack { display: grid; gap: 12px; }
.skeleton-shell {
  min-height: 100vh; display: grid; grid-template-columns: 252px minmax(0,1fr);
}
.skeleton-sidebar { border-right: 1px solid #202020; padding: 22px 18px; }
.skeleton-main { padding: 34px 30px; }
.skeleton-main-inner { max-width: 1080px; margin: auto; }
.skeleton-title { width: 230px; height: 28px; margin-bottom: 10px; }
.skeleton-subtitle { width: min(420px, 70%); height: 12px; margin-bottom: 28px; }

@keyframes shimmer { 100% { transform: translateX(100%); } }

.legal-page {
  width: min(760px, 100%);
  margin: 0 auto;
}
.legal-page .card { line-height: 1.72; }
.legal-page p { color: var(--text-soft); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; padding-bottom: 72px; }
  .sidebar {
    position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; top: auto;
    height: 68px; padding: 8px 10px; border-right: 0; border-top: 1px solid var(--line);
    background: rgba(8,8,8,.97); backdrop-filter: blur(12px);
  }
  .brand, .sidebar-bottom { display: none; }
  .nav { grid-template-columns: repeat(4, minmax(0,1fr)); margin: 0; gap: 3px; height: 100%; }
  .nav a {
    flex-direction: column; justify-content: center; gap: 3px; padding: 4px 2px;
    font-size: 10px; border-radius: 9px;
  }
  .nav a.active { box-shadow: none; border-color: #332d1e; }
  .nav-icon { width: 18px; height: 18px; }
  .topbar { padding: 0 18px; }
  .content { padding: 26px 18px 55px; }
  .grid, .grid-3 { grid-template-columns: 1fr; }
  .skeleton-shell { grid-template-columns: 1fr; }
  .skeleton-sidebar { display: none; }
  .skeleton-main { padding: 26px 18px; }
}

@media (max-width: 480px) {
  .auth-shell { padding: 12px; }
  .auth-card { padding: 22px 18px 24px; }
  .topbar-actions .badge { display: none; }
  .topbar .identity span { max-width: 170px; overflow: hidden; text-overflow: ellipsis; display: block; }
  .kv { grid-template-columns: 1fr; gap: 3px; }
  .list-item { align-items: flex-start; flex-direction: column; }
  .list-item > .btn { width: 100%; }
  .btn-row { display: grid; grid-template-columns: 1fr; }
}

.mini-spinner {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid rgba(0,0,0,.25); border-top-color: rgba(0,0,0,.85);
  animation: spin .7s linear infinite;
}
.btn-secondary .mini-spinner, .btn-danger .mini-spinner {
  border-color: rgba(255,255,255,.22); border-top-color: rgba(255,255,255,.9);
}
@keyframes spin { to { transform: rotate(360deg); } }
