/* NFC Tools Web — estilos (mobile-first, tema claro/escuro) */

:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #eef2f8;
  --surface-3: #e4e9f2;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #5b6478;
  --accent: #2f6bff;
  --accent-2: #00b8d4;
  --accent-ink: #ffffff;
  --accent-soft: color-mix(in srgb, var(--accent) 12%, transparent);
  --ok: #16a34a;
  --warn: #d97706;
  --danger: #dc2626;
  --shadow: 0 1px 2px rgb(15 23 42 / .05), 0 6px 24px rgb(15 23 42 / .06);
  --shadow-lg: 0 20px 60px rgb(15 23 42 / .25);
  --radius: 18px;
  --radius-sm: 12px;
  --tabbar-h: 64px;
  --topbar-h: 56px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1120;
    --surface: #121a2e;
    --surface-2: #19233c;
    --surface-3: #222e4b;
    --border: #243150;
    --text: #e8edf7;
    --muted: #94a3bf;
    --accent: #5b8cff;
    --accent-2: #22d3ee;
    --accent-soft: color-mix(in srgb, var(--accent) 18%, transparent);
    --ok: #22c55e;
    --warn: #f59e0b;
    --danger: #f43f5e;
    --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 8px 28px rgb(0 0 0 / .25);
    --shadow-lg: 0 24px 70px rgb(0 0 0 / .6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b1120;
  --surface: #121a2e;
  --surface-2: #19233c;
  --surface-3: #222e4b;
  --border: #243150;
  --text: #e8edf7;
  --muted: #94a3bf;
  --accent: #5b8cff;
  --accent-2: #22d3ee;
  --accent-soft: color-mix(in srgb, var(--accent) 18%, transparent);
  --ok: #22c55e;
  --warn: #f59e0b;
  --danger: #f43f5e;
  --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 8px 28px rgb(0 0 0 / .25);
  --shadow-lg: 0 24px 70px rgb(0 0 0 / .6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font);
  min-height: 100dvh;
  overflow-x: hidden;
}
a { color: var(--accent); text-decoration: none; }
button { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
p { margin: 0; }
code { font-family: var(--mono); font-size: .9em; background: var(--surface-2); padding: 1px 5px; border-radius: 6px; }
[hidden] { display: none !important; }
.ic { display: inline-flex; flex: none; align-items: center; justify-content: center; }
.ic svg { display: block; }

/* ---------- utilitários ---------- */
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack-xs { display: flex; flex-direction: column; gap: 6px; }
.grow { flex: 1 1 auto; }
.min0 { min-width: 0; }
.center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: var(--mono); font-size: .92em; }
.pre { white-space: pre-wrap; }
.break { overflow-wrap: anywhere; word-break: break-word; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.err { color: var(--danger); font-size: 13px; }

/* ---------- casca ---------- */
#app { min-height: 100dvh; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.6) blur(14px);
  -webkit-backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
  padding-top: env(safe-area-inset-top, 0px);
}
.topbar-in { max-width: 760px; margin: 0 auto; height: var(--topbar-h); display: flex; align-items: center; gap: 10px; padding: 0 16px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; }
.brand-name { display: none; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 40%, transparent);
}
.brand-mark.lg { width: 56px; height: 56px; border-radius: 18px; }
.page-title { flex: 1; font-size: 18px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mode-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; background: var(--surface); border: 1px solid var(--border); color: var(--text);
}
.mode-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.mode-chip.ok .dot { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 25%, transparent); }
.mode-chip.warn .dot { background: var(--warn); }
.mode-chip.bad .dot { background: var(--danger); }

