:root {
  color-scheme: dark;
  --bg: #07090c;
  --bg-soft: #0a0e13;
  --panel: #0e131a;
  --panel-2: #121924;
  --panel-3: #17202c;
  --line: #222c3a;
  --line-soft: #1a2230;
  --text: #e9eff8;
  --muted: #8d99ab;
  --muted-2: #69758a;
  --accent: #c9f75a;
  --accent-soft: rgba(201, 247, 90, 0.12);
  --accent-line: rgba(201, 247, 90, 0.38);
  --cyan: #6ee7ff;
  --ok: #51d88a;
  --warn: #ffb454;
  --danger: #ff6b6b;
  --radius: 18px;
  --mono: "JetBrains Mono", "Cascadia Code", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --sans: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

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

body {
  background: radial-gradient(1200px 720px at 82% -12%, rgba(201, 247, 90, 0.065), transparent 60%),
    radial-gradient(900px 600px at 4% 4%, rgba(110, 231, 255, 0.05), transparent 58%),
    var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

.bg-grid {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(255, 255, 255, 0.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.022) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 30%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 30%, transparent 100%);
}

.hidden {
  display: none !important;
}

.mono {
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.muted {
  color: var(--muted);
}

.eyebrow {
  margin: 0 0 6px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  opacity: 0.9;
}

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  letter-spacing: -0.02em;
}

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

button {
  cursor: pointer;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

::selection {
  background: var(--accent);
  color: #0a0d07;
}

/* Scrollbars */
* {
  scrollbar-width: thin;
  scrollbar-color: #2a3647 transparent;
}
*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
*::-webkit-scrollbar-thumb {
  background: #2a3647;
  border-radius: 20px;
  border: 3px solid var(--bg);
}

/* ------------------------------------------------------------------ boot */
.boot {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 18px;
  background: var(--bg);
  color: var(--muted);
  transition: opacity 0.25s ease;
}

.boot.done {
  opacity: 0;
  pointer-events: none;
}

.spinner {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 2px solid #232c39;
  border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}

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

/* ----------------------------------------------------------------- login */
.login {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 28px 20px calc(28px + env(safe-area-inset-bottom));
}

.login-card {
  width: min(430px, 100%);
  padding: 38px 34px 30px;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: linear-gradient(165deg, rgba(20, 27, 38, 0.96), rgba(9, 13, 18, 0.97));
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  position: relative;
  overflow: hidden;
}

.login-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-line), transparent);
}

.brand-mark {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 17px;
  border: 1px solid var(--accent-line);
  background: linear-gradient(160deg, rgba(201, 247, 90, 0.16), rgba(201, 247, 90, 0.03));
  color: var(--accent);
  margin-bottom: 24px;
  box-shadow: 0 0 40px rgba(201, 247, 90, 0.12);
}

.brand-mark svg {
  width: 34px;
  height: 34px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.brand-mark svg circle {
  fill: currentColor;
  stroke: none;
}

.brand-mark.small {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  margin: 0;
  flex: none;
}

.brand-mark.small svg {
  width: 23px;
  height: 23px;
}

.login h1 {
  margin: 0 0 10px;
  font-size: 30px;
  line-height: 1.1;
}

.login-sub {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 26px;
}

.login label {
  display: block;
  margin-bottom: 8px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.password-wrap {
  position: relative;
  margin-bottom: 14px;
}

.password-wrap input {
  width: 100%;
  height: 50px;
  padding: 0 52px 0 16px;
  border-radius: 13px;
  border: 1px solid var(--line);
  background: #0a0f15;
  color: var(--text);
  font-size: 16px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.password-wrap input:focus {
  outline: none;
  border-color: var(--accent-line);
  box-shadow: 0 0 0 3px rgba(201, 247, 90, 0.09);
}

.icon-btn {
  position: absolute;
  right: 7px;
  top: 50%;
  transform: translateY(-50%);
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
}

.icon-btn:hover {
  background: var(--panel-2);
  color: var(--text);
}

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

.login-foot {
  margin: 20px 0 0;
  padding-top: 18px;
  border-top: 1px solid var(--line-soft);
  color: var(--muted-2);
  font-size: 12px;
  line-height: 1.5;
}

.form-error {
  min-height: 20px;
  margin: 12px 0 0;
  color: var(--danger);
  font-size: 13px;
}

/* --------------------------------------------------------------- controls */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 8px 15px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--panel-2);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.btn:hover {
  background: var(--panel-3);
  border-color: #334155;
  text-decoration: none;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #0a0d07;
  font-weight: 650;
}

.btn-primary:hover {
  background: #dcff7f;
  border-color: #dcff7f;
  color: #0a0d07;
}

.btn-ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--muted);
}

