* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  background: #f8f9fb;
  color: #1a1d23;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: #2563eb;
  text-decoration: none;
}

input,
button,
select,
textarea {
  font: inherit;
}

/* ── Suspense fallback ── */
.shell-suspense-fallback {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  color: #6b7280;
  font-size: 14px;
  background: #f8f9fb;
}

.app-shell {
  min-height: 100dvh;
}

/* ── Left Navigation ── */
.left-nav {
  position: fixed;
  inset: 0 auto 0 0;
  width: 270px;
  border-right: 1px solid #e8ecf1;
  background: #fdfdfe;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.brand-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid #e8ecf1;
  border-radius: 12px;
  background: #fff;
  padding: 10px;
}

.brand-chip-logo {
  width: 42px;
  height: 42px;
  object-fit: cover;
  border-radius: 10px;
}

.brand-chip-title {
  font-weight: 700;
  font-size: 13px;
  line-height: 1.35;
}

.brand-chip-sub {
  font-size: 12px;
  color: #6b7280;
}

.nav-stack {
  display: grid;
  gap: 6px;
}

.nav-item {
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 10px 12px;
  color: #374151;
  background: transparent;
  transition: background 120ms, color 120ms;
}

.nav-item:hover {
  background: #f1f3f7;
}

.nav-item-active {
  background: #1a1d23;
  color: #fff;
  border-color: #1a1d23;
}

/* ── Sidebar sections ── */
.side-section {
  background: #fff;
  border: 1px solid #e8ecf1;
  border-radius: 12px;
  padding: 10px;
}

.side-title {
  font-size: 11px;
  color: #8993a4;
  margin-bottom: 8px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  font-weight: 600;
}

.side-muted {
  color: #9ca3af;
  font-size: 12px;
}

.side-job {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid #f1f3f7;
  border-radius: 8px;
  padding: 8px;
  margin-bottom: 6px;
  color: #1a1d23;
  font-size: 12px;
}

.side-footer {
  margin-top: auto;
  color: #6b7280;
  font-size: 12px;
  display: grid;
  gap: 4px;
}

/* ── Main Content Pane ── */
.main-pane {
  margin-left: 270px;
  padding: 24px;
  max-width: 1400px;
}

/* ── Auth layout ── */
.auth-layout {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: min(460px, 92vw);
  background: #fff;
  border: 1px solid #e8ecf1;
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.04);
  padding: 22px;
}

.auth-subtitle {
  margin-top: -6px;
  color: #6b7280;
}

.auth-hint {
  margin: 10px 0;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 13px;
  background: #f8f9fb;
  border: 1px solid #e8ecf1;
}

.auth-btn {
  width: 100%;
  margin-top: 6px;
}

/* ── Cards ── */
.card {
  background: #fff;
  border: 1px solid #e8ecf1;
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 14px;
}

.row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ── Status pills ── */
.status-pill {
  display: inline-block;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 12px;
  border: 1px solid transparent;
  font-weight: 500;
}

.status-success {
  background: #ecfdf5;
  color: #047857;
  border-color: #d1fae5;
}

.status-failed {
  background: #fef2f2;
  color: #b91c1c;
  border-color: #fecaca;
}

.status-pending {
  background: #fffbeb;
  color: #b45309;
  border-color: #fde68a;
}

/* ── Metrics ── */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.metric {
  background: #f8f9fb;
  border: 1px solid #e8ecf1;
  border-radius: 12px;
  padding: 12px;
}

.metric-label {
  color: #8993a4;
  font-size: 12px;
  font-weight: 500;
}

.metric-value {
  font-weight: 700;
  margin-top: 6px;
  font-size: 16px;
  color: #1a1d23;
}

/* ── Jobs ── */
.jobs-list {
  display: grid;
  gap: 10px;
}

.job-item {
  border: 1px solid #e8ecf1;
  border-radius: 12px;
  padding: 12px;
  background: #fff;
  color: inherit;
  transition: background 120ms;
}

.job-item:hover {
  background: #f8f9fb;
}

/* ── Two-column layout ── */
.two-col {
  display: grid;
  grid-template-columns: minmax(0, 2.2fr) minmax(320px, 1fr);
  gap: 14px;
  align-items: start;
}

.job-detail-main {
  min-width: 0;
}

.job-overview-card {
  padding: 12px 14px;
  margin-bottom: 12px;
}

.job-overview-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.job-overview-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.job-overview-brand-text {
  min-width: 0;
}

.job-overview-title {
  font-weight: 700;
  font-size: 15px;
  line-height: 1.3;
}

.job-overview-id {
  color: #8993a4;
  font-size: 11px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  word-break: break-all;
}

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

