/* Brand tokens + Bootstrap variable overrides (APP-DESIGN.md §4). Loaded after bootstrap.min.css
   and app.css so these values win. Dark mode rides Bootstrap 5.3's own [data-bs-theme="dark"]
   variable remapping -- js/theme.js sets that attribute on <html>; this file only supplies the
   brand colors on top of it. */

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/inter-latin-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/fonts/inter-latin-500-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/fonts/inter-latin-600-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/fonts/inter-latin-700-normal.woff2') format('woff2');
}

:root {
  --bs-font-sans-serif: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto,
    Helvetica, Arial, sans-serif;
  --bs-primary: #2563eb;
  --bs-primary-rgb: 37, 99, 235;
  --bs-success: #16a34a;
  --bs-success-rgb: 22, 163, 74;
  --bs-warning: #d97706;
  --bs-warning-rgb: 217, 119, 6;
  --bs-danger: #dc2626;
  --bs-danger-rgb: 220, 38, 38;
  --bs-border-radius: 0.5rem;
  --bs-border-radius-sm: 0.375rem;
  --bs-border-radius-lg: 0.625rem;

  --dd-surface: #ffffff;
  --dd-page: #f8fafc;
  --dd-border: #e5e7eb;
}

[data-bs-theme='dark'] {
  --dd-surface: #111827;
  --dd-page: #0b1220;
  --dd-border: #1f2937;
}

html, body {
  font-family: var(--bs-font-sans-serif);
  background: var(--dd-page);
}

/* App shell */
.dd-topbar {
  height: 56px;
  background: var(--dd-surface);
  border-bottom: 1px solid var(--dd-border);
}

[data-bs-theme='dark'] .dd-topbar {
  background: #0b1220;
}

.dd-wordmark {
  font-weight: 700;
  color: var(--bs-body-color);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.dd-topbar .nav-link {
  color: var(--bs-secondary-color);
  font-weight: 500;
}

.dd-topbar .nav-link.active {
  color: var(--bs-body-color);
}

.dd-avatar {
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  background: var(--bs-primary);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
}

.dd-page-container {
  max-width: 1200px;
  margin-inline: auto;
  padding: 24px;
}

.dd-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.dd-page-header p {
  margin: 0.25rem 0 0;
}

.dd-breadcrumb {
  margin-bottom: 0.25rem;
}

.dd-breadcrumb .breadcrumb {
  font-size: 0.875rem;
}

.dd-breadcrumb .breadcrumb-item + .breadcrumb-item::before {
  content: "/";
}

/* Settings sub-nav */
.dd-settings-nav {
  border-right: 1px solid var(--dd-border);
  min-width: 12rem;
}

.dd-settings-nav .nav-link {
  color: var(--bs-body-color);
  border-radius: var(--bs-border-radius-sm);
  padding: 0.5rem 0.75rem;
}

.dd-settings-nav .nav-link.active {
  background: var(--bs-tertiary-bg);
  font-weight: 600;
}

/* Context page tab strip (ServerDetail/SiteDetail skeleton, APP-DESIGN.md §2) */
.dd-tab-strip .nav-link {
  color: var(--bs-secondary-color);
}

.dd-tab-strip .nav-link.active {
  color: var(--bs-body-color);
  font-weight: 600;
}

/* Auth screens (APP-DESIGN.md §3): two-panel layout outside the shell. */
.dd-auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 40% 60%;
}

.dd-auth-left {
  background: #0b1220;
  color: #f8fafc;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1.5rem;
  padding: 3rem;
}

.dd-auth-wordmark {
  font-size: 1.25rem;
  color: #f8fafc;
}

.dd-auth-values {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  font-size: 1.05rem;
  color: #cbd5e1;
  max-width: 26rem;
}

.dd-auth-mock {
  border-radius: var(--bs-border-radius-lg);
  overflow: hidden;
  border: 1px solid #1f2937;
  max-width: 30rem;
}

