/* ovh-mcp dashboard on Darkroom, the DigitalHeMan design system
   (https://digitalheman.com/ds/darkroom/v1/darkroom.css, linked before this
   file). Darkroom supplies the palette, type and the dr- components; this
   file keeps only what is the dashboard's own: its token names, pointed at
   Darkroom's, and the layout of its screens. Darkroom sits in cascade layers,
   so every rule here wins over it - which is why nothing here sets a value
   for a token name Darkroom defines, except in the light theme below. */
:root {
  --page: var(--dr-void);
  --surface: var(--dr-ground);
  --surface-2: var(--dr-raised);
  --ink: var(--dr-ink);
  --ink-2: var(--dr-ink-muted);
  --muted: var(--dr-ink-faint);
  --border: var(--dr-line);
  --border-strong: var(--dr-line-strong);
  --accent: var(--dr-safelight);
  --accent-ink: var(--dr-on-safelight);
  --good: var(--dr-positive);
  --warning: var(--dr-warning);
  --critical: var(--dr-danger);
  --critical-bg: var(--dr-safelight-dim);
  --scrim: rgba(0, 0, 0, 0.72);
}

/* Darkroom is dark-only and so is the dashboard by default. The light theme
   (the toggle, remembered per browser) keeps working by giving Darkroom's own
   tokens light values, so the dr- components follow it too. The safelight,
   tone and status colours are darkened to keep their contrast on paper. */
:root[data-theme="light"] {
  color-scheme: light;
  --dr-void: #f9f9f7;
  --dr-ground: #fcfcfb;
  --dr-raised: #f0efec;
  --dr-ink: #0b0b0b;
  --dr-ink-muted: #52514e;
  --dr-ink-faint: #6b6964;
  --dr-line: rgba(11, 11, 11, 0.12);
  --dr-line-strong: rgba(11, 11, 11, 0.28);
  --dr-safelight: #c2410c;
  --dr-safelight-hover: #a3360a;
  --dr-safelight-dim: rgba(194, 65, 12, 0.1);
  --dr-safelight-line: rgba(194, 65, 12, 0.45);
  --dr-on-safelight: #ffffff;
  --dr-tone: #4f6573;
  --dr-positive: #0a7a0a;
  --dr-warning: #8a5d06;
  --scrim: rgba(11, 11, 11, 0.4);
}

* { box-sizing: border-box; }

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

body {
  display: flex;
  flex-direction: column;
  background: var(--page);
  color: var(--ink);
  font-family: var(--dr-font-body);
  font-size: 0.875rem;
  line-height: 1.45;
}

#app {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.loading, .center-screen {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.loading { color: var(--ink-2); }

code, pre, .mono { font-family: var(--dr-font-mono); font-size: 0.8125rem; }

/* -- app bar: filled from /api/appbar, which leaves the private half out
   unless this request has a signed-in session ---------------------- */

.dr-appbar:empty { min-height: 2.75rem; }

/* -- brand: the Darkroom wordmark, the version and a label ----------- */

.brand { display: flex; flex-direction: column; gap: 0.375rem; }
.brand-line { display: flex; align-items: baseline; gap: 0.625rem; flex-wrap: wrap; }
.brand .dr-wordmark { font-size: 1.625rem; white-space: nowrap; }
.brand-hero { align-items: center; text-align: center; margin-bottom: 1.5rem; }
.brand-hero .brand-line { justify-content: center; }
.brand-hero .dr-wordmark { font-size: 2.75rem; }

/* -- buttons: dr-btn, with the dashboard's own sizes ----------------- */

.btn-block { width: 100%; }
.btn-compact { min-height: 2.25rem; padding: 0 0.875rem; font-size: 0.8125rem; }
.btn-danger { border-color: var(--critical); color: var(--critical); }
.btn-danger:hover { background: var(--critical-bg); border-color: var(--critical); }

/* A text button that reads as a link. */
button.dr-link {
  background: none;
  border: 0;
  border-bottom: 2px solid var(--dr-safelight);
  padding: 0 0 0.125em;
  font: inherit;
  cursor: pointer;
}

/* -- auth screens -------------------------------------------------- */

.auth-card {
  width: 100%;
  max-width: 24rem;
  padding: 2rem;
  margin: 1rem;
}
.auth-card--wide { max-width: 27rem; }

.auth-card h1 { margin: 0 0 0.375rem; text-align: center; }

.auth-card .subtitle {
  color: var(--ink-2);
  margin: 0 0 1.5rem;
  text-align: center;
}

.auth-footer { text-align: center; margin-top: 1.25rem; }

.field { margin-bottom: 1rem; }

.field label {
  display: block;
  margin-bottom: 0.375rem;
}

.field .dr-input { width: 100%; }

.field .hint {
  color: var(--muted);
  font-size: 0.75rem;
  margin-top: 0.375rem;
}

