/* ============================================================
   RenewDesk v2 — Design System
   Fonts loaded per-page via Google Fonts
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }

:root {
  --bg: #f5f3ee;
  --surface: #ffffff;
  --surface-2: #f2efe7;
  --surface-3: #e9e5da;
  --border: #e6e1d4;
  --border-2: #dcd6c6;
  --text: #15181a;
  --text-2: #5e635f;
  --text-3: #979b92;
  --accent: #0f9d76;
  --accent-2: #0b7c5e;
  --accent-soft: rgba(15,157,118,.13);
  --on-accent: #ffffff;
  --c-blue: #5b69e6;
  --c-amber: #e0902a;
  --good: #16a34a;
  --good-soft: rgba(22,163,74,.13);
  --warn: #cf8316;
  --warn-soft: rgba(207,131,22,.16);
  --bad: #df433f;
  --bad-soft: rgba(223,67,63,.13);
  --shadow: 0 1px 2px rgba(20,22,18,.04), 0 10px 26px rgba(20,22,18,.05);
  --sidebar-w: 254px;
}

/* ---- Base ---- */
html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* Override Tailwind body constraints */
body.rd-body {
  height: auto !important;
  min-height: 100vh !important;
  overflow: visible !important;
  flex-direction: row !important;
  background: var(--bg) !important;
}

::placeholder { color: var(--text-3); }
input[type=checkbox] { accent-color: var(--accent); cursor: pointer; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 8px; border: 2px solid var(--bg); }

/* ============================================================
   LAYOUT
   ============================================================ */
.rd-layout {
  display: flex;
  min-height: 100vh;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.rd-sidebar {
  width: var(--sidebar-w);
  flex: none;
  border-right: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 40;
}

.rd-sidebar-logo {
  padding: 22px 18px 18px;
  display: flex;
  align-items: center;
  gap: 11px;
  flex-shrink: 0;
}

.rd-logo-icon {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: linear-gradient(150deg, var(--accent), var(--accent-2));
  display: grid;
  place-items: center;
  color: #fff;
  flex: none;
}

.rd-logo-img {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  object-fit: contain;
  flex: none;
}

.rd-logo-text {
  font-size: 19px;
  font-weight: 700;
  font-family: 'Space Grotesk', sans-serif;
  letter-spacing: -0.01em;
  color: var(--text);
}

.rd-nav-label {
  padding: 8px 14px 6px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
}

.rd-nav-label + .rd-nav-label,
.rd-nav + .rd-nav-label {
  padding-top: 16px;
}

.rd-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 2px 12px;
}

.rd-nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-2);
  text-decoration: none;
  transition: background 0.12s, color 0.12s;
  line-height: 1;
}

.rd-nav-item:hover {
  background: var(--surface-2);
  color: var(--text);
}

.rd-nav-item.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}

.rd-nav-item svg { flex: none; }

.rd-nav-badge {
  margin-left: auto;
  background: var(--bad-soft);
  color: var(--bad);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  font-family: 'IBM Plex Mono', monospace;
}

.rd-sidebar-footer {
  margin-top: auto;
  padding: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
}

.rd-user-row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px;
  border-radius: 11px;
  cursor: default;
}

.rd-user-row:hover { background: var(--surface-2); }

.rd-user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 13px;
  flex: none;
  font-family: 'Space Grotesk', sans-serif;
}

.rd-user-info { flex: 1; min-width: 0; }

.rd-user-name {
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text);
}

.rd-user-role {
  font-size: 11px;
  color: var(--text-3);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.rd-logout-btn {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text-3);
  display: grid;
  place-items: center;
  cursor: pointer;
  flex: none;
  transition: background 0.12s, color 0.12s;
}

.rd-logout-btn:hover {
  background: var(--bad-soft);
  color: var(--bad);
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.rd-main {
  flex: 1;
  min-width: 0;
  padding: 30px 38px 70px;
  overflow-y: auto;
}

/* ============================================================
   PAGE HEADER
   ============================================================ */
.rd-page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.rd-page-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.025em;
  margin: 0;
  color: var(--text);
}

