:root {
  --bg: #0a0a0b;
  --bg-2: #111113;
  --card: #151518;
  --card-2: #1b1b1f;
  --line: #26262b;
  --text: #f4f1ec;
  --muted: #8d8a86;
  --orange: #ff7a1a;
  --orange-2: #ff9a3d;
  --orange-dim: rgba(255, 122, 26, 0.12);
  --danger: #ff4d4d;
  --ok: #3ddc84;
  --radius: 12px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
  background-image:
    radial-gradient(800px 400px at 85% -10%, rgba(255, 122, 26, 0.16), transparent 60%),
    radial-gradient(600px 300px at -10% 10%, rgba(255, 122, 26, 0.07), transparent 60%);
  background-repeat: no-repeat;
}
a { color: var(--orange); }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }

/* ---------- header ---------- */
header.top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 0;
}
.brand {
  font-family: 'Chakra Petch', sans-serif; font-weight: 700; font-size: 22px;
  letter-spacing: 0.5px; display: flex; align-items: center; gap: 10px;
}
.brand .logo {
  width: 32px; height: 32px; border-radius: 8px;
  background: linear-gradient(135deg, var(--orange), #c24d00);
  display: grid; place-items: center; color: #000; font-size: 16px; font-weight: 800;
}
.brand span.accent { color: var(--orange); }
.tag { color: var(--muted); font-size: 13px; }

/* ---------- hero ---------- */
.hero { padding: 36px 0 12px; }
.hero h1 {
  font-family: 'Chakra Petch', sans-serif; font-size: clamp(28px, 5vw, 46px);
  line-height: 1.1; margin: 0 0 10px; font-weight: 700;
}
.hero h1 em { font-style: normal; color: var(--orange); }
.hero p { color: var(--muted); max-width: 620px; margin: 0 0 24px; }

.quote-box {
  display: flex; gap: 10px; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 8px;
}
.quote-box:focus-within { border-color: var(--orange); box-shadow: 0 0 0 4px var(--orange-dim); }
.quote-box input {
  flex: 1; min-width: 0; background: transparent; border: 0; outline: 0;
  color: var(--text); font-size: 15px; padding: 10px 12px; font-family: inherit;
}
.quote-box input::placeholder { color: #5d5a57; }

.btn {
  border: 0; border-radius: 9px; padding: 11px 20px; cursor: pointer;
  font-weight: 700; font-family: inherit; font-size: 14px; white-space: nowrap;
  transition: transform .08s, background .15s, opacity .15s;
  text-decoration: none; display: inline-block;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--orange); color: #111; }
.btn-primary:hover { background: var(--orange-2); }
.btn-ghost { background: transparent; color: var(--orange); border: 1px solid rgba(255,122,26,.45); }
.btn-ghost:hover { background: var(--orange-dim); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.hint { font-size: 12.5px; color: var(--muted); margin-top: 10px; }
.hint a { text-decoration: none; }

.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 28px 0 8px; }
.step { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.step b { color: var(--orange); font-family: 'Chakra Petch', sans-serif; margin-right: 6px; }
.step div { color: var(--muted); font-size: 13px; }

/* ---------- resultado ---------- */
.alert {
  margin: 18px 0 0; padding: 12px 14px; border-radius: 10px;
  background: rgba(255, 77, 77, 0.08); border: 1px solid rgba(255, 77, 77, 0.35); color: #ffb3b3;
}
.summary {
  position: sticky; top: 0; z-index: 5; margin: 26px 0 16px;
  background: rgba(17, 17, 19, 0.92); backdrop-filter: blur(8px);
  border: 1px solid var(--line); border-left: 3px solid var(--orange);
  border-radius: var(--radius); padding: 14px 18px;
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
}
.summary .label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 1px; }
.summary .total { font-family: 'Chakra Petch', sans-serif; font-size: 30px; font-weight: 700; color: var(--orange); line-height: 1.1; }
.summary .meta { color: var(--muted); font-size: 13px; }
.summary .spacer { flex: 1; }
.share-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--card-2); border: 1px solid var(--orange); color: var(--text); padding: 10px 16px; border-radius: 10px; font-size: 14px; z-index: 50; }

.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar input {
  background: var(--card); border: 1px solid var(--line); color: var(--text);
  border-radius: 9px; padding: 9px 12px; font-family: inherit; min-width: 220px;
}
.toolbar label { color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 6px; cursor: pointer; }
.toolbar input[type=checkbox] { min-width: 0; accent-color: var(--orange); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; padding-bottom: 60px; }
.item {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column; position: relative;
  transition: border-color .15s, transform .15s;
}
.item:hover { border-color: rgba(255,122,26,.5); transform: translateY(-2px); }
.item .img {
  aspect-ratio: 4 / 3; display: grid; place-items: center; padding: 14px;
  background: radial-gradient(circle at 50% 60%, var(--card-2), var(--card));
  border-bottom: 2px solid var(--rar, #444);
}
.item .img img { max-width: 100%; max-height: 100%; object-fit: contain; }
.item .body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.item .name { font-size: 13px; font-weight: 600; line-height: 1.3; }
.item .float { font-size: 11.5px; color: var(--muted); }
.item .price { margin-top: auto; font-family: 'Chakra Petch', sans-serif; font-weight: 700; font-size: 18px; color: var(--orange); }
.item.no-offer { opacity: .45; }
.item.no-offer .price { color: var(--muted); font-size: 14px; font-family: 'Inter', sans-serif; font-weight: 500; }

.skeleton { height: 230px; border-radius: var(--radius); background: linear-gradient(90deg, var(--card) 0%, var(--card-2) 50%, var(--card) 100%); background-size: 200% 100%; animation: sh 1.2s infinite; }
@keyframes sh { to { background-position: -200% 0; } }

footer { color: #5d5a57; font-size: 12px; text-align: center; padding: 20px 0 30px; }
.hidden { display: none !important; }

/* ---------- admin ---------- */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }
.panel h2 { font-family: 'Chakra Petch', sans-serif; margin: 0 0 4px; font-size: 18px; }
.panel .sub { color: var(--muted); font-size: 13px; margin: 0 0 16px; }
.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.field label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 5px; }
.field input, .field select, .field textarea {
  width: 100%; background: var(--bg-2); border: 1px solid var(--line); color: var(--text);
  border-radius: 9px; padding: 10px 12px; font-family: inherit; font-size: 14px;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: 0; border-color: var(--orange); }
