/* SHUAA Doser V2 (EXPERIMENTAL): mesma identidade da Guition (SHUAA Premium: grafite-azulado + verde-agua).
   Valores de components/gateway_ui/src/ui_internal.h. Os cartoes V2 sao escuros nos dois temas, como a tela fisica. */
:root {
  --v2-bg: #080c11;
  --v2-panel: #0f151d;
  --v2-card: #141c26;
  --v2-card2: #1a2431;
  --v2-line: #2b3a4c;
  --v2-text: #eef2f6;
  --v2-muted: #9fb0c3;
  --v2-accent: #2fb6c9;
  --v2-accent-d: #16808f;
  --v2-ok: #18b85e;
  --v2-warn: #f2a31b;
  --v2-crit: #e53b3f;
  --v2-chip: #3b4b60;
}

.v2-head h1 { letter-spacing: .2px; }
.v2-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 14px; }
.v2-card {
  background: var(--v2-card);
  color: var(--v2-text);
  border: 1px solid var(--v2-line);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}
button.v2-card { text-align: left; font: inherit; cursor: pointer; transition: border-color .15s, transform .15s; }
button.v2-card:hover, button.v2-card:focus-visible { border-color: var(--v2-accent); outline: none; transform: translateY(-1px); }
.v2-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.v2-muted { color: var(--v2-muted); }
.v2-small { font-size: 12px; margin-top: 3px; }
.v2-stats, .v2-facts { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--v2-muted); font-size: 14px; }
.v2-stats b, .v2-facts b { color: var(--v2-text); font-variant-numeric: tabular-nums; }
.v2-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap;
  background: var(--v2-chip); color: var(--v2-text);
}
.v2-chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .9; }
.v2-ok { background: rgba(24, 184, 94, .16); color: #4fd98a; }
.v2-warn { background: rgba(242, 163, 27, .16); color: #ffc15a; }
.v2-crit { background: rgba(229, 59, 63, .16); color: #ff7477; }
.v2-wait { background: rgba(47, 182, 201, .14); color: #6fd7e6; }
.v2-notice { border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; border: 1px solid var(--v2-line); }
.v2-notice.v2-ok { border-color: rgba(24, 184, 94, .4); }
.v2-notice.v2-warn { border-color: rgba(242, 163, 27, .4); }
.v2-notice.v2-crit { border-color: rgba(229, 59, 63, .4); }
.v2-notice.v2-wait { border-color: rgba(47, 182, 201, .4); }
.v2-empty, .v2-loading { color: var(--v2-muted); padding: 24px; text-align: center; background: var(--v2-card); border: 1px dashed var(--v2-line); border-radius: 14px; }
.v2-table-wrap { border-radius: 10px; overflow: hidden; border: 1px solid var(--v2-line); }
.v2-table { width: 100%; border-collapse: collapse; background: var(--v2-panel); color: var(--v2-text); font-size: 14px; }
.v2-table th { color: var(--v2-muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; text-align: left; padding: 10px 12px; }
.v2-table td { padding: 10px 12px; border-top: 1px solid var(--v2-line); vertical-align: middle; }
.v2-table td.v2-name { font-weight: 600; }
.v2-dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: 8px; vertical-align: -1px; box-shadow: 0 0 0 2px rgba(255, 255, 255, .08); }
.v2-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.v2-actions .btn { padding: 6px 10px; min-height: 0; }
.v2-primary { background: var(--v2-accent-d) !important; border-color: var(--v2-accent) !important; color: #fff !important; }
.v2-check { flex-direction: row; align-items: center; gap: 8px; }
.v2-gallons { display: flex; flex-wrap: wrap; gap: 14px; }
.v2-gallon { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 92px; text-align: center; }
.v2-gallon-bar {
  width: 52px; height: 72px; border-radius: 10px 10px 8px 8px; border: 2px solid var(--v2-line);
  background: var(--v2-panel); position: relative; overflow: hidden;
}
.v2-gallon-bar i { position: absolute; left: 0; right: 0; bottom: 0; background: linear-gradient(180deg, var(--v2-accent), var(--v2-accent-d)); }
@media (prefers-reduced-motion: reduce) { button.v2-card { transition: none; } }
@media (max-width: 640px) {
  .v2-card { padding: 12px; border-radius: 12px; }
  /* celular: cada receita vira um cartao, sem rolagem lateral */
  .v2-table thead { display: none; }
  .v2-table, .v2-table tbody, .v2-table tr, .v2-table td { display: block; width: 100%; }
  .v2-table tr { border-top: 1px solid var(--v2-line); padding: 10px 12px; }
  .v2-table tr:first-child { border-top: 0; }
  .v2-table td { border: 0; padding: 3px 0; display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
  .v2-table td[data-label]::before { content: attr(data-label); color: var(--v2-muted); font-size: 12px; min-width: 70px; }
  .v2-table td.v2-name { font-size: 16px; padding-bottom: 6px; }
  .v2-actions { justify-content: flex-start; padding-top: 8px !important; }
  .v2-modal .modal { width: calc(100vw - 24px); max-height: calc(100vh - 24px); overflow: auto; }
}

/* ---- Atualizacoes (OTA) ---- */
.ota-h2 { font-size: 16px; margin: 18px 0 10px; letter-spacing: .02em; }
.ota-num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.ota-strip p { margin: 6px 0 0; }
.ota-dev { position: relative; transition: border-color .2s; }
.ota-dev.ota-sel { border-color: var(--v2-accent); box-shadow: 0 0 0 1px var(--v2-accent) inset; }
.ota-dev.ota-live { border-color: rgba(47, 182, 201, .6); }
.ota-dev-id { display: flex; align-items: center; gap: 10px; min-width: 0; }
.ota-dev-id b { overflow-wrap: anywhere; }
.ota-ico { width: 34px; height: 34px; border-radius: 10px; flex: none; background: var(--v2-card2); border: 1px solid var(--v2-line); position: relative; }
.ota-ico::after { content: ""; position: absolute; inset: 9px; border-radius: 4px; border: 2px solid var(--v2-accent); }
.ota-ico-node::after { border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%; inset: 8px 10px; }
.ota-ver { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 10px; background: var(--v2-panel); border: 1px solid var(--v2-line); }
.ota-ver .ota-num { font-size: 20px; font-weight: 700; color: var(--v2-text); }
.ota-pick { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 10px; background: var(--v2-card2); cursor: pointer; font-size: 14px; }
.ota-pick input { width: 18px; height: 18px; accent-color: var(--v2-accent); }
.ota-pick.ota-off { opacity: .6; cursor: not-allowed; }
.ota-fw { text-align: left; font: inherit; color: var(--v2-text); cursor: pointer; }
.ota-fw .ota-num { font-size: 18px; }
.ota-fw.ota-sel { border-color: var(--v2-accent); box-shadow: 0 0 0 1px var(--v2-accent) inset; }
.ota-go { border-color: rgba(47, 182, 201, .45); }
.ota-devs, .ota-fws { align-items: start; }
.ota-steps { list-style: none; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; margin: 4px 0 2px; padding: 0; counter-reset: s; }
.ota-steps li { display: flex; flex-direction: column; align-items: center; gap: 5px; font-size: 10px; line-height: 1.15; min-width: 0; overflow-wrap: anywhere; color: var(--v2-muted); text-align: center; position: relative; }
.ota-steps li::before { content: ""; position: absolute; top: 6px; left: -50%; right: 50%; height: 2px; background: var(--v2-line); z-index: 0; }
.ota-steps li:first-child::before { display: none; }
.ota-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--v2-card2); border: 2px solid var(--v2-line); position: relative; z-index: 1; }
.ota-steps li.ok { color: var(--v2-text); }
.ota-steps li.ok .ota-dot { background: var(--v2-ok); border-color: var(--v2-ok); }
.ota-steps li.ok::before, .ota-steps li.now::before { background: var(--v2-ok); }
.ota-steps li.now { color: var(--v2-text); font-weight: 600; }
.ota-steps li.now .ota-dot { background: var(--v2-accent); border-color: var(--v2-accent); }
.ota-steps li.fail .ota-dot { background: var(--v2-crit); border-color: var(--v2-crit); }
.ota-steps li.fail { color: #ff7477; font-weight: 600; }
.ota-bar { height: 8px; border-radius: 6px; background: var(--v2-panel); border: 1px solid var(--v2-line); overflow: hidden; }
.ota-bar > div { height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--v2-accent-d), var(--v2-accent)); transition: width .6s ease; }
.ota-cancel { align-self: flex-start; }
.ota-hist { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ota-hist li { background: var(--v2-card); color: var(--v2-text); border: 1px solid var(--v2-line); border-left-width: 4px; border-radius: 10px; padding: 10px 12px; display: grid; gap: 3px; }
.ota-hist .ota-h-ok { border-left-color: var(--v2-ok); }
.ota-hist .ota-h-crit { border-left-color: var(--v2-crit); }
.ota-hist .ota-h-warn { border-left-color: var(--v2-warn); }
.ota-modal { position: fixed; inset: 0; background: rgba(0, 0, 0, .6); display: grid; place-items: center; z-index: 50; padding: 16px; }
.ota-dialog { width: min(560px, 100%); max-height: calc(100vh - 32px); overflow: auto; }
.ota-dialog h2 { margin: 0; font-size: 18px; }
.ota-dialog input[type=password], .ota-dialog input[type=text], .ota-dialog input[type=file] { width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--v2-line); background: var(--v2-card2); color: var(--v2-text); font: inherit; box-sizing: border-box; }
.ota-order { margin: 0; padding-left: 20px; display: grid; gap: 4px; }
.ota-err { color: #ff7477; min-height: 1em; }
.ota-ok { color: #4fd98a; }
.ota-up { display: grid; gap: 8px; }
.ota-avail { font-size: 12px; color: var(--v2-warn); }
.ota-avail b { color: var(--v2-text); }
.ota-rec { color: #4fd98a; }
.ota-bad-fw { color: #ff7477; }
.ota-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 14px 0 4px; }
.ota-kpi { background: var(--v2-card); border: 1px solid var(--v2-line); border-radius: 12px; padding: 10px 12px; display: grid; gap: 4px; min-width: 0; }
.ota-kpi > span { color: var(--v2-muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.ota-kpi > b { font-size: 22px; color: var(--v2-text); }
.ota-kpi > b.ota-kpi-s { font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.ota-kpi-crit { border-color: rgba(229, 59, 63, .55); }
.ota-kpi-crit > b { color: #ff7477; }
.ota-kpi-warn { border-color: rgba(242, 163, 27, .5); }
.ota-hf { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 10px; }
.ota-hf-b { border: 1px solid var(--v2-line); cursor: pointer; font: inherit; font-size: 12px; }
.ota-hf-b.on { background: var(--v2-accent-d); border-color: var(--v2-accent); }
.ota-hf-b:focus-visible, .ota-h-head:focus-visible { outline: 2px solid var(--v2-accent); outline-offset: 2px; }
.ota-hf-sum { margin-left: auto; }
.ota-h-head { all: unset; display: grid; gap: 3px; cursor: pointer; }
.ota-tl { list-style: none; margin: 6px 0 0; padding: 8px 0 0; border-top: 1px dashed var(--v2-line); display: grid; gap: 4px; font-size: 13px; }
.ota-tl li { display: grid; grid-template-columns: 64px 48px 1fr; gap: 8px; align-items: baseline; }
.ota-tl-t { color: var(--v2-muted); }
.ota-tl-d { color: var(--v2-muted); font-size: 12px; }
.ota-tl-crit b { color: #ff7477; }
.ota-tl-ok b { color: #4fd98a; }
.ota-tl-warn b { color: var(--v2-warn); }
@media (max-width: 760px) {
  .ota-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ota-hf-sum { margin-left: 0; width: 100%; }
  .ota-tl li { grid-template-columns: 58px 1fr; }
  .ota-tl-d { display: none; }
}
@media (prefers-reduced-motion: no-preference) {
  .ota-steps li.now .ota-dot { animation: ota-pulse 1.4s ease-in-out infinite; }
  .ota-live .ota-bar > div { background-size: 28px 28px; background-image: linear-gradient(90deg, var(--v2-accent-d), var(--v2-accent)), repeating-linear-gradient(45deg, rgba(255,255,255,.14) 0 8px, transparent 8px 16px); background-blend-mode: overlay; animation: ota-stripes 1s linear infinite; }
  @keyframes ota-pulse { 50% { box-shadow: 0 0 0 6px rgba(47, 182, 201, .18); } }
  @keyframes ota-stripes { to { background-position: 28px 0; } }
}
@media (max-width: 560px) {
  .ota-steps { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .ota-steps li span:last-child { font-size: 9px; }
}
