/*
 * Light theme, built on the exact palette already approved for Borroka's
 * own correspondence (see the Generate Correspondence letterhead) —
 * #9A8479 (taupe, sampled from the logo mark) as the one accent every
 * button/link/active-state/chart-hue traces back to, #6E5A50 (darker
 * taupe) for headings, #262626 body text, #595959 muted/secondary text.
 * Deliberately no @media (prefers-color-scheme: dark) block — the app
 * has no in-app theme toggle, and the brief is explicit: light
 * everywhere, not "light unless the OS says otherwise."
 *
 * Status colours (--status-good/-warning/-serious/-critical below) are
 * intentionally UNCHANGED from before this patch — they already are the
 * validated dataviz reference palette's own "status is fixed, never
 * themed" scale (see the dataviz skill's palette.md), so re-deriving them
 * from the taupe brand would be re-theming a scale that's explicitly not
 * supposed to follow the theme.
 */
:root {
  color-scheme: light;
  --surface-1: #faf8f5;
  --surface-page: #ffffff;
  --text-primary: #262626;
  --text-secondary: #595959;
  --text-muted: #595959;
  --text-heading: #6e5a50;
  --gridline: #e8e0d6;
  --baseline: #96826c;
  --border: rgba(38, 38, 38, 0.12);
  --series-1: #9a8479;
  --status-good: #0ca30c;
  --status-good-bg: #e6f6e6;
  --status-warning: #fab219;
  --status-warning-bg: #fef3dc;
  --status-serious: #ec835a;
  --status-serious-bg: #fce9e1;
  --status-critical: #d03b3b;
  --status-critical-bg: #fbe4e4;
  --status-violet: #4a3aa7;
  --status-violet-bg: #ece9fa;
  --status-neutral-bg: #f0ebe4;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--surface-page);
  color: var(--text-primary);
}

#app {
  min-height: 100vh;
}

a {
  color: var(--series-1);
}

/* ---------------- Connect screen ---------------- */

.connect-screen {
  max-width: 560px;
  margin: 10vh auto;
  padding: 32px;
  text-align: center;
}

.connect-screen h1 {
  margin-bottom: 8px;
}

.btn-row {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 16px;
  flex-wrap: wrap;
}

/* ---------------- Layout ---------------- */

.app-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* logo-full.jpg has a hard white edge (no transparency) — matches
   --surface-page exactly now that the app is light-only, so this no
   longer needs its own dark-mode-proof hardcoded background; kept
   explicit anyway since a plain white bar is what the mark is designed
   to sit on (the same presentation as the real Borroka letterhead). */
.brand-header {
  flex-shrink: 0;
  height: 76px;
  background: #ffffff;
  display: flex;
  align-items: center;
  padding: 0 28px;
  border-bottom: 1px solid var(--border);
}

.brand-header-logo {
  height: 52px;
  width: auto;
  display: block;
}

.layout {
  display: flex;
  flex: 1;
  min-height: 0;
}

.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--surface-1);
  border-right: 1px solid var(--border);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 100%;
  overflow-y: auto;
}

.brand {
  font-weight: 700;
  font-size: 1.1rem;
  padding: 8px 8px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* logo-mark.png is transparent (no baked-in background like logo-full.jpg),
   so on the taupe-tinted --surface-1 it needs its own light card behind it
   for real separation — background/padding on an <img> shows through the
   transparent PNG pixels, so this needs no wrapper element. This is the
   "icon mark alone, space is tight" placement per the brief; the fuller
   lockup goes in .brand-header above where there's room. */
.brand-icon {
  width: 28px;
  height: 28px;
  object-fit: contain;
  flex-shrink: 0;
  background: #ffffff;
  border-radius: 6px;
  padding: 3px;
  box-shadow: 0 0 0 1px var(--border);
}

.connect-logo {
  width: 96px;
  height: auto;
  margin: 0 auto 16px;
  display: block;
  background: #ffffff;
  border-radius: 16px;
  padding: 14px;
  box-shadow: 0 0 0 1px var(--border);
}

.nav-section-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  padding: 12px 8px 4px;
}

.nav-link {
  display: block;
  padding: 8px 8px 8px 10px;
  border-left: 3px solid transparent;
  border-radius: 6px;
  text-decoration: none;
  color: var(--text-primary);
  font-size: 0.92rem;
  line-height: 1.3;
  /* Long company names (e.g. "Mozambican Chemicals (Mochemco)") wrap to a
     second line rather than ellipsis-truncating — the sidebar's fixed width
     means truncation was hiding real, distinguishing parts of names. */
  white-space: normal;
  overflow-wrap: break-word;
}

