/* Canais abertos.
 *
 * A base vem da folha de hidrologia já em uso em técnicas compensatórias: painel,
 * cartões, verificações, abas, canvas e avisos são os mesmos componentes. Aqui
 * ficam apenas as peças que este produto acrescenta — o seletor de seção, a
 * entrada de seção levantada, os quadros de estado e o desenho do ressalto.
 */
@import url("../shared/ep-hidrologia.css");
@import url("../shared/ep-como-usar.css");

.section-picker {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-top: 4px;
}
.section-picker button {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: white;
  text-align: left;
}
.section-picker button strong { font-size: 12px; font-weight: 500; letter-spacing: -0.01em; }
.section-picker button small { font-size: 10px; color: var(--muted); line-height: 1.3; }
.section-picker button:hover { border-color: var(--chart-blue-light); }
.section-picker button[aria-pressed="true"] {
  border-color: var(--navy);
  background: var(--navy);
  box-shadow: 0 4px 13px rgb(17 24 22 / 18%);
}
.section-picker button[aria-pressed="true"] strong { color: #fff; }
.section-picker button[aria-pressed="true"] small { color: #a8e3cf; }

textarea {
  width: 100%;
  margin-top: 6px;
  padding: 9px 10px;
  border: 1px solid #c8d4dd;
  border-radius: 8px;
  background: white;
  color: var(--ink);
  font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  font-size: 11px;
  line-height: 1.55;
  resize: vertical;
}
textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgb(8 127 91 / 12%); outline: none; }

.switch-label {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 10px;
  font-size: 12px;
  font-weight: 500;
}
.switch-label input { width: 15px; height: 15px; margin: 0; accent-color: var(--blue); }

.identification {
  margin-top: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: white;
}
.identification summary {
  position: relative;
  padding: 13px 40px 13px 15px;
  color: var(--navy);
  font-size: 12px;
  font-weight: 600;
}
.identification summary::after {
  content: "+";
  position: absolute;
  top: 10px;
  right: 15px;
  color: var(--blue);
  font-size: 18px;
  font-weight: 400;
}
.identification[open] summary::after { content: "−"; }
.identification .field-grid { padding: 0 15px 15px; }
.identification label { font-size: 11px; }
.identification input {
  width: 100%;
  margin-top: 5px;
  padding: 8px 10px;
  border: 1px solid #c8d4dd;
  border-radius: 8px;
  font-size: 12px;
}

/* Quadros de estado hidráulico: uma linha por regime, colunas de grandezas. */
.state-table { margin-top: 12px; overflow: auto; border: 1px solid var(--line); border-radius: 11px; }
.state-table table { font-size: 11px; }
.state-table th, .state-table td { padding: 9px 11px; border-bottom: 1px solid var(--line); text-align: right; }
.state-table th:first-child, .state-table td:first-child { text-align: left; }
.state-table thead th { position: sticky; top: 0; background: #f4f7f6; color: var(--muted); font-size: 9.5px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; }
.state-table tbody tr:last-child td { border-bottom: 0; }
.state-table tbody th { font-weight: 550; text-align: left; }
.state-table .row-mark { display: inline-block; width: 9px; height: 9px; margin-right: 7px; border-radius: 2px; vertical-align: -1px; }

.panel-intro { margin: 0 0 4px; color: var(--muted); font-size: 12px; line-height: 1.55; }
.panel-intro strong { color: var(--ink); font-weight: 600; }

.figure-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-family: Georgia, serif;
  font-size: 12px;
  line-height: 1.5;
}

.quantities { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1px; margin-top: 12px; overflow: hidden; border: 1px solid var(--line); border-radius: 11px; background: var(--line); }
.quantities > div { padding: 12px 14px; background: white; }
.quantities dt { color: var(--muted); font-size: 9.5px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; }
.quantities dd { margin: 5px 0 0; font-size: 17px; font-weight: 500; }
.quantities dd small { margin-left: 3px; color: var(--muted); font-size: 11px; font-weight: 400; }

.empty-state {
  margin-top: 12px;
  padding: 18px 20px;
  border: 1px dashed #c3d2cc;
  border-radius: 11px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

@media (max-width: 1100px) {
  .section-picker { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Entrada de seção levantada em campo.
 *
 * A instrução fica junto do campo, não numa ajuda solta depois dele: quem digita
 * uma seção precisa saber o sentido, a unidade e o que acontece se errar antes
 * de digitar, não depois.
 */
.survey-guide {
  margin: 4px 0 14px;
  padding: 13px 15px;
  border-left: 3px solid var(--chart-blue-dark);
  border-radius: 0 8px 8px 0;
  background: #eef7f3;
}
.survey-guide strong { display: block; margin-bottom: 7px; color: var(--navy); font-size: 11.5px; font-weight: 600; }
.survey-guide ol { margin: 0; padding-left: 17px; color: #33504a; font-size: 11px; line-height: 1.55; }
.survey-guide li + li { margin-top: 5px; }
.survey-guide b { font-weight: 600; color: var(--ink); }

.survey-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 3px 12px;
  margin-top: 14px;
}
/* Sem a quebra, o rótulo é espremido a zero pelos botões — que não encolhem,
 * porque `.text-button` é nowrap — e o texto de um passa por cima do outro. */
.survey-head label { flex: 1 1 auto; min-width: 0; margin-top: 0; font-size: 12px; font-weight: 500; }
.survey-actions { display: flex; flex: 0 0 auto; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.file-button { cursor: pointer; }
.file-button:hover { text-decoration: underline; }
.survey-optional {
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 9px;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.survey-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  margin-top: 8px;
  padding: 0 10px;
}
.survey-columns.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.survey-columns span { color: var(--muted); font-size: 9px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; }

#survey-fields textarea { margin-top: 3px; }

.survey-status {
  margin: 7px 0 0;
  padding-left: 16px;
  font-size: 11px;
  line-height: 1.5;
  text-indent: -16px;
}
.survey-status::before { display: inline-block; width: 12px; margin-right: 4px; text-indent: 0; }
.survey-status.is-ok { color: #2b6b57; }
.survey-status.is-ok::before { content: "✓"; }
.survey-status.is-error { color: #a3312a; }
.survey-status.is-error::before { content: "!"; font-weight: 700; }
.survey-status.is-warn { color: #8a6212; }
.survey-status.is-warn::before { content: "△"; }
.survey-status:empty { display: none; }

/* ALINHAMENTO DOS CAMPOS DA GRADE.
 *
 * O label era `display: block`, então o campo começava onde o texto acabasse:
 * "Garantia temporal pretendida" ocupa duas linhas, "Anos mínimos de série"
 * ocupa uma, e os dois campos da mesma linha saíam em alturas diferentes.
 *
 * Coluna flexível com o campo empurrado para o fim resolve sem depender de o
 * rótulo caber numa linha — que é uma condição que nenhum texto em português
 * respeita por muito tempo. O `:not(.checkbox)` preserva a caixa de marcação,
 * que é deitada de propósito. */
.field-grid label:not(.checkbox) { display: flex; flex-direction: column; gap: 5px; }
.field-grid label:not(.checkbox) > .input-with-unit,
.field-grid label:not(.checkbox) > input,
.field-grid label:not(.checkbox) > select,
.field-grid label:not(.checkbox) > textarea { margin-top: auto; }