.error-banner {
  background: var(--critical-bg);
  border: 1px solid var(--critical);
  color: var(--ink);
  padding: 0.625rem 0.75rem;
  margin-bottom: 1rem;
}

.info-banner {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--ink-2);
  padding: 0.625rem 0.75rem;
  margin-bottom: 1rem;
}

.divider {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  margin: 1.25rem 0;
}
.divider::before, .divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* The QR code stays dark-on-white in both themes: authenticator apps need
   that contrast and a light quiet zone to scan it. */
.qr-box {
  background: #ffffff;
  border: 1px solid var(--border);
  padding: 1rem;
  display: flex;
  justify-content: center;
  margin-bottom: 1rem;
}
.qr-box img { width: 180px; height: 180px; }

.recovery-codes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.375rem 1rem;
  background: var(--page);
  border: 1px solid var(--border);
  padding: 0.875rem;
  margin: 0.875rem 0;
}

.choice-grid { display: grid; gap: 0.625rem; }

.choice-card {
  border: 1px solid var(--border);
  padding: 0.875rem;
  background: var(--page);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  text-align: left;
}
.choice-card:hover { border-color: var(--border-strong); }
.choice-card h3 { margin: 0 0 0.25rem; font-size: 0.9375rem; font-weight: 600; }
.choice-card p { margin: 0; font-size: 0.8125rem; color: var(--ink-2); }

/* -- shell / dashboard ---------------------------------------------- */

.shell { flex: 1; display: flex; flex-direction: column; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  padding: 1rem clamp(1rem, 3vw, 2.5rem) 0;
  gap: 0.75rem 1.5rem;
}
.topbar .actions { display: flex; align-items: center; flex-wrap: wrap; gap: 0.5rem; }

.tabs {
  padding: 0 clamp(1rem, 3vw, 2.5rem);
  border-bottom: 1px solid var(--border);
  flex-wrap: nowrap;
  overflow-x: auto;
}
.tabs a { white-space: nowrap; }

.content {
  flex: 1;
  padding: 1.5rem clamp(1rem, 3vw, 2.5rem);
  width: 100%;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin-bottom: 1rem;
}
.panel-header h2 { margin: 0; }
.panel-header .meta { color: var(--muted); }
.panel-header .tools { display: flex; align-items: center; gap: 0.75rem; }

.card { margin-bottom: 0.875rem; }
.card-title { margin: 0; font-size: 0.9375rem; font-weight: 600; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr));
  gap: 0.875rem;
}
.card-grid .card { margin-bottom: 0; }

.project-card h3 {
  margin: 0 0 0.375rem;
  font-size: 1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.project-card .desc { color: var(--ink-2); font-size: 0.8125rem; margin: 0 0 0.75rem; }
.project-card .dr-specs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.project-card .dr-specs dd { overflow-wrap: anywhere; }

.kv { display: flex; justify-content: space-between; gap: 1rem; padding: 0.25rem 0; }
.kv .k { color: var(--ink-2); }

/* Status tags: dr-tag, with green and amber for states that are neither
   urgent (dr-tag--alert, the safelight) nor neutral. */
.tag-ok { border-color: var(--good); color: var(--good); }
.tag-warn { border-color: var(--warning); color: var(--warning); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left;
  font-family: var(--dr-font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0.5rem 0.625rem;
  border-bottom: 1px solid var(--border-strong);
}
td { padding: 0.5rem 0.625rem; border-bottom: 1px solid var(--border); vertical-align: top; }
tr:last-child td { border-bottom: none; }

.empty-state {
  color: var(--ink-2);
  text-align: center;
  padding: 2.5rem 0;
}

.severity-chips { display: flex; gap: 0.5rem; margin-bottom: 0.875rem; flex-wrap: wrap; }

.section-title { display: block; margin: 1.25rem 0 0.5rem; }
.section-title:first-child { margin-top: 0; }

.ip-row { display: flex; justify-content: space-between; gap: 1rem; padding: 0.25rem 0; border-bottom: 1px solid var(--border); }
.ip-row:last-child { border-bottom: none; }

.account-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.625rem 0;
  border-bottom: 1px solid var(--border);
}
.account-row:last-child { border-bottom: none; }
.account-row .sub { font-size: 0.75rem; color: var(--muted); }

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: var(--scrim);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.modal {
  padding: 1.5rem;
  width: calc(100% - 2rem);
  max-width: 24rem;
  background: var(--surface-2);
}
.modal h3 { margin: 0 0 0.75rem; }

.row { display: flex; gap: 0.625rem; }
.row > * { flex: 1; }

.muted { color: var(--ink-2); }
.small { font-size: 0.75rem; }
.mt { margin-top: 0.875rem; }
.mb0 { margin-bottom: 0; }
.warn-text { color: var(--warning); }
.break-all { word-break: break-all; }