/* .nav-company links get their border-left colour set inline per-company
   (app.js) — the reserved transparent border above keeps every other nav
   link's padding identical so nothing jumps when a colour is present. */

.nav-link:hover {
  background: var(--status-neutral-bg);
}

.nav-link.active {
  background: var(--series-1);
  color: #ffffff;
}

.btn-block {
  margin-top: 16px;
  width: 100%;
}

.content-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.main {
  padding: 24px 32px 64px;
  max-width: 1100px;
  width: 100%;
}

h1,
h2,
h3 {
  color: var(--text-heading);
}

h1 {
  font-size: 1.6rem;
  margin: 0 0 4px;
}

h2 {
  font-size: 1.1rem;
  margin: 32px 0 12px;
}

.muted {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 32px;
}

.section-header h2 {
  margin: 0;
}

/* ---------------- Banners ---------------- */

.banner-region {
  padding: 0 32px;
}

.banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-radius: 8px;
  margin-top: 16px;
  font-size: 0.9rem;
}

.banner-info {
  background: var(--status-neutral-bg);
  color: var(--text-secondary);
}

.banner-warn {
  background: var(--status-warning-bg);
  color: var(--text-primary);
}

.banner-error {
  background: var(--status-critical-bg);
  color: var(--text-primary);
}

.banner-close {
  background: none;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  color: inherit;
  line-height: 1;
}

/* ---------------- Stat tiles ---------------- */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.stat-tile {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
}

.stat-value {
  font-size: 1.6rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.stat-label {
  color: var(--text-muted);
  font-size: 0.82rem;
  margin-top: 2px;
}

/* ---------------- Bar chart ---------------- */

.bar-chart {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}

.bar-row {
  display: grid;
  grid-template-columns: 110px 1fr 40px;
  align-items: center;
  gap: 10px;
}

.bar-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bar-track {
  background: var(--gridline);
  border-radius: 4px;
  height: 12px;
  overflow: hidden;
}

.bar-fill {
  background: var(--series-1);
  height: 100%;
  border-radius: 4px;
}

.bar-count {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

/* ---------------- Tables ---------------- */

.data-table-wrap {
  overflow-x: auto;
  border-radius: 10px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.data-table th,
.data-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--gridline);
}

.data-table th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.row-link {
  cursor: pointer;
}

.row-link:hover {
  background: var(--status-neutral-bg);
}

.status-cell {
  color: var(--text-secondary);
  font-size: 0.8rem;
}

.empty-text {
  color: var(--text-muted);
  font-style: italic;
}

.notes-text {
  white-space: pre-wrap;
  color: var(--text-secondary);
  max-width: 70ch;
}

.warn-text {
  color: var(--status-serious);
}

.error-text {
  color: var(--status-critical);
}

/* ---------------- Badges ---------------- */

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-top: 8px;
}

.badge-active {
  background: var(--status-good-bg);
  color: var(--status-good);
}

.badge-inactive {
  background: var(--status-neutral-bg);
  color: var(--text-muted);
}

.badge-dormant {
  background: var(--status-warning-bg);
  color: var(--status-warning);
}

/* Shared status-tone badges — used by ui.js's toneBadge() for every
   state-like value in the app (Project Status, Task Status, Meeting
   Status, Deal Stage) so a status always carries real, consistent
   colour instead of one flat neutral shade regardless of what it says. */
.badge-tone-good {
  background: var(--status-good-bg);
  color: var(--status-good);
}
.badge-tone-warning {
  background: var(--status-warning-bg);
  color: var(--status-warning);
}
.badge-tone-critical {
  background: var(--status-critical-bg);
  color: var(--status-critical);
}
.badge-tone-neutral {
  background: var(--status-neutral-bg);
  color: var(--text-secondary);
}

.badge-status {
  background: var(--status-neutral-bg);
  color: var(--text-secondary);
}

/* ---------------- Buttons ---------------- */

.btn {
  font: inherit;
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  font-size: 0.88rem;
}

.btn-primary {
  background: var(--series-1);
  color: #ffffff;
}

.btn-secondary {
  background: transparent;
  border-color: var(--border);
  color: var(--text-primary);
}

.btn-small {
  padding: 4px 10px;
  font-size: 0.78rem;
  background: transparent;
  border-color: var(--border);
  color: var(--text-primary);
}

/* ---------------- Modal / forms ---------------- */

.modal {
  border: none;
  border-radius: 12px;
  padding: 0;
  background: var(--surface-1);
  color: var(--text-primary);
  width: min(560px, 92vw);
}

.modal::backdrop {
  background: rgba(0, 0, 0, 0.4);
}