.view { max-width: 760px; margin: 0 auto; padding: 16px 16px calc(var(--tabbar-h) + var(--safe-b) + 28px); outline: none; }
.view.enter { animation: viewIn .22s ease-out; }
@keyframes viewIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  backdrop-filter: saturate(1.6) blur(16px);
  -webkit-backdrop-filter: saturate(1.6) blur(16px);
  border-top: 1px solid var(--border);
  padding-bottom: var(--safe-b);
}
.tabbar-in { max-width: 760px; margin: 0 auto; height: var(--tabbar-h); display: grid; grid-template-columns: repeat(5, 1fr); }
.tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); font-size: 11px; font-weight: 600; position: relative; }
.tab .ic { width: 52px; height: 30px; border-radius: 999px; transition: background .2s, color .2s; }
.tab.active { color: var(--accent); }
.tab.active .ic { background: var(--accent-soft); }
body.bare .tabbar, body.bare .topbar { display: none; }
body.bare .view { padding-bottom: 32px; }

/* ---------- cartões ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.card-head:last-child { margin-bottom: 0; }
.card-title { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 700; margin-bottom: 10px; }
.card-head .card-title { margin-bottom: 0; }
.card-title .ic { color: var(--accent); }
.section { display: flex; flex-direction: column; gap: 8px; }
.section-title { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 4px 4px 0; }
.intro { display: flex; gap: 14px; align-items: flex-start; }
.intro h3 { font-size: 17px; margin-bottom: 4px; }
.warn-card { border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); background: color-mix(in srgb, var(--danger) 5%, var(--surface)); }
.warn-card .card-title .ic { color: var(--danger); }
.status-card { display: flex; gap: 14px; align-items: flex-start; }
.status-card h3 { font-size: 17px; margin-bottom: 4px; }
.status-card.ok .tile-ic { --c: var(--ok); }
.status-card.warn .tile-ic { --c: var(--warn); }
.status-card.bad .tile-ic { --c: var(--danger); }
.banner { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--accent-soft); color: var(--text); }
.banner .ic { color: var(--accent); }
.note { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--surface-2); color: var(--muted); font-size: 13.5px; }
.note .ic { margin-top: 2px; color: var(--accent); }
.note.warn { background: color-mix(in srgb, var(--warn) 12%, var(--surface)); color: var(--text); }
.note.warn .ic { color: var(--warn); }
.empty { text-align: center; padding: 36px 16px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty-ic { width: 64px; height: 64px; border-radius: 20px; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); margin-bottom: 4px; }
.empty h3 { font-size: 17px; }
.empty p { max-width: 380px; }
.empty .btn { margin-top: 8px; }
.empty-small { display: flex; gap: 10px; align-items: center; color: var(--muted); }
.about { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 18px 12px 4px; }

/* ---------- ícones em bloco ---------- */
.tile-ic {
  --c: var(--accent);
  flex: none; width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center;
  color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent);
}
.tile-ic.sm { width: 36px; height: 36px; border-radius: 11px; }
.tile-ic.xs { width: 26px; height: 26px; border-radius: 8px; }
.tile-ic.lg { width: 52px; height: 52px; border-radius: 16px; }