.btn-ghost:hover {
  color: var(--text);
  background: var(--panel-2);
}

.btn-danger {
  color: var(--danger);
  border-color: rgba(255, 107, 107, 0.3);
  background: rgba(255, 107, 107, 0.07);
}

.btn-danger:hover {
  background: rgba(255, 107, 107, 0.14);
  border-color: rgba(255, 107, 107, 0.5);
}

.btn-block {
  width: 100%;
  min-height: 48px;
  font-size: 15px;
}

.btn-icon {
  width: 38px;
  padding: 0;
}

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

.btn-sm {
  min-height: 30px;
  padding: 4px 10px;
  font-size: 12px;
  border-radius: 8px;
}

/* ---------------------------------------------------------------- topbar */
.shell {
  position: relative;
  z-index: 1;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(7, 9, 12, 0.78);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
}

.topbar-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-text h1 {
  margin: 0;
  font-size: 17px;
  line-height: 1.2;
  white-space: nowrap;
}

.brand-text .eyebrow {
  margin-bottom: 2px;
  font-size: 9.5px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sync {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  height: 34px;
  border: 1px solid var(--line-soft);
  border-radius: 9px;
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.sync .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted-2);
  flex: none;
}

.sync[data-state="ok"] .dot {
  background: var(--ok);
  box-shadow: 0 0 10px rgba(81, 216, 138, 0.7);
}

.sync[data-state="busy"] .dot {
  background: var(--warn);
  animation: pulse 1s infinite;
}

.sync[data-state="error"] .dot {
  background: var(--danger);
}

@keyframes pulse {
  50% {
    opacity: 0.3;
  }
}

/* ------------------------------------------------------------------ wrap */
.wrap {
  max-width: 1240px;
  margin: 0 auto;
  padding: 34px 24px 56px;
}

.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 26px;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  flex: none;
}

.hero h2 {
  margin: 0 0 8px;
  font-size: clamp(25px, 3.6vw, 36px);
  line-height: 1.12;
}

.hero p.muted {
  margin: 0;
  max-width: 720px;
  font-size: 14px;
}

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

.stat {
  position: relative;
  padding: 16px 18px;
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  background: linear-gradient(160deg, rgba(18, 25, 36, 0.75), rgba(10, 14, 19, 0.6));
  overflow: hidden;
}

.stat::after {
  content: "";
  position: absolute;
  left: 0;
  top: 16px;
  bottom: 16px;
  width: 2px;
  border-radius: 2px;
  background: var(--accent);
  opacity: 0.55;
}

.stat-label {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--muted-2);
  margin-bottom: 6px;
}

.stat-num {
  font-size: 29px;
  font-weight: 650;
  line-height: 1;
  letter-spacing: -0.03em;
}

.stat-sub {
  margin-top: 6px;
  font-size: 11.5px;
  color: var(--muted-2);
}

/* --------------------------------------------------------------- toolbar */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}

.search-wrap {
  position: relative;
  flex: 1 1 280px;
  max-width: 420px;
}

.search-wrap svg {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  width: 17px;
  height: 17px;
  fill: none;
  stroke: var(--muted-2);
  stroke-width: 1.8;
  stroke-linecap: round;
}