.rd-page-subtitle {
  color: var(--text-2);
  font-size: 15px;
  margin: 6px 0 0;
}

/* ============================================================
   CARDS
   ============================================================ */
.rd-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.rd-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}

.rd-card-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

/* ============================================================
   TABLES — override Tailwind to match v2
   ============================================================ */
.rd-table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.rd-table-wrap table {
  width: 100%;
  border-collapse: collapse;
}

.rd-table-wrap thead tr {
  background: var(--surface) !important;
}

.rd-table-wrap thead th {
  padding: 12px 20px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
  border-bottom: 1px solid var(--border);
  background: transparent !important;
}

.rd-table-wrap tbody tr:hover td {
  background: var(--surface-2);
}

.rd-table-wrap tbody td {
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

/* ============================================================
   TOOLBAR (search + filter row)
   ============================================================ */
.rd-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.rd-search-wrap {
  flex: 1;
  min-width: 240px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--border-2);
  background: var(--surface);
  border-radius: 12px;
  padding: 0 14px;
  box-shadow: var(--shadow);
}

.rd-search-wrap svg { flex: none; }

.rd-search-input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 13px 0;
  font-size: 14px;
  color: var(--text);
  outline: none;
  font-family: inherit;
}

.rd-search-input::placeholder { color: var(--text-3); }

.rd-filter-select {
  border: 1px solid var(--border-2);
  background: var(--surface);
  border-radius: 12px;
  padding: 13px 16px;
  font-size: 14px;
  color: var(--text);
  outline: none;
  font-family: inherit;
  cursor: pointer;
  box-shadow: var(--shadow);
  -webkit-appearance: none;
  -moz-appearance: none;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.rd-btn {
  border: none;
  border-radius: 999px;
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 700;
  font-family: 'Space Grotesk', sans-serif;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background 0.12s;
  line-height: 1;
}

.rd-btn-primary { background: var(--accent); color: var(--on-accent); }
.rd-btn-primary:hover { background: var(--accent-2); }

.rd-btn-outline {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-2);
}
.rd-btn-outline:hover { background: var(--surface-2); }

.rd-icon-btn {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  text-decoration: none;
  flex: none;
}
.rd-icon-btn:hover { background: var(--accent-soft); color: var(--accent); }
.rd-icon-btn.danger:hover { background: var(--bad-soft); color: var(--bad); }
.rd-icon-btn.success:hover { background: var(--good-soft); color: var(--good); }

/* ============================================================
   BADGES / PILLS
   ============================================================ */
.rd-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  font-family: 'IBM Plex Mono', monospace;
  white-space: nowrap;
}

.rd-badge-good { background: var(--good-soft); color: var(--good); }
.rd-badge-warn { background: var(--warn-soft); color: var(--warn); }
.rd-badge-bad  { background: var(--bad-soft);  color: var(--bad);  }
.rd-badge-neutral { background: var(--surface-3); color: var(--text-2); }
.rd-badge-accent { background: var(--accent-soft); color: var(--accent); }

.rd-status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
  flex: none;
}
.rd-dot-good { background: var(--good); }
.rd-dot-warn { background: var(--warn); }
.rd-dot-bad  { background: var(--bad);  }

/* Active project badge */
.rd-status-active {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--good-soft);
  color: var(--good);
  font-size: 12px;
  font-weight: 700;
}

/* ============================================================
   MODAL
   ============================================================ */
.rd-modal-overlay,
.rd-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(21,24,26,0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.rd-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  width: 100%;
  max-width: 520px;
  margin: 16px;
  box-shadow: 0 24px 60px rgba(20,22,18,.18);
  overflow: hidden;
}

.rd-modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.rd-modal-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.rd-modal-close {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 18px;
  line-height: 1;
  transition: background 0.12s;
}
.rd-modal-close:hover { background: var(--surface-2); color: var(--text); }