.dd-auth-mock svg,
.dd-auth-mock img {
  display: block;
  width: 100%;
  height: auto;
}

.dd-auth-right {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem;
  background: var(--dd-surface);
}

.dd-auth-form {
  width: 100%;
  max-width: 26rem;
}

.dd-auth-legal {
  margin-top: 1.5rem;
}

.dd-auth-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--bs-secondary-color);
  font-size: 0.85rem;
  margin: 1rem 0;
}

.dd-auth-divider::before,
.dd-auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--dd-border);
}

@media (max-width: 768px) {
  .dd-auth-shell {
    grid-template-columns: 1fr;
  }

  .dd-auth-left {
    flex-direction: row;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    gap: 0;
  }

  .dd-auth-values,
  .dd-auth-mock {
    display: none;
  }
}

/* Tables (APP-DESIGN.md §4): table-sm, 44px rows, hover, no zebra. */
.table {
  --bs-table-hover-bg: var(--bs-tertiary-bg);
  --bs-table-striped-bg: transparent;
}

.table > :not(caption) > * > * {
  padding: 0.625rem 0.75rem;
}

.table > tbody > tr > td:first-child > a {
  font-weight: 600;
}

/* Visible focus states (APP-DESIGN.md §7): Bootstrap's own focus ring covers form controls: this
   adds one for links, nav items and table-row links that don't otherwise get one. */
a:focus-visible,
button:focus-visible,
.nav-link:focus-visible,
.btn:focus-visible {
  outline: 2px solid var(--bs-primary);
  outline-offset: 2px;
}

/* Status chip (APP-DESIGN.md §4), introduced by the Dashboard (task DD-0089) and reused wherever
   a job or deployment status shows up. */
.dd-status-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--bs-tertiary-bg);
  color: var(--bs-secondary-color);
}

.dd-status-chip-succeeded {
  background: rgba(22, 163, 74, 0.12);
  color: #16a34a;
}

.dd-status-chip-failed {
  background: rgba(220, 38, 38, 0.12);
  color: #dc2626;
}

.dd-status-chip-running {
  background: rgba(37, 99, 235, 0.12);
  color: #2563eb;
}

.dd-status-chip-cancelled {
  background: transparent;
  border: 1px solid var(--dd-border);
  color: var(--bs-secondary-color);
}

/* Provisioning checklist (task DD-0134): the Server page's Overview right after Create. */
.dd-provisioning-checklist {
  border: 1px solid var(--dd-border);
  border-radius: 0.5rem;
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
}

.dd-checklist-step {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.3rem 0;
  color: var(--bs-secondary-color);
}

.dd-checklist-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
}

.dd-checklist-step-done {
  color: var(--bs-body-color);
}

.dd-checklist-step-done .dd-checklist-icon {
  color: #16a34a;
  font-weight: 700;
}

.dd-checklist-step-running {
  color: var(--bs-body-color);
  font-weight: 600;
}

.dd-checklist-step-failed .dd-checklist-icon {
  color: #dc2626;
  font-weight: 700;
}

/* Shared LogViewer (task DD-0130): a dark terminal fixed on its own palette, not the Bootstrap
   --bs-* tokens above -- item 23 of APP-PARITY-RESEARCH-2026-09-13.md calls this out explicitly
   ("independent dark log terminal"), so it looks the same whether the rest of the page is in light
   or dark mode, same as Forge/Render's log explorers. */
.dd-log-viewer {
  --dd-log-bg: #1a1b26;
  --dd-log-fg: #d6d6e0;
  --dd-log-muted: #8a8ba3;
  --dd-log-border: #33344a;
  --dd-log-debug: #7a7c99;
  --dd-log-info: #d6d6e0;
  --dd-log-warn: #e0af68;
  --dd-log-error: #f7768e;
  border-radius: 0.5rem;
  border: 1px solid var(--dd-log-border);
  background: var(--dd-log-bg);
  color: var(--dd-log-fg);
  overflow: hidden;
}

