:root {
  --tf04-ink: #102a43;
  --tf04-muted: #627d98;
  --tf04-line: #d9e2ec;
  --tf04-soft: #f5f8fb;
  --tf04-teal: #0f766e;
  --tf04-teal-soft: #e7f7f4;
  --tf04-shadow: 0 18px 48px rgba(16, 42, 67, 0.12);
}

#interventions.interventionsPage {
  width: 100%;
  min-width: 0;
  padding-bottom: 48px;
}

#interventions .modulePageHeader {
  align-items: center;
  margin-bottom: 22px;
}

#interventions .pageTitleIcon { color: var(--tf04-teal); }

#interventions .modulePrimaryAction {
  min-height: 44px;
  border: 1px solid #0b5f59;
  background: linear-gradient(135deg, #0f766e 0%, #0b5f59 100%);
  box-shadow: 0 9px 22px rgba(15, 118, 110, 0.2);
}

#interventions .interventionStats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

#interventions .interventionStats article {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 0;
  min-height: 88px;
  gap: 13px;
  padding: 16px 17px;
  overflow: hidden;
  border: 1px solid var(--tf04-line);
  border-radius: 14px;
  background: linear-gradient(145deg, #fff 0%, #f9fbfd 100%);
  box-shadow: 0 4px 14px rgba(16, 42, 67, 0.05);
  animation: tf04-rise 360ms both;
}

#interventions .interventionStats article:nth-child(2) { animation-delay: 45ms; }
#interventions .interventionStats article:nth-child(3) { animation-delay: 90ms; }
#interventions .interventionStats article:nth-child(4) { animation-delay: 135ms; }

#interventions .interventionStats article::after {
  position: absolute;
  inset: auto -22px -30px auto;
  width: 78px;
  height: 78px;
  border-radius: 50%;
  background: rgba(15, 118, 110, 0.05);
  content: "";
}

#interventions .interventionStats small {
  display: block;
  margin-bottom: 4px;
  color: var(--tf04-muted);
  font-size: 12px;
  font-weight: 700;
}

#interventions .interventionStats strong {
  color: var(--tf04-ink);
  font-size: 24px;
  line-height: 1;
  letter-spacing: -0.035em;
}

#interventions .operationToolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(240px, 340px) auto;
  align-items: end;
  gap: 12px;
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid var(--tf04-line);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 5px 18px rgba(16, 42, 67, 0.045);
}

#interventions .ticketSearch,
#interventions .operationToolbar .remoteSelect { min-width: 0; }

#interventions .operationToolbar input,
#interventions .operationToolbar .remoteSelectInput,
#interventions .filterButton { min-height: 44px; }

#interventions .filterButton {
  padding-inline: 20px;
  border-color: #b7c6d7;
  color: var(--tf04-ink);
  font-weight: 800;
  white-space: nowrap;
}

#interventions .operationPanel {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--tf04-line);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 8px 28px rgba(16, 42, 67, 0.06);
}

#interventions .panelTitle {
  padding: 16px 18px;
  border-bottom: 1px solid #e9eff5;
  background: linear-gradient(180deg, #fff 0%, #fbfcfe 100%);
}

#interventions .interventionCards {
  display: grid;
  gap: 10px;
  padding: 14px;
}

#interventions .interventionCards > article,
#interventions .interventionCards > .interventionCard {
  border: 1px solid var(--tf04-line);
  border-radius: 13px;
  background: #fff;
  box-shadow: 0 3px 10px rgba(16, 42, 67, 0.035);
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

#interventions .interventionCards > article:hover,
#interventions .interventionCards > .interventionCard:hover {
  border-color: #9fb3c8;
  box-shadow: 0 9px 22px rgba(16, 42, 67, 0.08);
  transform: translateY(-1px);
}

#interventionCreateDialog,
#interventionEditDialog {
  width: min(1440px, calc(100vw - 34px));
  max-width: none;
  max-height: min(94dvh, 1040px);
  padding: 0;
  overflow: hidden;
  border: 1px solid #cbd5e1;
  border-radius: 18px;
  background: #fff;
  box-shadow: var(--tf04-shadow);
}

#interventionCreateDialog { width: min(1180px, calc(100vw - 42px)); }

#interventionCreateDialog::backdrop,
#interventionEditDialog::backdrop {
  background: rgba(15, 35, 55, 0.58);
  backdrop-filter: blur(3px);
}

