/* Rastreio — visual minimalista, claro e escuro */
:root {
  --bg: #F7F7F5;
  --surface: #FFFFFF;
  --ink: #111111;
  --ink-2: #3D3D39;
  --muted: #5F5F5A;
  --faint: #6B6B66;
  --line: #E8E8E4;
  --line-2: #E4E4E0;
  --accent: #111111;
  --on-accent: #FFFFFF;
  --blue: #2343B8;   --blue-bg: #EEF1FD;
  --green: #1D6B43;  --green-bg: #E8F4ED;
  --orange: #9A4A0B; --orange-bg: #FDF0E3;
  --red: #B3261E;    --red-bg: #FCEBEA;
  --grey: #4F4F4B;   --grey-bg: #EFEFEC;
  --focus: #2343B8;
  --radius: 14px;
  --sans: Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111110;
    --surface: #1A1A19;
    --ink: #F2F2EF;
    --ink-2: #D6D6D1;
    --muted: #A8A8A2;
    --faint: #9A9A94;
    --line: #2A2A28;
    --line-2: #333331;
    --accent: #F2F2EF;
    --on-accent: #111111;
    --blue: #A9BBFF;   --blue-bg: #1C2340;
    --green: #86D9AA;  --green-bg: #15291F;
    --orange: #F5B47A; --orange-bg: #33230F;
    --red: #F2A29C;    --red-bg: #3A1A18;
    --grey: #C8C8C2;   --grey-bg: #262624;
    --focus: #A9BBFF;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--ink); text-decoration: none; }
a:hover { color: var(--ink-2); }
code { font-family: var(--mono); font-size: 0.9em; background: var(--grey-bg); padding: 1px 6px; border-radius: 6px; }
.mono { font-family: var(--mono); letter-spacing: 0.04em; }
.muted { color: var(--muted); }
.ink { color: var(--ink); font-weight: 600; }
.small { font-size: 13px; }
h1, h2, p { margin: 0; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.icon { flex-shrink: 0; display: block; }

/* Estrutura */
.app {
  max-width: 560px;
  margin: 0 auto;
  padding: 24px 20px 48px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.content { display: flex; flex-direction: column; gap: 24px; }

.topbar { display: flex; align-items: center; justify-content: space-between; }
.topbar-actions { display: flex; gap: 8px; }
.topbar-actions form { margin: 0; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 9px;
  background: var(--accent); color: var(--on-accent);
  display: inline-flex; align-items: center; justify-content: center;
}
.brand-mark-lg { width: 52px; height: 52px; border-radius: 14px; }
.brand-ok { background: var(--green); color: var(--surface); }

.icon-btn {
  width: 44px; height: 44px;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink);
  border-radius: 12px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn:hover { background: var(--grey-bg); color: var(--ink); }
.icon-btn-sm { width: 36px; height: 36px; border: 0; background: transparent; border-radius: 10px; color: var(--muted); }

/* Títulos */
.hero { display: flex; flex-direction: column; gap: 8px; padding-top: 8px; }
.hero h1, .detail-head h1, .auth-brand h1 {
  font-size: clamp(26px, 6vw, 32px); line-height: 1.15; font-weight: 700; letter-spacing: -0.025em;
}
.h2, .section-head h2 { font-size: 15px; font-weight: 600; margin: 0 0 12px; padding: 0; }
.count {
  display: inline-block; margin-left: 6px; min-width: 22px; padding: 0 7px;
  font-size: 12px; line-height: 20px; text-align: center; border-radius: 999px;
  background: var(--grey-bg); color: var(--grey); font-weight: 600;
}

/* Cartões e formulários */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px 16px;
  margin: 0;
  min-width: 0;
}
fieldset.card { border: 1px solid var(--line); }
legend.h2 { float: left; width: 100%; }
legend.h2 + * { clear: both; }
.stack { display: flex; flex-direction: column; gap: 10px; margin: 0; }
.add-form, .install-form { display: flex; flex-direction: column; gap: 12px; margin: 0; }
.install-form { gap: 16px; }
label { font-size: 13px; font-weight: 500; color: var(--ink-2); }
.field {
  display: flex; align-items: center; gap: 10px;
  min-height: 52px; padding: 0 14px;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius);
  color: var(--faint);
}
.field:focus-within { border-color: var(--ink); }
.field-strong { min-height: 56px; border-width: 1.5px; border-color: var(--ink); }
.field input {
  flex: 1; min-width: 0; height: 48px; border: 0; outline: none; background: transparent;
  font: inherit; font-size: 16px; color: var(--ink);
}
.field input.mono { font-family: var(--mono); letter-spacing: 0.05em; }
.field-strong input { font-size: 17px; }
.js-upper { text-transform: uppercase; }
.js-upper::placeholder { text-transform: none; }
input::placeholder { color: var(--faint); opacity: 1; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 420px) { .grid-2 { grid-template-columns: minmax(0, 1fr); } }
.inline-form { display: flex; gap: 8px; }
.inline-form .field { flex: 1; min-width: 0; }

.btn {
  min-height: 52px; padding: 0 20px;
  border-radius: var(--radius); border: 1px solid transparent;
  font: inherit; font-size: 16px; font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-primary { background: var(--accent); color: var(--on-accent); width: 100%; }
.btn-primary:hover { opacity: 0.9; color: var(--on-accent); }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line-2); }
.btn-ghost:hover { background: var(--grey-bg); }
.btn-danger { background: var(--red-bg); color: var(--red); width: 100%; }
.btn-danger:hover { filter: brightness(0.97); }

