/* Clarynt v5 tokens (ported inline — no external font/CSS fetches, the
   manager must work on a locked-down VM with no outbound access). */
:root {
  --silk: #f2f0e9;
  --silk-raised: #f8f7f2;
  --ink: #1a1a18;
  --ink-soft: #26261f;
  --graphite: #2e2e2b;
  --graphite-mid: #5c5c56;
  --graphite-soft: #8a8a82;
  --marigold: #ff9f1c;
  --marigold-text: #cc7a00;
  --rose: #e8185a;
  --ok: #1f7a44;
  --error: #b3261e;
  --warn: #b87400;
  --line: rgba(26, 26, 24, 0.14);
  --line-strong: rgba(26, 26, 24, 0.28);
  --z-base: 1;
  --z-sticky: 20;
  --z-overlay: 60;
  --shadow-sm: 0 1px 2px rgba(70, 55, 30, 0.08);
  --shadow-md: 0 2px 10px rgba(70, 55, 30, 0.12);
  --focus-ring: 2px solid var(--marigold-text);
  --font-structure: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-voice: "Switzer", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--silk);
  color: var(--graphite);
  font-family: var(--font-voice);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, th, button, .label, .metric-value, .wordmark {
  font-family: var(--font-structure);
  font-weight: 700;
}

.label {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 10px;
  color: var(--graphite-soft);
}

a { color: var(--marigold-text); text-decoration: none; }
a:hover { text-decoration: underline; }

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

.tabular { font-variant-numeric: tabular-nums; }

/* ---------- shell ---------- */
#root { height: 100%; }
.shell { display: flex; flex-direction: column; height: 100%; }

header.top {
  display: flex; align-items: center; gap: 20px;
  padding: 0 20px; height: 52px;
  background: var(--ink); color: var(--silk);
  position: sticky; top: 0; z-index: var(--z-sticky);
}

.wordmark { font-size: 17px; letter-spacing: -0.01em; color: #e9e7df; }
.wordmark .nt { color: var(--marigold); }
.wordmark .cursor { color: var(--marigold); animation: blink 1.1s step-end infinite; }
@keyframes blink { 50% { opacity: 0; } }

header.top .product {
  font-family: var(--font-structure); font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.1em; font-size: 10px;
  color: var(--graphite-soft); padding-left: 20px; border-left: 1px solid rgba(255,255,255,0.16);
}
header.top .spacer { flex: 1; }
header.top .sysinfo { font-size: 11px; color: var(--graphite-soft); font-variant-numeric: tabular-nums; }
header.top button.link { color: var(--graphite-soft); background: none; border: none; cursor: pointer; font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.08em; font-family: var(--font-structure); font-weight: 700; }
header.top button.link:hover { color: var(--silk); }

.body { display: flex; flex: 1; min-height: 0; }

/* ---------- sidebar ---------- */
aside {
  width: 268px; flex: none; border-right: 1px solid var(--line);
  background: var(--silk-raised); display: flex; flex-direction: column; min-height: 0;
}
aside .aside-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 8px; }
aside .list { overflow-y: auto; flex: 1; }

.app-row {
  display: block; width: 100%; text-align: left; cursor: pointer;
  background: none; border: none; border-bottom: 1px solid var(--line);
  padding: 10px 16px; font-family: var(--font-voice); color: var(--graphite);
  /* app names are identifiers — never case-transformed */
  text-transform: none; letter-spacing: normal; box-shadow: none; border-radius: 0;
}
.app-row:hover { background: rgba(255, 159, 28, 0.07); }
.app-row.active { background: rgba(255, 159, 28, 0.13); box-shadow: inset 3px 0 0 var(--marigold); }
.app-row .name { font-family: var(--font-structure); font-weight: 700; font-size: 13px; display: flex; align-items: center; gap: 7px; }
.app-row .meta { font-size: 11px; color: var(--graphite-soft); margin-top: 2px; font-variant-numeric: tabular-nums; }

.dot { width: 7px; height: 7px; border-radius: 50%; flex: none; background: var(--graphite-soft); }
.dot.healthy { background: var(--ok); }
.dot.unhealthy { background: var(--error); }
.dot.unknown { background: var(--graphite-soft); }
.dot.disabled { background: var(--line-strong); }
.dot.degraded { background: var(--warn); }

/* ---------- main ---------- */
main { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 22px 26px 60px; min-width: 0; }
.page-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 18px; }
.page-head h1 { font-size: 22px; margin: 0 0 3px; letter-spacing: -0.01em; }
.page-head .sub { font-size: 12px; color: var(--graphite-mid); font-variant-numeric: tabular-nums; }
.page-head .spacer { flex: 1; }

.actions { display: flex; gap: 8px; flex-wrap: wrap; }

button, .btn {
  font-family: var(--font-structure); font-weight: 700; font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.07em;
  padding: 7px 13px; border-radius: 3px; cursor: pointer;
  border: 1px solid var(--line-strong); background: var(--silk-raised); color: var(--graphite);
  box-shadow: var(--shadow-sm);
}
button:hover:not(:disabled) { border-color: var(--graphite-mid); }
button:disabled { opacity: 0.45; cursor: not-allowed; }
button.primary { background: var(--marigold); border-color: #e08c10; color: #23180a; }
button.danger { color: var(--error); border-color: rgba(179, 38, 30, 0.4); }
button.sm { padding: 4px 9px; font-size: 10px; }

/* ---------- tabs ---------- */
/* Tabs scroll rather than clip on a narrow pane. */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; scrollbar-width: thin; }
.tab {
  background: none; border: none; border-bottom: 2px solid transparent; box-shadow: none;
  padding: 9px 13px; color: var(--graphite-mid); border-radius: 0; flex: none; white-space: nowrap;
}
.tab.active { color: var(--graphite); border-bottom-color: var(--marigold); }
.tab:hover:not(.active) { color: var(--graphite); border-bottom-color: var(--line-strong); }

