/* Plena QR — identidade baseada em plenatecnologia.com */
:root {
    --bg: #060d1b;
    --panel: #0c1628;
    --panel-2: #111d33;
    --line: rgba(158, 186, 226, .17);
    --text: #f5f8ff;
    --muted: #b1bfd2;
    --blue: #1677ff;
    --blue-hover: #3a8cff;
    --cyan: #35c6ff;
    --green: #2fd18b;
    --amber: #ffc24b;
    --red: #ff6b6b;
    --radius: 14px;
    --font: Inter, "Segoe UI", Arial, sans-serif;
    --mono: ui-monospace, "SF Mono", Consolas, "Liberation Mono", monospace;
    color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--font); }
a { color: var(--cyan); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; line-height: 1.2; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; margin: 0 0 .9rem; }
hr { border: 0; border-top: 1px solid var(--line); margin: .5rem 0; width: 100%; }
code, .mono { font-family: var(--mono); letter-spacing: .02em; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
[hidden] { display: none !important; }

.muted { color: var(--muted); }
.small { font-size: .85rem; }
.strong { font-weight: 600; }
.break { word-break: break-all; }
.truncate { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.eyebrow { margin: 0 0 .2rem; font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; color: var(--cyan); }
.hint { display: inline; font-size: .8rem; color: var(--muted); font-weight: 400; }
p.hint { display: block; margin: 0; }
.empty { color: var(--muted); margin: 0; }
.field-error { display: block; color: var(--red); font-size: .82rem; font-weight: 500; }

/* Estrutura do painel */
.admin { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 1.5rem; padding: 1.4rem 1rem; border-right: 1px solid var(--line); background: var(--panel); }
.sidebar nav { display: flex; flex-direction: column; gap: .2rem; }
.sidebar nav a, .tabbar a { display: flex; align-items: center; gap: .7rem; padding: .6rem .75rem; border-radius: 10px; color: var(--muted); font-weight: 500; }
.sidebar nav a:hover { background: var(--panel-2); color: var(--text); text-decoration: none; }
.sidebar nav a.is-active { background: rgba(22, 119, 255, .16); color: var(--text); }
.sidebar svg, .tabbar svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.sidebar-foot { margin-top: auto; display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding: 0 .75rem; }
.brand { display: flex; align-items: center; gap: .6rem; font-size: 1.1rem; color: var(--text); padding: 0 .5rem; }
.brand:hover { text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: linear-gradient(135deg, var(--blue), var(--cyan)); font-weight: 700; color: #fff; }
.brand-center { justify-content: center; margin-bottom: 1.5rem; }
.main { padding: 2rem clamp(1rem, 3vw, 2.5rem) 3rem; max-width: 1200px; width: 100%; display: flex; flex-direction: column; gap: 1.25rem; }
.tabbar { display: none; }

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; }
.page-head h1 { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.page-head p { margin: .3rem 0 0; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; min-width: 0; }
.card.narrow { max-width: 520px; }
.stack { display: flex; flex-direction: column; gap: 1rem; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; }
.grid-2.tight { gap: .9rem; }
.grid-detail { display: grid; grid-template-columns: minmax(0, 360px) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.row-between { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }
.actions { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: 1rem; }
.actions:first-child { margin-top: 0; }

/* Indicadores */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
.stat { display: flex; flex-direction: column; gap: .2rem; padding: 1.1rem 1.25rem; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); color: var(--text); }
.stat:hover { border-color: rgba(53, 198, 255, .45); text-decoration: none; }
.stat-value { font-size: 1.9rem; font-weight: 700; line-height: 1.1; }
.stat-label { color: var(--muted); font-size: .85rem; }

.bars { display: flex; align-items: flex-end; gap: 3px; height: 120px; padding-top: .5rem; }
.bar { flex: 1; min-height: 2px; height: var(--h); background: linear-gradient(180deg, var(--cyan), var(--blue)); border-radius: 3px 3px 0 0; opacity: .9; }
.bar:hover { opacity: 1; }

.list { list-style: none; margin: 0; padding: 0; }
.list li + li { border-top: 1px solid var(--line); }
.list a { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .65rem 0; color: var(--text); }
.list a:hover { text-decoration: none; color: var(--cyan); }
.pill { background: var(--panel-2); border-radius: 999px; padding: .1rem .6rem; font-size: .85rem; font-weight: 600; }

.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .8rem; }
.timeline li { display: flex; flex-direction: column; gap: .1rem; padding-left: .9rem; border-left: 2px solid var(--line); }

.badge { display: inline-block; padding: .15rem .55rem; border-radius: 999px; font-size: .75rem; font-weight: 600; vertical-align: middle; font-family: var(--font); letter-spacing: 0; }
.badge-active { background: rgba(47, 209, 139, .15); color: var(--green); }
.badge-stock { background: rgba(53, 198, 255, .14); color: var(--cyan); }
.badge-paused { background: rgba(255, 194, 75, .15); color: var(--amber); }
.badge-archived { background: rgba(177, 191, 210, .14); color: var(--muted); }

/* Formulários */
label { display: block; font-weight: 500; font-size: .9rem; }
label > input, label > select, label > textarea { display: block; margin-top: .35rem; }
label > .hint:last-child, label > input + .hint { display: block; margin-top: .3rem; }
input, select, textarea { width: 100%; font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: .65rem .8rem; min-height: 44px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(22, 119, 255, .25); }
input[type="checkbox"], input[type="radio"] { width: auto; min-height: 0; accent-color: var(--blue); }
fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .5rem; }
legend { font-weight: 600; font-size: .9rem; margin-bottom: .5rem; padding: 0; width: 100%; }
.check { display: flex; flex-direction: row; align-items: center; gap: .5rem; font-weight: 400; }
.chip { display: flex; flex-direction: row; align-items: center; gap: .4rem; padding: .5rem .85rem; border: 1px solid var(--line); border-radius: 999px; cursor: pointer; font-weight: 500; }
.chip:has(input:checked) { border-color: var(--blue); background: rgba(22, 119, 255, .16); }
.chip input { margin: 0; }
.inline-form { display: flex; gap: .75rem; align-items: flex-end; flex-wrap: wrap; }
.inline-form .grow { flex: 1 1 220px; }
.filters { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.filters input[type="search"] { flex: 1 1 260px; width: auto; }
.filters select { width: auto; }
.zip-form { display: flex; gap: 1.5rem; flex-wrap: wrap; align-items: flex-end; margin-top: 1rem; }
.zip-form fieldset { flex-direction: column; gap: .3rem; }
.zip-form legend { margin-bottom: .2rem; }

.button { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 44px; padding: .6rem 1.1rem; border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; }
.button:hover { border-color: rgba(53, 198, 255, .5); text-decoration: none; }
.button-primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.button-primary:hover { background: var(--blue-hover); border-color: var(--blue-hover); }
.button-ghost { background: transparent; }
.button-danger { background: transparent; color: var(--red); border-color: rgba(255, 107, 107, .4); }
.button-small { min-height: 34px; padding: .35rem .75rem; font-size: .85rem; }
.button-block { width: 100%; }
.button[disabled] { opacity: .6; cursor: progress; }
.link-button { background: none; border: 0; color: var(--cyan); cursor: pointer; font: inherit; padding: 0; }

.flash { padding: .75rem 1rem; border-radius: 10px; font-weight: 500; }
.flash-success { background: rgba(47, 209, 139, .14); color: var(--green); border: 1px solid rgba(47, 209, 139, .3); }
.flash-error { background: rgba(255, 107, 107, .12); color: var(--red); border: 1px solid rgba(255, 107, 107, .3); }

/* Tabelas */
.table-wrap { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: .75rem 1rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; }
.pager { display: flex; gap: .3rem; flex-wrap: wrap; }
.pager a { padding: .35rem .7rem; border-radius: 8px; border: 1px solid var(--line); color: var(--text); }
.pager a.is-active { background: var(--blue); border-color: var(--blue); }

/* Detalhe da placa */
.qr-card { display: flex; flex-direction: column; gap: .8rem; align-items: stretch; }
.qr-card img { width: 220px; height: auto; align-self: center; border-radius: 10px; background: #fff; }
.copy-field { display: flex; gap: .5rem; align-items: center; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: .45rem .45rem .45rem .75rem; }
.copy-field code { flex: 1; font-size: .8rem; }
.downloads { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.type-picker { gap: .5rem; }
details summary { cursor: pointer; color: var(--cyan); margin-top: .75rem; }
.scanner { display: flex; flex-direction: column; gap: .6rem; }
.scanner video { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 12px; background: #000; }

/* Páginas públicas (quem lê a placa) */
.public { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 1.5rem 1rem; background: radial-gradient(120% 80% at 50% 0%, #0f2347 0%, var(--bg) 60%); }
.public-card { width: 100%; max-width: 420px; background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 2rem 1.5rem; display: flex; flex-direction: column; gap: 1rem; text-align: center; }
.public-card h1 { font-size: 1.45rem; }
.public-card p { margin: 0; }
.public-card form { text-align: left; }
.public-foot { color: var(--muted); font-size: .8rem; margin-top: 1rem; }
.public-icon { width: 64px; height: 64px; margin: 0 auto; display: grid; place-items: center; border-radius: 18px; background: rgba(22, 119, 255, .16); }
.public-icon svg { width: 32px; height: 32px; fill: none; stroke: var(--cyan); stroke-width: 1.8; stroke-linejoin: round; }
.public-icon.pix { background: rgba(47, 209, 139, .14); }
.public-icon.pix svg { stroke: var(--green); }
.pix-amount { font-size: 2rem; font-weight: 700; }
.steps { text-align: left; margin: 0; padding-left: 1.2rem; color: var(--muted); display: flex; flex-direction: column; gap: .35rem; }
.pix-key { text-align: left; display: flex; flex-direction: column; gap: .5rem; }
.pix-key p { margin: .4rem 0; }

/* Celular */
@media (max-width: 900px) {
    .grid-detail, .grid-2 { grid-template-columns: minmax(0, 1fr); }
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
    .admin { display: block; padding-bottom: 72px; }
    .sidebar { display: none; }
    .main { padding: 1.25rem 1rem 2rem; }
    .tabbar { display: flex; position: fixed; inset: auto 0 0 0; z-index: 10; background: var(--panel); border-top: 1px solid var(--line); padding: .3rem .3rem calc(.3rem + env(safe-area-inset-bottom)); }
    .tabbar a { flex: 1; flex-direction: column; gap: .15rem; padding: .4rem .2rem; font-size: .68rem; text-align: center; }
    .tabbar a.is-active { color: var(--cyan); }
    .grid-2.tight { grid-template-columns: minmax(0, 1fr); }
    .table thead { display: none; }
    .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
    .table tr { padding: .6rem 0; border-bottom: 1px solid var(--line); }
    .table td { border: 0; padding: .25rem 1rem; display: flex; justify-content: space-between; gap: 1rem; text-align: right; }
    .table td::before { content: attr(data-label); color: var(--muted); font-size: .8rem; text-align: left; }
    .table .num { text-align: right; }
    .truncate { max-width: 60vw; }
}

/* Contas (painel da Plena) */
.password-card { border-color: rgba(47, 209, 139, .45); }
.credentials { display: grid; grid-template-columns: auto 1fr; gap: .35rem 1rem; margin: .5rem 0 1rem; }
.credentials dt { color: var(--muted); font-size: .85rem; }
.credentials dd { margin: 0; word-break: break-all; }
.lookup { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.lookup p { margin: .2rem 0; }
.user-row { padding: .65rem 0; align-items: center; }
