:root {
  color-scheme: dark;
  --brand: #09090B;
  --deep: #0E0E11;
  --surface: #121215;
  --glass: #121215;
  --accent: #FF4B5F;
  --accent-soft: rgba(255, 75, 95, .15);
  --action: #CB061D;
  --action-hover: #E0102A;
  --on-accent: #FAFAFA;
  --focus: #FF8A96;
  --mint: #8fe3b0;
  --green: #1c8f4e;
  --whats: #1c8f4e;
  --ink: #FAFAFA;
  --text: #FAFAFA;
  --ink-soft: #D4D4D8;
  --muted: #A1A1AA;
  --line: #2A2A30;
  --soft: rgba(255, 255, 255, .08);
  --bg: #09090B;
  --radius: 12px;
  --radius-btn: 8px;
  --shadow: 0 2px 10px rgba(0, 0, 0, .3);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: "Inter", system-ui, sans-serif; -webkit-font-smoothing: antialiased; font-size: 16px; }
body.has-bar { padding-bottom: 104px; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
svg.lucide { width: 1em; height: 1em; flex: none; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
.container { width: min(1280px, 100%); margin: 0 auto; padding-inline: 32px; }

.topbar { position: sticky; top: 0; z-index: 20; border-bottom: 1px solid var(--line); background: var(--brand); }
.topbar__inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 80px; }
.brand img { display: block; width: auto; height: 44px; object-fit: contain; }
.brand__text { color: #fff; font-weight: 700; }
.nav { display: flex; gap: 38px; }
.nav a { color: #fff; font-size: 15px; font-weight: 600; }
.nav a:hover, .nav a.is-active { color: var(--accent); }

.home { display: flex; flex-direction: column; align-items: center; padding-top: 72px; padding-bottom: 64px; text-align: center; }
h1 { margin: 0; color: var(--ink); font-size: clamp(26px, 4vw, 34px); font-weight: 700; }
.home h1 { font-size: clamp(30px, 5vw, 36px); }
.home p { margin: 8px 0 32px; color: var(--muted); font-size: 18px; }
.segments { display: flex; gap: 26px; margin-bottom: 32px; }
.segment { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; width: 168px; height: 125px; border: 2px solid var(--line); border-radius: 16px; color: var(--ink); transition: .18s; }
.segment svg.lucide { width: 38px; height: 38px; color: var(--accent); stroke-width: 1.6; }
.segment:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 8px 20px; border: 0; border-radius: var(--radius-btn); font-size: 14px; font-weight: 600; transition: .15s; }
.btn:hover { filter: brightness(1.08); }
.btn--primary:hover { filter: none; background: var(--action-hover); }
.btn--soft { border: 1px solid rgba(255, 75, 95, .6); background: #1E0A0E; color: var(--ink); }
.btn--soft:hover { filter: none; border-color: var(--accent); background: #2A0E14; }
.btn--accent { background: var(--action); color: var(--on-accent); }
.btn--primary { background: var(--action); color: var(--on-accent); }
.btn--green { background: var(--green); color: #fff; }
.btn--locked { border: 1px solid var(--line); background: transparent; color: var(--muted); cursor: not-allowed; }
.btn--locked:hover { filter: none; }

.catalog { padding-top: 48px; padding-bottom: 40px; }
.catalog h1 { margin-bottom: 24px; text-align: center; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 16px; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--glass); }
.toolbar__group { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.count { color: var(--muted); font-size: 13px; }
.tool { display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 4px 10px; border: 1px solid var(--line); border-radius: 30px; background: var(--glass); color: var(--ink-soft); font-size: 13px; }
.tool:hover { border-color: var(--accent); }
.tool svg { color: var(--accent); }
.tool svg.red { color: #ff9c8f; }
.tool svg.green { color: var(--mint); }
.tool b { display: grid; place-items: center; min-width: 18px; height: 18px; border-radius: 9px; background: var(--action); color: var(--on-accent); font-size: 11px; }
.tool--small { font-size: 12px; }
.view-switch { display: flex; gap: 2px; padding: 2px; border-radius: 30px; background: var(--soft); }
.view-switch button { display: grid; place-items: center; width: 38px; height: 28px; border: 0; border-radius: 30px; background: transparent; color: var(--ink); }
.view-switch button.is-active { background: var(--action); color: var(--on-accent); }

.cards { display: grid; gap: 12px; }
.card { display: grid; grid-template-columns: 22px 44px minmax(190px, 1.5fr) 1fr 1fr 1fr 120px auto; align-items: center; gap: 14px; min-height: 74px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--glass); box-shadow: var(--shadow); transition: opacity .15s, border-color .15s; }
.card:hover { border-color: rgba(255, 75, 95, .6); }
.card.is-selected { border-color: var(--accent); background: var(--accent-soft); }
.card.is-off { opacity: .38; }
.card__check { appearance: none; -webkit-appearance: none; width: 18px; height: 18px; margin: 0; border: 1.5px solid var(--accent); border-radius: 5px; background: var(--brand) center / 12px 12px no-repeat; cursor: pointer; transition: background-color .15s, border-color .15s; }
.card__check:hover:not(:disabled) { border-color: var(--focus); }
.card__check:checked { border-color: var(--action); background-color: var(--action); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E"); }
.card__check:disabled { border-color: rgba(255, 255, 255, .18); cursor: not-allowed; }
.card__icon { display: grid; place-items: center; width: 42px; height: 42px; border: 1px solid var(--accent); border-radius: 8px; background: var(--accent-soft); color: var(--accent); font-size: 21px; }
.card__main { min-width: 0; }
.card__credit { display: block; color: var(--ink); font-size: 19px; font-weight: 700; white-space: nowrap; }
.card__sub { display: block; overflow: hidden; color: var(--muted); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.tag { display: inline-block; margin-left: 6px; padding: 1px 6px; border-radius: 5px; background: #fff3d6; color: #8a5a00; font-size: 11px; font-weight: 600; }
.stat span { display: block; color: var(--muted); font-size: 10.5px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; }
.stat strong { color: var(--ink); font-size: 13.5px; font-weight: 600; white-space: nowrap; }
.card__logo { display: grid; place-items: center; height: 40px; color: var(--ink); font-size: 12px; font-weight: 600; line-height: 1.1; text-align: center; opacity: .88; transition: opacity .15s; }
.card:hover .card__logo, .card.is-selected .card__logo { opacity: 1; }
.card__logo img { display: block; max-width: 100%; max-height: 34px; object-fit: contain; }
.card__actions { display: flex; gap: 8px; }
.round { display: grid; place-items: center; width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 50%; background: var(--glass); color: var(--ink-soft); font-size: 17px; }
.round:hover { border-color: var(--accent); }
.round--whats { border-color: var(--whats); background: var(--whats); color: #fff; font-size: 19px; }
.round--lock { color: var(--muted); cursor: not-allowed; }
.round--lock:hover { border-color: var(--line); }

.cards.is-grid { grid-template-columns: repeat(auto-fill, minmax(255px, 1fr)); }
.is-grid .card { grid-template-columns: 22px 44px 1fr; align-content: start; }
.is-grid .card__main, .is-grid .card__logo, .is-grid .card__actions { grid-column: 1 / -1; }
.is-grid .card__logo { order: -1; grid-column: 3; grid-row: 1; justify-items: end; }
.is-grid .stat { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: baseline; padding-top: 8px; border-top: 1px solid var(--line); }
.is-grid .card__actions { justify-content: flex-end; }

.skeleton { height: 74px; border-radius: var(--radius); background: linear-gradient(90deg, rgba(255, 255, 255, .05) 25%, rgba(255, 255, 255, .11) 50%, rgba(255, 255, 255, .05) 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.state { grid-column: 1 / -1; padding: 48px 16px; color: var(--muted); text-align: center; }
.state svg.lucide { width: 34px; height: 34px; color: var(--accent); }
.state p { margin: 10px 0 16px; }
#sentinel { height: 1px; }

.disclaimer { margin-top: 24px; padding: 40px clamp(18px, 5vw, 60px) 32px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--glass); color: var(--ink-soft); font-size: 15px; line-height: 1.65; text-align: center; }
.disclaimer svg.lucide { display: block; width: 56px; height: 56px; margin: 0 auto 24px; color: var(--accent); stroke-width: 1.8; }
.disclaimer p { margin: 0; }
.disclaimer strong { color: var(--ink); font-weight: 700; }
.disclaimer hr { height: 1px; margin: 24px 0; border: 0; background: var(--line); }

.tool:disabled { opacity: .5; cursor: not-allowed; }
.tool:disabled:hover { border-color: var(--line); }

.selbar { position: fixed; left: 50%; bottom: 16px; z-index: 15; width: min(1108px, calc(100vw - 32px)); transform: translateX(-50%); animation: selbar-in .18s ease-out; }
@keyframes selbar-in { from { opacity: 0; translate: 0 12px; } }
.selbar__main { display: flex; align-items: center; gap: 14px; min-height: 68px; padding: 10px 12px; border: 1px solid rgba(255, 75, 95, .6); border-radius: 16px; background: #1E0A0E; color: #fff; box-shadow: 0 10px 30px rgba(0, 0, 0, .4); }
.selbar__summary { display: flex; flex: 0 1 245px; align-items: center; gap: 10px; min-width: 0; padding: 4px 8px 4px 4px; border: 0; border-radius: 10px; background: transparent; color: #fff; text-align: left; }
.selbar__summary:hover { background: rgba(255, 255, 255, .09); }
.selbar__summary > svg.lucide { margin-left: auto; color: var(--accent); font-size: 17px; }
.selbar__count { display: grid; place-items: center; flex: none; min-width: 36px; height: 36px; padding-inline: 6px; border-radius: 8px; background: var(--action); color: var(--on-accent); font-size: 15px; font-weight: 700; }
.selbar__info { display: grid; min-width: 0; line-height: 1.25; }
.selbar__info strong { overflow: hidden; font-size: 14px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.selbar__sub { overflow: hidden; color: var(--muted); font-size: 12.5px; text-overflow: ellipsis; white-space: nowrap; }
.selbar__totals { display: flex; flex: 1; justify-content: space-evenly; gap: 24px; min-width: 0; margin: 0; }
.selbar__totals div { min-width: 0; }
.selbar__totals dt { color: var(--muted); font-size: 10.5px; letter-spacing: .05em; text-transform: uppercase; white-space: nowrap; }
.selbar__totals dd { margin: 0; font-size: 14px; font-weight: 600; white-space: nowrap; }
.selbar__tools { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.selbar__tool { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 6px 10px; border: 0; border-radius: 9px; background: transparent; color: #fff; font-size: 13px; font-weight: 500; white-space: nowrap; }
.selbar__tool:hover { background: rgba(255, 255, 255, .12); }
.selbar__tool svg.lucide { font-size: 16px; }
.selbar__tool--compat[aria-pressed="true"] { background: rgba(255, 75, 95, .3); }
.selbar__primary { display: inline-flex; align-items: center; justify-content: center; flex: none; gap: 7px; min-height: 44px; padding: 8px 18px; border: 0; border-radius: var(--radius-btn); background: var(--action); color: var(--on-accent); font-size: 14px; font-weight: 700; white-space: nowrap; }
.selbar__primary:hover { background: var(--action-hover); }
.selbar__primary.is-whats:hover { background: var(--green); filter: brightness(1.08); }
.selbar__primary.is-whats { background: var(--green); color: #fff; }
.selbar__primary svg.lucide { font-size: 17px; }
.selbar .short { display: none; }
:is(.selbar__summary, .selbar__tool, .selbar__primary):focus-visible { outline-color: #fff; }

.sheet[open] { display: flex; flex-direction: column; }
.sheet .dialog__body { flex: 1; min-height: 0; overflow-y: auto; }
.sel-list { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.sel-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 8px 7px 12px; border: 1px solid var(--line); border-radius: 9px; }
.sel-list strong { display: block; color: var(--ink); font-size: 14px; }
.sel-list span { color: var(--muted); font-size: 12.5px; }

@media (min-width: 961px) {
  .has-totals .selbar__sub { display: none; }
}

@media (max-width: 960px) {
  .selbar__totals { display: none; }
  .selbar__summary { flex: 1 1 auto; }
}

@media (max-width: 720px) {
  body.has-bar { padding-bottom: calc(92px + env(safe-area-inset-bottom)); }
  .selbar { left: 0; bottom: 0; width: 100%; transform: none; }
  .selbar__main { gap: 6px; min-height: 72px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); border-radius: 16px 16px 0 0; }
  .selbar__tool--desktop { display: none; }
  .selbar__tool--compat { width: 40px; padding: 0; }
  .selbar__tool--compat span { display: none; }
  .selbar__tools { margin-left: 0; }
  .selbar__summary { gap: 8px; padding-right: 4px; }
  .selbar__primary { padding-inline: 14px; }
  .selbar__primary svg.lucide { display: none; }
  .selbar .long { display: none; }
  .selbar .short { display: inline; }
  .dialog.sheet { width: 100%; max-width: 100%; max-height: 85dvh; margin: auto 0 0; border-radius: 16px 16px 0 0; }
  .sheet .dialog__foot { padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
  .sheet .dialog__foot .btn { flex: 1; padding-inline: 8px; }
}

.dialog { width: min(640px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); padding: 0; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--text); box-shadow: 0 16px 48px rgba(0, 0, 0, .45); }
.dialog--narrow { width: min(500px, calc(100vw - 32px)); }
.dialog::backdrop { background: rgba(4, 5, 8, .75); }
.dialog__head, .dialog__foot { display: flex; align-items: center; gap: 10px; padding: 14px 16px; }
.dialog__head { justify-content: space-between; border-bottom: 1px solid var(--line); }
.dialog__head h2 { margin: 0; color: var(--ink); font-size: 17px; }
.dialog__foot { flex-wrap: wrap; justify-content: flex-end; border-top: 1px solid var(--line); }
.dialog__body { padding: 16px; font-size: 14.5px; line-height: 1.5; }
.icon-btn { display: grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: 50%; background: transparent; color: var(--ink-soft); font-size: 20px; }
.icon-btn:hover { background: var(--soft); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid label { display: grid; gap: 5px; min-width: 0; color: var(--ink); font-size: 13px; font-weight: 600; }
.form-grid input, .form-grid select { width: 100%; height: 40px; padding: 0 10px; border: 1px solid #71717A; border-radius: var(--radius-btn); background: var(--deep); color: var(--ink); font-size: 16px; font-weight: 400; }
.rows { display: grid; gap: 7px; margin: 0; }
.rows div { display: flex; justify-content: space-between; gap: 16px; }
.rows dt { color: var(--muted); }
.rows dd { margin: 0; color: var(--ink); font-weight: 600; text-align: right; }
.block-title { margin: 16px 0 6px; color: var(--ink); font-weight: 700; }
.note { margin-top: 14px; padding: 10px 12px; border-radius: 8px; background: var(--accent-soft); color: var(--ink); font-size: 13.5px; }
.sel-list li:not(:has(button)) { padding-right: 12px; }

body.has-bar .toast { bottom: 104px; }
.toast { position: fixed; left: 50%; bottom: 24px; z-index: 40; width: max-content; max-width: calc(100vw - 32px); padding: 10px 16px; border: 1px solid var(--line); border-radius: 30px; background: var(--deep); color: #fff; font-size: 14px; transform: translateX(-50%); }
#printArea { display: none; }

@media (max-width: 1020px) {
  .card { grid-template-columns: 22px 44px 1fr auto; }
  .card__main { grid-column: 3; }
  .card__logo { grid-column: 4; grid-row: 1; width: 100px; }
  .stat { grid-row: 2; grid-column: span 1; }
  .card .stat:nth-of-type(1) { grid-column: 1 / 3; }
  .card { row-gap: 10px; }
  .card:not(.x) { grid-template-columns: 22px 44px 1fr 1fr 100px; }
  .card:not(.x) .card__main { grid-column: 3 / 5; }
  .card:not(.x) .card__logo { grid-column: 5; }
  .card:not(.x) .stat { grid-row: 2; grid-column: auto; }
  .card:not(.x) .stat--in { grid-column: 1 / 3; min-width: 0; }
  .card:not(.x) .card__actions { grid-row: 2; grid-column: 5; justify-content: flex-end; }
  .is-grid .card:not(.x) { grid-template-columns: 22px 44px 1fr; }
  .is-grid .card:not(.x) .card__main { grid-column: 1 / -1; }
  .is-grid .card:not(.x) .card__logo { grid-column: 3; grid-row: 1; width: auto; }
  .is-grid .card:not(.x) .stat, .is-grid .card:not(.x) .stat--in { grid-column: 1 / -1; grid-row: auto; }
  .is-grid .card:not(.x) .card__actions { grid-column: 1 / -1; grid-row: auto; }
}

@media (max-width: 640px) {
  .container { padding-inline: 20px; }
  /* Logo com a HS é largo: os links descem para uma segunda linha */
  .topbar__inner { flex-wrap: wrap; row-gap: 12px; min-height: 0; padding-block: 14px 12px; }
  .brand img { height: 36px; }
  .nav { width: 100%; justify-content: space-between; gap: 8px; }
  .nav a { font-size: 14px; }
  .home { padding-top: 44px; }
  .segments { gap: 12px; width: 100%; justify-content: center; }
  .segment { flex: 1; width: auto; max-width: 168px; }
  .catalog { padding-top: 28px; }
  .toolbar { padding: 10px; }
  .toolbar__group { width: 100%; }
  .toolbar__group:last-child { justify-content: space-between; }
  .tool span { font-size: 12px; }
  .card:not(.x) { grid-template-columns: 20px 40px 1fr 76px; gap: 10px; padding: 12px; }
  .card:not(.x) .card__main { grid-column: 3; }
  .card:not(.x) .card__logo { grid-column: 4; width: 76px; }
  .card__credit { font-size: 17px; }
  .card__sub { white-space: normal; }
  .card__sub .tag { display: block; width: fit-content; margin: 4px 0 0; }
  .card:not(.x) .stat, .card:not(.x) .stat--in { grid-column: 1 / -1; grid-row: auto; display: flex; justify-content: space-between; align-items: baseline; }
  .card:not(.x) .card__actions { grid-column: 1 / -1; grid-row: auto; }
  .is-grid .card:not(.x) { grid-template-columns: 20px 40px 1fr 76px; }
  .is-grid .card:not(.x) .card__main { grid-column: 3; }
  .is-grid .card:not(.x) .card__logo { grid-column: 4; grid-row: 1; }
  .form-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

@media print {
  :root { color-scheme: light; }
  body { background: #fff; }
  body > *:not(#printArea) { display: none !important; }
  body.has-bar { padding: 0; }
  #printArea { display: block; color: #000; font-size: 10px; }
  #printArea h2 { margin: 0 0 8px; font-size: 15px; }
  #printArea table { width: 100%; border-collapse: collapse; }
  #printArea th, #printArea td { padding: 3px 4px; border: 1px solid #bbb; text-align: left; }
  #printArea thead { display: table-header-group; }
  #printArea tr { break-inside: avoid; }
}
