/* GRVM custom layer: header scroll state, mobile menu, dashboard layout.
   Colors come from the numes-derived token system already in the page. */

/* ---------- marketing header scroll state ---------- */
header.site-header.site-scrolled {
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  border-color: var(--hairline);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* ---------- mobile nav panel ---------- */
.site-mobile-nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 60;
  background: var(--surface);
  border-bottom: 1px solid var(--hairline);
  padding: 12px 20px;
  display: none;
  flex-direction: column;
  gap: 8px;
}
.site-mobile-nav[data-open="true"] { display: flex; }
.site-mobile-nav a {
  display: flex;
  align-items: center;
  min-height: 40px;
  padding: 0 12px;
  border-radius: var(--shape-action);
  border: 1px solid var(--hairline);
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}
.site-mobile-nav a.site-nav-cta {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.site-mobile-nav .site-mobile-close {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: var(--shape-action);
  border: 1px solid var(--hairline);
  background: none;
  color: var(--ink);
  align-self: flex-end;
  cursor: pointer;
}

/* ---------- dashboard shell ---------- */
.dw-shell {
  min-height: 100vh;
  background: var(--canvas);
  color: var(--ink);
}
.dw-sidebar {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  width: 248px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--hairline);
  background: var(--surface);
  z-index: 30;
}
.dw-side-top { padding: 20px 18px 14px; }
.dw-side-nav {
  flex: 1;
  overflow-y: auto;
  padding: 6px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.dw-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  padding: 0 10px;
  border-radius: var(--shape-action);
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none;
  transition: background-color 0.15s, color 0.15s;
}
.dw-nav-item:hover { color: var(--ink); background: var(--raised); }
.dw-nav-item[aria-current="page"] {
  background: var(--iris-soft);
  color: var(--iris-ink);
  font-weight: 600;
}
.dw-nav-item svg { flex-shrink: 0; }
.dw-side-bottom {
  border-top: 1px solid var(--hairline);
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.dw-user {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.dw-user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}
.dw-user-mail {
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dw-logout {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: var(--shape-action);
  border: 1px solid var(--hairline);
  background: none;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.dw-logout:hover { color: var(--ink); border-color: var(--faint); }

.dw-main {
  margin-left: 248px;
  padding: 32px 40px 64px;
  max-width: 1080px;
}
.dw-page-head { margin-bottom: 24px; }
.dw-page-title {
  font-size: 1.6rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--ink);
  margin: 0 0 4px;
}
.dw-page-sub { font-size: 14px; color: var(--muted); margin: 0; max-width: 60ch; }

/* mobile: sidebar becomes a top bar */
.dw-topbar {
  display: none;
  position: sticky;
  top: 0;
  z-index: 30;
  height: 56px;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border-bottom: 1px solid var(--hairline);
  background: var(--surface);
}
@media (max-width: 900px) {
  .dw-sidebar { display: none; }
  .dw-main { margin-left: 0; padding: 24px 16px 64px; }
  .dw-topbar { display: flex; }
  .dw-drawer[data-open="true"] { display: flex; }
}
.dw-drawer {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 70;
  background: var(--canvas);
  flex-direction: column;
  padding: 16px;
}
.dw-drawer-backdrop { position: fixed; inset: 0; background: #00000059; }

/* ---------- stat cards ---------- */
.dw-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}
@media (max-width: 1100px) { .dw-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px)  { .dw-stats { grid-template-columns: 1fr; } }
.dw-stat {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--shape-panel);
  padding: 16px 18px;
}
.dw-stat-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 8px;
}
.dw-stat-value {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--ink);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.dw-stat-delta { font-size: 12px; color: var(--muted); margin-top: 6px; }

/* ---------- cards & chart ---------- */
.dw-card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--shape-panel);
  padding: 18px 20px;
  margin-bottom: 22px;
}
.dw-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 14px;
}
.dw-chart-svg { width: 100%; height: auto; display: block; }

/* ---------- misc ---------- */
.dw-empty {
  text-align: center;
  padding: 48px 16px;
  color: var(--muted);
  font-size: 14px;
}
.dw-empty strong { display: block; color: var(--ink); font-size: 15px; margin-bottom: 4px; }
.dw-spark { color: var(--accent); }
.dw-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--hairline);
  color: var(--muted);
}
.dw-badge.dw-on { color: var(--success); border-color: var(--success-border); background: var(--success-soft); }
.dw-badge.dw-off { color: var(--danger); border-color: var(--danger-border); background: var(--danger-soft); }
.dw-badge.dw-brand { color: var(--iris-ink); border-color: var(--iris-border); background: var(--iris-soft); }

.dw-dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: #17171a59;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.dw-dialog-backdrop[data-open="true"] { display: flex; }
.dw-dialog {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--shape-panel);
  box-shadow: var(--overlay-shadow);
  width: 100%;
  max-width: 460px;
  padding: 22px;
}
.dw-dialog h3 { margin: 0 0 4px; font-size: 16px; font-weight: 600; color: var(--ink); }
.dw-dialog p.dw-dialog-sub { margin: 0 0 16px; font-size: 13px; color: var(--muted); }
.dw-field { margin-bottom: 14px; }
.dw-field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 6px;
}
.dw-input, .dw-select, .dw-textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--hairline);
  border-radius: var(--shape-action);
  background: var(--canvas);
  color: var(--ink);
  padding: 8px 10px;
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.dw-input:focus, .dw-select:focus, .dw-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
.dw-textarea { min-height: 120px; resize: vertical; }
.dw-dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.dw-secret {
  font-family: var(--font-mono);
  font-size: 12.5px;
  background: var(--code-surface);
  border: 1px solid var(--hairline);
  border-radius: var(--shape-action);
  padding: 10px 12px;
  word-break: break-all;
  margin: 10px 0 4px;
  color: var(--ink);
}
.dw-row-actions { display: flex; gap: 4px; justify-content: flex-end; }
.dw-iconbtn {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: var(--shape-action);
  border: 1px solid var(--hairline);
  background: none;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.dw-iconbtn:hover { color: var(--ink); border-color: var(--faint); }
.dw-iconbtn.dw-danger:hover { color: var(--danger); border-color: var(--danger-border); }

/* models list */
.dw-model-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--hairline);
  transition: background-color 0.15s;
}
.dw-model-row:hover { background: var(--raised); }
.dw-model-row:last-child { border-bottom: none; }
.dw-model-logo {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border-radius: 6px;
  object-fit: contain;
}
.dw-model-logo.dw-fallback {
  display: grid;
  place-items: center;
  background: var(--raised);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.dw-model-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  font-family: var(--font-mono);
}
.dw-model-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.dw-model-id {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  border: 1px solid var(--hairline);
  border-radius: var(--shape-tag);
  padding: 3px 8px;
  background: none;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
}
.dw-model-id:hover { color: var(--ink); border-color: var(--faint); }

/* login page */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--canvas);
  padding: 20px;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--shape-panel);
  box-shadow: var(--lift-shadow);
  padding: 28px;
}
.login-error {
  border: 1px solid var(--danger-border);
  background: var(--danger-soft);
  color: var(--danger);
  border-radius: var(--shape-action);
  font-size: 13px;
  padding: 9px 12px;
  margin-bottom: 14px;
}