#interventionCreateDialog[open],
#interventionEditDialog[open] { animation: tf04-dialog-in 180ms ease-out both; }

#interventionCreateDialog > form,
#interventionEditDialog > form {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-height: inherit;
  margin: 0;
  overflow: hidden;
}

#interventions .dialogHeader {
  position: relative;
  flex: 0 0 auto;
  padding: 18px 22px;
  border-bottom: 1px solid var(--tf04-line);
  background: radial-gradient(circle at 92% -35%, rgba(15, 118, 110, 0.14), transparent 34%), linear-gradient(180deg, #fff 0%, #f8fbfd 100%);
}

#interventions .dialogHeader h3 {
  color: var(--tf04-ink);
  letter-spacing: -0.02em;
}

#interventions .dialogIcon {
  border: 1px solid #b7e1dc;
  background: var(--tf04-teal-soft);
  color: var(--tf04-teal);
}

#interventions .dialogClose {
  min-width: 40px;
  min-height: 40px;
  border-radius: 10px;
}

#interventions .operationForm,
#interventions .interventionSheetContent {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

#interventions .operationForm {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  padding: 22px;
  background: var(--tf04-soft);
}

#interventions .operationForm label,
#interventions .sheetFormGrid label,
#interventions .sheetMetricGrid label { min-width: 0; }

#interventions .operationForm input,
#interventions .operationForm textarea,
#interventions .sheetFormGrid input,
#interventions .sheetFormGrid textarea,
#interventions .sheetMetricGrid input,
#interventions .interventionMaterialComposer input {
  border-color: #c9d6e2;
  background: #fff;
  color: var(--tf04-ink);
}

#interventions .operationForm textarea {
  min-height: 108px;
  resize: vertical;
}

#interventions .interventionSheetContent {
  display: grid;
  gap: 16px;
  padding: 18px;
  background: linear-gradient(rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0.78)), repeating-linear-gradient(0deg, transparent 0, transparent 31px, #edf2f7 32px);
}

#interventions .sheetSection {
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--tf04-line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 4px 14px rgba(16, 42, 67, 0.04);
}

#interventions .sheetSectionHeading {
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e6edf4;
}

#interventions .sheetSectionHeading > div > span {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid #b7e1dc;
  border-radius: 10px;
  background: var(--tf04-teal-soft);
  color: var(--tf04-teal);
  font-size: 12px;
  font-weight: 900;
}

#interventions .sheetSectionHeading h4 {
  color: var(--tf04-ink);
  font-size: 15px;
  letter-spacing: -0.01em;
}

#interventions .sheetSectionHeading small { color: var(--tf04-muted); }

#interventions .sheetFormGrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

#interventions .sheetFormGrid textarea {
  min-height: 104px;
  resize: vertical;
}

#interventions .sheetMetricGrid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

#interventions .sheetMetricGrid > label {
  padding: 12px;
  border: 1px solid #d9e2ec;
  border-radius: 12px;
  background: #f9fbfd;
}

#interventions .sheetMetricGrid .metricTotal {
  border-color: #9dd8d1;
  background: var(--tf04-teal-soft);
}

#interventions .metricInput { margin-top: 7px; }
#interventions .metricInput input { min-width: 0; font-weight: 800; }
#interventions .interventionMaterialsHeading { gap: 12px; }

#interventions .interventionMaterialsSummary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid #d8e6e4;
  border-radius: 11px;
  background: #f4fbfa;
}

#interventions .interventionMaterialsSummary strong { color: var(--tf04-teal); }

#interventions .interventionMaterialComposer {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(120px, 170px) auto;
  align-items: end;
  gap: 12px;
  padding: 14px;
  border: 1px dashed #a9bccd;
  border-radius: 12px;
  background: #f8fafc;
}

#interventions .sheetChecklist,
#interventions .attachmentList,
#interventions .interventionMaterialsList {
  display: grid;
  gap: 9px;
}

#interventions .attachmentUploader {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px dashed #9fb3c8;
  border-radius: 12px;
  background: #f8fafc;
}

#interventions .attachmentFilePicker { min-width: 0; }

#interventions .signatureWorkspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.45fr);
  gap: 16px;
}

#interventions .signatureCanvasWrap {
  min-height: 190px;
  overflow: hidden;
  border: 1px solid #b9c9d8;
  border-radius: 12px;
  background: linear-gradient(180deg, transparent calc(100% - 38px), #d8e2eb calc(100% - 37px), transparent calc(100% - 36px)), #fff;
}

