:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --line: #e2e8f0;
  --line-2: #f1f5f9;
  --text: #0f172a;
  --muted: #64748b;
  --accent: #0f172a;
  --brand: #2563eb;
  --danger: #e11d48;
  --ok: #059669;
  --ok-bg: #ecfdf5;
  --danger-bg: #fff1f2;
  --chat: #4f46e5;
  --storage: #0d9488;
  --shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
  --radius: 14px;
  --font: "Plus Jakarta Sans", "Segoe UI", sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }
.hidden { display: none !important; }

.login-page {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.12), transparent 40%),
    radial-gradient(circle at bottom right, rgba(13, 148, 136, 0.1), transparent 36%),
    #f1f5f9;
}
.login-card {
  width: min(420px, 100%);
  background: var(--panel);
  border-radius: 20px;
  padding: 28px;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
}
.mark {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.03em;
  text-decoration: none;
}
.mark-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--brand), var(--storage));
}
.login-card h1 {
  margin: 16px 0 6px;
  font-size: 26px;
  letter-spacing: -0.04em;
}
.login-card p.lead {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 14px;
}

label.field, .field {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}
.field span, .lbl {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  border-radius: 10px;
  padding: 10px 12px;
  outline: none;
  font-size: 14px;
  min-height: 42px;
}
input:focus, select:focus, textarea:focus {
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 0;
  border-radius: 10px;
  min-height: 40px;
  padding: 0 14px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
a.btn { text-decoration: none; }
.btn.block { width: 100%; }
.btn.ghost {
  background: #fff;
  color: #334155;
  border: 1px solid var(--line);
}
.btn.danger { background: var(--danger); color: #fff; }
.btn.small { min-height: 32px; padding: 0 10px; font-size: 12px; }
.error {
  margin-top: 10px;
  color: var(--danger);
  font-size: 13px;
}
.alert {
  margin: 12px 0 0;
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 13px;
}
.alert.ok { background: var(--ok-bg); color: #047857; }
.alert.err { background: var(--danger-bg); color: #be123c; }
.alert.warn { background: #fffbeb; color: #b45309; }

.app {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  background: var(--bg);
}
.topbar {
  display: flex;
  align-items: center;
  gap: 28px;
  height: 64px;
  padding: 0 28px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.topbar .mark { color: var(--text); }
.topbar nav {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
}
.topbar nav::-webkit-scrollbar { display: none; }
.topbar nav a {
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0 14px;
  border-radius: 9px;
  text-decoration: none;
  color: #475569;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
}
.topbar nav a:hover { background: #f1f5f9; color: var(--text); }
.topbar nav a.active {
  background: var(--accent);
  color: #fff;
}
.topbar-end {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  margin-left: auto;
}
.badge.soon { background: #fffbeb; color: #b45309; }
.svc-card.soon { opacity: 0.92; }
.split-3 {
  margin-top: 18px;
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr 1fr 1fr;
}
.split-3 .panel { margin-top: 0; }
.topbar-email {
  font-size: 13px;
  color: var(--muted);
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.topbar .out {
  background: none;
  border: 0;
  color: #64748b;
  padding: 0 10px;
  height: 36px;
  font-size: 13px;
  border-radius: 8px;
}
.topbar .out:hover { color: var(--text); background: #f1f5f9; }
.content {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 28px 24px 48px;
}
.page-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-end;
}
.page-head h1 {
  margin: 0;
  font-size: 28px;
  letter-spacing: -0.04em;
}
.page-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
  max-width: 46rem;
}

.cards {
  margin-top: 20px;
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.card-link, .panel, .svc-card, .project-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-link {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-decoration: none;
  padding: 18px 18px 16px;
}
.card-link:hover { border-color: #bfdbfe; }
.card-link .k { color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.card-link .v {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.04em;
}
.panel { margin-top: 18px; overflow: hidden; }
.panel-pad { padding: 16px 18px; }
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line-2);
}
.panel-head h2, .panel-head strong {
  margin: 0;
  font-size: 16px;
}
.split {
  margin-top: 18px;
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr 1fr;
}
.split .panel { margin-top: 0; }
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line-2);
}
.toolbar .field { margin: 0; min-width: 140px; flex: 1; }
.table-wrap { overflow-x: auto; }
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table.data th, table.data td {
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line-2);
  vertical-align: middle;
}
table.data th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #94a3b8;
  font-weight: 600;
}
table.data tr:last-child td { border-bottom: 0; }
.mono { font-family: var(--mono); font-size: 12px; color: #475569; }
.muted { color: var(--muted); font-size: 13px; }
.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0 8px;
  height: 22px;
  font-size: 11px;
  font-weight: 600;
  background: #f1f5f9;
  color: #334155;
}
.badge.open, .badge.enabled { background: var(--ok-bg); color: #047857; }
.badge.closed, .badge.disabled { background: #f1f5f9; color: #64748b; }
.badge.chat { background: #eef2ff; color: #4338ca; }
.badge.storage { background: #f0fdfa; color: #0f766e; }
.empty {
  padding: 36px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}
.empty b { display: block; color: var(--text); margin-bottom: 4px; font-size: 16px; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; }
.code {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  font-family: var(--mono);
  font-size: 12px;
  color: #475569;
  white-space: pre-wrap;
  word-break: break-word;
}

.svc-grid {
  margin-top: 20px;
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr 1fr 1fr;
}
.svc-card { padding: 20px; }
.svc-card .eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.svc-card h2 {
  margin: 6px 0 8px;
  font-size: 20px;
  letter-spacing: -0.03em;
}
.svc-card p { margin: 0; color: var(--muted); }
.svc-card .meta {
  margin-top: 16px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.project-grid {
  margin-top: 18px;
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.project-card {
  display: block;
  padding: 18px;
  text-decoration: none;
}
.project-card:hover { border-color: #bfdbfe; }
.project-card h3 {
  margin: 0 0 4px;
  font-size: 18px;
  letter-spacing: -0.03em;
}
.project-card .chips {
  margin-top: 14px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.key-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
}
.key-row code {
  font-family: var(--mono);
  font-size: 12px;
  color: #334155;
}

.crumb {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  font-size: 13px;
  color: var(--muted);
}
.crumb a {
  color: var(--muted);
  text-decoration: none;
}
.crumb a:hover { color: var(--text); }
.crumb span:last-child { color: var(--text); font-weight: 500; }

.project-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 8px;
}
.project-hero h1 {
  margin: 0;
  font-size: 30px;
  letter-spacing: -0.045em;
  line-height: 1.15;
}
.project-hero-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}
.project-hero-meta code {
  font-size: 13px;
  color: #475569;
}
.badge.prod { background: #ecfdf5; color: #047857; }
.badge.nonprod { background: #f1f5f9; color: #475569; }

.project-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
  min-width: min(420px, 100%);
}
.project-meta .field {
  margin: 0;
  min-width: 140px;
  flex: 1;
}

.list-panel {
  margin-top: 20px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.list-panel-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line-2);
}
.list-panel-head strong {
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #64748b;
}

.svc-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line-2);
}
.svc-row:last-child { border-bottom: 0; }
.svc-row.soon { opacity: 0.72; }
.svc-row-main { min-width: 0; flex: 1; }
.svc-row-title {
  display: flex;
  align-items: center;
  gap: 8px;
}
.svc-row-title strong {
  font-size: 15px;
  letter-spacing: -0.02em;
}
.svc-row-desc {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}
.svc-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.key-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}
.key-line code {
  font-family: var(--mono);
  font-size: 12px;
  color: #334155;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 10px;
}

.endpoint-block {
  padding: 14px 18px 16px;
  border-bottom: 1px solid var(--line-2);
}
.endpoint-block:last-child { border-bottom: 0; }
.endpoint-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}
.endpoint-block .code {
  margin: 0;
}

@media (max-width: 960px) {
  .cards, .split, .split-3, .svc-grid, .project-grid { grid-template-columns: 1fr; }
  .topbar { gap: 16px; padding: 0 16px; }
  .topbar-email { display: none; }
  .project-hero { align-items: stretch; }
  .project-meta { width: 100%; }
}
@media (max-width: 640px) {
  .content { padding: 16px 14px 32px; }
  .page-head h1, .project-hero h1 { font-size: 22px; }
  input, select, textarea { font-size: 16px; }
  .svc-row { flex-direction: column; }
}
