/* Zimac proxy admin console — self-contained styles (no shared UI-kit dep, so
   the proxy stays a standalone crate). Dark, calm, the Zimac family look: the
   token values mirror the app.zimac.ai landing page (the brand gold standard),
   so keep them in lockstep with services/landing/public/index.html. */

:root {
  --bg: #0b0d14;
  --bg-2: #0f1117;
  --panel: #1a1d27;
  --panel-2: #232733;
  --border: #2a2e3a;
  --text: #e4e4e7;
  --muted: #8b8d98;
  --faint: #5e616d;
  --accent: #6c63ff;
  --accent-2: #c084fc;
  --pink: #f472b6;
  --good: #34d399;
  --bad: #f87171;
  --grad: linear-gradient(150deg, #6c63ff, #7d76ff 60%, #f472b6);
  --radius: 14px;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

/* The UI toggles visibility via the `hidden` attribute (e.g. `#login`,
   `#workspace`). The UA's `[hidden]{display:none}` has the same specificity as a
   class selector, so a later author rule like `.login{display:flex}` would
   override it and leave the element visible. Make `hidden` authoritative. */
[hidden] {
  display: none !important;
}

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

body {
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(108, 99, 255, 0.14) 0%, transparent 55%),
    radial-gradient(900px 500px at 8% 4%, rgba(244, 114, 182, 0.08) 0%, transparent 60%),
    var(--bg);
  color: var(--text);
  font: 14px/1.5 "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.gradient,
.gradient-text {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---- Sidebar ---- */
.sidebar {
  border-right: 1px solid var(--border);
  background: linear-gradient(180deg, var(--bg-2), var(--bg));
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

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

/* The ❖ mark in a rounded gradient box — same treatment as the landing page. */
.brand-mark {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: linear-gradient(150deg, rgba(108, 99, 255, 0.9), rgba(244, 114, 182, 0.85));
  color: #fff;
  font-size: 17px;
  line-height: 1;
  box-shadow: 0 0 22px rgba(108, 99, 255, 0.5);
}

.brand-name {
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.2px;
}

.brand-sub {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1.4px;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  padding: 9px 12px;
  border-radius: 10px;
  color: var(--muted);
  font-weight: 500;
  background: none;
  border: 1px solid transparent;
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.nav-item:hover {
  color: var(--text);
  background: var(--panel-2);
}

.nav-item.active {
  color: var(--text);
  background: var(--panel);
  border-color: var(--border);
}

.who {
  margin-top: auto;
  color: var(--faint);
  font-size: 12px;
  word-break: break-all;
}

/* ---- Main ---- */
.main {
  padding: 26px 30px 60px;
  max-width: 1100px;
}

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

.topbar h1 {
  font-size: 22px;
  margin: 0;
}

.workspace,
.view {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ---- Overview / Usage widgets ---- */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
}

.stat {
  background: linear-gradient(180deg, var(--panel), var(--bg-2));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
}

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

.stat-label {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.quickstart {
  margin: 0;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  color: var(--muted);
}

.quickstart b {
  color: var(--text);
}

.inline-link {
  color: var(--accent-2);
  text-decoration: none;
  border-bottom: 1px solid rgba(192, 132, 252, 0.4);
}

.kv {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 8px 22px;
  margin: 0;
  font-size: 13px;
}

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

.kv dd {
  margin: 0;
}

.kv .ok {
  color: var(--good);
  font-weight: 600;
}

.kv .off {
  color: var(--faint);
  font-weight: 600;
}

.chip {
  display: inline-block;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  color: var(--muted);
  margin: 2px 6px 2px 0;
}

.bar {
  height: 6px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--border);
  overflow: hidden;
  margin: 4px 0 12px;
}

.bar-fill {
  height: 100%;
  background: var(--grad);
}

.usage-card .grid td,
.usage-card .grid th {
  white-space: normal;
}

/* ---- Edit modal ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(4, 6, 10, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal-card {
  max-width: 560px;
  width: 100%;
}

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

/* ---- Cards ---- */
.card {
  background: linear-gradient(180deg, var(--panel), var(--bg-2));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.card h2 {
  margin: 0 0 14px;
  font-size: 15px;
  font-weight: 600;
}

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

.card-head h2 {
  margin: 0;
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 14px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  flex: 1 1 160px;
}

input {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.18);
}

.org-row {
  align-items: flex-end;
}

.org-row .btn {
  flex: 0 0 auto;
  height: 40px;
}

.hint {
  color: var(--faint);
  font-size: 12px;
  margin: 8px 0 0;
}

/* ---- Buttons ---- */
.btn {
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  background: var(--grad);
  box-shadow: 0 8px 30px rgba(108, 99, 255, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  cursor: pointer;
  transition: filter 0.15s, transform 0.05s;
}

.btn:hover {
  filter: brightness(1.08);
}

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

.btn.ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
  box-shadow: none;
}

.btn.ghost:hover {
  background: var(--panel-2);
  filter: none;
}

.btn.link {
  background: none;
  border: none;
  color: var(--accent);
  padding: 4px 8px;
  font-weight: 600;
}

.btn.link.danger {
  color: var(--bad);
}

.btn.lg {
  padding: 13px 22px;
  font-size: 15px;
}

/* ---- Reveal ---- */
.reveal {
  border-color: #2f3b2c;
  background: linear-gradient(180deg, #16201a, var(--bg-2));
}

.secret {
  display: block;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  word-break: break-all;
  color: var(--good);
  margin-bottom: 12px;
}

.reveal-actions {
  display: flex;
  gap: 10px;
}

/* ---- Table ---- */
.table-wrap {
  overflow-x: auto;
}

.grid {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.grid th {
  text-align: left;
  color: var(--muted);
  font-weight: 500;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.grid td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.grid tr:last-child td {
  border-bottom: none;
}

.grid code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--muted);
}

.grid .sub {
  color: var(--faint);
  font-size: 11px;
  margin-left: 6px;
}

.actions {
  display: flex;
  gap: 4px;
}

.pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.pill.active {
  color: var(--good);
  background: rgba(52, 211, 153, 0.12);
  border: 1px solid rgba(52, 211, 153, 0.3);
}

.pill.revoked {
  color: var(--bad);
  background: rgba(248, 113, 113, 0.12);
  border: 1px solid rgba(248, 113, 113, 0.3);
}

/* ---- Toast ---- */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  padding: 12px 16px;
  border-radius: 10px;
  box-shadow: var(--shadow);
  max-width: 360px;
}

.toast.err {
  border-left-color: var(--bad);
}

/* ---- Login overlay ---- */
.login {
  position: fixed;
  inset: 0;
  z-index: 50;
  background:
    radial-gradient(900px 500px at 70% -10%, rgba(108, 99, 255, 0.16) 0%, transparent 60%),
    radial-gradient(700px 460px at 12% 100%, rgba(244, 114, 182, 0.08) 0%, transparent 60%),
    var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 24px;
}

.login-card {
  max-width: 460px;
  width: 100%;
  text-align: left;
  padding: 32px;
}

.login-brand {
  margin-bottom: 22px;
}

.login-title {
  font-size: 26px;
  line-height: 1.25;
  margin: 0 0 12px;
}

.login-lede {
  color: var(--muted);
  margin: 0 0 24px;
}

.login-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.login-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--faint);
  font-size: 12px;
  margin-top: 18px;
}

.login-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--good);
  box-shadow: 0 0 8px var(--good);
}

.login-legal {
  color: var(--faint);
  font-size: 12px;
}

@media (max-width: 760px) {
  body {
    grid-template-columns: 1fr;
  }
  .sidebar {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
  .nav,
  .who {
    display: none;
  }
}
