/* ===== dc_acute_details_html (HTML form, scoped) =====
   Acute items breakdown dialog, opened by px_form_alert from
   dispatch_confirmation_html/_cards.py.

   Loaded eagerly from anvil.yaml native_deps.head_html. Every rule here comes
   from the form's old <style> block; nothing is added and nothing is dropped.

   SCOPE. Every rule is :where(.dcad-container), which adds zero specificity
   and so cannot change which rule wins -- EXCEPT the table family below, which
   names .dcad-container as a REAL ancestor class. Those rules sit on the same
   element as the shared .px-table / .px-table th and declare the same
   properties, and a head link loses a specificity tie with theme.css on
   order, so they win on specificity instead. The pairs that actually tie are
   .dcad-table vs .px-table (border-collapse, font-size), .dcad-table thead th
   vs .px-table th (font-size) and .dcad-section-sep td vs .px-table td
   (padding); the rest of the family takes the same treatment so the family
   internal order is unchanged.

   The root rule stays BARE and byte-identical, and carries exactly the
   declarations it carries today: this app does NOT apply the guide screen-root
   rule, and this form is a dialog body rather than a screen in
   any case.

   [data-theme="dark"] sits on <html>, an ancestor of the root, so the scope
   goes after it; where the dark rule SUBJECT is the root itself it stays bare,
   because :where(.dcad-container) [data-theme=...] .dcad-container would never
   match.

   NO DESIGNER GATE. Nothing here hides content that only JavaScript reveals,
   so there is no live class to gate on.

   @keyframes dcadFadeIn is already form-prefixed, so it needs no rename.
   No url(), no @font-face, no html rule and no :root block. .themed-scrollbar
   stays the dependency and is not declared here. */

.dcad-container {
  --accent: #22c55e;
  --accent-hover: #16a34a;
  --accent-subtle: rgba(34,197,94,0.1);
  --px-loading-accent: #22c55e;
  background: var(--px-bg-deep);
  padding: 24px;
  color: var(--px-text-primary);
  font-family: var(--px-font);
  animation: dcadFadeIn 0.4s ease both;
  position: relative;
}

@keyframes dcadFadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

:where(.dcad-container) .dcad-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

:where(.dcad-container) .dcad-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--px-text-primary);
  margin: 0;
  padding-left: 16px;
  border-left: 4px solid var(--accent);
}

:where(.dcad-container) .dcad-subtitle {
  font-family: var(--px-mono);
  font-size: 0.75rem;
  color: var(--px-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin-top: 2px;
}

:where(.dcad-container) .dcad-table-card {
  background: var(--px-bg-card);
  border-radius: 12px;
  box-shadow: var(--px-shadow-md);
  border: 1px solid var(--px-border);
  overflow: hidden;
  max-height: 500px;
  overflow-y: auto;
}

.dcad-container .dcad-table {
  border-collapse: separate;
  border-spacing: 0;
  font-size: 14px;
}

.dcad-container .dcad-table thead th {
  font-size: 0.8rem;
  border-right: 1px solid rgba(255,255,255,0.15);
}

.dcad-container .dcad-table thead th:last-child { border-right: none; }
.dcad-container .dcad-table thead th.dcad-th-center { text-align: center; }

.dcad-container .dcad-table tbody tr:hover {
  transform: translateX(4px);
}

.dcad-container .dcad-table td {
  color: var(--px-text-primary);
}

.dcad-container .dcad-table td.dcad-td-center { text-align: center; }

:where(.dcad-container) .dcad-bag-badge {
  display: inline-block;
  background: var(--accent);
  color: white;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 700;
  font-family: var(--px-mono);
}

:where(.dcad-container) .dcad-bag-date {
  display: block;
  margin-top: 4px;
  color: var(--px-text-muted);
  font-size: 0.7rem;
  font-weight: 600;
  font-family: var(--px-mono);
}

:where(.dcad-container) .dcad-patient-dob {
  color: var(--px-text-secondary);
  font-weight: 600;
}

:where(.dcad-container) .dcad-items-list {
  font-size: 0.8rem;
  color: var(--px-text-secondary);
  line-height: 1.6;
}

:where(.dcad-container) .dcad-bag-note {
  color: #f59e0b;
  font-style: italic;
  font-size: 0.7rem;
}

:where(.dcad-container) .dcad-storage-cd {
  color: #dc2626;
  font-weight: 700;
}

:where(.dcad-container) .dcad-storage-fridge {
  color: #2563eb;
  font-weight: 700;
}

:where(.dcad-container) .dcad-btn {
  border: none;
  padding: 8px 14px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.8rem;
  font-family: var(--px-font);
  cursor: pointer;
  transition: opacity 0.2s ease, transform 0.2s ease, background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  display: inline-block;
}

:where(.dcad-container) .dcad-btn:hover { transform: translateY(-1px); box-shadow: 0 2px 8px rgba(0,0,0,0.15); }
:where(.dcad-container) .dcad-btn:active { transform: translateY(0); }

:where(.dcad-container) .dcad-btn-defer {
  background: #2563eb;
  color: white;
  margin-right: 6px;
}
:where(.dcad-container) .dcad-btn-defer:hover { background: #1d4ed8; }

:where(.dcad-container) .dcad-btn-defer-limit {
  background: #dc2626;
  color: white;
  margin-right: 6px;
  opacity: 0.6;
  cursor: not-allowed;
}

:where(.dcad-container) .dcad-btn-convert {
  background: #f59e0b;
  color: white;
}
:where(.dcad-container) .dcad-btn-convert:hover { background: #d97706; }

:where(.dcad-container) .dcad-btn-disabled {
  background: var(--px-bg-elevated);
  color: var(--px-text-muted);
  border: 1px solid var(--px-border);
  opacity: 0.6;
  cursor: not-allowed;
}

:where(.dcad-container) .dcad-btn-processing {
  opacity: 0.5;
  cursor: not-allowed;
}

:where(.dcad-container) .dcad-defer-count {
  display: block;
  margin-top: 4px;
  font-size: 0.7rem;
  font-weight: 600;
}

:where(.dcad-container) .dcad-defer-count-warning { color: #dc2626; }
:where(.dcad-container) .dcad-defer-count-info { color: var(--px-text-muted); }
:where(.dcad-container) .dcad-defer-count-deferred { color: #f59e0b; font-weight: 700; }

.dcad-container .dcad-section-sep td {
  padding: 10px 12px;
  font-weight: 700;
  font-size: 0.85rem;
  border-top: 2px solid;
}

.dcad-container .dcad-section-deferred td {
  background: rgba(245, 158, 11, 0.08);
  border-top-color: #f59e0b;
  color: #d97706;
}

:where(.dcad-container) .dcad-row-deferred {
  background: rgba(245, 158, 11, 0.04);
}

:where(.dcad-container) .dcad-row-regular {
  background: var(--px-bg-card);
}

[data-theme="dark"] .dcad-container {
  background: var(--px-bg-deep);
}

[data-theme="dark"] :where(.dcad-container) .dcad-table-card {
  background: var(--px-bg-card);
}

[data-theme="dark"] .dcad-container .dcad-section-deferred td {
  background: rgba(245, 158, 11, 0.12);
  color: #fbbf24;
}

[data-theme="dark"] :where(.dcad-container) .dcad-row-deferred {
  background: rgba(245, 158, 11, 0.06);
}