.modal-form {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: 85vh;
  overflow-y: auto;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.form-field input,
.form-field select,
.form-field textarea {
  font: inherit;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid var(--baseline);
  background: var(--surface-page);
  color: var(--text-primary);
}

.form-error {
  min-height: 0;
}

/* ---------------- Phase 2: buttons / badges / actions ---------------- */

.btn-danger {
  color: var(--status-critical);
  border-color: var(--status-critical);
}

.actions-cell {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.badge-priority-low {
  background: var(--status-neutral-bg);
  color: var(--text-secondary);
}
.badge-priority-medium {
  background: var(--status-warning-bg);
  color: var(--status-warning);
}
.badge-priority-high {
  background: var(--status-serious-bg);
  color: var(--status-serious);
}
.badge-priority-urgent {
  background: var(--status-critical-bg);
  color: var(--status-critical);
}

.badge-action-create {
  background: var(--status-good-bg);
  color: var(--status-good);
}
.badge-action-update {
  background: var(--status-neutral-bg);
  color: var(--text-secondary);
}
.badge-action-delete {
  background: var(--status-critical-bg);
  color: var(--status-critical);
}

.nav-footer {
  margin-top: 8px;
  color: var(--text-muted);
  font-size: 0.82rem;
}

/* ---------------- Phase 2: Acting-as selector ---------------- */

.actor-box {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.actor-select {
  width: 100%;
  font: inherit;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid var(--baseline);
  background: var(--surface-page);
  color: var(--text-primary);
}

/* ---------------- Phase 2: checkbox list (meeting attendees) ---------------- */

.checkbox-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 180px;
  overflow-y: auto;
  border: 1px solid var(--baseline);
  border-radius: 6px;
  padding: 8px 10px;
  background: var(--surface-page);
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  color: var(--text-primary);
}

.checkbox-row input {
  width: auto;
}

/* ---------------- Phase 2: meeting minutes / action items ---------------- */

.minutes-view h2 {
  margin: 20px 0 6px;
}

.action-item-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.action-item-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
}

/* ---------------- Print (meeting minutes) ---------------- */

@media print {
  .sidebar,
  .banner-region,
  .no-print {
    display: none !important;
  }
  .layout {
    display: block;
  }
  .main {
    max-width: none;
    padding: 0;
  }
}

/* ---------------- Responsive ---------------- */

@media (max-width: 720px) {
  .layout {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .main {
    padding: 16px;
  }
  .banner-region {
    padding: 0 16px;
  }
  .bar-row {
    grid-template-columns: 90px 1fr 32px;
  }
}

/* ---------------- Patch: colour dots (Company/Staff) ---------------- */

/* Sized up from 10px and given a subtle ring so a company's own colour
   reads at a glance instead of needing a squint — this one shared
   component is what makes company colour show up consistently
   everywhere a company/staff member appears (task rows, meeting rows,
   dashboards, sidebar), not a per-view reimplementation. */
.colour-dot {
  display: inline-block;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(38, 38, 38, 0.06);
}

.dot-tag {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

/* ---------------- Patch: heading-critical (Overdue) ---------------- */

.heading-critical {
  color: var(--status-critical);
}

.attendee-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
}

/* ---------------- Patch: Category badges ---------------- */

.badge-category-compliance {
  background: var(--status-violet-bg);
  color: var(--status-violet);
}
.badge-category-operational {
  background: var(--status-neutral-bg);
  color: var(--text-secondary);
}

/* ---------------- Patch: Urgent Window ---------------- */

.urgent-panel {
  background: var(--status-warning-bg);
  border: 1px solid var(--status-warning);
  border-radius: 12px;
  padding: 20px;
  margin-top: 16px;
}

.urgent-panel h2 {
  margin-top: 0;
}

.urgent-panel h3 {
  margin: 20px 0 8px;
  font-size: 0.95rem;
}

/* ---------------- Patch: Calendar ---------------- */

.calendar-nav {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 16px 0;
}

.calendar-company-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.btn-pill {
  font: inherit;
  padding: 4px 12px 4px 8px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--surface-1);
  color: var(--text-primary);
  cursor: pointer;
  font-size: 0.82rem;
  display: inline-flex;
  align-items: center;
}

.btn-pill-off {
  color: var(--text-muted);
  opacity: 0.6;
}

.calendar-title {
  margin: 0;
  flex: 1;
  text-align: center;
  font-size: 1rem;
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 4px;
  color: var(--text-muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  text-align: center;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.calendar-cell {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-1);
  min-height: 100px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.calendar-cell-muted {
  opacity: 0.45;
}

.calendar-cell-today {
  border-color: var(--series-1);
  border-width: 2px;
}

.calendar-daynum {
  background: none;
  border: none;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-primary);
  text-align: left;
  padding: 0;
}

.calendar-events {
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow: hidden;
}

.calendar-chip {
  display: block;
  font-size: 0.76rem;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--status-neutral-bg);
  color: var(--text-primary);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.calendar-more {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.calendar-week {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}

.calendar-week-col {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-1);
  padding: 10px;
  min-height: 200px;
}

.calendar-day-agenda {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}

@media (max-width: 900px) {
  .calendar-grid,
  .calendar-week {
    grid-template-columns: 1fr;
  }
}

/* ---------------- Phase 3: Budget & Expenses ---------------- */

.badge-approval-pending-approval {
  background: var(--status-warning-bg);
  color: var(--status-warning);
}
.badge-approval-approved {
  background: var(--status-good-bg);
  color: var(--status-good);
}

.amount-cell {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ---------------- Phase 3: Documents ---------------- */

.document-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 8px 0 16px;
}

.document-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--surface-page);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
}