#interventions .sheetStatus {
  border: 1px solid #c7d4df;
  background: #eef3f7;
  color: #486581;
}

#interventions .sheetStickyFooter,
#interventions .dialogFooter {
  position: sticky;
  z-index: 4;
  bottom: 0;
  flex: 0 0 auto;
  padding: 14px 18px;
  border-top: 1px solid var(--tf04-line);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 -10px 24px rgba(16, 42, 67, 0.07);
  backdrop-filter: blur(10px);
}

#interventions .dialogPrimary,
#interventions .attachmentUploadButton,
#interventions .sheetInlineButton {
  min-height: 42px;
  border-radius: 10px;
}

#interventions .dialogPrimary {
  border-color: #0b5f59;
  background: linear-gradient(135deg, #0f766e, #0b5f59);
  box-shadow: 0 7px 16px rgba(15, 118, 110, 0.17);
}

#interventions .interventionInvoiceButton {
  min-height: 42px;
  border-radius: 10px;
  border-color: #b8c7d5;
  background: #eef3f7;
  color: var(--tf04-ink);
  font-weight: 800;
}

@keyframes tf04-rise {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes tf04-dialog-in {
  from { opacity: 0; transform: translateY(10px) scale(0.992); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 1100px) {
  #interventions .interventionStats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #interventions .operationToolbar { grid-template-columns: minmax(0, 1fr) minmax(230px, 0.72fr); }
  #interventions .operationToolbar .filterButton { grid-column: 1 / -1; }
  #interventions .sheetMetricGrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #interventions .signatureWorkspace { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  #interventions.interventionsPage { padding-bottom: 24px; }
  #interventions .modulePageHeader { align-items: stretch; }
  #interventions .modulePrimaryAction { width: 100%; justify-content: center; }
  #interventions .interventionStats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  #interventions .interventionStats article { min-height: 80px; padding: 12px; }
  #interventions .interventionStats strong { font-size: 21px; }
  #interventions .operationToolbar { grid-template-columns: 1fr; gap: 10px; padding: 11px; }
  #interventions .operationToolbar .filterButton { grid-column: auto; width: 100%; }
  #interventions .interventionCards { padding: 9px; }

  #interventionCreateDialog,
  #interventionEditDialog {
    width: 100vw;
    height: 100dvh;
    max-width: none;
    max-height: 100dvh;
    margin: 0;
    border: 0;
    border-radius: 0;
  }

  #interventionCreateDialog > form,
  #interventionEditDialog > form { height: 100dvh; max-height: 100dvh; }
  #interventions .dialogHeader { z-index: 5; padding: 13px 14px; }
  #interventions .interventionSheetHeader > div:first-child { min-width: 0; }
  #interventions .sheetHeaderActions { align-items: flex-end; }

  #interventions .sheetStatus {
    max-width: 130px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  #interventions .operationForm,
  #interventions .sheetFormGrid,
  #interventions .sheetMetricGrid,
  #interventions .interventionMaterialComposer,
  #interventions .attachmentUploader { grid-template-columns: 1fr; }

  #interventions .operationForm { gap: 13px; padding: 14px; }
  #interventions .operationForm textarea { min-height: 96px; }
  #interventions .interventionSheetContent { gap: 11px; padding: 10px; }
  #interventions .sheetSection { padding: 13px; border-radius: 12px; }

  #interventions .sheetSectionHeading,
  #interventions .interventionMaterialsHeading {
    align-items: flex-start;
    flex-direction: column;
  }

  #interventions .interventionMaterialsSummary { width: 100%; flex-wrap: wrap; }
  #interventions .signatureCanvasWrap { min-height: 170px; }

  #interventions .sheetStickyFooter,
  #interventions .dialogFooter {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 10px;
  }

  #interventions .sheetStickyFooter button,
  #interventions .dialogFooter button,
  #interventions .attachmentUploadButton,
  #interventions .sheetInlineButton {
    width: 100%;
    min-height: 46px;
    justify-content: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  #interventions .interventionStats article,
  #interventionCreateDialog[open],
  #interventionEditDialog[open] { animation: none; }

  #interventions .interventionCards > article,
  #interventions .interventionCards > .interventionCard { transition: none; }
}