.search-wrap input {
  width: 100%;
  height: 40px;
  padding: 0 14px 0 39px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--panel);
  color: var(--text);
  font-size: 13.5px;
}

.search-wrap input::placeholder {
  color: var(--muted-2);
}

.search-wrap input:focus {
  outline: none;
  border-color: var(--accent-line);
  box-shadow: 0 0 0 3px rgba(201, 247, 90, 0.07);
}

.chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  transition: all 0.15s ease;
}

.chip:hover {
  color: var(--text);
  border-color: #334155;
}

.chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #0a0d07;
  font-weight: 600;
}

.chip .n {
  font-family: var(--mono);
  font-size: 10px;
  opacity: 0.7;
}

.select {
  height: 40px;  padding: 0 34px 0 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--panel)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238d99ab' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E")
    no-repeat right 10px center / 16px;
  color: var(--text);
  font-size: 13px;
  appearance: none;
  cursor: pointer;
}

#btn-check {
  height: 40px;
}

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

/* ----------------------------------------------------------------- cards */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 14px;
}

.groups {
  display: block;
}

.group {
  margin-bottom: 28px;
}

.group:last-child {
  margin-bottom: 0;
}

.group-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 11px;
}

.group-head h3 {
  margin: 0;
  font-size: 16px;
  letter-spacing: -0.01em;
}

.group-count {
  flex: none;
  padding: 2px 8px;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  color: var(--muted-2);
  font-size: 9px;
  letter-spacing: 0.08em;
}

.group-line {
  flex: 1;
  height: 1px;
  background: var(--line-soft);
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 274px;
  padding: 19px 19px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(165deg, rgba(19, 26, 37, 0.82), rgba(10, 14, 20, 0.92));
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(201, 247, 90, 0.55), transparent);
  opacity: 0;
  transition: opacity 0.18s ease;
}

.card:hover {
  border-color: rgba(201, 247, 90, 0.34);
  transform: translateY(-2px);
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.34);
}

.card:hover::before {
  opacity: 1;
}

.card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.cat {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--muted-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pill {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 9px;
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border: 1px solid transparent;
}

.pill::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

.pill.live {
  color: var(--ok);
  background: rgba(81, 216, 138, 0.09);
  border-color: rgba(81, 216, 138, 0.25);
}

.pill.dev {
  color: var(--warn);
  background: rgba(255, 180, 84, 0.09);
  border-color: rgba(255, 180, 84, 0.24);
}

.pill.paused {
  color: var(--muted);
  background: rgba(141, 153, 171, 0.08);
  border-color: rgba(141, 153, 171, 0.2);
}

.pill.archived {
  color: var(--muted-2);
  background: rgba(105, 117, 138, 0.08);
  border-color: rgba(105, 117, 138, 0.18);
}

.card h3 {
  margin: 0 0 7px;
  font-size: 19px;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.tagline {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.health-line {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 13px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-2);
}

.health-line .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted-2);
  flex: none;
}

.health-line.ok .dot {
  background: var(--ok);
  box-shadow: 0 0 8px rgba(81, 216, 138, 0.6);
}

.health-line.warn .dot {
  background: var(--warn);
}

.health-line.down {
  color: rgba(255, 107, 107, 0.85);
}

.health-line.down .dot {
  background: var(--danger);
}

.ready {
  margin-top: auto;
  margin-bottom: 14px;
}

.ready-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 7px;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted-2);
}

.ready-row b {
  font-size: 12px;
  letter-spacing: 0;
  color: var(--text);
}

.track {
  height: 5px;
  border-radius: 99px;
  background: #1b2330;
  overflow: hidden;
}