/* ---------- botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 16px; border-radius: 14px; border: 1px solid transparent;
  font-weight: 600; font-size: 15px; cursor: pointer; text-decoration: none; user-select: none;
  background: var(--surface-2); color: var(--text); transition: transform .08s, filter .15s, background .15s;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn.primary { background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 70%, var(--accent-2))); color: var(--accent-ink); box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 30%, transparent); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: var(--surface); border-color: var(--border); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.block { width: 100%; }
.btn.xl { min-height: 56px; font-size: 16.5px; border-radius: 16px; }
.btn.sm { min-height: 38px; padding: 7px 12px; font-size: 14px; border-radius: 12px; }
.btn.xs { min-height: 30px; padding: 4px 10px; font-size: 13px; border-radius: 10px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.btn-row.tight { gap: 2px; flex-wrap: nowrap; }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; border: 0;
  background: transparent; color: var(--muted); cursor: pointer; flex: none;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.xs { width: 32px; height: 32px; border-radius: 10px; }
.back { color: var(--text); margin-left: -8px; }
.link-btn {
  display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-radius: 16px; font-weight: 600;
  background: var(--surface); border: 1px solid var(--border); color: var(--text); box-shadow: var(--shadow);
}
.link-btn .ic { color: var(--muted); }

/* ---------- formulários ---------- */
.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label { font-size: 13px; font-weight: 600; color: var(--muted); }
.req { color: var(--danger); }
.help { color: var(--muted); font-size: 12.5px; }
.field.invalid .input { border-color: var(--danger); box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 15%, transparent); }
.input {
  width: 100%; min-height: 46px; padding: 11px 14px; border-radius: 13px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font: inherit; font-size: 16px; outline: none; transition: border-color .15s, box-shadow .15s;
}
textarea.input { resize: vertical; min-height: 90px; line-height: 1.45; }
select.input { appearance: none; padding-right: 36px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 19px) 50%, calc(100% - 14px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input.sm { min-height: 38px; padding: 7px 12px; font-size: 14px; width: auto; }
select.input.sm { padding-right: 32px; max-width: 58%; }
.input.mono { font-family: var(--mono); font-size: 14.5px; }
.input-group { position: relative; display: flex; }
.input-group .input { padding-right: 48px; }
.input-addon { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; border: 0; background: none; color: var(--muted); display: grid; place-items: center; cursor: pointer; border-radius: 10px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.inline-field { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 0; font-size: 14px; }
.list-edit { display: flex; flex-direction: column; gap: 10px; margin-bottom: 8px; }
.list-edit-row { display: flex; gap: 6px; align-items: center; padding: 10px; border-radius: 14px; background: var(--surface-2); }

.switch-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; cursor: pointer; }
.switch-row + .switch-row { border-top: 1px solid var(--border); }
.switch-row.inline { padding: 4px 0; }
.switch-row.disabled { opacity: .5; cursor: not-allowed; }
.switch-row.danger-on .row-ic { color: var(--danger); background: color-mix(in srgb, var(--danger) 14%, transparent); }
.row-ic { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); flex: none; }
.row-title { font-weight: 600; font-size: 15px; }
.row-desc { color: var(--muted); font-size: 13px; }
.switch { position: relative; width: 48px; height: 28px; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.slider { position: absolute; inset: 0; border-radius: 999px; background: var(--surface-3); transition: background .2s; }
.slider::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgb(0 0 0 / .25); transition: transform .2s; }
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider::after { transform: translateX(20px); }
.switch input:focus-visible + .slider { box-shadow: 0 0 0 3px var(--accent-soft); }