.document-row > span:nth-child(2) {
  font-weight: 600;
  flex: 1;
  min-width: 120px;
}

.document-add-box {
  margin-top: 4px;
}

.document-add-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ---------------- Phase 4: charts (Chart.js canvases) ---------------- */

.chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.chart-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
}

.chart-card h3 {
  margin: 0 0 12px;
  font-size: 0.95rem;
}

.chart-canvas-wrap {
  position: relative;
  height: 240px;
}

/* ---------------- Phase 4: Master Financial Statement ---------------- */

.reference-panel {
  background: var(--status-neutral-bg);
  border: 1px dashed var(--baseline);
  border-radius: 10px;
  padding: 16px;
  margin-top: 16px;
}

.reference-panel h3 {
  margin-top: 0;
}

.reference-cell {
  color: var(--text-secondary);
  border-left: 2px dashed var(--baseline);
}

/* ---------------- Patch: Task sub-heading grouping ---------------- */

.task-group-heading {
  margin: 20px 0 6px;
  font-size: 0.9rem;
}

/* ---------------- Patch: Financial Snapshot ---------------- */

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.financial-scenario-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.financial-scenario-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ---------------- Patch: Compliance Documents checklist ---------------- */

.badge-tier-required {
  background: var(--status-violet-bg);
  color: var(--status-violet);
}

.badge-tier-recommended {
  background: var(--status-neutral-bg);
  color: var(--text-secondary);
}

.badge-checklist-not-started {
  background: var(--status-warning-bg);
  color: var(--status-warning);
}

.badge-checklist-obtained {
  background: var(--status-good-bg);
  color: var(--status-good);
}

/* "Not Applicable" is a judgement call someone made, not a settled state
   like Obtained — flagged red (not neutral grey) so it stands out for
   review rather than blending in as if it were resolved. */
.badge-checklist-not-applicable {
  background: var(--status-critical-bg);
  color: var(--status-critical);
}

/* ---------------- Patch: Deals detail view ---------------- */

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px 24px;
  margin: 8px 0 16px;
}

.detail-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.88rem;
}

.detail-row > .muted {
  font-size: 0.75rem;
}

/* ---------------- Patch: Daily Workspace ---------------- */

.upcoming-list {
  margin: 8px 0 0;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.upcoming-list li {
  font-size: 0.9rem;
}

/* ---------------- Patch: Slide-over panel (Company -> Project -> Task/Document) ---------------- */

.panel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 40;
}

.panel-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(760px, 94vw);
  background: var(--surface-1);
  color: var(--text-primary);
  box-shadow: -8px 0 24px rgba(0, 0, 0, 0.25);
  transform: translateX(100%);
  transition: transform 0.25s ease;
  z-index: 41;
  display: flex;
  flex-direction: column;
}

.panel.open {
  transform: translateX(0);
}

.panel-titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--gridline);
  flex-shrink: 0;
}

.panel-close {
  border: none;
  background: none;
  color: var(--text-secondary);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
}

.panel-close:hover {
  color: var(--text-primary);
}

.panel-body {
  padding: 20px 24px 40px;
  overflow-y: auto;
  flex: 1;
}

.doc-viewer-frame {
  width: 100%;
  height: 78vh;
  border: 1px solid var(--gridline);
  border-radius: 8px;
}

.doc-viewer-image {
  max-width: 100%;
  max-height: 78vh;
  display: block;
  border-radius: 8px;
  border: 1px solid var(--gridline);
}

/* ---------------- Patch: shared currency-input widget ---------------- */

.currency-input {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--gridline);
  border-radius: 8px;
  background: var(--surface-page);
}

.currency-input .btn-row {
  gap: 12px;
  align-items: flex-end;
}

/* ---------------- Patch: Generate Correspondence ---------------- */

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