.bar {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #93c93a, var(--accent));
  transition: width 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.bar.warn {
  background: linear-gradient(90deg, #d89032, var(--warn));
}

.bar.low {
  background: linear-gradient(90deg, #c24b4b, var(--danger));
}

.chips.stack {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 14px;
}

.chip-tag {
  display: inline-block;
  padding: 3px 8px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.018);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.chip-tag.more {
  color: var(--muted-2);
}

.card-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 10px;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
  font-size: 11.5px;
  color: var(--muted-2);
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex: none;
  margin-left: auto;
}

.card-copy {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 24px;
  padding: 0 7px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: transparent;
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.card-copy svg {
  width: 11px;
  height: 11px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.card-copy:hover {
  color: var(--accent);
  border-color: var(--accent-line);
  background: var(--accent-soft);
}

.card-code:hover {
  color: var(--cyan);
  border-color: rgba(110, 231, 255, 0.35);
  background: rgba(110, 231, 255, 0.08);
}

.cred-count {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.cred-count svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
}

.open-hint {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted-2);
  transition: color 0.15s ease;
}

.card:hover .open-hint {
  color: var(--accent);
}

.empty {
  padding: 56px 20px;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

.empty .mono {
  color: var(--muted);
  font-size: 12px;
}

/* -------------------------------------------------------------- accounts */
.accounts-section {
  margin-top: 44px;
  padding-top: 28px;
  border-top: 1px solid var(--line-soft);
}

.section-head {
  margin-bottom: 16px;
}

.section-head h3 {
  margin: 0;
  font-size: 20px;
}

.accounts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
}

.account {
  padding: 15px 16px;
  border: 1px solid var(--line-soft);
  border-radius: 13px;
  background: rgba(14, 19, 26, 0.66);
}

.account-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.account h4 {
  margin: 0;
  font-size: 13.5px;
}

.account-login {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--accent);
  word-break: break-word;
  margin-bottom: 6px;
}

.account-note {
  margin: 0;
  color: var(--muted-2);
  font-size: 11.5px;
  line-height: 1.45;
}

.copy-link {
  border: 0;
  background: transparent;
  color: var(--muted-2);
  padding: 2px;
  display: inline-grid;
  place-items: center;
  border-radius: 5px;
}

.copy-link:hover {
  color: var(--accent);
  background: var(--panel-2);
}

.copy-link svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
}

/* ------------------------------------------------------------------ foot */
.foot {
  max-width: 1240px;
  margin: 0 auto;
  padding: 22px 24px 48px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  border-top: 1px solid var(--line-soft);
  color: var(--muted-2);
  font-size: 11.5px;
}

.foot .mono {
  color: var(--muted-2);
  font-size: 9.5px;
}

/* ---------------------------------------------------------------- drawer */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(2, 4, 7, 0.66);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: fade 0.18s ease;
}

@keyframes fade {
  from {
    opacity: 0;
  }
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 60;
  width: min(760px, 100vw);
  height: 100dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: #0a0e14;
  border-left: 1px solid var(--line);
  box-shadow: -30px 0 90px rgba(0, 0, 0, 0.5);
  animation: slideIn 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes slideIn {
  from {
    transform: translateX(30px);
    opacity: 0.4;
  }
}

.drawer-head {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 18px 24px 16px;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(10, 14, 20, 0.93);
  backdrop-filter: blur(12px);
}

.drawer-head-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.drawer-head .cat {
  font-size: 10px;
}

.drawer-title {
  margin: 0 0 6px;
  font-size: 26px;
  line-height: 1.15;
}

.drawer-tagline {
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
}

.drawer-close {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  display: grid;
  place-items: center;
  font-size: 19px;
  line-height: 1;
  flex: none;
}

.drawer-close:hover {
  background: var(--panel-2);
  color: var(--text);
}

.drawer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 14px;
}

.drawer-body {
  padding: 22px 24px calc(36px + env(safe-area-inset-bottom));
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
  margin-bottom: 24px;
}

.meta {
  padding: 12px 13px;
  border: 1px solid var(--line-soft);
  border-radius: 11px;
  background: rgba(18, 25, 36, 0.5);
}

.meta-label {
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--muted-2);
  margin-bottom: 4px;
}

.meta-value {
  font-size: 12.5px;
  word-break: break-word;
}