.seg { display: flex; padding: 4px; gap: 4px; background: var(--surface-2); border-radius: 14px; overflow-x: auto; }
.seg label { flex: 1; position: relative; min-width: max-content; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg span { display: block; text-align: center; padding: 8px 12px; border-radius: 10px; font-size: 13.5px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.seg input:checked + span { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.seg input:focus-visible + span { box-shadow: 0 0 0 2px var(--accent); }

/* ---------- listas ---------- */
.list { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.list > .empty { background: transparent; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 13px 14px; color: var(--text); background: none; border: 0; text-align: left; cursor: pointer; width: 100%; }
.list-item + .list-item { border-top: 1px solid var(--border); }
.list-item:hover { background: var(--surface-2); }
.list-item.static { cursor: default; }
.list-item.static:hover { background: none; }
.list-item.danger .row-title { color: var(--danger); }
.table { display: flex; flex-direction: column; }
.trow { display: flex; align-items: center; gap: 10px; padding: 10px 2px; border-top: 1px solid var(--border); font-size: 14px; flex-wrap: wrap; }
.trow:first-child { border-top: 0; }
.trow.flash { animation: flash 1s ease-out; }
.trow.ok { color: var(--ok); }
.trow.warn { color: var(--warn); }
.trow.error { color: var(--danger); }
@keyframes flash { from { background: var(--accent-soft); } to { background: transparent; } }
.chip { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); font-size: 12px; font-weight: 600; color: var(--muted); }
.chip.xs { padding: 1px 7px; font-size: 11px; vertical-align: 1px; }
.chip.ok { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.chip.bad { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.kv-list { display: flex; flex-direction: column; }
.kv { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--border); min-width: 0; }
.kv-list .kv:first-child { border-top: 0; }
.kv-k { color: var(--muted); font-size: 13px; flex: 0 0 34%; }
.kv-v { flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: 14px; }
.kv-v.secret { letter-spacing: .1em; }
.bullets { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }

/* ---------- leitura ---------- */
.hero { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 26px 16px 10px; }
.hero .switch-row { width: 100%; border-top: 1px solid var(--border); margin-top: 6px; }
.scan-btn {
  position: relative; width: 168px; height: 168px; border-radius: 50%; border: 0; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: #fff;
  background: radial-gradient(circle at 30% 25%, color-mix(in srgb, var(--accent-2) 70%, #fff) 0%, var(--accent) 55%, color-mix(in srgb, var(--accent) 70%, #000) 100%);
  box-shadow: 0 16px 40px color-mix(in srgb, var(--accent) 45%, transparent), inset 0 2px 0 rgb(255 255 255 / .25);
  transition: transform .15s;
}
.scan-btn:active { transform: scale(.96); }
.scan-label { font-weight: 700; font-size: 16px; letter-spacing: .02em; }
.scan-rings { position: absolute; inset: 0; pointer-events: none; }
.scan-rings i { position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--accent); opacity: 0; }
.scan-btn:hover .scan-rings i, .scan-btn.active .scan-rings i { animation: ring 2.4s ease-out infinite; }
.scan-rings i:nth-child(2) { animation-delay: .8s !important; }
.scan-rings i:nth-child(3) { animation-delay: 1.6s !important; }
.scan-btn.active { background: radial-gradient(circle at 30% 25%, #fda4af 0%, var(--danger) 60%, #7f1d1d 100%); box-shadow: 0 16px 40px color-mix(in srgb, var(--danger) 45%, transparent); }
.scan-btn.active .scan-rings i { border-color: var(--danger); }
@keyframes ring { 0% { transform: scale(1); opacity: .6; } 100% { transform: scale(1.55); opacity: 0; } }

.tag-info-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.tag-info-title { font-weight: 700; font-size: 17px; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stat { background: var(--surface-2); border-radius: 12px; padding: 10px 12px; min-width: 0; }
.stat:first-child { grid-column: 1 / -1; }
.stat-v { font-weight: 700; font-size: 15px; overflow-wrap: anywhere; }
.stat-k { color: var(--muted); font-size: 12px; }
.tag-info .rec-actions { margin-top: 12px; }

/* ---------- registros ---------- */
.rec { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.rec.nested { box-shadow: none; background: var(--surface-2); border-color: transparent; padding: 12px; }
.rec-head { display: flex; align-items: center; gap: 12px; }
.rec-title { font-weight: 700; font-size: 16px; }
.rec-sub { color: var(--muted); font-size: 12px; font-family: var(--mono); overflow-wrap: anywhere; }
.rec-main { font-size: 16px; white-space: pre-wrap; overflow-wrap: anywhere; padding: 12px 14px; background: var(--surface-2); border-radius: 12px; max-height: 320px; overflow: auto; }
.rec.nested .rec-main { background: var(--surface); }
.rec-main.mono { font-family: var(--mono); font-size: 13.5px; }
.rec-img { max-width: 100%; border-radius: 12px; align-self: flex-start; }
.rec-children { display: flex; flex-direction: column; gap: 8px; }
.rec-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.rec-tech summary { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; cursor: pointer; list-style: none; padding: 4px 0; }
.rec-tech summary::-webkit-details-marker { display: none; }
.rec-tech[open] summary { margin-bottom: 6px; }
.hexdump { font-family: var(--mono); font-size: 12px; line-height: 1.55; background: var(--surface-2); padding: 10px 12px; border-radius: 10px; overflow-x: auto; margin: 8px 0 0; color: var(--text); }
.hexdump.wrap { white-space: pre-wrap; word-break: break-all; margin: 0; }

/* ---------- gravação ---------- */
.type-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.type-tile {
  display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 14px; text-align: left; cursor: pointer;
  border-radius: 16px; border: 1px solid var(--border); background: var(--surface); transition: transform .1s, border-color .15s, box-shadow .15s;
}
.type-tile:hover { border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); box-shadow: var(--shadow); }
.type-tile:active { transform: scale(.98); }
.type-label { font-weight: 700; font-size: 14.5px; line-height: 1.25; }
.type-desc { color: var(--muted); font-size: 12.5px; line-height: 1.3; }
.card > .type-grid { margin-bottom: 12px; }
.picker { display: flex; flex-direction: column; gap: 6px; }
.picker-group { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin: 12px 2px 4px; }
.picker-group:first-child { margin-top: 0; }
.preview { border: 1px dashed var(--border); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.preview-head { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.preview-row { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; }
.preview-row.err { color: var(--danger); }
.entries { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.entry { display: flex; align-items: center; gap: 4px; border: 1px solid var(--border); border-radius: 14px; padding: 4px 4px 4px 0; background: var(--surface); }
.entry-main { flex: 1; display: flex; align-items: center; gap: 12px; padding: 8px 10px; border: 0; background: none; text-align: left; cursor: pointer; min-width: 0; }
.entry-tools { display: flex; align-items: center; }
.meter { height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; margin: 4px 0 8px; }
.meter-fill { height: 100%; width: 0; border-radius: 999px; transition: width .35s, background .3s; background: var(--ok); }
.meter-fill.warn { background: var(--warn); }
.meter-fill.over { background: var(--danger); }
.meter-text { font-size: 13.5px; }
.fits { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; }

/* ---------- ferramentas ---------- */
.tool-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.tool-card { display: flex; flex-direction: column; gap: 8px; padding: 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); color: var(--text); box-shadow: var(--shadow); transition: transform .1s; }
.tool-card:active { transform: scale(.98); }
.tool-title { font-weight: 700; font-size: 14.5px; line-height: 1.25; }
.tool-desc { color: var(--muted); font-size: 12.5px; line-height: 1.35; }
.step { width: 34px; height: 34px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 800; margin: 0 auto; }
.step.sm { width: 24px; height: 24px; font-size: 13px; margin: 0; }
.src { display: flex; gap: 12px; align-items: flex-start; }
.count-row { display: flex; align-items: baseline; gap: 10px; }
.big-count { font-size: 44px; font-weight: 800; line-height: 1; color: var(--accent); font-variant-numeric: tabular-nums; }
.calc-out { display: flex; flex-direction: column; gap: 6px; }
.tpl-head { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 12px; }

/* ---------- ajuda ---------- */
.checks { display: flex; flex-direction: column; gap: 8px; }
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.check .dot { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); flex: none; }
.check .dot.ok { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.check .dot.bad { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.faq { display: flex; flex-direction: column; gap: 8px; }
.faq-item { padding: 0; }
.faq-item summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; font-weight: 600; cursor: pointer; list-style: none; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary .ic { color: var(--muted); transition: transform .2s; }
.faq-item[open] summary .ic { transform: rotate(180deg); }
.faq-item p { padding: 0 16px 16px; font-size: 14px; }

/* ---------- overlay NFC ---------- */
.nfc-overlay { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end; justify-content: center; background: rgb(2 6 23 / .55); opacity: 0; transition: opacity .2s; }
.nfc-overlay.open { opacity: 1; }
.ov-card {
  width: 100%; max-width: 480px; background: var(--surface); border-radius: 28px 28px 0 0; padding: 30px 22px calc(20px + var(--safe-b));
  display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; box-shadow: var(--shadow-lg);
  transform: translateY(30px); transition: transform .25s cubic-bezier(.2, .9, .3, 1.2);
}
.nfc-overlay.open .ov-card { transform: none; }
.nfc-anim { position: relative; width: 132px; height: 132px; display: grid; place-items: center; margin-bottom: 6px; }
.ring { position: absolute; inset: 14px; border-radius: 50%; border: 2px solid var(--accent); opacity: 0; animation: ring 2.4s ease-out infinite; }
.ring.r2 { animation-delay: .8s; }
.ring.r3 { animation-delay: 1.6s; }
.nfc-core { position: relative; width: 92px; height: 92px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 10px 30px color-mix(in srgb, var(--accent) 40%, transparent); transition: background .3s; }
.nfc-overlay[data-state="busy"] .nfc-core { animation: pulse 1s ease-in-out infinite; }
.nfc-overlay[data-state="success"] .nfc-core { background: var(--ok); box-shadow: 0 10px 30px color-mix(in srgb, var(--ok) 40%, transparent); animation: pop .35s ease-out; }
.nfc-overlay[data-state="error"] .nfc-core { background: var(--danger); box-shadow: 0 10px 30px color-mix(in srgb, var(--danger) 40%, transparent); animation: shake .35s; }
.nfc-overlay[data-state="warn"] .nfc-core { background: var(--warn); }
.nfc-overlay[data-state="success"] .ring, .nfc-overlay[data-state="error"] .ring, .nfc-overlay[data-state="warn"] .ring { animation: none; opacity: 0; }
.nfc-overlay[data-mode="lock"] .nfc-core, .nfc-overlay[data-mode="erase"] .nfc-core { background: linear-gradient(135deg, #f97316, var(--danger)); }
@keyframes pulse { 50% { transform: scale(.93); } }
@keyframes pop { 0% { transform: scale(.8); } 70% { transform: scale(1.08); } 100% { transform: scale(1); } }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.ov-title { font-size: 20px; font-weight: 800; }
.ov-hint { color: var(--muted); font-size: 14.5px; max-width: 340px; white-space: pre-wrap; }
.ov-extra { display: flex; flex-direction: column; align-items: center; }
.ov-extra:empty { display: none; }
.ov-counter { font-size: 48px; font-weight: 800; line-height: 1; color: var(--accent); font-variant-numeric: tabular-nums; }
.ov-log { width: 100%; display: flex; flex-direction: column; gap: 4px; max-height: 140px; overflow: auto; }
.ov-log:empty { display: none; }
.ov-log-row { font-size: 13px; padding: 6px 10px; border-radius: 10px; background: var(--surface-2); text-align: left; }
.ov-log-row.ok { color: var(--ok); }
.ov-log-row.warn { color: var(--warn); }
.ov-log-row.error { color: var(--danger); }
.ov-card .btn { margin-top: 8px; }

/* ---------- folhas (modais) ---------- */
.sheet-backdrop { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; background: rgb(2 6 23 / .5); opacity: 0; transition: opacity .2s; }
.sheet-backdrop.open { opacity: 1; }
.sheet {
  width: 100%; max-width: 560px; max-height: 92dvh; display: flex; flex-direction: column;
  background: var(--bg); border-radius: 24px 24px 0 0; box-shadow: var(--shadow-lg);
  transform: translateY(40px); transition: transform .25s cubic-bezier(.2, .9, .3, 1.1);
}
.sheet.wide { max-width: 720px; }
.sheet-backdrop.open .sheet { transform: none; }
.sheet-head { display: flex; align-items: center; gap: 12px; padding: 16px 12px 12px 18px; border-bottom: 1px solid var(--border); }
.sheet-head h2 { flex: 1; font-size: 18px; }
.sheet-body { padding: 16px 18px; overflow-y: auto; overscroll-behavior: contain; }
.sheet-foot { display: flex; gap: 10px; padding: 12px 18px calc(12px + var(--safe-b)); border-top: 1px solid var(--border); }
.sheet-foot .btn { flex: 1; }

/* ---------- toasts ---------- */
.toasts { position: fixed; left: 0; right: 0; top: calc(env(safe-area-inset-top, 0px) + 12px); z-index: 90; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast {
  display: flex; align-items: center; gap: 10px; max-width: 520px; padding: 11px 16px; border-radius: 14px;
  background: var(--text); color: var(--bg); font-size: 14px; font-weight: 600; box-shadow: var(--shadow-lg);
  opacity: 0; transform: translateY(-10px); transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: none; }
.toast.success .ic { color: #4ade80; }
.toast.error .ic { color: #fb7185; }
.toast.warn .ic { color: #fbbf24; }

/* ---------- simulador ---------- */
.sim-dock {
  position: fixed; left: 50%; transform: translateX(-50%); top: calc(env(safe-area-inset-top, 0px) + 10px); z-index: 70; width: calc(100% - 24px); max-width: 520px;
  background: #1e1b4b; color: #e0e7ff; border-radius: 20px; padding: 12px; box-shadow: 0 20px 50px rgb(30 27 75 / .5);
  border: 1px solid #4338ca;
}
.sim-dock-head { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 700; margin: 0 4px 10px; color: #c7d2fe; }
.sim-tags { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: thin; }
.sim-tag {
  flex: 0 0 132px; display: flex; flex-direction: column; gap: 2px; text-align: left; padding: 10px; border-radius: 14px; cursor: pointer;
  background: #312e81; border: 1px solid #4f46e5; color: #fff; min-width: 0;
}
.sim-tag:hover { background: #3730a3; }
body.sim-on .view { padding-top: 160px; }
body.sim-on .topbar { visibility: hidden; }
.sim-tag.present { background: #4f46e5; box-shadow: 0 0 0 2px #a5b4fc; }
.sim-tag small { font-size: 11.5px; color: #c7d2fe; }
.sim-tag small.muted { color: #a5b4fc; }
.sim-tag-top { display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.sim-tag strong { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- links inteligentes ---------- */
.smart-page { max-width: 520px; margin: 0 auto; padding-top: max(12px, env(safe-area-inset-top, 0px)); display: flex; flex-direction: column; gap: 22px; min-height: calc(100dvh - 60px); }
.smart-body { flex: 1; }
.smart-hero { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; padding: 18px 0 6px; }
.smart-hero h1 { font-size: 26px; font-weight: 800; overflow-wrap: anywhere; }
.smart-ic { --c: var(--accent); width: 72px; height: 72px; border-radius: 24px; display: grid; place-items: center; color: var(--c); background: color-mix(in srgb, var(--c) 15%, transparent); margin-bottom: 4px; }
.smart-ic.ok { --c: var(--ok); border-radius: 50%; width: 84px; height: 84px; animation: pop .4s ease-out; }
.smart-text { font-size: 17px; line-height: 1.6; overflow-wrap: anywhere; }
.smart-card { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 22px 16px 10px; }
.smart-card h1 { font-size: 26px; font-weight: 800; }
.avatar { width: 96px; height: 96px; border-radius: 50%; display: grid; place-items: center; font-size: 34px; font-weight: 800; color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 12px 32px color-mix(in srgb, var(--accent) 40%, transparent); margin-bottom: 8px; }
.smart-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.smart-grid .btn { min-height: 52px; }
.wifi-pass { font-size: 22px; font-weight: 700; overflow-wrap: anywhere; }
.big-time { font-size: 54px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; margin-top: 6px; }
.pix-amount { font-size: 34px !important; color: var(--ok); }
.smart-footer { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 12.5px; color: var(--muted); padding: 10px; }

/* ---------- telas maiores ---------- */
@media (min-width: 640px) {
  .brand-name { display: inline; }
  .page-title { font-size: 17px; color: var(--muted); font-weight: 600; padding-left: 12px; border-left: 1px solid var(--border); }
  .tool-grid { grid-template-columns: repeat(3, 1fr); }
  .stats { grid-template-columns: 2fr 1fr 1.4fr; }
  .stat:first-child { grid-column: auto; }
  .sheet-backdrop, .nfc-overlay { align-items: center; padding: 24px; }
  .sheet, .ov-card { border-radius: 26px; }
  .ov-card { padding-bottom: 22px; }
}
@media (max-width: 380px) {
  .row2 { grid-template-columns: 1fr; }
  .hide-sm { display: none; }
  .type-grid { grid-template-columns: 1fr 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
