/* Paladio UCP Control Center — design tokens */

:root {
  /* Surfaces */
  --bg: #f7f7f5;
  --surface: #ffffff;
  --surface-2: #fafaf9;
  --surface-sunken: #f4f4f2;
  --sidebar: #0f1115;
  --sidebar-2: #16181d;
  --sidebar-hover: #1f222a;
  --sidebar-text: #c9ccd3;
  --sidebar-text-dim: #7a7e88;
  --sidebar-border: #22252d;

  /* Lines */
  --border: #e7e5e2;
  --border-strong: #d6d3ce;
  --border-soft: #efedea;

  /* Text */
  --ink: #0b0c0e;
  --ink-2: #2a2b2f;
  --muted: #57534e;
  --muted-2: #78716c;
  --faint: #a8a29e;

  /* Accents */
  --accent: #2563eb;
  --accent-600: #1d4ed8;
  --accent-700: #1e40af;
  --accent-50: #eef4ff;
  --accent-100: #dbe7ff;
  --accent-ink: #1e3a8a;

  /* Status */
  --ok: #15803d;
  --ok-bg: #e8f5ec;
  --warn: #b45309;
  --warn-bg: #fdf3e3;
  --bad: #b91c1c;
  --bad-bg: #fbe9e7;
  --info: #1e6fbb;
  --info-bg: #e6f0fb;
  --neutral-bg: #ececea;

  /* Radii */
  --r-1: 4px;
  --r-2: 6px;
  --r-3: 8px;
  --r-4: 10px;

  /* Shadows */
  --shadow-1: 0 1px 0 rgba(15, 17, 21, 0.04), 0 1px 2px rgba(15, 17, 21, 0.04);
  --shadow-2: 0 4px 16px -6px rgba(15, 17, 21, 0.10), 0 2px 4px rgba(15, 17, 21, 0.04);
  --shadow-pop: 0 12px 32px -12px rgba(15, 17, 21, 0.20), 0 4px 12px -4px rgba(15, 17, 21, 0.08);

  /* Type */
  --font-ui: "Geist", "Söhne", "Inter", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "Geist Mono", "JetBrains Mono", "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }
html, body, #root { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-ui);
  font-feature-settings: "ss01", "cv11", "cv02";
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button { font: inherit; color: inherit; cursor: pointer; background: none; border: 0; padding: 0; }
input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }

/* Scrollbars */
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: #d6d3ce; border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-thumb:hover { background: #a8a29e; background-clip: padding-box; border: 2px solid transparent; }

/* ------ Shell ------ */
.shell { display: grid; grid-template-columns: 228px 1fr; height: 100vh; overflow: hidden; }