.field textarea { min-height: 80px; resize: vertical; }
.field.check { display: flex; align-items: center; gap: 8px; padding-top: 22px; }
.field.check input { width: auto; accent-color: var(--orange); }
.field.check label { margin: 0; color: var(--text); }

.margin-box { display: grid; grid-template-columns: 1fr auto; gap: 20px; align-items: center; }
.margin-box input[type=range] { width: 100%; accent-color: var(--orange); }
.big-num { font-family: 'Chakra Petch', sans-serif; font-size: 40px; font-weight: 700; color: var(--orange); min-width: 120px; text-align: right; }
.example { margin-top: 12px; background: var(--bg-2); border: 1px dashed var(--line); border-radius: 10px; padding: 12px 14px; font-size: 13.5px; color: var(--muted); }
.example b { color: var(--text); }
.example .profit { color: var(--ok); }
.example .loss { color: var(--danger); }

.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; align-items: center; }
.saved { color: var(--ok); font-size: 13px; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 500; }
td.num, th.num { text-align: right; }
.table-wrap { overflow-x: auto; }
pre.raw { background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px; max-height: 360px; overflow: auto; font-size: 12px; color: #d8d4ce; }

.login { max-width: 380px; margin: 12vh auto 0; }

@media (max-width: 640px) {
  .steps { grid-template-columns: 1fr; }
  .quote-box { flex-direction: column; }
  .grid { grid-template-columns: repeat(2, 1fr); }
  .summary .total { font-size: 24px; }
  .margin-box { grid-template-columns: 1fr; }
  .big-num { text-align: left; }
  .toolbar input { min-width: 0; flex: 1; }
  .share-actions, .share-actions .btn { width: 100%; text-align: center; }
}

/* página da cotação salva */
a.brand { color: var(--text); text-decoration: none; }
#qid { text-transform: none; letter-spacing: 0; color: var(--text); }
header.top { gap: 12px; flex-wrap: wrap; }

/* seleção de itens */
.item.selectable { cursor: pointer; user-select: none; }
.item.selectable:not(.selected) { opacity: .55; }
.item.selectable:not(.selected):hover { opacity: .85; }
.item.selected { border-color: var(--orange); box-shadow: 0 0 0 1px var(--orange) inset; }
.item:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }
.item .check {
  position: absolute; top: 10px; right: 10px; z-index: 2;
  width: 24px; height: 24px; border-radius: 6px;
  border: 2px solid rgba(255,255,255,.35); background: rgba(10,10,11,.6);
  display: grid; place-items: center; font-weight: 800; font-size: 14px; color: #111;
}
.item.selected .check { background: var(--orange); border-color: var(--orange); }
.toolbar .sel-actions { display: flex; gap: 8px; margin-left: auto; }
.toolbar .sel-actions .btn { padding: 8px 14px; font-size: 13px; }
.hint-sel { color: var(--muted); font-size: 13px; margin: -4px 0 12px; }
@media (max-width: 640px) { .toolbar .sel-actions { margin-left: 0; width: 100%; } .toolbar .sel-actions .btn { flex: 1; } }
.btn.disabled { opacity: .5; }

/* logo da marca: fundo preto some sobre o fundo escuro */
.brand-logo { height: 46px; width: auto; mix-blend-mode: lighten; display: block; }

/* dólar automático */
.fx-box { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  background: var(--bg-2); border: 1px solid var(--line); border-left: 3px solid var(--orange);
  border-radius: 10px; padding: 12px 16px; margin-bottom: 16px; }
.fx-label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 1px; }
.fx-rate { font-family: 'Chakra Petch', sans-serif; font-size: 28px; font-weight: 700; color: var(--orange); }
.fx-src { color: var(--muted); font-size: 12.5px; }

/* status de salvamento do painel */
.save-bar { position: fixed; right: 16px; bottom: 16px; z-index: 40; }
.save-status { display: inline-block; background: var(--card-2); border: 1px solid var(--line); border-radius: 999px;
  padding: 8px 14px; font-size: 13px; color: var(--muted); box-shadow: 0 8px 24px rgba(0,0,0,.4); }
.save-status:empty { display: none; }
.save-status.ok { color: var(--ok); border-color: rgba(61,220,132,.4); }
.save-status.pending { color: var(--orange-2); border-color: rgba(255,122,26,.45); }
.save-status.err { color: var(--danger); border-color: rgba(255,77,77,.45); }
