/* NomadNet Web Cabinet & Enterprise Admin — Codeg Light Minimalist Design System
   (radix-maia neutral light palette: #FFFFFF cards, #FAFAFA canvas, 1px solid #E4E4E7 hairline borders,
   #18181B zinc-900 primary controls, #09090B foreground, #71717A muted, tabular-nums) */
:root {
  --coral: #007AFF;
  --coral-hover: #0062CC;
  --cream: #F6F4EF;
  --navy: #0A0A12;
  --navy-2: #14121E;

  /* Codeg v0.32.4 Light Neutral tokens */
  --bg: #FAFAFA;
  --surface: #FFFFFF;
  --surface-muted: #F4F4F5;
  --text: #09090B;
  --muted: #71717A;
  --border: #E4E4E7;
  --border-strong: #D4D4D8;
  --primary: #18181B;
  --primary-hover: #27272A;
  --primary-fg: #FAFAFA;
  --accent-blue: #2563EB;
  --ok: #059669;
  --warn: #D97706;
  --danger: #DC2626;
  --radius: 8px;
  --radius-sm: 6px;
  font-family: "Inter Variable", "Inter", "Geist Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--text); text-decoration: none; }
a:hover { color: var(--accent-blue); text-decoration: none; }
h1 { font-size: 1.35rem; font-weight: 600; letter-spacing: -0.025em; margin: 0 0 .5rem; color: var(--text); }
h2 { font-size: 0.96rem; font-weight: 600; letter-spacing: -0.015em; margin: 0 0 .6rem; color: var(--text); }
code, pre {
  font-family: "JetBrains Mono", "Geist Mono", ui-monospace, "Cascadia Code", Consolas, monospace;
  font-variant-numeric: tabular-nums;
  font-size: 0.82rem;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.08rem 0.35rem;
}

.topbar {
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar-inner {
  max-width: 1380px;
  margin: 0 auto;
  padding: 0.55rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
}
.brand {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
  letter-spacing: -0.03em;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.brand-logo-svg {
  flex-shrink: 0;
  border-radius: 5px;
  box-shadow: 0 1px 2px rgba(9, 9, 11, 0.08);
}
.brand:hover { text-decoration: none; color: var(--text); }
.brand-dot { color: var(--accent-blue); margin-left: -6px; }
.nav { display: flex; gap: 0.25rem; align-items: center; }
.nav a {
  color: var(--muted);
  font-weight: 500;
  font-size: 0.84rem;
  padding: 0.32rem 0.65rem;
  border-radius: var(--radius-sm);
  transition: background 0.12s ease, color 0.12s ease;
}
.nav a:hover { color: var(--text); background: var(--surface-muted); text-decoration: none; }
.nav a.active {
  color: var(--text);
  background: var(--surface-muted);
  font-weight: 600;
}
.nav a.nav-admin {
  color: var(--text);
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--surface);
}
.nav a.nav-admin.active {
  background: var(--primary);
  color: var(--primary-fg);
  border-color: var(--primary);
}
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: .75rem; }
.user-email { color: var(--muted); font-size: .8rem; font-family: "JetBrains Mono", monospace; }
.lang-switch a { color: var(--muted); font-size: .76rem; font-weight: 600; }
.lang-switch a.active { color: var(--text); }
.lang-sep { color: var(--border); margin: 0 .2rem; }

.main { flex: 1; width: 100%; max-width: 1380px; margin: 0 auto; padding: 1.5rem 1.25rem; }
.footer {
  text-align: center;
  color: var(--muted);
  font-size: .78rem;
  padding: 1rem;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
  margin-bottom: 1rem;
  box-shadow: 0 1px 2px rgba(9, 9, 11, 0.03);
}
.auth-card { max-width: 400px; margin: 3rem auto; }

label {
  display: block;
  font-weight: 500;
  font-size: .8rem;
  color: var(--muted);
  margin: .65rem 0 .25rem;
}
input[type=email], input[type=password], input[type=number], input[type=text], select, textarea {
  width: 100%;
  padding: .45rem .65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: .85rem;
  font-family: inherit;
  transition: border-color 0.12s ease;
}
textarea { resize: vertical; font-family: "JetBrains Mono", monospace; font-size: .8rem; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(24, 24, 27, 0.08);
}
.hint { color: var(--muted); font-size: .76rem; margin: .2rem 0 0; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: .45rem .85rem;
  font-size: .82rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background .12s ease, border-color .12s ease, color .12s ease;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn-primary {
  background: var(--primary);
  color: var(--primary-fg);
  border-color: var(--primary);
}
.btn-primary:hover {
  background: var(--primary-hover);
  color: var(--primary-fg);
}
.btn-ghost {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
.btn-ghost:hover {
  background: var(--surface-muted);
  border-color: var(--border-strong);
  color: var(--text);
}
.btn-danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-block { width: 100%; margin-top: .85rem; }
.btn-sm { padding: .24rem .52rem; font-size: .76rem; }
.inline-form { display: inline; }
.cta-row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: .85rem;
  margin-bottom: 1rem;
}
.stat { padding: .9rem 1.05rem; }
.stat-label {
  color: var(--muted);
  font-size: .74rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.stat-value {
  font-size: 1.55rem;
  font-weight: 600;
  letter-spacing: -.03em;
  margin: .15rem 0;
  font-variant-numeric: tabular-nums;
}
.stat-sub { color: var(--muted); font-size: .76rem; }
.meter { height: 5px; border-radius: 999px; background: var(--surface-muted); margin-top: .5rem; overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--primary); border-radius: 999px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .81rem; }
th {
  text-align: left;
  color: var(--muted);
  font-weight: 600;
  font-size: .71rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  background: var(--bg);
}
th, td { padding: .45rem .5rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: rgba(244, 244, 245, 0.45); }
.cell-right { text-align: right; }
.row-revoked { opacity: .5; }

.tag {
  display: inline-flex;
  align-items: center;
  padding: .1rem .48rem;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: var(--surface-muted);
  color: var(--text);
  font-size: .72rem;
  font-weight: 500;
  margin: .1rem .2rem .1rem 0;
  font-variant-numeric: tabular-nums;
}
.tag-topup, .tag-paid, .tag-grant, .tag-ru {
  border-color: rgba(5, 150, 105, 0.35);
  background: rgba(5, 150, 105, 0.07);
  color: var(--ok);
}
.tag-usage, .tag-pending {
  border-color: rgba(217, 119, 6, 0.35);
  background: rgba(217, 119, 6, 0.08);
  color: var(--warn);
}
.tag-failed, .tag-refunded {
  border-color: rgba(220, 38, 38, 0.35);
  background: rgba(220, 38, 38, 0.08);
  color: var(--danger);
}
.tag-world, .tag-allocate {
  border-color: rgba(37, 99, 235, 0.3);
  background: rgba(37, 99, 235, 0.06);
  color: var(--accent-blue);
}

.alert { border-radius: var(--radius-sm); padding: .6rem .9rem; font-size: .84rem; margin-bottom: .9rem; }
.alert-error { background: rgba(220, 38, 38, .08); color: var(--danger); border: 1px solid rgba(220, 38, 38, .28); }
.alert-warn { background: rgba(217, 119, 6, .08); color: var(--warn); border: 1px solid rgba(217, 119, 6, .28); }
.alert-ok { background: rgba(5, 150, 105, .08); color: var(--ok); border: 1px solid rgba(5, 150, 105, .28); }

.activate-card { border-left: 3px solid var(--primary); }

.key-box {
  background: var(--surface-muted);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  padding: .75rem .9rem;
  font-family: "JetBrains Mono", monospace;
  font-size: .85rem;
  word-break: break-all;
  white-space: pre-wrap;
  user-select: all;
}
.scopes-set { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .65rem .9rem; margin: .5rem 0 .85rem; }
.scopes-set legend { font-size: .8rem; font-weight: 600; padding: 0 .35rem; }
.check { display: flex; align-items: center; gap: .5rem; font-weight: 400; font-size: .83rem; color: var(--text); margin: .55rem 0; }
.check input { width: auto; }
.muted { color: var(--muted); font-size: .82rem; margin: 0 0 .65rem; }
.key-created { max-width: 640px; margin: 2rem auto; }

.subnav {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  margin-bottom: 1.1rem;
  padding: .3rem;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.subnav a {
  display: inline-flex;
  align-items: center;
  padding: .36rem .75rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: .81rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.12s ease;
}
.subnav a:hover { color: var(--text); text-decoration: none; }
.subnav a.active {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(9, 9, 11, 0.05);
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: .85rem;
  margin-bottom: 1rem;
}
.page-header h1 { margin-bottom: .2rem; }
.page-lead { color: var(--muted); font-size: .85rem; margin: 0; }

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}
.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: .85rem;
  margin-bottom: 1rem;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
  gap: .7rem;
  align-items: end;
}
.form-row-inline {
  display: flex;
  gap: .3rem;
  align-items: center;
  flex-wrap: wrap;
}
.input-sm {
  width: 68px !important;
  padding: .22rem .38rem !important;
  font-size: .75rem !important;
}
.select-sm {
  width: auto !important;
  max-width: 145px !important;
  padding: .22rem .38rem !important;
  font-size: .75rem !important;
}
.mono {
  font-family: "JetBrains Mono", "Geist Mono", ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: .8rem;
  font-variant-numeric: tabular-nums;
}
.card-selected { border: 1.5px solid var(--primary); }
.card-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: .6rem;
  margin-bottom: .65rem;
}
.card-header-row h2 { margin: 0; }
.models-strip {
  margin-top: .75rem;
  padding-top: .65rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: .3rem;
  align-items: center;
}
.meter-sm { width: 100px; height: 5px; border-radius: 999px; background: var(--surface-muted); overflow: hidden; margin-top: .25rem; }
.meter-sm span { display: block; height: 100%; background: var(--primary); border-radius: 999px; }
.w-10 { width: 10%; }
.w-20 { width: 20%; }
.w-30 { width: 30%; }
.w-40 { width: 40%; }
.w-50 { width: 50%; }
.w-60 { width: 60%; }
.w-70 { width: 70%; }
.w-80 { width: 80%; }
.w-90 { width: 90%; }
.w-100 { width: 100%; }
