:root {
  --ink: #1f2927;
  --muted: #6c7773;
  --line: #e7ece8;
  --surface: #ffffff;
  --surface-soft: #f4f7f3;
  --page: #f6f8f5;
  --teal: #168d78;
  --teal-dark: #0d6557;
  --amber: #b26b20;
  --amber-soft: #fff5e8;
  --blue: #396b9b;
  --blue-soft: #edf5fc;
  --red: #b64c4d;
  --red-soft: #fff0ef;
  --shadow: 0 24px 70px rgba(31, 52, 45, .08), 0 3px 12px rgba(31, 52, 45, .04);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { overflow-x: hidden; }
body { margin: 0; min-width: 320px; color: var(--ink); background: var(--page); overflow-x: hidden; }
button, select { font: inherit; }
button, a, select { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid #3b9c8b; outline-offset: 3px; }

.prototype-bar { display: flex; gap: 18px; align-items: center; justify-content: space-between; padding: 9px 20px; color: #eaf8f3; background: #1d3b35; font-size: .78rem; letter-spacing: .01em; }
.prototype-bar > div { display: flex; align-items: center; gap: 8px; }
.prototype-dot { width: 7px; height: 7px; border-radius: 50%; background: #8ce0c5; box-shadow: 0 0 0 4px rgba(140,224,197,.14); }
.prototype-note { color: #a9c8bf; }
.state-picker { display: flex; align-items: center; gap: 9px; color: #b9d2cb; }
.state-picker span { font-size: .74rem; }
.state-picker select { min-width: 178px; border: 1px solid #52766c; border-radius: 8px; padding: 6px 28px 6px 9px; color: #f5fffb; background: #284c44; cursor: pointer; }

.page-shell { width: 100%; max-width: 1120px; min-height: calc(100vh - 88px); margin: 0 auto; padding: 34px 28px 64px; }
.app-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 62px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-size: 1.05rem; font-weight: 750; letter-spacing: -.04em; text-decoration: none; }
.brand-mark { display: grid; width: 30px; height: 30px; place-items: center; border-radius: 10px 10px 10px 3px; color: white; background: var(--teal); font-family: Georgia, serif; font-size: 1.3rem; font-weight: 700; transform: rotate(-8deg); }
.brand-accent { color: var(--teal); }
.avatar-button { width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 50%; color: var(--teal-dark); background: white; font-size: .8rem; font-weight: 750; cursor: pointer; }
.home-grid { width: 100%; max-width: 660px; min-width: 0; margin: 0 auto; }
.intro-row { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.eyebrow { margin: 0 0 9px; color: var(--teal); font-size: .78rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
h1 { max-width: 460px; margin: 0; font-size: clamp(1.75rem, 4vw, 2.5rem); line-height: 1.08; letter-spacing: -.055em; }
.secure-label { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: .75rem; white-space: nowrap; }
.secure-icon { display: grid; width: 20px; height: 20px; place-items: center; border-radius: 50%; color: var(--teal); background: #e2f2ed; font-size: 1rem; }

.snapshot { width: 100%; min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 28px; background: var(--surface); box-shadow: var(--shadow); }
.snapshot-body { padding: clamp(24px, 5vw, 44px); }
.hero-state { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-width: 0; margin-bottom: 28px; }
.hero-copy { min-width: 0; }
.hero-kicker { margin: 0 0 10px; color: var(--muted); font-size: .9rem; }
.hero-number { margin: 0; color: var(--ink); font-size: clamp(4.2rem, 17vw, 7.5rem); font-weight: 760; letter-spacing: -.1em; line-height: .86; }
.hero-number span { margin-left: 6px; color: var(--muted); font-size: .32em; font-weight: 650; letter-spacing: -.04em; }
.hero-state-label { display: inline-flex; align-items: center; gap: 8px; margin: 17px 0 0; font-size: 1.04rem; font-weight: 720; }
.hero-message { max-width: 440px; margin: 0; color: var(--ink); font-size: clamp(1.8rem, 5vw, 3rem); font-weight: 760; letter-spacing: -.055em; line-height: 1.03; }
.hero-support { max-width: 430px; margin: 16px 0 0; color: var(--muted); font-size: .98rem; line-height: 1.45; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--teal); }
.visual-bottle { position: relative; display: grid; width: 108px; height: 164px; flex: 0 0 auto; place-items: center; border: 2px solid #d6e3dc; border-radius: 32px 32px 21px 21px; background: #f6faf7; }
.visual-bottle::before { position: absolute; top: -15px; width: 34px; height: 18px; border: 2px solid #d6e3dc; border-bottom: 0; border-radius: 12px 12px 0 0; background: #f6faf7; content: ""; }
.visual-bottle::after { position: absolute; bottom: -7px; left: 12px; right: 12px; height: 8px; border-radius: 0 0 10px 10px; background: #dce9e2; content: ""; }
.bottle-level { position: absolute; right: 8px; bottom: 8px; left: 8px; height: var(--level, 60%); border-radius: 21px 21px 14px 14px; background: #bde6d8; opacity: .95; }
.bottle-level::after { position: absolute; top: 9px; right: 10px; width: 20px; height: 2px; border-radius: 2px; background: rgba(255,255,255,.72); content: ""; }
.bottle-mark { z-index: 1; color: #7aa395; font-family: Georgia, serif; font-size: 2rem; font-weight: 700; }
.hero-normal .status-dot { background: var(--teal); }
.hero-low .status-dot, .hero-very-low .status-dot { background: var(--amber); }
.hero-low .bottle-level { background: #f1c98d; }
.hero-very-low .hero-number { color: #9b5a16; }
.hero-very-low .bottle-level { background: #e7ad64; }
.hero-unknown .visual-bottle { opacity: .62; }
.hero-unknown .bottle-level { display: none; }
.hero-unknown .hero-number { color: #9aa6a1; }

.action-callout { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 0 0 24px; padding: 15px 16px; border: 1px solid #f1dfc6; border-radius: 16px; color: #704519; background: var(--amber-soft); }
.action-callout strong { display: block; margin-bottom: 3px; font-size: .91rem; }
.action-callout p { margin: 0; color: #876344; font-size: .82rem; line-height: 1.35; }
.action-meta { display: block; margin-top: 6px; color: #876344; font-size: .76rem; }
.action-icon { display: grid; width: 35px; height: 35px; flex: 0 0 auto; place-items: center; border-radius: 11px; color: #9b5a16; background: #ffe8c7; font-size: 1.1rem; }
.action-button { flex: 0 0 auto; border: 0; border-radius: 10px; padding: 10px 13px; color: white; background: var(--teal-dark); font-size: .8rem; font-weight: 750; cursor: pointer; }
.action-button[hidden] { display: none; }
.quiet-message { display: flex; align-items: flex-start; gap: 12px; margin: 0 0 24px; padding: 16px; border-radius: 16px; color: #40514c; background: var(--surface-soft); }
.quiet-message strong { display: block; margin-bottom: 4px; font-size: .93rem; }
.quiet-message p { margin: 0; color: var(--muted); font-size: .84rem; line-height: 1.4; }
.message-icon { display: grid; width: 34px; height: 34px; flex: 0 0 auto; place-items: center; border-radius: 11px; color: var(--teal-dark); background: #dff1eb; font-weight: 800; }
.message-warning { color: #78491b; background: var(--amber-soft); }
.message-warning .message-icon { color: #9b5a16; background: #ffe8c7; }
.message-error { color: #7e3c3e; background: var(--red-soft); }
.message-error .message-icon { color: var(--red); background: #ffdcd9; }
.message-neutral { color: #465954; background: #f1f5f2; }

.estimate-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding-top: 22px; border-top: 1px solid var(--line); }
.meta-item { min-width: 0; }
.meta-label { display: block; margin-bottom: 5px; color: var(--muted); font-size: .73rem; overflow-wrap: anywhere; }
.meta-value { color: var(--ink); font-size: .87rem; font-weight: 670; }
.meta-value.soft { color: var(--muted); font-weight: 550; }
.freshness-badge, .connectivity-badge { display: inline-flex; align-items: center; gap: 6px; }
.badge-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--teal); }
.badge-dot.offline { background: #a5794d; }
.badge-dot.stale { background: #9b7a43; }

.secondary-row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.compact-item { min-width: 0; }
.secondary-label { display: block; margin-bottom: 7px; color: var(--muted); font-size: .73rem; }
.secondary-value { color: var(--ink); font-size: .78rem; font-weight: 670; line-height: 1.3; }
.history-panel { border-top: 1px solid var(--line); }
.history-panel summary { padding: 17px clamp(24px, 5vw, 44px); color: var(--teal-dark); font-size: .83rem; font-weight: 720; cursor: pointer; list-style-position: inside; }
.history-content { padding: 0 clamp(24px, 5vw, 44px) 22px; color: var(--muted); font-size: .81rem; line-height: 1.5; }
.history-content p { margin: 0; }
.history-content strong { color: var(--ink); }
.app-message { min-height: 430px; display: grid; place-items: center; padding: 48px 28px; text-align: center; }
.app-message-inner { max-width: 360px; }
.app-message h2 { margin: 18px 0 8px; font-size: 1.55rem; letter-spacing: -.04em; }
.app-message p { margin: 0; color: var(--muted); font-size: .92rem; line-height: 1.5; }
.app-message .action-button { margin-top: 20px; }
.loading-orb { width: 46px; height: 46px; border: 3px solid #d9ebe5; border-top-color: var(--teal); border-radius: 50%; }
.app-symbol { display: grid; width: 52px; height: 52px; margin: 0 auto; place-items: center; border-radius: 17px; color: var(--teal-dark); background: #e2f2ed; font-size: 1.55rem; font-weight: 760; }
.app-symbol.error { color: var(--red); background: #ffe4e1; }

.prototype-footer { display: flex; justify-content: space-between; max-width: 1120px; margin: 0 auto; padding: 0 28px 24px; color: #83908b; font-size: .72rem; }

@media (max-width: 620px) {
  .prototype-bar { align-items: flex-start; flex-direction: column; gap: 9px; padding: 10px 14px; }
  .state-picker { width: 100%; justify-content: space-between; }
  .state-picker select { min-width: 0; width: min(210px, calc(100vw - 170px)); max-width: 210px; }
  .page-shell { width: 100vw; max-width: 100vw; padding: 24px 16px 42px; }
  .home-grid { width: 100%; max-width: 100%; }
  .snapshot { width: calc(100vw - 32px); max-width: calc(100vw - 32px); }
  .app-header { margin-bottom: 42px; }
  .intro-row { align-items: flex-start; flex-direction: column; gap: 13px; margin-bottom: 18px; }
  .secure-label { align-self: flex-start; }
  .snapshot { border-radius: 22px; }
  .snapshot-body { padding: 24px 20px; }
  .hero-state { display: block; }
  .hero-copy { min-width: 0; }
  .visual-bottle { display: none; }
  .visual-bottle::before { top: -12px; width: 26px; height: 14px; }
  .bottle-level { right: 6px; bottom: 6px; left: 6px; border-radius: 16px 16px 11px 11px; }
  .bottle-mark { font-size: 1.45rem; }
  .action-callout { align-items: flex-start; flex-wrap: wrap; }
  .action-button { margin-left: 47px; }
  .estimate-meta, .secondary-row { grid-template-columns: minmax(0, 1fr); }
  .secondary-row { gap: 12px; }
  .prototype-footer { flex-direction: column; gap: 6px; padding: 0 16px 20px; }
}
@media (min-width: 900px) {
  .home-grid { max-width: 760px; }
  .secondary-row { grid-template-columns: repeat(2, 1fr); }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; } }

/* M1: visual original preservado acima; componentes da aplicação local abaixo. */
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.skip-link { position: fixed; top: 8px; left: 8px; z-index: 5; padding: 12px; color: white; background: var(--teal-dark); transform: translateY(-160%); }
.skip-link:focus { transform: none; }
.demo-banner { display: flex; justify-content: center; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 18px; color: #fff; background: #1d3b35; font-size: .8rem; line-height: 1.5; text-align: center; }
.demo-banner span { color: #cee4dc; }
.app-header { margin-bottom: 26px; gap: 16px; }
.text-link { color: var(--teal-dark); font-weight: 700; text-underline-offset: 4px; line-height: 1.5; }
.main-nav { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 26px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.main-nav a { border-radius: 12px; padding: 11px 16px; color: #465954; text-decoration: none; font-size: .9rem; font-weight: 700; }
.main-nav a:hover { background: #e7f0eb; }
.main-nav a[aria-current] { background: var(--teal-dark); color: white; }
.demo-tools { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 16px 20px; margin-bottom: 30px; border: 1px dashed #b8cfc4; border-radius: 16px; background: #edf4ee; }
.demo-tools strong { font-size: .85rem; }
.demo-tools p { margin: 4px 0 0; font-size: .8rem; color: #465954; }
label { display: block; font-size: .82rem; font-weight: 700; color: #465954; }
select { display: block; width: 100%; margin-top: 7px; padding: 10px 12px; border: 1px solid #b8c9c0; border-radius: 10px; background: white; color: var(--ink); }
.intro-description { color: #55655e; line-height: 1.6; margin: 12px 0 0; }
h1 { max-width: 100%; }
h2 { font-size: 1.35rem; letter-spacing: -.03em; line-height: 1.3; }
p { line-height: 1.6; }
.muted { color: #55655e; font-size: .88rem; }
.snapshot { max-width: 820px; margin: 0 auto; }
.snapshot-body { padding: clamp(20px, 4vw, 36px); }
.device-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.device-card { min-width: 0; background: white; padding: 24px; border: 1px solid var(--line); border-radius: 24px; box-shadow: 0 10px 28px rgba(31,52,45,.04); }
.device-card h2 { margin: 16px 0 8px; }
.demo-pill { display: inline-block; border-radius: 8px; padding: 5px 9px; font-size: .72rem; font-weight: 700; color: var(--teal-dark); background: #e2f2ed; }
.card-kicker { font-size: .8rem; color: #55655e; margin: 24px 0 4px; }
.card-number { font-size: clamp(1.8rem, 3.4vw, 3rem); font-weight: 750; letter-spacing: -.06em; margin: 0; overflow-wrap: anywhere; }
.level-label { font-weight: 700; color: #40514a; }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; border-top: 1px solid var(--line); margin: 20px 0; padding-top: 20px; }
.facts div { min-width: 0; }
.facts dt { font-size: .76rem; color: #55655e; margin-bottom: 5px; }
.facts dd { font-size: .9rem; font-weight: 650; margin: 0; overflow-wrap: anywhere; }
.device-card .facts { grid-template-columns: 1fr; gap: 12px; }
.card-links { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); }
.device-chooser { max-width: 350px; margin-bottom: 20px; }
.action-button { display: inline-block; text-decoration: none; line-height: 1.5; min-height: 42px; }
.action-button:hover { background: #084c42; }
.action-button:disabled { background: #e7ece8; color: #55655e; cursor: default; }
.detail-disclosure { margin: 16px 0; padding: 18px; border: 1px solid var(--line); border-radius: 14px; }
.detail-disclosure summary { cursor: pointer; color: var(--teal-dark); font-weight: 700; line-height: 1.5; }
.detail-disclosure p { font-size: .9rem; }
.welcome { max-width: 680px; }
.welcome h2 { font-size: clamp(1.8rem, 5vw, 2.5rem); }
.welcome .action-button { margin-top: 14px; }
.demo-footer { margin-top: 42px; color: #55655e; font-size: .76rem; line-height: 1.8; text-align: center; }
.history-filter { display: flex; align-items: end; gap: 20px; justify-content: space-between; flex-wrap: wrap; }
.history-filter p { color: #55655e; font-size: .8rem; }
.empty-history { text-align: center; padding: 38px 0; }
.chart { margin: 28px 0; }
.chart figcaption { font-weight: 700; }
.chart-scroll { overflow-x: auto; }
.chart-plot { display: flex; gap: 14px; min-width: 400px; padding: 20px 12px 10px; background: #f4f7f3; border-radius: 14px; }
.chart-column { flex: 1; min-width: 30px; text-align: center; }
.chart-value, .chart-date { font-size: .72rem; color: #40514c; }
.bar-track { display: flex; align-items: end; justify-content: center; height: 150px; border-bottom: 1px solid #8ba79b; position: relative; background: repeating-linear-gradient(to top, transparent, transparent calc(25% - 1px), #e0e8e2 calc(25% - 1px), #e0e8e2 25%); margin: 8px 0; }
.chart-bar { width: min(32px, 75%); background: var(--teal); border-radius: 6px 6px 0 0; }
.chart-gap { align-self: center; font-size: 1.8rem; color: #64776b; }
.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: .8rem; text-align: left; }
caption { text-align: left; padding: 14px; font-weight: 700; }
th { background: #f4f7f3; color: #40514c; }
th, td { padding: 14px; border-top: 1px solid var(--line); vertical-align: top; }
td:first-child { min-width: 140px; }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 20px; font-size: .85rem; }
.number-unavailable { font-size: 2rem; }
.refresh-control { max-width: 820px; margin: 0 auto 18px; }
.refresh-control p { margin: 8px 0; }
.demo-tools label { min-width: 0; flex: 1; }
.physical-pill { display: inline-block; border: 1px solid #9fb9ad; border-radius: 999px; padding: 5px 10px; color: #254b3d; background: #edf5ef; font-size: .76rem; font-weight: 700; }
.physical-import-panel { margin-top: 18px; }
.physical-import-panel form { display: grid; gap: 12px; margin: 20px 0; }
.physical-import-panel textarea { box-sizing: border-box; width: 100%; min-height: 116px; resize: vertical; border: 1px solid #aabbb1; border-radius: 10px; padding: 12px; font: 500 .85rem/1.5 ui-monospace, Consolas, monospace; color: #172922; background: #fbfdfb; }
.physical-import-panel textarea:focus { outline: 3px solid #77b7a0; outline-offset: 2px; }
.physical-import-panel button:disabled { opacity: .55; cursor: not-allowed; }
.monitor-status-card { border: 1px solid #c7d4ce; border-radius: 12px; padding: 16px; margin: 10px 0 20px; background: #f7faf8; }
.monitor-status-card[data-state="RECEBENDO"] { border-color: #26744f; }
.monitor-status-card[data-state="DESATUALIZADO"], .monitor-status-card[data-state="DESCONECTADO"], .monitor-status-card[data-state="ERRO"] { border-color: #a64b35; }
.monitor-state-pill { display: inline-flex; align-items: center; min-height: 28px; border-radius: 999px; padding: 3px 11px; background: #e2e9e5; color: #263b31; font-weight: 750; }
.monitor-status-card[data-state="RECEBENDO"] .monitor-state-pill { background: #d7eee1; color: #145a35; }
.monitor-status-card[data-state="DESATUALIZADO"] .monitor-state-pill, .monitor-status-card[data-state="DESCONECTADO"] .monitor-state-pill, .monitor-status-card[data-state="ERRO"] .monitor-state-pill { background: #f8e5df; color: #762b1a; }
.monitor-recent-errors { margin: 0; padding-left: 20px; color: #704437; font: 500 .82rem/1.5 ui-monospace, Consolas, monospace; }
.physical-reading { margin: 18px 0; padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.physical-reading-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.physical-reading h3 { margin: 0; }
.weight-original { white-space: pre-wrap; overflow-wrap: anywhere; padding: 12px; border-radius: 8px; background: #f4f7f3; font-size: .78rem; }
@media (max-width: 1000px) { .device-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px) {
  .demo-tools { align-items: stretch; flex-direction: column; gap: 14px; }
  .main-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
  .main-nav a { padding: 12px 10px; font-size: .82rem; text-align: center; }
  .device-grid { grid-template-columns: 1fr; }
  .snapshot { width: 100%; max-width: 100%; }
  .facts { grid-template-columns: 1fr; gap: 14px; }
  .app-header { margin-bottom: 24px; }
  .app-header .text-link { font-size: .75rem; max-width: 130px; text-align: right; }
  .action-button { margin-left: 0; }
  .card-number { font-size: 2.6rem; }
  .pagination { gap: 7px; }
  .pagination .action-button { padding: 10px; }
  .history-filter label { width: 100%; }
}