.dd-log-viewer-fullscreen {
  position: fixed;
  inset: 1rem;
  z-index: 1060;
  box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.5);
}

.dd-log-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--dd-log-border);
}

.dd-log-search {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex: 1 1 14rem;
  min-width: 10rem;
}

.dd-log-search .form-control {
  background: var(--dd-log-bg);
  border-color: var(--dd-log-border);
  color: var(--dd-log-fg);
}

.dd-log-match-count {
  font-size: 0.75rem;
  color: var(--dd-log-muted);
  white-space: nowrap;
}

.dd-log-level-filter {
  width: auto;
  background: var(--dd-log-bg);
  border-color: var(--dd-log-border);
  color: var(--dd-log-fg);
}

.dd-log-toolbar-actions {
  display: flex;
  gap: 0.35rem;
  margin-left: auto;
}

.dd-log-body {
  max-height: 28rem;
  overflow-y: auto;
  padding: 0.75rem 1rem;
  font-family: var(--bs-font-monospace);
  font-size: 0.85rem;
}

.dd-log-viewer-fullscreen .dd-log-body {
  max-height: none;
  height: calc(100% - 3rem);
}

/* One deployment step's own log slice (task DD-0136) -- same monospace look as the LogViewer's
   flat log, just for the short excerpt one step's row expands to. */
.dd-log-pre {
  max-height: 16rem;
  overflow-y: auto;
  padding: 0.5rem 0.75rem;
  font-family: var(--bs-font-monospace);
  font-size: 0.8rem;
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--bs-tertiary-bg);
  border-radius: 0.25rem;
}

.dd-log-line {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  color: var(--dd-log-info);
}

.dd-log-text {
  white-space: pre-wrap;
  word-break: break-word;
}

.dd-log-line-debug {
  color: var(--dd-log-debug);
}

.dd-log-line-warn {
  color: var(--dd-log-warn);
}

.dd-log-line-error {
  color: var(--dd-log-error);
}

.dd-log-line-current-match {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 0.25rem;
}

.dd-log-line mark {
  background: #e0af68;
  color: #1a1b26;
  border-radius: 0.15rem;
  padding: 0 0.1rem;
}

.dd-log-time {
  flex: 0 0 auto;
  color: var(--dd-log-muted);
}

.dd-log-level-tag {
  flex: 0 0 auto;
  color: var(--dd-log-muted);
  text-transform: uppercase;
  font-size: 0.7rem;
}

.dd-log-status {
  padding: 0.35rem 0.75rem;
  border-top: 1px solid var(--dd-log-border);
}

/* "Live" badge (task DD-0129): sits next to a succeeded deployment's StatusChip wherever that
   deployment happens to be the site's current_deployment_id -- a fact about the site, not the
   deployment row itself, so it is never part of StatusChip's own status-code mapping. */
.dd-live-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(22, 163, 74, 0.12);
  color: #16a34a;
}

.dd-status-dot {
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 999px;
  background: currentColor;
  animation: dd-status-dot-pulse 1.2s ease-in-out infinite;
}

@keyframes dd-status-dot-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

/* Command palette (task DD-0128, Cmd+K / Ctrl+K global search). */
.dd-search-trigger {
  color: var(--bs-secondary-color);
  font-size: 1.1rem;
  line-height: 1;
}

.dd-palette-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 12vh;
  z-index: 1050;
}