.metric-grid-compact {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.metric-compact {
  background: #f8f9fb;
  border: 1px solid #e8ecf1;
  border-radius: 10px;
  padding: 8px 10px;
}

.metric-compact .metric-label {
  font-size: 11px;
}

.metric-compact .metric-value {
  font-size: 14px;
  margin-top: 4px;
}

.job-overview-meta {
  margin-top: 8px;
  font-size: 12px;
  color: #4b5563;
  line-height: 1.5;
}

.job-overview-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.job-overview-msg {
  margin: 8px 0 0;
  font-size: 13px;
  color: #374151;
}

/* ── Report ── */
.report-master-card {
  padding: 14px 16px 20px;
}

.report-master-card > h2 {
  margin: 0 0 14px;
  font-size: 15px;
  font-weight: 600;
  color: #374151;
}

.report-prose {
  max-width: 720px;
}

.report-section {
  scroll-margin-top: 16px;
  padding: 14px 16px !important;
  margin-bottom: 10px !important;
  background: #fdfdfe;
  border-color: #e8ecf1 !important;
  border-radius: 12px;
}

.report-section h3 {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: #1a1d23;
}

.report-section-content {
  white-space: pre-wrap;
  line-height: 1.8;
  font-size: 15px;
  color: #1f2937;
}

/* ── Section nav (sticky sidebar) ── */
.section-nav {
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  padding-right: 4px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.acceptance-rail-card {
  padding: 12px 14px;
  margin-bottom: 0 !important;
}

.acceptance-rail-card h3 {
  margin: 0 0 10px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #8993a4;
}

.acceptance-nav-links {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.acceptance-nav-links a {
  font-size: 13px;
  padding: 6px 8px;
  border-radius: 8px;
  color: #374151;
}

.acceptance-nav-links a:hover {
  background: #f1f3f7;
}

/* ── Buttons ── */
.btn {
  border: 1px solid #d4d8e0;
  background: #fff;
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: background 120ms, border-color 120ms;
}

.btn:hover {
  background: #f8f9fb;
  border-color: #c0c5cf;
}

.btn:active {
  transform: translateY(1px);
}

.btn-sm {
  padding: 6px 10px;
  font-size: 13px;
}

.btn-primary {
  background: #1a1d23;
  color: #fff;
  border-color: #1a1d23;
}

.btn-primary:hover {
  background: #2d3139;
}

/* ── Inputs ── */
.input,
.textarea {
  width: 100%;
  border: 1px solid #d4d8e0;
  border-radius: 10px;
  padding: 8px 10px;
  margin: 6px 0 10px;
  background: #fff;
  transition: border-color 150ms;
}

.input:focus,
.textarea:focus {
  outline: none;
  border-color: #94a3b8;
}

/* ── Charts ── */
.chart-block {
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid #f1f3f7;
}

.chart-block:last-child {
  border-bottom: 0;
  margin-bottom: 0;
  padding-bottom: 0;
}

.chart-caption {
  font-size: 12px;
  color: #8993a4;
  margin-top: 8px;
  line-height: 1.5;
}

.stats-kv {
  font-size: 12px;
  color: #374151;
  line-height: 1.65;
}

.stats-kv div {
  padding: 2px 0;
}

.empty {
  color: #9ca3af;
}

/* ── Mobile: hamburger button ── */
.mobile-hamburger {
  display: none; /* hidden on desktop */
  width: 36px; height: 36px; border-radius: 8px; border: none;
  background: transparent; cursor: pointer;
  align-items: center; justify-content: center;
  color: #475569;
}

/* ── Mobile: sidebar backdrop ── */
.mobile-sidebar-backdrop {
  display: none; /* hidden on desktop */
}

/* ── Responsive: Mobile (<768px) ── */
@media (max-width: 767px) {
  /* Show hamburger */
  .mobile-hamburger {
    display: flex;
  }

  /* Mobile sidebar: slide off-screen by default, slide in when .mobile-open */
  .app-sidebar {
    position: fixed !important;
    top: 0 !important; bottom: 0 !important; left: 0 !important;
    width: 280px !important;
    z-index: 40 !important;
    box-shadow: 4px 0 24px rgba(0,0,0,0.12) !important;
    border-right: none !important;
    transform: translateX(-100%) !important;
    transition: transform 250ms cubic-bezier(0.4, 0, 0.2, 1) !important;
  }

  .app-sidebar.mobile-open {
    transform: translateX(0) !important;
  }

  /* Show backdrop when sidebar is open */
  .mobile-sidebar-backdrop {
    display: block;
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    z-index: 35;
    background: rgba(0,0,0,0.3);
  }

  /* Layout fixes */
  .main-pane {
    margin-left: 0;
    padding: 12px;
  }

  .metric-grid,
  .metric-grid-compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .two-col {
    grid-template-columns: 1fr;
  }

  .section-nav {
    position: static;
    max-height: none;
    overflow: visible;
  }
}

/* ── Responsive: Tablet ── */
@media (max-width: 1100px) {
  .left-nav {
    position: static;
    width: auto;
    border-right: 0;
  }

  .main-pane {
    margin-left: 0;
  }

  .two-col {
    grid-template-columns: 1fr;
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metric-grid-compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .section-nav {
    position: static;
    max-height: none;
    overflow: visible;
  }
}