.rd-modal-body { padding: 24px; }

.rd-modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: var(--surface);
}

/* ============================================================
   FORM ELEMENTS
   ============================================================ */
.rd-form-group { margin-bottom: 0; }
.rd-form-group + .rd-form-group { margin-top: 16px; }
.rd-form-group + .rd-grid-2,
.rd-grid-2 + .rd-form-group { margin-top: 16px; }

.rd-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.rd-input,
.rd-select,
.rd-textarea {
  width: 100%;
  border: 1px solid var(--border-2);
  background: var(--surface-2);
  border-radius: 12px;
  padding: 12px 15px;
  font-size: 14px;
  color: var(--text);
  outline: none;
  font-family: inherit;
  transition: border-color 0.15s;
}

.rd-input:focus,
.rd-select:focus,
.rd-textarea:focus { border-color: var(--accent); background: var(--surface); }

.rd-select {
  cursor: pointer;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23979b92' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 18px;
}

.rd-radio-group { display: flex; gap: 8px; height: 42px; }
.rd-radio-option {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 13px; border: 1px solid var(--border-2); background: var(--surface-2);
  border-radius: 10px; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--text-2);
  line-height: 1; box-sizing: border-box;
  transition: border-color .15s, background .15s, color .15s;
}
.rd-radio-option input[type="radio"] { accent-color: var(--accent); margin: 0; cursor: pointer; flex: none; }
.rd-radio-option[data-value="Yes"]:has(input:checked) { border-color: var(--good); background: var(--good-soft); color: var(--good); }
.rd-radio-option[data-value="No"]:has(input:checked) { border-color: var(--bad); background: var(--bad-soft); color: var(--bad); }

.rd-textarea { resize: vertical; min-height: 90px; }

.rd-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
.rd-grid-2 > .rd-form-group + .rd-form-group { margin-top: 0; }

.rd-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; align-items: start; }
.rd-grid-3 > .rd-form-group + .rd-form-group { margin-top: 0; }

.rd-checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-top: 16px;
  cursor: pointer;
}

.rd-checkbox-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}

/* ============================================================
   ALERT / ERROR BOX
   ============================================================ */
.rd-alert-error {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--bad-soft);
  color: var(--bad);
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 18px;
}

/* ============================================================
   UTILITY
   ============================================================ */
.mono { font-family: 'IBM Plex Mono', monospace; }
.fw-bold { font-weight: 700; }
.color-good { color: var(--good) !important; }
.color-warn { color: var(--warn) !important; }
.color-bad  { color: var(--bad)  !important; }
.color-muted { color: var(--text-2) !important; }
.color-dimmer { color: var(--text-3) !important; }

/* Override Tailwind's bg-background-light with v2 bg */
.bg-background-light { background: var(--bg) !important; }
.dark\:bg-background-dark { background: var(--bg) !important; }

/* ============================================================
   MOBILE HAMBURGER BUTTON
   ============================================================ */
.rd-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
  flex: none;
}

/* ============================================================
   MOBILE RESPONSIVE
   ============================================================ */
@media (max-width: 800px) {
  .rd-sidebar {
    position: fixed;
    left: calc(-1 * var(--sidebar-w) - 10px);
    transition: left 0.25s ease;
    z-index: 200;
    box-shadow: none;
  }
  .rd-sidebar.open {
    left: 0;
    box-shadow: 4px 0 32px rgba(20,22,18,.14);
  }
  .rd-menu-btn { display: flex; }
  .rd-main { padding: 20px 18px 60px; }
  .rd-page-header { flex-direction: column; align-items: flex-start; gap: 12px; }
  .rd-page-header > div:last-child { width: 100%; }
}

/* ============================================================
   DATATABLES — shared styling for all list tables (DataTables v2)
   Scoped via .rd-card ancestor so it out-specifies the CDN stylesheet
   without needing per-page ID overrides.
   ============================================================ */