.dd-palette {
  width: 100%;
  max-width: 36rem;
  max-height: 60vh;
  background: var(--dd-surface);
  border: 1px solid var(--dd-border);
  border-radius: var(--bs-border-radius-lg);
  box-shadow: 0 20px 48px rgba(15, 23, 42, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.dd-palette-input {
  border: none;
  border-bottom: 1px solid var(--dd-border);
  border-radius: 0;
  padding: 0.9rem 1rem;
}

.dd-palette-input:focus {
  box-shadow: none;
}

.dd-palette-results {
  overflow-y: auto;
  padding: 0.5rem;
}

.dd-palette-empty {
  padding: 1rem;
  font-size: 0.9rem;
}

.dd-palette-group-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.5rem 0.6rem 0.25rem;
}

.dd-palette-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  border: none;
  background: transparent;
  text-align: left;
  padding: 0.5rem 0.6rem;
  border-radius: var(--bs-border-radius-sm);
  color: var(--bs-body-color);
}

.dd-palette-item.active,
.dd-palette-item:hover {
  background: var(--bs-tertiary-bg);
}

.dd-palette-item-subtitle {
  font-size: 0.8rem;
  flex-shrink: 0;
}

/* Health dot (APP-DESIGN.md §4): ok/warn/down/unknown. */
.dd-health-dot {
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 999px;
  background: var(--bs-secondary-color);
}

.dd-health-dot-ok { background: #16a34a; }
.dd-health-dot-warn { background: #d97706; }
.dd-health-dot-down { background: #dc2626; }
.dd-health-dot-unknown { background: var(--bs-secondary-color); }

/* Secondary/cancel buttons (task DD-0142): Bootstrap's compiled .btn-outline-secondary/.btn-light
   bake in a fixed gray at build time, so the --bs-primary/--bs-danger overrides at the top of this
   file never reach them -- next to the app's own palette they read as disabled even when they
   aren't (Rename/Cancel on Settings -> Providers). Override each button's own --bs-btn-* variables
   (Bootstrap 5.3's per-component API) instead, so both read at full opacity against --bs-body-color
   in light and dark. */
.btn-outline-secondary {
  --bs-btn-color: var(--bs-body-color);
  --bs-btn-border-color: var(--bs-secondary-color);
  --bs-btn-hover-color: var(--bs-body-color);
  --bs-btn-hover-bg: var(--bs-tertiary-bg);
  --bs-btn-hover-border-color: var(--bs-secondary-color);
  --bs-btn-active-color: var(--bs-body-color);
  --bs-btn-active-bg: var(--bs-tertiary-bg);
  --bs-btn-active-border-color: var(--bs-secondary-color);
}

.btn-light {
  --bs-btn-color: var(--bs-body-color);
  --bs-btn-bg: var(--bs-tertiary-bg);
  --bs-btn-border-color: var(--dd-border);
  --bs-btn-hover-color: var(--bs-body-color);
  --bs-btn-hover-bg: var(--bs-secondary-bg);
  --bs-btn-hover-border-color: var(--dd-border);
}

/* Designed empty state (task DD-0137): icon + one sentence + one primary button. */
.dd-empty-state-icon {
  color: var(--bs-secondary-color);
  margin-bottom: 0.75rem;
}

/* Card-ified table under 576px (task DD-0137, parity item 12): every <td> needs its own
   data-label="<column header>" attribute for this to render -- the Activity page table is the
   reference implementation; adopt the same attribute on a table's cells to opt it in. Above the
   breakpoint this is a no-op and the table renders normally. */
@media (max-width: 575.98px) {
  .dd-table-cards thead {
    display: none;
  }

  .dd-table-cards table,
  .dd-table-cards tbody,
  .dd-table-cards tr,
  .dd-table-cards td {
    display: block;
    width: 100%;
  }

  .dd-table-cards tr {
    border: 1px solid var(--dd-border);
    border-radius: var(--bs-border-radius);
    margin-bottom: 0.75rem;
    padding: 0.5rem 0.75rem;
  }

  .dd-table-cards td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    border: none !important;
    padding: 0.35rem 0 !important;
    text-align: right;
  }

  .dd-table-cards td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--bs-secondary-color);
    text-align: left;
  }

  .dd-table-cards td:empty::before {
    content: none;
  }
}