/* ---------- cards / grids ---------- */
.card {
  background: var(--silk-raised); border: 1px solid var(--line); border-radius: 4px;
  padding: 16px; box-shadow: var(--shadow-sm); margin-bottom: 16px;
}
.card > h2 { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--graphite-soft); margin: 0 0 12px; }

/* Individually bordered tiles rather than gaps over a tinted container: an
   uneven final row would otherwise leave an empty grey cell. */
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 16px; }
.metric { background: var(--silk-raised); border: 1px solid var(--line); border-radius: 4px; padding: 12px 14px; box-shadow: var(--shadow-sm); }
.metric .metric-value { font-size: 18px; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; display: flex; align-items: center; gap: 7px; }
.metric .metric-value.ok { color: var(--ok); }
.metric .metric-value.bad { color: var(--error); }
.metric .metric-value.warn { color: var(--warn); }
.metric .metric-sub { font-size: 11px; color: var(--graphite-soft); margin-top: 2px; }

table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
th {
  text-align: left; text-transform: uppercase; letter-spacing: 0.07em; font-size: 10px;
  color: var(--graphite-soft); padding: 6px 10px; border-bottom: 1px solid var(--line-strong); white-space: nowrap;
}
td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; font-variant-numeric: tabular-nums; }
tr:last-child td { border-bottom: none; }
td.wrap { font-variant-numeric: normal; }

code, .mono { font-family: var(--mono); font-size: 12px; }

/* ---------- terminal / logs ---------- */
.terminal {
  background: var(--ink); color: #d8d5c9; font-family: var(--mono); font-size: 12px;
  line-height: 1.55; padding: 14px 16px; border-radius: 4px; overflow: auto;
  max-height: 62vh; white-space: pre-wrap; word-break: break-word;
}
.terminal.short { max-height: 34vh; }

/* ---------- forms ---------- */
.field { margin-bottom: 14px; }
.field > label { display: block; margin-bottom: 4px; }
input[type="text"], input[type="password"], input[type="number"], select, textarea {
  width: 100%; padding: 7px 9px; border: 1px solid var(--line-strong); border-radius: 3px;
  background: #fff; color: var(--graphite); font-family: var(--font-voice); font-size: 13px;
}
textarea { font-family: var(--mono); font-size: 12px; min-height: 74px; resize: vertical; }
.hint { font-size: 11px; color: var(--graphite-soft); margin-top: 3px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.inline { display: flex; gap: 8px; align-items: center; }

/* ---------- pills / states ---------- */
.pill {
  display: inline-block; font-family: var(--font-structure); font-weight: 700; font-size: 9.5px;
  text-transform: uppercase; letter-spacing: 0.07em; padding: 2px 7px; border-radius: 3px;
  border: 1px solid var(--line-strong); color: var(--graphite-mid); white-space: nowrap;
}
.pill.ok { color: var(--ok); border-color: rgba(31, 122, 68, 0.4); }
.pill.bad { color: var(--error); border-color: rgba(179, 38, 30, 0.4); }
.pill.warn { color: var(--warn); border-color: rgba(184, 116, 0, 0.45); }
.pill.live { color: var(--rose); border-color: rgba(232, 24, 90, 0.4); }

.empty { padding: 28px 16px; text-align: center; color: var(--graphite-soft); font-size: 13px; }
.skeleton { height: 12px; border-radius: 2px; background: linear-gradient(90deg, rgba(26,26,24,0.07), rgba(26,26,24,0.12), rgba(26,26,24,0.07)); background-size: 200% 100%; animation: shimmer 1.3s infinite; margin-bottom: 8px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.error-box { border: 1px solid rgba(179,38,30,0.4); border-left: 3px solid var(--error); background: rgba(179,38,30,0.05); padding: 10px 12px; border-radius: 3px; color: var(--error); font-size: 12.5px; margin-bottom: 14px; }
.stale { color: var(--warn); font-size: 10px; text-transform: uppercase; letter-spacing: 0.07em; font-family: var(--font-structure); font-weight: 700; }

/* ---------- toast ---------- */
#toasts { position: fixed; right: 18px; bottom: 18px; z-index: var(--z-overlay); display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--ink); color: #e9e7df; padding: 10px 14px; border-radius: 3px; font-size: 12.5px;
  box-shadow: var(--shadow-md); max-width: 380px; border-left: 3px solid var(--marigold);
}
.toast.bad { border-left-color: var(--error); }
.toast.ok { border-left-color: var(--ok); }

/* ---------- login ---------- */
.login-wrap { display: flex; align-items: center; justify-content: center; height: 100%; }
.login-card { width: 320px; background: var(--silk-raised); border: 1px solid var(--line); border-radius: 4px; padding: 24px; box-shadow: var(--shadow-md); }
.login-card .wordmark { color: var(--graphite); font-size: 20px; }
.login-card .wordmark .nt { color: var(--marigold-text); }
.login-card .wordmark .cursor { color: var(--marigold-text); }

/* ---------- modal ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(26,26,24,0.45); z-index: var(--z-overlay); display: flex; align-items: flex-start; justify-content: center; padding-top: 7vh; }
.modal { background: var(--silk); border: 1px solid var(--line-strong); border-radius: 4px; width: 560px; max-width: 94vw; max-height: 82vh; overflow-y: auto; padding: 22px; box-shadow: var(--shadow-md); }
.modal h2 { margin: 0 0 16px; font-size: 16px; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