.rd-card div.dt-container { width: 100%; display: block; }
.rd-card .dt-info {
  float: left;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-3);
  font-family: inherit;
  white-space: nowrap;
  box-sizing: border-box;
}
.rd-card .dt-info .dt-info-num {
  font-weight: 700;
  font-family: 'IBM Plex Mono', monospace;
  color: var(--text-2);
}
.rd-card .dt-paging {
  float: right;
  padding: 11px 20px;
  border-top: 1px solid var(--border);
  box-sizing: border-box;
}
.rd-card .dt-paging nav { display: flex !important; gap: 6px !important; }
.rd-card .dt-paging .dt-paging-button {
  padding: 7px 13px !important;
  border-radius: 8px !important;
  border: 1px solid var(--border-2) !important;
  background: var(--surface) !important;
  color: var(--text) !important;
  font-size: 12.5px !important;
  font-family: inherit !important;
  cursor: pointer !important;
  min-width: 36px !important;
  line-height: 1.4 !important;
  font-weight: 500 !important;
  box-sizing: border-box !important;
  margin: 0 !important;
}
.rd-card .dt-paging .dt-paging-button:hover:not(.disabled):not(.current) {
  background: var(--surface-2) !important;
  color: var(--text) !important;
}
.rd-card .dt-paging .dt-paging-button.current,
.rd-card .dt-paging .dt-paging-button.current:hover {
  background: var(--accent) !important;
  color: #ffffff !important;
  border-color: var(--accent) !important;
  font-weight: 700 !important;
}
.rd-card .dt-paging .dt-paging-button.disabled,
.rd-card .dt-paging .dt-paging-button.disabled:hover {
  opacity: .4 !important;
  cursor: not-allowed !important;
  background: var(--surface) !important;
  border-color: var(--border-2) !important;
  color: var(--text) !important;
}
.rd-card .dt-autosize { clear: both; }
.rd-card table.dataTable thead th { cursor: pointer; position: relative; }
.rd-card table.dataTable thead th.dt-orderable-asc:hover,
.rd-card table.dataTable thead th.dt-orderable-desc:hover { color: var(--text-2); }

/* ============================================================
   REPORT BUILDER — drag-and-drop section list
   ============================================================ */
.rd-report-palette {
  display: flex; flex-wrap: wrap; gap: 8px;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.rd-report-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border-2);
  font-size: 12.5px; font-weight: 600; color: var(--text-2);
  cursor: pointer; transition: border-color .12s, color .12s;
}
.rd-report-chip:hover { border-color: var(--accent); color: var(--accent); }
.rd-report-chip.disabled { opacity: .4; cursor: not-allowed; pointer-events: none; }

.rd-report-list { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.rd-report-empty { text-align: center; padding: 40px 20px; color: var(--text-3); font-size: 13.5px; }

.rd-report-section {
  border: 1px solid var(--border); border-radius: 12px; background: var(--surface);
  overflow: hidden;
}
.rd-report-section.disabled { opacity: .55; }
.rd-report-section.sortable-ghost { opacity: .35; }
.rd-report-section.sortable-chosen { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }

.rd-report-section-head {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; background: var(--surface-2); cursor: pointer;
}
.rd-report-drag-handle {
  cursor: grab; color: var(--text-3); flex: none; display: flex; align-items: center;
  touch-action: none;
}
.rd-report-drag-handle:active { cursor: grabbing; }
.rd-report-section-title { flex: 1; font-size: 14px; font-weight: 700; }
.rd-report-section-actions { display: flex; gap: 4px; flex: none; }
.rd-report-section-body { padding: 14px 16px; border-top: 1px solid var(--border); }
.rd-report-section-body.collapsed { display: none; }

.rd-report-fields-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px 14px;
}
.rd-report-fields-grid .rd-form-group { margin-bottom: 0; margin-top: 0; }
.rd-report-fields-grid + .rd-report-repeat-table,
.rd-report-fields-grid + div > .rd-report-repeat-table { margin-top: 4px; }