.hint { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }

/* Mensagens */
.flash {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px; border-radius: var(--radius); font-size: 14px; font-weight: 500;
}
.flash .icon { margin-top: 1px; }
.flash-success { background: var(--green-bg); color: var(--green); }
.flash-error   { background: var(--red-bg); color: var(--red); }
.flash-info    { background: var(--blue-bg); color: var(--blue); }

/* Filtros */
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.filters a {
  min-height: 44px; padding: 0 16px; display: inline-flex; align-items: center;
  border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface);
  font-size: 14px; font-weight: 500; color: var(--ink-2);
}
.filters a[aria-current="page"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

/* Lista de encomendas */
.pkg-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.pkg {
  display: flex; align-items: center; gap: 14px; padding: 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
}
.pkg:hover { border-color: var(--line-2); background: var(--surface); box-shadow: 0 1px 0 var(--line-2); }
.pkg-icon {
  width: 44px; height: 44px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.pkg-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pkg-title { font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pkg-code { font-size: 12px; color: var(--faint); }
.pkg-sub { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill { font-size: 12px; font-weight: 600; padding: 5px 10px; border-radius: 999px; white-space: nowrap; }
.kind-transito { background: var(--blue-bg); color: var(--blue); }
.kind-entregue { background: var(--green-bg); color: var(--green); }
.kind-atencao  { background: var(--orange-bg); color: var(--orange); }
.kind-pendente { background: var(--grey-bg); color: var(--grey); }
@media (max-width: 380px) { .pkg .pill { display: none; } }

.empty { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; padding: 32px 16px; color: var(--muted); }
.empty-icon { width: 56px; height: 56px; border-radius: 16px; background: var(--grey-bg); color: var(--grey); display: flex; align-items: center; justify-content: center; }
.empty-inline { font-size: 14px; color: var(--muted); padding: 8px 0; }

/* Detalhe */
.detail-nav { display: flex; justify-content: space-between; align-items: center; }
.detail-nav form { margin: 0; }
.detail-head { display: flex; flex-direction: column; gap: 6px; }
.code-row { display: flex; align-items: center; gap: 4px; }
.code-text { font-size: 13px; color: var(--muted); }
.js-copy.copied { color: var(--green); }

.progress { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.progress .bar { height: 6px; border-radius: 3px; background: var(--line-2); }
.progress .bar.on { background: var(--accent); }
.steps {
  list-style: none; margin: 12px 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px;
  font-size: 11px; font-weight: 500; color: var(--muted);
}
.steps .current { color: var(--ink); font-weight: 600; }

.timeline { list-style: none; margin: 0; padding: 0; }
.tl-item { position: relative; display: flex; gap: 14px; padding-bottom: 20px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before {
  content: ""; position: absolute; left: 6px; top: 20px; bottom: 0; width: 2px; background: var(--line-2);
}
.tl-item:last-child::before { display: none; }
.tl-dot {
  width: 14px; height: 14px; margin-top: 4px; flex-shrink: 0; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--faint);
}
.tl-item.latest .tl-dot { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 4px var(--grey-bg); }
.tl-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tl-title { font-size: 15px; font-weight: 500; }
.tl-item.latest .tl-title { font-weight: 600; }
.tl-place { font-size: 13px; color: var(--muted); }
.tl-time { font-size: 12px; color: var(--faint); }

.manage summary {
  display: flex; align-items: center; gap: 8px; cursor: pointer; list-style: none;
  font-size: 15px; font-weight: 600; min-height: 28px;
}
.manage summary::-webkit-details-marker { display: none; }
.manage[open] summary { margin-bottom: 14px; }
.manage form + form { margin-top: 14px; }

.updated { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 12px; color: var(--faint); }
.updated .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); }

/* Login e instalador */
.page-auth .app { min-height: 100vh; justify-content: center; }
.auth { display: flex; flex-direction: column; gap: 16px; }
.auth-brand { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; margin-bottom: 4px; }
.page-install .hero { align-items: flex-start; }

.checks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.checks.card { padding: 16px; }
.checks li { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; }
.checks li .icon { margin-top: 2px; }
.checks .ok .icon { color: var(--green); }
.checks .warn .icon { color: var(--orange); }
.checks .fail { color: var(--red); }

.radio-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 420px) { .radio-row { grid-template-columns: minmax(0, 1fr); } }
.radio {
  display: flex; align-items: flex-start; gap: 10px; padding: 14px;
  border: 1px solid var(--line-2); border-radius: var(--radius); cursor: pointer;
}
.radio:has(input:checked) { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.radio.disabled { opacity: 0.5; cursor: not-allowed; }
.radio input { margin-top: 3px; accent-color: var(--accent); }
.radio span { display: flex; flex-direction: column; gap: 2px; color: var(--ink); font-size: 14px; }
.radio small { color: var(--muted); font-size: 12px; font-weight: 400; }
.mysql-fields[hidden] { display: none; }
.check-row { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--ink); min-height: 44px; }
.check-row input { width: 18px; height: 18px; accent-color: var(--accent); }

/* ===== 1.1 ===== */
[hidden] { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.app-footer { text-align: center; font-size: 12px; color: var(--faint); padding-top: 8px; }
.topbar-actions { gap: 6px; }
@media (max-width: 380px) { .topbar-actions .icon-btn { width: 40px; height: 40px; } .brand span:last-child { display: none; } }

.btn-link { background: transparent; border: 0; color: var(--muted); min-height: 44px; padding: 0 4px; font-weight: 500; font-size: 14px; }
.btn-link:hover { color: var(--ink); }
.btn-block { width: 100%; }
.btn-auto { width: auto; flex-shrink: 0; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-row form { margin: 0; }
.text-link { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 500; color: var(--ink-2); min-height: 44px; }
.text-link:hover { color: var(--ink); }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.section-head h2 { margin: 0; }
.list-section .section-head { margin-bottom: 8px; }

.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-head .h2 { margin: 0; }
.link-card { display: flex; align-items: center; gap: 14px; color: var(--ink); }
.link-card:hover { border-color: var(--line-2); color: var(--ink); }
.link-card > .icon { color: var(--faint); }

textarea, select {
  font: inherit; font-size: 15px; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line-2); border-radius: var(--radius); padding: 12px 14px; width: 100%;
}
textarea { resize: vertical; min-height: 120px; line-height: 1.5; }
textarea.mono { font-family: var(--mono); font-size: 14px; letter-spacing: 0.02em; }
textarea:focus, select:focus { outline: none; border-color: var(--ink); }
.select-field { padding: 0 8px; flex: 1; min-width: 0; }
.select-field select { border: 0; padding: 0 6px; height: 48px; background: transparent; }
.field select { flex: 1; min-width: 0; }
.file-input { font: inherit; font-size: 14px; color: var(--muted); min-height: 44px; }
.file-input::file-selector-button {
  font: inherit; font-weight: 600; font-size: 14px; margin-right: 12px; padding: 10px 14px; cursor: pointer;
  border: 1px solid var(--line-2); border-radius: 10px; background: var(--surface); color: var(--ink);
}

details.card > summary {
  display: flex; align-items: center; gap: 8px; cursor: pointer; list-style: none;
  font-size: 15px; font-weight: 600; min-height: 28px;
}
details.card > summary::-webkit-details-marker { display: none; }
details.card[open] > summary { margin-bottom: 14px; }
.sub-details { border-top: 1px solid var(--line); padding-top: 12px; }
.sub-details summary { cursor: pointer; font-size: 14px; font-weight: 600; min-height: 32px; color: var(--ink-2); }
.sub-details[open] summary { margin-bottom: 10px; }

.tag { display: inline-flex; vertical-align: -2px; color: var(--blue); }

/* 2FA */
.setup-steps { margin: 0; padding-left: 20px; font-size: 14px; color: var(--ink-2); display: flex; flex-direction: column; gap: 4px; }
.qr-box { display: flex; justify-content: center; padding: 8px 0; }
.qr { width: 220px; height: 220px; border-radius: 12px; border: 1px solid var(--line); }
.secret-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; background: var(--grey-bg); border-radius: 12px; }
.secret { font-size: 14px; word-break: break-all; color: var(--ink); }
.share-url { font-size: 12px; word-break: break-all; color: var(--ink-2); }
.otp-input { font-size: 22px !important; letter-spacing: 0.3em !important; text-align: center; }
.recovery { display: flex; flex-direction: column; gap: 12px; padding: 14px; border-radius: 14px; background: var(--orange-bg); color: var(--ink); font-size: 14px; }
.recovery-list { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 16px; font-size: 15px; }

/* Painel */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tabs a {
  min-height: 40px; padding: 0 14px; display: inline-flex; align-items: center; gap: 6px; border-radius: 999px;
  border: 1px solid var(--line-2); background: var(--surface); font-size: 14px; font-weight: 500; color: var(--ink-2);
}
.tabs a[aria-current="page"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.kv { margin: 0; display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 8px 12px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; color: var(--ink); word-break: break-word; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.stat { background: var(--grey-bg); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 2px; }
.stat strong { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.stat span { font-size: 12px; color: var(--muted); }
.table-wrap { overflow-x: auto; margin: 0 -4px; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td { text-align: left; padding: 8px 4px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { font-weight: 600; color: var(--muted); font-size: 12px; }
.table td.num, .table th.num { text-align: right; white-space: nowrap; }
.code-block {
  font-family: var(--mono); font-size: 12px; background: var(--grey-bg); color: var(--ink);
  padding: 10px 12px; border-radius: 10px; word-break: break-all; display: block;
}
.lvl { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.lvl-error { color: var(--red); }
.lvl-warn { color: var(--orange); }
.lvl-info { color: var(--blue); }
.meter { -webkit-appearance: none; appearance: none; width: 100%; height: 8px; border: 0; border-radius: 4px; background: var(--line-2); overflow: hidden; }
.meter::-webkit-progress-bar { background: var(--line-2); border-radius: 4px; }
.meter::-webkit-progress-value { background: var(--accent); border-radius: 4px; }
.meter::-moz-progress-bar { background: var(--accent); border-radius: 4px; }
.h3 { font-size: 13px; font-weight: 600; color: var(--ink-2); margin: 6px 0 0; }
.result { font-size: 14px; display: flex; flex-direction: column; gap: 6px; }
.flash a { color: inherit; text-decoration: underline; }
.muted a { color: var(--ink); text-decoration: underline; }
.pre-line { white-space: pre-line; }
.backup-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.backup-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name del" "meta del"; gap: 2px 8px; padding: 10px 0; border-bottom: 1px solid var(--line); align-items: center; }
.backup-list li:last-child { border-bottom: 0; }
.backup-name { grid-area: name; font-size: 12px; word-break: break-all; text-decoration: underline; }
.backup-list .small { grid-area: meta; }
.backup-list form { grid-area: del; margin: 0; }
.updated .dot-error { background: var(--red); }
p > .icon, li > .icon:only-child { display: inline-block; vertical-align: -2px; }
