/* =============================================================
   styles.css — All application styles
   Da-Qian Interior Design Material Calculator
   ============================================================= */

:root {
      --bg: #f5f4ef;
      --card: #ffffff;
      --ink: #1f2933;
      --muted: #667085;
      --line: #d0d5dd;
      --soft: #eef2f6;
      --accent: #2563eb;
      --accent2: #0f766e;
      --danger: #b42318;
      --warn: #b54708;
    }
    * { box-sizing: border-box; }
    body {
      margin: 0;
      font-family: Arial, "Noto Sans TC", "Microsoft JhengHei", sans-serif;
      background: var(--bg);
      color: var(--ink);
      line-height: 1.45;
    }
    header {
      padding: 22px 18px;
      background: #111827;
      color: #fff;
    }
    header h1 { margin: 0 0 6px; font-size: 24px; }
    header p { margin: 0; color: #d1d5db; }
    main { max-width: 1380px; margin: 0 auto; padding: 18px; }

    /* BC-25: Workspace gating — no project open means no editable fields. */
    .workspace-lock-banner {
      display: none;
      background: #fef3c7; border: 1px solid var(--warn); color: #92400e;
      border-radius: 10px; padding: 14px 16px; margin-bottom: 16px;
      font-weight: 700; font-size: 14px; text-align: center;
    }
    main.locked .workspace-lock-banner { display: block; }
    main.locked > *:not(.workspace-lock-banner) {
      pointer-events: none;
      opacity: 0.38;
      filter: grayscale(35%);
      user-select: none;
    }
    .card {
      background: var(--card);
      border: 1px solid var(--line);
      border-radius: 14px;
      padding: 16px;
      margin-bottom: 16px;
      box-shadow: 0 2px 10px rgba(16, 24, 40, 0.04);
    }
    .material-card { border: 2px solid #c7d7fe; background: #fbfcff; }
    .row { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; }
    .field { display: flex; flex-direction: column; gap: 6px; min-width: 150px; }
    .field.wide { min-width: 240px; }
    label { font-weight: 700; font-size: 13px; color: #344054; }
    input, textarea, select {
      font-family: inherit;
      font-size: 14px;
      border: 1px solid var(--line);
      border-radius: 8px;
      padding: 9px 10px;
      background: #fff;
      color: var(--ink);
      outline: none;
    }
    textarea { width: 100%; min-height: 90px; resize: vertical; }
    input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12); }
    button {
      border: 0;
      border-radius: 9px;
      padding: 9px 12px;
      font-weight: 700;
      cursor: pointer;
      background: var(--accent);
      color: #fff;
    }
    button.secondary { background: #475467; }
    button.green { background: var(--accent2); }
    button.danger { background: var(--danger); }
    button.light { background: var(--soft); color: var(--ink); border: 1px solid var(--line); }
    button.small { padding: 6px 9px; font-size: 12px; }
    .total-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
      gap: 12px;
    }
    .metric {
      border: 1px solid var(--line);
      border-radius: 12px;
      padding: 14px;
      background: #fbfcfe;
    }
    .metric .name { color: var(--muted); font-size: 13px; font-weight: 700; }
    .metric .value { font-size: 23px; font-weight: 800; margin-top: 4px; }
    .metric .zh { color: #475467; font-size: 13px; margin-top: 2px; }
    h2 { margin: 0 0 12px; font-size: 20px; }
    h3 { margin: 0; font-size: 18px; }
    .material-header, .floor-header { display:flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
    .table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
    table { width: 100%; border-collapse: collapse; min-width: 900px; background: #fff; }
    th, td { border-bottom: 1px solid var(--line); padding: 8px; text-align: left; vertical-align: middle; }
    th { background: #f2f4f7; font-size: 13px; color: #344054; }
    tr:last-child td { border-bottom: 0; }
    td.no { width: 52px; text-align: center; font-weight: 800; color: #475467; }
    td.actions { width: 100px; }
    .dim-input { width: 100%; min-width: 150px; }
    .minus-input { width: 100%; min-width: 260px; }
    .readonly { color: #344054; font-weight: 700; white-space: nowrap; }
    .hint { font-size: 13px; color: var(--muted); }
    .warning-box {
      border: 1px solid #fedf89;
      background: #fffaeb;
      color: #7a2e0e;
      border-radius: 12px;
      padding: 12px 14px;
      margin-top: 12px;
      display: none;
    }
    .warning-box ul { margin: 8px 0 0 20px; padding: 0; }
    .summary-table { min-width: 900px; }
    .copy-box {
      white-space: pre-wrap;
      background: #101828;
      color: #f9fafb;
      padding: 14px;
      border-radius: 12px;
      font-family: "Noto Sans TC", "Microsoft JhengHei", Arial, sans-serif;
      max-height: 420px;
      overflow: auto;
    }
    .pill {
      display: inline-block;
      padding: 4px 8px;
      border-radius: 999px;
      background: #e0f2fe;
      color: #075985;
      font-size: 12px;
      font-weight: 700;
    }
    .footer-note { font-size: 12px; color: var(--muted); margin-top: 10px; }
    .soft-section { border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: #fff; margin: 12px 0; }
    .price-section { border-color: #bbf7d0; background: #f7fef9; }
    .tile-section { border-color: #c7d7fe; background: #f8fbff; }

    /* Material group accent colors */
    .mat-color-0 { border-left: 5px solid #2563eb; }
    .mat-color-1 { border-left: 5px solid #0f766e; }
    .mat-color-2 { border-left: 5px solid #b45309; }
    .mat-color-3 { border-left: 5px solid #7c3aed; }
    .mat-color-4 { border-left: 5px solid #be123c; }
    .mat-color-5 { border-left: 5px solid #0369a1; }
    .mat-color-6 { border-left: 5px solid #4d7c0f; }
    .mat-color-7 { border-left: 5px solid #9333ea; }

    /* Floor summary bar */
    .floor-summary-bar {
      display: flex;
      flex-wrap: wrap;
      gap: 10px;
      background: #f2f4f7;
      border-radius: 10px;
      padding: 10px 14px;
      margin: 10px 0 6px;
      border: 1px solid var(--line);
    }
    .floor-summary-bar .fsb-item {
      display: flex;
      flex-direction: column;
      min-width: 110px;
    }
    .floor-summary-bar .fsb-label {
      font-size: 11px;
      font-weight: 700;
      color: var(--muted);
      text-transform: uppercase;
      letter-spacing: 0.04em;
    }
    .floor-summary-bar .fsb-value {
      font-size: 16px;
      font-weight: 800;
      color: var(--ink);
      margin-top: 2px;
    }

    /* Collapse toggle */
    .floor-collapse-btn {
      background: var(--soft);
      color: var(--ink);
      border: 1px solid var(--line);
      padding: 4px 9px;
      font-size: 12px;
      border-radius: 7px;
      cursor: pointer;
      font-weight: 700;
    }
    .floor-body { transition: none; }
    .floor-body.collapsed { display: none; }

    /* Material type radio buttons */
    .type-radio-group { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
    .type-radio-group label {
      display: flex; align-items: center; gap: 5px;
      cursor: pointer; font-weight: 600; font-size: 14px;
      padding: 6px 12px; border-radius: 8px;
      border: 1px solid var(--line); background: #fff;
      transition: background 0.1s;
    }
    .type-radio-group input[type=radio] { accent-color: var(--accent); width:16px; height:16px; }
    .type-radio-group label.active { background: #eff6ff; border-color: var(--accent); color: var(--accent); }
    @media (max-width: 700px) {
      main { padding: 10px; }
      header h1 { font-size: 20px; }
      .metric .value { font-size: 20px; }
    }

    /* PDF report / print export */
    #printReport { display: none; }
    .report-preview-note { font-size: 13px; color: var(--muted); margin-top: 8px; }

    .report-preview-panel {
      display: none;
      margin-top: 14px;
      border: 1px solid var(--line);
      border-radius: 12px;
      padding: 14px;
      background: #fff;
      max-height: 520px;
      overflow: auto;
    }
    .report-preview-panel h1 { font-size: 22px; margin: 0 0 6px; }
    .report-preview-panel h2 { font-size: 16px; margin: 18px 0 8px; border-bottom: 1px solid #98a2b3; padding-bottom: 4px; }
    .report-preview-panel h3 { font-size: 14px; margin: 14px 0 6px; }
    .report-preview-panel h4 { font-size: 13px; margin: 10px 0 4px; }
    .report-preview-panel p { margin: 4px 0; font-size: 12px; }
    .report-preview-panel table { width: 100%; border-collapse: collapse; margin: 6px 0 12px; font-size: 11px; min-width: 0; }
    .report-preview-panel th, .report-preview-panel td { border: 1px solid #98a2b3; padding: 4px 5px; vertical-align: top; }
    .report-preview-panel th { background: #eef2f6; }
    .report-preview-panel .report-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 8px 0 10px; }
    .report-preview-panel .report-metric { border: 1px solid #98a2b3; padding: 7px; border-radius: 6px; }
    .report-preview-panel .report-metric b { display: block; font-size: 12px; }
    .report-preview-panel .report-metric span { display: block; font-size: 15px; font-weight: 800; margin-top: 2px; }
    .report-preview-panel .small-note { font-size: 10px; color: #344054; }
    .report-preview-panel .right { text-align: right; }
    .status-note { margin-top: 10px; font-size: 13px; color: var(--muted); }

    /* Report styling - always active (not just @media print), and class-based
       (not ID-based) so it applies both to #printReport itself AND to the
       fully separate, isolated container used for PDF capture (see reports.js
       generateAndUploadReportPdf) - that isolation is what keeps PDF
       generation from ever being able to interfere with actual printing. */
    .report-content {
      font-family: Arial, "Noto Sans TC", "Microsoft JhengHei", sans-serif;
      color: #111827;
    }
    .report-content h1 { font-size: 22px; margin: 0 0 6px; }
    .report-content h2 { font-size: 16px; margin: 18px 0 8px; border-bottom: 1px solid #98a2b3; padding-bottom: 4px; }
    .report-content h3 { font-size: 14px; margin: 14px 0 6px; }
    .report-content h4 { font-size: 13px; margin: 10px 0 4px; }
    .report-content p { margin: 4px 0; font-size: 11px; }
    .report-content table { width: 100%; border-collapse: collapse; margin: 6px 0 12px; font-size: 10px; min-width: 0; }
    .report-content th, .report-content td { border: 1px solid #98a2b3; padding: 4px 5px; vertical-align: top; }
    .report-content th { background: #eef2f6; }
    .report-content .report-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 8px 0 10px; }
    .report-content .report-metric { border: 1px solid #98a2b3; padding: 7px; border-radius: 6px; }
    .report-content .report-metric b { display: block; font-size: 12px; }
    .report-content .report-metric span { display: block; font-size: 15px; font-weight: 800; margin-top: 2px; }
    .report-content .page-break { page-break-before: always; }
    .report-content .small-note { font-size: 10px; color: #344054; }
    .report-content .right { text-align: right; }

    @media print {
      @page { size: A4; margin: 12mm; }
      body { background: #fff; color: #111827; }
      /* #printReport is a direct child of <body> (sits right after </main>).
         Hiding its SIBLINGS with display:none (not visibility:hidden) actually
         collapses their height too - visibility:hidden alone leaves the huge,
         invisible <main> still occupying full page space, which is what was
         causing extra blank pages after the real report content. This also
         covers any modal/overlay automatically, since they're all direct body
         children too. */
      body > *:not(#printReport) { display: none !important; }
      #printReport {
        display: block !important;
        position: static;
        width: 100%;
      }
    }

    /* ── NEW: Project Info section ── */
    .proj-info-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
      gap: 10px;
      margin-top: 10px;
    }
    .proj-info-grid .field { min-width: 0; }

    /* ── NEW: Header with logo ── */
    .header-inner {
      display: flex;
      align-items: center;
      gap: 18px;
      max-width: 1380px;
      margin: 0 auto;
    }
    .header-logo {
      height: 68px;
      width: auto;
      object-fit: contain;
      flex-shrink: 0;
      border-radius: 6px;
      background: #fff;
      padding: 4px;
    }
    .header-text h1 { margin: 0 0 4px; font-size: 22px; }
    .header-text p { margin: 0; color: #d1d5db; font-size: 13px; }
    .header-company { font-size: 15px; font-weight: 700; color: #c9a84c; letter-spacing: 0.03em; margin-bottom: 2px; }

    /* ── NEW: Material image thumbnail on card ── */
    .mat-thumb-wrap {
      width: 64px; height: 64px; flex-shrink: 0;
      border-radius: 10px; overflow: hidden;
      border: 2px solid var(--line);
      background: #f2f4f7;
      display: flex; align-items: center; justify-content: center;
      cursor: pointer; position: relative;
    }
    .mat-thumb-wrap img {
      width: 100%; height: 100%; object-fit: cover;
    }
    .mat-thumb-placeholder {
      font-size: 22px; color: #c0c8d0; user-select: none;
    }
    .mat-thumb-wrap:hover::after {
      content: '📷';
      position: absolute; inset: 0;
      background: rgba(0,0,0,0.45);
      display: flex; align-items: center; justify-content: center;
      font-size: 20px; border-radius: 8px;
    }

    /* ── NEW: Per-card color swatch ── */
    .card-color-picker {
      display: flex; align-items: center; gap: 6px; flex-direction: column;
    }
    .card-color-picker label { font-size: 10px; font-weight: 700; color: #667085; margin: 0; }
    .card-color-picker input[type=color] {
      width: 36px; height: 28px; padding: 2px; cursor: pointer;
      border-radius: 6px; border: 1px solid var(--line);
    }

    /* ── Revision badge ── */
    .revision-badge {
      display: inline-flex; align-items: center; gap: 6px;
      padding: 4px 12px; border-radius: 999px;
      background: #f0f9ff; border: 1px solid #bae6fd;
      color: #0369a1; font-size: 12px; font-weight: 700;
    }
    .revision-changes {
      font-size: 11px; color: #344054; margin-top: 4px; padding-left: 2px;
    }
    .revision-changes li { margin: 2px 0; }
    .lib-modal-overlay {
      display: none; position: fixed; inset: 0;
      background: rgba(0,0,0,0.50); z-index: 9998;
      align-items: center; justify-content: center;
    }
    .lib-modal {
      background: #fff; border-radius: 16px; padding: 28px;
      width: min(960px, 96vw); max-height: 90vh; overflow-y: auto; overflow-x: hidden;
      box-shadow: 0 8px 40px rgba(0,0,0,0.22);
    }
    .lib-modal h2 { margin: 0 0 16px; font-size: 20px; }

    /* BB-07: Projects sliding panel */
    .projects-panel-overlay {
      display: none; position: fixed; inset: 0;
      background: rgba(0,0,0,0.40); z-index: 9997;
    }
    .projects-panel {
      position: fixed; top: 0; right: 0; height: 100vh; width: min(400px, 92vw);
      background: #fff; box-shadow: -8px 0 30px rgba(0,0,0,0.18);
      padding: 20px; overflow-y: auto;
      transform: translateX(100%); transition: transform 0.25s ease;
    }
    .projects-panel-overlay.open { display: block; }
    .projects-panel-overlay.open .projects-panel { transform: translateX(0); }
    .projects-panel-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
    .projects-panel-header h2 { margin: 0; font-size: 18px; }
    .project-row {
      border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-top: 10px;
    }
    .project-row.active { border-color: var(--accent); background: #eff6ff; }
    .project-row-name { font-weight: 700; font-size: 14px; }
    .project-row-meta { font-size: 11px; color: var(--muted); margin-top: 2px; }
    .project-row-actions { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
    .project-row-actions button, .project-row-actions .badge {
      font-size: 11px; padding: 4px 8px; border-radius: 6px; border: 1px solid var(--line);
      background: #f8fafc; color: var(--ink); cursor: pointer;
    }
    .project-row-actions .badge { background: var(--accent); color: #fff; border-color: var(--accent); cursor: default; }
    .lib-table {
      width: 100%; border-collapse: collapse; font-size: 13px;
      table-layout: fixed;
    }
    .lib-table th { background: #f2f4f7; border-bottom: 2px solid var(--line); padding: 8px 10px; text-align: left; }
    .lib-table td { border-bottom: 1px solid var(--line); padding: 8px 10px; vertical-align: middle; word-wrap: break-word; }
    .lib-table tr:last-child td { border-bottom: 0; }
    .lib-table .archived td { opacity: 0.45; }
    .lib-table col.col-img     { width: 72px; }
    .lib-table col.col-en      { width: 32%; }
    .lib-table col.col-zh      { width: 24%; }
    .lib-table col.col-actions { width: 180px; }
    .lib-color-dot {
      display: inline-block; width: 16px; height: 16px;
      border-radius: 50%; border: 1px solid rgba(0,0,0,0.15);
      vertical-align: middle;
    }
    .lib-img-thumb {
      width: 52px; height: 52px; object-fit: cover;
      border-radius: 8px; border: 1px solid var(--line);
      display: block;
      vertical-align: middle;
    }
    .lib-form-grid {
      display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
      margin-bottom: 16px;
    }
    .lib-form-grid .field { min-width: 0; }
    .lib-form-grid .field.full { grid-column: 1/-1; }
    .lib-archive-badge {
      display: inline-block; padding: 2px 8px;
      border-radius: 999px; background: #fef3c7; color: #92400e;
      font-size: 11px; font-weight: 700;
    }

    /* ── NEW: Autosave bar ── */
    .autosave-bar {
      display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
      padding: 8px 12px; background: #f8fafc;
      border: 1px solid var(--line); border-radius: 10px; margin-top: 12px;
      font-size: 13px;
    }
    .autosave-bar label { font-weight: 600; color: #344054; cursor: pointer; display: flex; align-items: center; gap: 6px; }
    .autosave-bar .as-status { color: var(--muted); font-size: 12px; }

    /* ── NEW: Area Categories ── */
    .category-chip {
      display: inline-flex; align-items: center; gap: 6px;
      padding: 4px 10px; border-radius: 999px;
      background: #e0f2fe; color: #0369a1;
      font-size: 12px; font-weight: 700;
      border: 1px solid #bae6fd; cursor: default;
    }
    .category-chip button {
      background: none; border: none; color: #0369a1;
      padding: 0; font-size: 13px; line-height: 1; cursor: pointer; font-weight: 800;
    }
    .category-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
    .cat-section { border: 1px solid #bfdbfe; background: #eff6ff; border-radius: 12px; padding: 12px; margin-bottom: 12px; }

    /* ── NEW: Validation warning rows ── */
    .row-warn td { background: #fffbeb !important; }
    .row-warn-msg { color: #b45309; font-size: 11px; font-weight: 700; display: block; }

    /* ── NEW: Chart container ── */
    .charts-row {
      display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 14px;
    }
    .chart-box {
      border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: #fff;
    }
    .chart-box h3 { margin: 0 0 10px; font-size: 14px; color: #344054; }
    .chart-box canvas { max-height: 220px; }
    .chart-empty { text-align: center; color: var(--muted); font-size: 13px; padding: 30px 0; }
    @media (max-width: 700px) {
      .charts-row { grid-template-columns: 1fr; }
      .header-logo { height: 48px; }
    }

/* ── Visual Material Picker (Change 2) ──────────────────────── */
.picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
  max-height: 320px;
  overflow-y: auto;
  padding: 4px 2px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fafafa;
}
.picker-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 6px 8px;
  border-radius: 10px;
  border: 2px solid transparent;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
  position: relative;
  text-align: center;
}
.picker-card:hover {
  border-color: #2563eb;
  box-shadow: 0 2px 10px rgba(37,99,235,0.12);
}
.picker-card.selected {
  border-color: #2563eb;
  background: #eff6ff;
}
.picker-thumb {
  width: 64px; height: 64px;
  border-radius: 8px;
  overflow: hidden;
  background: #f2f4f7;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  border: 1px solid var(--line);
}
.picker-thumb img { width: 100%; height: 100%; object-fit: cover; }
.picker-thumb-placeholder { font-size: 26px; color: #c0c8d0; }
.picker-name   { font-size: 12px; font-weight: 700; color: #1f2933; line-height: 1.2; }
.picker-zhname { font-size: 11px; color: #667085; line-height: 1.2; }
.picker-check  {
  position: absolute; top: 4px; right: 4px;
  background: #2563eb; color: #fff;
  border-radius: 50%; width: 18px; height: 18px;
  font-size: 11px; font-weight: 900;
  display: flex; align-items: center; justify-content: center;
}
.picker-empty {
  grid-column: 1/-1;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  padding: 28px 16px;
  line-height: 1.6;
}

/* ── Finalize Report button ───────────────────────────────── */
.btn-finalize {
  padding: 10px 22px;
  background: #166534;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}
.btn-finalize:hover { background: #14532d; }

/* ── Material card left-border identity color (Change 1) ───── */
/* The border-left is set inline via style attribute using --group-color.
   This rule ensures the card background tint also uses the group color. */
.material-card {
  border-left-width: 4px;
  border-left-style: solid;
}

/* ── Material Library modal — wider, no horizontal scroll ──── */
/* lib-table layout is defined in the main styles block above */

/* ── Report Viewer Modal (full-screen style) ─────────────────── */
.report-viewer-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.72);
  z-index: 10000;
  align-items: flex-start;
  justify-content: center;
  padding: 24px 16px;
  overflow-y: auto;
}
.report-viewer-modal {
  background: #fff;
  border-radius: 16px;
  width: min(1400px, 96vw);
  min-height: 60vh;
  box-shadow: 0 12px 60px rgba(0,0,0,0.32);
  display: flex;
  flex-direction: column;
  margin: auto;
}
.report-viewer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 2px solid #e5e7eb;
  background: #1f2933;
  border-radius: 16px 16px 0 0;
  flex-shrink: 0;
  gap: 12px;
  flex-wrap: wrap;
}
.report-viewer-toolbar-title {
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.report-viewer-toolbar-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}
.report-viewer-body {
  padding: 32px 36px;
  overflow-y: auto;
  flex: 1;
  background: #f8fafc;
}
.report-viewer-body h1 { font-size: 22px; margin: 0 0 6px; }
.report-viewer-body h2 { font-size: 16px; margin: 18px 0 8px; border-bottom: 1px solid #98a2b3; padding-bottom: 4px; }
.report-viewer-body h3 { font-size: 14px; margin: 14px 0 6px; }
.report-viewer-body h4 { font-size: 13px; margin: 10px 0 4px; }
.report-viewer-body p  { margin: 4px 0; font-size: 12px; }
.report-viewer-body table { width: 100%; border-collapse: collapse; margin: 6px 0 12px; font-size: 11px; }
.report-viewer-body th, .report-viewer-body td { border: 1px solid #98a2b3; padding: 4px 6px; vertical-align: top; }
.report-viewer-body th { background: #eef2f6; }
.report-viewer-body .report-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 8px 0 10px; }
.report-viewer-body .report-metric { border: 1px solid #98a2b3; padding: 7px; border-radius: 6px; }
.report-viewer-body .report-metric b { display: block; font-size: 12px; }
.report-viewer-body .report-metric span { display: block; font-size: 15px; font-weight: 800; margin-top: 2px; }
.report-viewer-body .small-note { font-size: 10px; color: #344054; }
.report-viewer-body .right { text-align: right; }
.report-viewer-body img { max-width: 100%; }
.btn-close-report {
  padding: 8px 18px;
  background: transparent;
  color: #d1d5db;
  border: 1px solid #4b5563;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.btn-close-report:hover { background: #374151; color: #fff; }

/* Phase B — server status badge: never relies on color alone (icon + text + glow) */
.server-badge {
  font-weight: 700;
  padding: 3px 10px;
  margin-left: 12px;
  border-radius: 20px;
  border: 2px solid transparent;
  transition: box-shadow 0.3s, border-color 0.3s;
}
.server-badge.server-online {
  border-color: #15803d;
  box-shadow: 0 0 8px 2px rgba(21, 128, 61, 0.9);
  animation: server-glow-online 1.6s ease-in-out infinite;
}
.server-badge.server-offline {
  border-color: #b91c1c;
  box-shadow: 0 0 8px 2px rgba(185, 28, 28, 0.6);
}
.server-badge.server-checking {
  border-color: #92400e;
  box-shadow: 0 0 6px 2px rgba(146, 64, 14, 0.5);
}
@keyframes server-glow-online {
  0%, 100% { box-shadow: 0 0 6px 1px rgba(21, 128, 61, 0.7); }
  50%      { box-shadow: 0 0 14px 4px rgba(21, 128, 61, 1); }
}