.sidebar {
  background: var(--sidebar);
  color: var(--sidebar-text);
  display: flex; flex-direction: column;
  border-right: 1px solid var(--sidebar-border);
}
.sidebar .brand {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 16px 14px;
  border-bottom: 1px solid var(--sidebar-border);
}
.sidebar .brand-mark {
  width: 26px; height: 26px; border-radius: 6px;
  background: linear-gradient(135deg, #2563eb 0%, #60a5fa 100%);
  display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 13px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.18);
}
.sidebar .brand-name { font-weight: 600; font-size: 14px; color: #fff; letter-spacing: -0.01em; white-space: nowrap; }
.sidebar .brand-sub { font-size: 11px; color: var(--sidebar-text-dim); margin-top: 1px; white-space: nowrap; }

.tenant {
  margin: 12px 10px 6px;
  border: 1px solid var(--sidebar-border);
  border-radius: 8px;
  padding: 8px 10px;
  display: flex; align-items: center; gap: 9px;
  background: var(--sidebar-2);
  cursor: pointer;
}
.tenant:hover { background: var(--sidebar-hover); }
.tenant .logo {
  width: 24px; height: 24px; border-radius: 5px;
  background: #2a2017; color: #d4a26b;
  display: grid; place-items: center; font-weight: 700; font-size: 11px;
  letter-spacing: 0.04em;
}
.tenant .label { font-size: 13px; color: #fff; font-weight: 500; white-space: nowrap; }
.tenant .sub { font-size: 10.5px; color: var(--sidebar-text-dim); margin-top: 1px; letter-spacing: 0.02em; white-space: nowrap; }
.tenant .switcher { margin-left: auto; color: var(--sidebar-text-dim); }

.nav { padding: 8px 8px; flex: 1; overflow: auto; }
.nav-group { margin-bottom: 10px; }
.nav-label {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--sidebar-text-dim); padding: 8px 10px 4px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px; border-radius: 6px;
  font-size: 13px; color: var(--sidebar-text);
  margin: 1px 0;
  cursor: pointer;
}
.nav-item:hover { background: var(--sidebar-hover); color: #fff; }
.nav-item.active { background: var(--sidebar-hover); color: #fff; box-shadow: inset 2px 0 0 var(--accent); }
.nav-item .ico { width: 16px; height: 16px; flex-shrink: 0; opacity: 0.9; }
.nav-item > span:not(.badge):not(.ico) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.nav-item .badge {
  margin-left: auto; font-size: 10.5px;
  padding: 1px 6px; border-radius: 999px;
  background: #25282f; color: var(--sidebar-text);
  font-variant-numeric: tabular-nums;
}
.nav-item.active .badge { background: rgba(37,99,235,0.20); color: #93b8ff; }
.nav-item .badge.alert { background: rgba(220, 38, 38, 0.18); color: #fca5a5; }

.sidebar .foot {
  padding: 10px;
  border-top: 1px solid var(--sidebar-border);
  display: flex; align-items: center; gap: 10px;
  font-size: 12px; color: var(--sidebar-text-dim);
  white-space: nowrap;
}
.sidebar .foot > div { min-width: 0; }
.sidebar .foot > div > div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar .avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: #3b82f6; color: #fff;
  display: grid; place-items: center; font-weight: 600; font-size: 11px;
}

/* ---- Main column ---- */
.main { display: flex; flex-direction: column; overflow: hidden; background: var(--bg); }

.topbar {
  height: 48px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  display: flex; align-items: center;
  padding: 0 18px;
  gap: 14px;
  flex-shrink: 0;
}
.crumbs { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); white-space: nowrap; min-width: 0; }
.crumbs .sep { color: var(--faint); }
.crumbs .here { color: var(--ink); font-weight: 500; }

.env-pill {
  display: inline-flex; align-items: center; gap: 7px;
  height: 26px; padding: 0 9px 0 8px;
  border: 1px solid var(--border-strong); border-radius: 6px;
  font-size: 12px;
  background: var(--surface-2);
  cursor: pointer;
}
.env-pill:hover { background: var(--surface-sunken); }
.env-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.env-dot.staging { background: var(--warn); }
.env-dot.sandbox { background: var(--info); }

.search {
  flex: 1; max-width: 380px;
  display: flex; align-items: center; gap: 8px;
  height: 28px; padding: 0 10px;
  border: 1px solid var(--border); border-radius: 6px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12.5px;
  white-space: nowrap;
  overflow: hidden;
}
.search > span:first-of-type { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.search .kbd {
  margin-left: auto;
  font-family: var(--font-mono); font-size: 10.5px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px; color: var(--muted-2);
}

.topbar .actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.icon-btn {
  width: 28px; height: 28px; border-radius: 6px;
  border: 1px solid transparent;
  display: grid; place-items: center; color: var(--muted);
}
.icon-btn:hover { background: var(--surface-sunken); color: var(--ink); border-color: var(--border); }
.icon-btn .dot {
  position: absolute; width: 6px; height: 6px; border-radius: 50%; background: var(--accent);
  transform: translate(8px,-8px);
}

/* ---- Page ---- */
.page { flex: 1; overflow: auto; }
.page-inner { padding: 22px 28px 40px; max-width: 1480px; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 20px; }
.page-title { font-size: 22px; font-weight: 600; letter-spacing: -0.015em; color: var(--ink); }
.page-sub { font-size: 13px; color: var(--muted); margin-top: 4px; max-width: 70ch; }
.page-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  height: 30px; padding: 0 12px;
  border: 1px solid var(--border-strong); border-radius: 6px;
  background: var(--surface);
  font-size: 13px; font-weight: 500;
  color: var(--ink);
  box-shadow: var(--shadow-1);
  white-space: nowrap;
  flex-shrink: 0;
}
.btn:hover { background: var(--surface-2); }
.btn.sm { height: 26px; padding: 0 9px; font-size: 12px; gap: 6px; }
.btn.lg { height: 34px; padding: 0 14px; font-size: 13.5px; }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent-600); }
.btn.primary:hover { background: var(--accent-600); }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--muted); }
.btn.ghost:hover { background: var(--surface-sunken); color: var(--ink); }
.btn.danger { color: var(--bad); border-color: #e7c1ba; background: #fff; }
.btn.danger:hover { background: var(--bad-bg); }

/* ---- Cards ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-1);
}
.card-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border-soft); }
.card-title { font-size: 13.5px; font-weight: 600; letter-spacing: -0.005em; }
.card-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-body { padding: 14px; }

/* ---- Pills / chips ---- */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  height: 20px; padding: 0 7px;
  font-size: 11.5px; line-height: 1; font-weight: 500;
  border-radius: 4px;
  background: var(--neutral-bg); color: var(--ink-2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex-shrink: 0;
}
.chip.ok    { background: var(--ok-bg);    color: var(--ok); }
.chip.warn  { background: var(--warn-bg);  color: var(--warn); }
.chip.bad   { background: var(--bad-bg);   color: var(--bad); }
.chip.info  { background: var(--info-bg);  color: var(--info); }
.chip.accent { background: var(--accent-50); color: var(--accent-700); }
.chip.outline { background: transparent; border: 1px solid var(--border-strong); color: var(--muted); }
.chip.mono { font-family: var(--font-mono); font-size: 11px; }
.chip .dotx { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ---- Table ---- */
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.table th {
  text-align: left;
  font-weight: 500; font-size: 11.5px;
  letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--muted-2);
  padding: 9px 12px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: middle;
  color: var(--ink-2);
}
.table tr:hover td { background: #fbfaf8; }
.table tr.selected td { background: var(--accent-50); }
.table .mono { font-family: var(--font-mono); font-size: 12px; color: var(--ink); }

/* ---- Mono fragment ---- */
.mono { font-family: var(--font-mono); }
.muted { color: var(--muted); }
.kbd-tag { font-family: var(--font-mono); font-size: 11px; background: var(--surface-2); border: 1px solid var(--border); padding: 1px 5px; border-radius: 4px; color: var(--muted); }

/* ---- Sparkline ---- */
.spark { height: 28px; width: 100%; }
.spark path.line { fill: none; stroke: var(--accent); stroke-width: 1.4; }
.spark path.area { fill: var(--accent-50); }

/* ---- Tabs ---- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.tab {
  padding: 8px 12px; font-size: 13px; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  cursor: pointer;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--ink); border-bottom-color: var(--ink); font-weight: 500; }

/* ---- Misc ---- */
.divider { height: 1px; background: var(--border); margin: 12px 0; }
.kv { display: flex; gap: 12px; font-size: 13px; }
.kv dt { color: var(--muted); min-width: 120px; }
.kv dd { margin: 0; color: var(--ink); font-variant-numeric: tabular-nums; }
.stack { display: flex; flex-direction: column; gap: 12px; }

/* ---- Grid utility ---- */
.grid { display: grid; gap: 14px; }
.g-12 { grid-template-columns: repeat(12, 1fr); }
.g-6 { grid-template-columns: repeat(6, 1fr); }
.g-4 { grid-template-columns: repeat(4, 1fr); }
.g-3 { grid-template-columns: repeat(3, 1fr); }
.g-2 { grid-template-columns: repeat(2, 1fr); }
.col-3 { grid-column: span 3; }
.col-4 { grid-column: span 4; }
.col-5 { grid-column: span 5; }
.col-6 { grid-column: span 6; }
.col-7 { grid-column: span 7; }
.col-8 { grid-column: span 8; }
.col-9 { grid-column: span 9; }
.col-12 { grid-column: span 12; }

/* ---- Numbers / metrics ---- */
.metric .num { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.metric .num-lg { font-size: 32px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.metric .label { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted-2); }
.metric .delta { font-size: 11.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.metric .delta.up { color: var(--ok); }
.metric .delta.down { color: var(--bad); }

/* Progress bars */
.bar { height: 6px; background: var(--surface-sunken); border-radius: 3px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.bar.thick { height: 8px; }
.bar.ok > span { background: var(--ok); }
.bar.warn > span { background: var(--warn); }
.bar.bad > span { background: var(--bad); }

/* Inputs */
.input {
  height: 30px; padding: 0 10px;
  border: 1px solid var(--border-strong); border-radius: 6px;
  background: var(--surface); font-size: 13px;
  width: 100%;
}
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37,99,235,0.15); }
.field-label { font-size: 12px; color: var(--muted); margin-bottom: 5px; display: block; font-weight: 500; }

/* Status pills */
.status-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; white-space: nowrap; }
.status-pill .dot { width: 8px; height: 8px; border-radius: 50%; }
.status-pill .dot.ok { background: var(--ok); box-shadow: 0 0 0 3px rgba(21,128,61,0.12); }
.status-pill .dot.warn { background: var(--warn); box-shadow: 0 0 0 3px rgba(180,83,9,0.12); }
.status-pill .dot.bad { background: var(--bad); box-shadow: 0 0 0 3px rgba(185,28,28,0.12); }
.status-pill .dot.idle { background: var(--faint); }

/* code block */
.codeblock {
  background: #0f1115; color: #d3d6dc;
  font-family: var(--font-mono); font-size: 12px; line-height: 1.55;
  border-radius: 8px; padding: 12px 14px; overflow: auto;
}
.codeblock .k { color: #93b8ff; }
.codeblock .s { color: #a7e3a4; }
.codeblock .n { color: #f3c66b; }
.codeblock .c { color: #6b7280; font-style: italic; }
.codeblock .p { color: #9aa0aa; }

/* divider with label */
.section-label { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted-2); margin: 4px 0 10px; }