.meta-value.big {
  font-size: 21px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.meta-sub {
  margin-top: 4px;
  font-size: 10.5px;
  color: var(--muted-2);
}

.notice {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 11px 13px;
  margin: 0 0 20px;
  border: 1px solid var(--accent-line);
  border-radius: 11px;
  background: var(--accent-soft);
  font-size: 12.5px;
}

.notice.down {
  border-color: rgba(255, 107, 107, 0.3);
  background: rgba(255, 107, 107, 0.06);
}

.notice-text {
  flex: 1;
  min-width: 200px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.notice-text strong {
  font-weight: 600;
}

.notice-text span {
  color: var(--muted);
}

.notice .btn {
  margin-left: auto;
}

.section {
  margin-bottom: 26px;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 11px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.section-title::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--line-soft);
}

.prose {
  margin: 0;
  color: #c3cedd;
  font-size: 13.5px;
  line-height: 1.6;
}

.ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 6px;
}

.ul li {
  position: relative;
  padding-left: 16px;
  color: #c3cedd;
  font-size: 13px;
  line-height: 1.45;
}

.ul li::before {
  content: "";
  position: absolute;
  left: 1px;
  top: 8px;
  width: 5px;
  height: 5px;
  border-radius: 1px;
  background: var(--accent);
  opacity: 0.65;
  transform: rotate(45deg);
}

.cred {
  padding: 13px 14px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: rgba(16, 22, 31, 0.62);
  margin-bottom: 8px;
}

.cred-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.cred-label {
  font-size: 12.5px;
  font-weight: 600;
}

.cred-line {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 24px;
  font-size: 12.5px;
}

.cred-line .k {
  width: 70px;
  flex: none;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted-2);
}

.cred-line .v {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text);
  word-break: break-all;
}

.cred-line .v.secret {
  letter-spacing: 0.12em;
  color: var(--accent);
}

.cred-actions {
  display: flex;
  gap: 4px;
  flex: none;
}

.cred-note {
  margin: 8px 0 0;
  padding-top: 8px;
  border-top: 1px dashed var(--line-soft);
  color: var(--muted-2);
  font-size: 11.5px;
}

.env-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.18);
  margin-bottom: 5px;
}

.env-key {
  flex: 0 0 190px;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--cyan);
  word-break: break-all;
}

.env-val {
  flex: 1;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  word-break: break-all;
}

.note-box {
  padding: 13px 14px;
  border-left: 2px solid var(--accent-line);
  border-radius: 0 10px 10px 0;
  background: rgba(201, 247, 90, 0.045);
  color: #c3cedd;
  font-size: 12.5px;
  line-height: 1.55;
}

