:root {
  --blue: #031279;
  --blue-700: #0a1f9a;
  --blue-50: #eef0fa;
  --welcome-bg: #1d268a;
  --ink: #12162e;
  --ink-2: #5b6080;
  --ink-3: #9196b0;
  --line: #e3e5ef;
  --bg: #f5f6fb;
  --card: #ffffff;
  --ok-bg: #e3f4ea; --ok: #1d6b3f;
  --wait-bg: #fff3d6; --wait: #8a5a00;
  --adj-bg: #fde6e4; --adj: #a3271c;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font-family: "DM Sans", system-ui, -apple-system, sans-serif; font-size: 16px; -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; padding: 0; }
textarea { font: inherit; }
img { display: block; }

/* splash + gates */
.splash { background: var(--welcome-bg) !important; }
.splash, .gate { min-height: 100vh; min-height: 100dvh; background: var(--blue) url(/icons/bg-tall.jpg) center/cover; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: calc(32px + var(--safe-top)) 28px calc(32px + var(--safe-bottom)); text-align: center; }
.splash-logo { width: 180px; height: auto; filter: drop-shadow(0 2px 12px rgba(3,18,121,.35)); }
.gate-box { background: rgba(255,255,255,.96); border-radius: 22px; padding: 28px 22px; max-width: 380px; width: 100%; color: var(--ink); }
.gate-box .logo-mark { width: 56px; height: 56px; border-radius: 14px; margin: 0 auto 14px; }
.gate-box h1 { font-size: 21px; font-weight: 600; margin: 0 0 8px; letter-spacing: -.01em; }
.gate-box p { font-size: 15px; line-height: 1.55; color: var(--ink-2); margin: 0 0 10px; }
.steps { text-align: left; margin: 18px 0 4px; padding: 0; list-style: none; counter-reset: s; }
.steps li { counter-increment: s; display: flex; gap: 12px; align-items: flex-start; font-size: 15px; line-height: 1.45; padding: 10px 0; border-top: 1px solid var(--line); }
.steps li::before { content: counter(s); flex: 0 0 26px; height: 26px; border-radius: 50%; background: var(--blue); color: #fff; font-size: 13px; font-weight: 600; display: flex; align-items: center; justify-content: center; }
.steps-note { font-size: 13px !important; color: var(--ink-3) !important; margin: 10px 0 0 !important; line-height: 1.45 !important; }
.steps-note .ti { font-size: 15px; vertical-align: -3px; }
.steps .ti { font-size: 19px; vertical-align: -4px; color: var(--blue); }

/* shell */
.top { position: sticky; top: 0; z-index: 5; background: var(--blue) url(/icons/bg-wide.jpg) center 40%/cover; color: #fff; padding: calc(14px + var(--safe-top)) 18px 16px; display: flex; align-items: center; gap: 12px; }
.top .back { width: 38px; height: 38px; border-radius: 50%; background: rgba(3,18,121,.55); display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }
.top .logo { height: 34px; width: auto; }
.top .who { margin-left: auto; text-align: right; line-height: 1.2; text-shadow: 0 1px 8px rgba(3,18,121,.6); min-width: 0; }
.top .who small { display: block; font-size: 12px; opacity: .85; }
.top .who b { font-weight: 600; font-size: 15px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .title { min-width: 0; text-shadow: 0 1px 8px rgba(3,18,121,.6); line-height: 1.25; }
.top .title small { display: block; font-size: 12px; opacity: .9; }
.top .title b { display: block; font-size: 16px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

main { padding: 16px 16px calc(96px + var(--safe-bottom)); max-width: 620px; margin: 0 auto; }
.install { display: flex; align-items: center; gap: 10px; background: var(--blue-50); color: var(--blue); border-radius: 14px; padding: 12px 14px; margin-bottom: 14px; font-size: 14px; }
.install button { margin-left: auto; background: var(--blue); color: #fff; padding: 8px 14px; border-radius: 99px; font-weight: 500; font-size: 14px; }
.section-h { font-size: 13px; font-weight: 600; color: var(--ink-2); text-transform: none; margin: 18px 4px 10px; display: flex; align-items: center; gap: 8px; }
.section-h:first-child { margin-top: 2px; }
.section-h .count { background: var(--blue); color: #fff; border-radius: 99px; font-size: 12px; padding: 1px 8px; }
.empty { text-align: center; color: var(--ink-2); padding: 48px 20px; font-size: 15px; line-height: 1.5; }
.empty .ti { font-size: 34px; color: var(--ink-3); display: block; margin-bottom: 8px; }

.card { display: flex; gap: 12px; align-items: center; width: 100%; text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 10px; margin-bottom: 10px; transition: transform .12s; }
.card:active { transform: scale(.985); }
.card.done { opacity: .78; }
.thumb { width: 62px; height: 78px; border-radius: 10px; background: var(--blue-50) center/cover no-repeat; flex-shrink: 0; position: relative; display: flex; align-items: center; justify-content: center; color: var(--blue); font-size: 22px; overflow: hidden; }
.thumb .badge { position: absolute; top: 4px; right: 4px; background: rgba(18,22,46,.7); color: #fff; font-size: 11px; border-radius: 6px; padding: 1px 5px; display: flex; align-items: center; gap: 2px; }
.card .meta { flex: 1; min-width: 0; }
.card .date { font-size: 13px; color: var(--ink-2); display: flex; align-items: center; gap: 4px; }
.card .name { font-size: 15px; font-weight: 600; margin: 3px 0 6px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .chev { color: var(--ink-3); font-size: 20px; }
.pills { display: flex; flex-wrap: wrap; gap: 5px; }
.pill { font-size: 12px; font-weight: 500; padding: 2px 9px; border-radius: 99px; display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.pill.fmt { background: var(--blue-50); color: var(--blue); }
.pill.pending { background: var(--wait-bg); color: var(--wait); }
.pill.approved { background: var(--ok-bg); color: var(--ok); }
.pill.adjust { background: var(--adj-bg); color: var(--adj); }
.pill.posted { background: #eceef3; color: var(--ink-2); }

/* detail */
.media { margin: -16px -16px 0; background: #0b0d1c; position: relative; }
.slides { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.slides::-webkit-scrollbar { display: none; }
.slide { flex: 0 0 100%; scroll-snap-align: center; aspect-ratio: 4/5; display: flex; align-items: center; justify-content: center; background: #0b0d1c; }
.slide img { width: 100%; height: 100%; object-fit: contain; }
.slide.tall { aspect-ratio: 9/16; max-height: 78vh; }
.counter { position: absolute; top: 12px; right: 12px; background: rgba(0,0,0,.6); color: #fff; font-size: 13px; border-radius: 99px; padding: 3px 10px; }
.dots { display: flex; justify-content: center; gap: 6px; padding: 10px 0 0; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: #c9ccdb; display: block; transition: all .2s; }
.dots i.on { background: var(--blue); width: 18px; border-radius: 4px; }
.swipe-hint { text-align: center; font-size: 13px; color: var(--ink-3); margin: 4px 0 0; }
.video-frame { width: 100%; aspect-ratio: 9/16; max-height: 78vh; border: 0; display: block; background: #000; }
video.video-frame { object-fit: contain; }
.no-media { aspect-ratio: 4/5; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #aab; gap: 8px; font-size: 14px; }
.no-media .ti { font-size: 30px; }
.drive-link { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 10px; padding: 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); font-size: 15px; font-weight: 500; color: var(--blue); text-decoration: none; }

.detail-head { margin: 16px 2px 12px; }
.detail-head h2 { font-size: 20px; font-weight: 600; margin: 8px 0 4px; line-height: 1.3; letter-spacing: -.01em; }
.detail-head .when { font-size: 14px; color: var(--ink-2); display: flex; align-items: center; gap: 6px; }
.note { background: var(--blue-50); border-radius: 14px; padding: 12px 14px; margin: 0 0 14px; font-size: 15px; line-height: 1.5; color: var(--ink); white-space: pre-wrap; }
.note b { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--blue); font-weight: 600; margin-bottom: 4px; }

.actions { position: sticky; bottom: 0; background: linear-gradient(to top, var(--bg) 75%, rgba(245,246,251,0)); padding: 14px 0 calc(14px + var(--safe-bottom)); margin-top: 6px; }
.row { display: flex; gap: 10px; }
.btn { flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 15px 12px; border-radius: 14px; font-size: 16px; font-weight: 600; border: 1px solid var(--line); background: var(--card); }
.btn.primary { background: var(--blue); color: #fff; border-color: var(--blue); }
.btn.ok { background: #1f8a50; color: #fff; border-color: #1f8a50; }
.btn[disabled] { opacity: .6; }
.state-msg { display: flex; gap: 10px; align-items: flex-start; border-radius: 14px; padding: 12px 14px; font-size: 15px; line-height: 1.45; margin-bottom: 10px; }
.state-msg.approved { background: var(--ok-bg); color: var(--ok); }
.state-msg.adjust { background: var(--adj-bg); color: var(--adj); }
.state-msg.posted { background: #eceef3; color: var(--ink-2); }
.state-msg .ti { font-size: 20px; margin-top: 1px; }
.link-btn { display: block; width: 100%; text-align: center; color: var(--ink-2); font-size: 14px; padding: 10px; text-decoration: underline; text-underline-offset: 3px; }
textarea.adj { width: 100%; min-height: 110px; border-radius: 14px; border: 1px solid var(--line); padding: 12px 14px; font-size: 16px; resize: vertical; background: var(--card); color: var(--ink); }
textarea.adj:focus { outline: 2px solid var(--blue); outline-offset: -1px; }
.err { color: var(--adj); font-size: 14px; margin: 6px 2px 0; }
.adj-label { font-size: 15px; font-weight: 600; margin: 0 2px 8px; }

/* feed */
.profile { display: flex; align-items: center; gap: 12px; margin: 2px 2px 12px; }
.profile .av { width: 52px; height: 52px; border-radius: 50%; background: var(--blue-50); color: var(--blue); font-weight: 600; font-size: 17px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; border: 2px solid var(--blue); }
.profile b { display: block; font-size: 16px; }
.profile small { font-size: 13px; color: var(--ink-2); }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; border-radius: 4px; overflow: hidden; }
.tile { aspect-ratio: 3/4; background: #dfe2ee center/cover no-repeat; position: relative; display: block; width: 100%; }
.tile .tag { position: absolute; left: 5px; bottom: 5px; background: rgba(18,22,46,.72); color: #fff; font-size: 11px; border-radius: 6px; padding: 2px 6px; }
.tile .ico { position: absolute; top: 5px; right: 5px; color: #fff; font-size: 16px; text-shadow: 0 1px 4px rgba(0,0,0,.6); }
.tile.unapproved::after { content: ""; position: absolute; inset: 3px; border: 2px dashed rgba(255,255,255,.95); border-radius: 3px; box-shadow: 0 0 0 1px rgba(0,0,0,.15); }
.tile.posted { filter: saturate(.55) brightness(.92); }
.tile .ph { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--blue); font-size: 24px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--ink-2); margin: 12px 2px 0; }
.legend span { display: flex; align-items: center; gap: 6px; }
.legend .sw { width: 14px; height: 18px; border-radius: 3px; background: #b7bdd6; }
.legend .sw.d { border: 2px dashed var(--ink-2); background: transparent; }
.legend .sw.p { background: #c6c9d4; }

/* tabbar */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; background: rgba(255,255,255,.96); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-top: 1px solid var(--line); display: flex; padding-bottom: var(--safe-bottom); }
.tabbar button { flex: 1; padding: 9px 0 10px; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 12px; color: var(--ink-3); font-weight: 500; }
.tabbar button .ti { font-size: 24px; }
.tabbar button.on { color: var(--blue); }

.toast { position: fixed; left: 50%; bottom: calc(84px + var(--safe-bottom)); transform: translateX(-50%); background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 99px; font-size: 14px; z-index: 20; box-shadow: 0 6px 20px rgba(0,0,0,.2); white-space: nowrap; }
.spinner { width: 28px; height: 28px; border: 3px solid var(--blue-50); border-top-color: var(--blue); border-radius: 50%; animation: spin .8s linear infinite; margin: 60px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* welcome (abertura do app) */
.welcome { position: fixed; inset: 0; z-index: 50; overflow: hidden; display: flex; align-items: center; justify-content: center; padding: 24px; background: var(--welcome-bg); transition: opacity .7s ease, visibility .7s; }
.welcome.out { opacity: 0; visibility: hidden; }
.welcome .glass { position: relative; width: 100%; max-width: 360px; padding: 34px 26px 28px; border-radius: 28px; text-align: center; color: #fff;
  background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.38);
  -webkit-backdrop-filter: blur(22px) saturate(150%); backdrop-filter: blur(22px) saturate(150%);
  box-shadow: 0 24px 60px rgba(3,18,121,.35), inset 0 1px 0 rgba(255,255,255,.45);
  animation: wglass .9s cubic-bezier(.2,.8,.2,1) .15s both; }
.welcome .wlogo { width: 112px; height: auto; margin: 0 auto 22px; animation: wline .7s ease .45s both; }
.welcome h1 { font-size: 30px; font-weight: 600; letter-spacing: -.02em; margin: 0 0 6px; line-height: 1.15; text-shadow: 0 2px 14px rgba(3,18,121,.45); animation: wline .7s ease .65s both; }
.welcome .w2 { font-size: 21px; font-weight: 500; margin: 0 0 14px; text-shadow: 0 2px 12px rgba(3,18,121,.45); animation: wline .7s ease .9s both; }
.welcome .w3 { font-size: 16px; margin: 0; opacity: .92; line-height: 1.45; animation: wline .7s ease 1.15s both; }
.welcome .wbar { height: 3px; border-radius: 3px; background: rgba(255,255,255,.25); margin: 24px auto 0; width: 64px; overflow: hidden; animation: wline .5s ease 1.2s both; }
.welcome .wbar i { display: block; height: 100%; background: #fff; transform-origin: left; animation: wbar 2.2s linear 1.3s both; }
@keyframes wglass { from { opacity: 0; transform: translateY(28px) scale(.94); } to { opacity: 1; transform: none; } }
@keyframes wline { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes wbar { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@media (prefers-reduced-motion: reduce) { .welcome *, .welcome { animation-duration: .01s !important; animation-delay: 0s !important; } }

.video-poster { display: flex; align-items: center; justify-content: center; aspect-ratio: 4/5; max-height: 70vh; width: auto; overflow: hidden; text-decoration: none; background: #0b0d1c; }
.video-poster img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .85; }
.video-poster .play { position: relative; width: 74px; height: 74px; border-radius: 50%; background: rgba(255,255,255,.92); color: var(--blue); display: flex; align-items: center; justify-content: center; font-size: 34px; box-shadow: 0 8px 30px rgba(0,0,0,.35); }
.video-poster .play .ti { margin-left: 4px; }
.video-poster .poster-label { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); background: rgba(0,0,0,.6); color: #fff; font-size: 14px; font-weight: 500; padding: 6px 14px; border-radius: 99px; white-space: nowrap; }
.video-poster:active .play { transform: scale(.94); }
.drive-cover { display: flex; align-items: center; justify-content: center; aspect-ratio: 4/5; max-height: 70vh; overflow: hidden; text-decoration: none; background: var(--welcome-bg); }
.drive-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .4; }
.drive-msg { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; color: #fff; text-align: center; font-size: 15px; line-height: 1.45; padding: 0 28px; text-shadow: 0 1px 10px rgba(3,18,121,.6); }
.drive-msg small { font-size: 13px; opacity: .85; }
.drive-msg b { font-size: 19px; font-weight: 600; }
.drive-msg .arrow { font-size: 26px; margin-top: 6px; animation: nudge 1.4s ease-in-out infinite; }
@keyframes nudge { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(6px); } }
.drive-btn { margin-top: 12px; text-decoration: none; width: 100%; }