/* Compact field sizing inside report section cards — applies in both the
   New (add) and Edit report flows, since they share this same markup. */
.rd-report-section-body .rd-label { margin-bottom: 7px; font-size: 12px; }
/* Some labels carry a "(target: ...)" hint and wrap to 2 lines while their
   row neighbors don't — pin a consistent label height so every input/select/
   radio-toggle in the same grid row starts at the same y position. */
.rd-report-fields-grid .rd-label { min-height: 32px; line-height: 1.35; display: block; }
.rd-report-section-body .rd-input,
.rd-report-section-body .rd-select,
.rd-report-section-body .rd-textarea { padding: 10px 13px; border-radius: 10px; font-size: 13.5px; }
.rd-report-section-body .rd-select { padding-right: 36px; }
.rd-report-fields-grid .rd-radio-group { width: auto; }
.rd-report-fields-grid .rd-radio-option { flex: none; min-width: 88px; padding: 8px 16px; }

.rd-report-repeat-table { width: 100%; border-collapse: collapse; margin-top: 10px; }
.rd-report-repeat-table th {
  text-align: left; font-size: 10.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  color: var(--text-3); padding: 6px 8px; border-bottom: 1px solid var(--border);
}
.rd-report-repeat-table td { padding: 5px 6px; border-bottom: 1px solid var(--border); vertical-align: top; }
.rd-report-repeat-table input { width: 100%; }

.rd-report-image-preview {
  width: 100%; max-width: 260px; border-radius: 8px; border: 1px solid var(--border);
  display: block; margin-top: 8px; object-fit: contain; background: var(--surface-2);
}

.rd-report-upload { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.rd-report-upload-btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 12px 15px; border-radius: 10px;
  background: var(--surface-2); border: 1px dashed var(--border-2);
  font-size: 12.5px; font-weight: 600; color: var(--text-2);
  cursor: pointer; transition: border-color .12s, color .12s, background .12s;
}
.rd-report-upload-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--surface); }
.rd-report-upload-btn.uploading { opacity: .6; pointer-events: none; }
.rd-report-upload-btn.uploading span::after { content: '…'; }
.rd-report-upload-btn input[type=file] { display: none; }
.rd-report-upload .rd-report-image-preview { flex-basis: 100%; margin-top: 0; }

.rd-report-gallery { display: flex; flex-direction: column; gap: 10px; }
.rd-report-gallery-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px;
}
.rd-report-gallery-item { position: relative; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); background: var(--surface-2); }
.rd-report-gallery-thumb { width: 100%; height: 100px; object-fit: cover; display: block; }
.rd-report-gallery-remove {
  position: absolute; top: 4px; right: 4px; background: rgba(0,0,0,.55); color: #fff;
  width: 24px; height: 24px; border-radius: 6px; border: none;
}
.rd-report-gallery-remove:hover { background: var(--bad); color: #fff; }

/* ---- Printable report view ---- */
.rd-report-print-section { margin-bottom: 26px; page-break-inside: avoid; }
.rd-report-print-title {
  font-size: 15px; font-weight: 700; margin: 0 0 10px;
  padding-bottom: 6px; border-bottom: 2px solid var(--border-2);
}
.rd-report-print-table { width: 100%; border-collapse: collapse; margin: 10px 0; }
.rd-report-print-table th, .rd-report-print-table td {
  text-align: left; padding: 7px 10px; border: 1px solid var(--border); font-size: 13px;
}
.rd-report-print-table th { background: var(--surface-2); font-weight: 700; }

@media print {
  .rd-sidebar, .rd-page-header .rd-menu-btn, .rd-no-print { display: none !important; }
  .rd-main { margin: 0 !important; padding: 0 !important; }
  body.rd-body { background: #fff !important; }
  .rd-card { box-shadow: none !important; border: none !important; }
}