/* ----------------------------------------------------------------- modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(3, 5, 8, 0.74);
  backdrop-filter: blur(5px);
  overflow-y: auto;
}

.modal-card {
  width: min(920px, 100%);
  max-height: calc(100dvh - 44px);
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #0c1118;
  box-shadow: 0 40px 120px rgba(0, 0, 0, 0.6);
  animation: modalIn 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes modalIn {
  from {
    transform: translateY(12px) scale(0.99);
    opacity: 0.5;
  }
}

.modal-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(12, 17, 24, 0.96);
  backdrop-filter: blur(10px);
}

.modal-head h3 {
  margin: 0;
  font-size: 19px;
}

.modal-body {
  padding: 20px 22px;
}

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

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

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

.field label {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted-2);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 38px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #0a0f15;
  color: var(--text);
  font-size: 13px;
  resize: vertical;
}

.field textarea {
  min-height: 74px;
  line-height: 1.45;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent-line);
  box-shadow: 0 0 0 3px rgba(201, 247, 90, 0.06);
}

.field .hint {
  color: var(--muted-2);
  font-size: 10.5px;
}

.subhead {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 10px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--line-soft);
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.row-edit {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1.1fr 1fr 1.3fr 1.3fr auto;
  gap: 6px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.14);
}

.row-edit.env-edit {
  grid-template-columns: 1fr 1.6fr auto;
}

.row-edit input {
  min-height: 34px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #0a0f15;
  color: var(--text);
  font-size: 11.5px;
  min-width: 0;
}

.row-edit input:focus {
  outline: none;
  border-color: var(--accent-line);
}

.row-del {
  width: 32px;
  height: 32px;
  border: 1px solid rgba(255, 107, 107, 0.25);
  border-radius: 7px;
  background: rgba(255, 107, 107, 0.07);
  color: var(--danger);
  display: grid;
  place-items: center;
  font-size: 16px;
  line-height: 1;
}

.modal-foot {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 22px calc(14px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line-soft);
  background: rgba(12, 17, 24, 0.97);
  backdrop-filter: blur(10px);
}

.modal-foot .right {
  display: flex;
  gap: 8px;
}

/* ----------------------------------------------------------------- toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  z-index: 120;
  transform: translate(-50%, 16px);
  max-width: min(520px, calc(100vw - 32px));
  padding: 11px 18px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #141c27;
  color: var(--text);
  font-size: 13px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast.error {
  border-color: rgba(255, 107, 107, 0.4);
}

/* ------------------------------------------------------------ responsive */
@media (max-width: 960px) {
  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .meta-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .topbar-inner {
    padding: 10px 16px;
    gap: 10px;
  }

  .brand-text h1 {
    font-size: 15px;
  }

  .brand-text .eyebrow,
  .sync {
    display: none;
  }

  .top-actions {
    gap: 5px;
  }

  .top-actions .btn:not(.btn-icon) {
    min-height: 34px;
    padding: 6px 10px;
    font-size: 12px;
  }

  .top-actions .btn-text {
    display: none;
  }

  #btn-export,
  #btn-lock {
    width: 34px;
    padding: 0;
  }

  .wrap {
    padding: 22px 16px 40px;
  }

  .hero {
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
  }

  .hero h2 {
    font-size: 26px;
  }

  .hero .btn {
    width: 100%;
  }

  .hero-actions {
    width: 100%;
  }

  .hero-actions .btn {
    flex: 1 1 180px;
  }

  .toolbar {
    gap: 8px;
  }

  .search-wrap {
    flex-basis: 100%;
    max-width: none;
  }

  .select {
    margin-left: auto;
  }

  .grid {
    grid-template-columns: 1fr;
  }

  .card {
    min-height: 0;
  }

  .drawer-head,
  .drawer-body {
    padding-left: 17px;
    padding-right: 17px;
  }

  .drawer-title {
    font-size: 22px;
  }

  .meta-grid {
    grid-template-columns: 1fr 1fr;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .row-edit {
    grid-template-columns: 1fr 1fr;
  }

  .row-edit input:nth-child(1),
  .row-edit input:nth-child(4),
  .row-edit input:nth-child(5) {
    grid-column: 1 / -1;
  }

  .row-edit.env-edit {
    grid-template-columns: 1fr auto;
  }

  .row-edit.env-edit input:first-child {
    grid-column: 1 / -1;
  }

  .row-edit.env-edit input:nth-child(2) {
    grid-column: 1;
  }

  .modal {
    padding: 0;
  }

  .modal-card {
    max-height: 100dvh;
    height: 100dvh;
    border-radius: 0;
    border: 0;
  }

  .modal-head,
  .modal-body,
  .modal-foot {
    padding-left: 16px;
    padding-right: 16px;
  }

  .env-row {
    flex-wrap: wrap;
    gap: 4px;
  }

  .env-key {
    flex-basis: 100%;
  }

  .cred-line .k {
    width: 58px;
  }

  .foot {
    padding: 18px 16px 84px;
    flex-direction: column;
  }
}

@media (max-width: 430px) {
  .stats {
    gap: 8px;
  }

  .stat {
    padding: 13px 14px;
  }

  .stat-num {
    font-size: 24px;
  }

  .meta-grid {
    grid-template-columns: 1fr;
  }

  .chips {
    width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 2px;
  }

  .chip {
    flex: none;
  }

  .select {
    width: 100%;
    margin-left: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
