/* Mágico: azul com preto */
:root {
  --bg: #05070d;
  --panel: #0b101d;
  --panel-2: #121a2e;
  --line: #1d2945;
  --text: #e8eefc;
  --muted: #8d9bbd;
  --accent: #2f7dff;
  --accent-dim: #1d4ea8;
  --accent-soft: #0f2350;
  --accent-text: #6ea8ff;
  --red: #c0342c;
  --green: #1f7a45;
  --radius: 12px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0; background: radial-gradient(1100px 600px at 85% -10%, #0e2257 0%, transparent 60%) fixed, var(--bg); color: var(--text);
  font: 14px/1.5 Inter, system-ui, sans-serif;
}
h1, h2, h3, .brand span { font-family: Sora, 'Segoe UI', sans-serif; letter-spacing: .01em; }
a { color: var(--accent-text); }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-box { text-align: center; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 40px 36px; max-width: 360px; width: 100%; }
.login-box h1 { color: var(--accent-text); margin: 8px 0 4px; font-size: 28px; }
.login-box p { color: var(--muted); margin: 0 0 24px; }
.login-crest { display: block; width: 210px; max-width: 70%; height: auto; margin: 0 auto 10px; filter: drop-shadow(0 6px 18px #000c); }

/* layout */
.app { display: grid; grid-template-columns: 230px 1fr; min-height: 100vh; }
.side { background: var(--panel); border-right: 1px solid var(--line); padding: 20px 14px; display: flex; flex-direction: column; gap: 18px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; justify-content: center; padding: 0 8px; }
.brand img { width: 108px; height: auto; filter: drop-shadow(0 4px 14px #000a); }
nav { display: flex; flex-direction: column; gap: 4px; }
nav a { display: flex; align-items: center; color: var(--text); text-decoration: none; padding: 9px 12px; border-radius: 8px; }
/* ícones do menu: PNG branco usado como máscara, então herdam a cor do texto */
.ico { flex: 0 0 auto; display: inline-block; width: 19px; height: 19px; margin-right: 11px; background: currentColor; -webkit-mask: var(--i) center / contain no-repeat; mask: var(--i) center / contain no-repeat; opacity: .92; }
nav a.active .ico { opacity: 1; }
nav a:hover { background: var(--panel-2); }
nav a.active { background: var(--accent-soft); color: #fff; box-shadow: inset 3px 0 0 var(--accent); }
.me { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 8px; border-top: 1px solid var(--line); }
.me img { width: 32px; height: 32px; border-radius: 50%; }
.me .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.me button { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 12px; }
.me button:hover { color: var(--red); }
.main { padding: 24px 28px 48px; min-width: 0; }
.top h2 { margin: 0 0 20px; font-size: 24px; color: var(--text); }

/* componentes */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.card h3 { margin: 0 0 12px; font-size: 15px; color: var(--accent-text); }
.grid { display: grid; gap: 16px; }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.stat .n { font-size: 28px; font-weight: 600; }
.stat .l { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.muted { color: var(--muted); }

label { display: block; font-size: 12px; color: var(--muted); margin: 12px 0 4px; text-transform: uppercase; letter-spacing: .05em; }
input[type=text], input[type=url], input[type=password], input[type=search], select, textarea {
  width: 100%; background: var(--panel-2); color: var(--text); border: 1px solid var(--line);
  border-radius: 8px; padding: 9px 11px; font: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-dim); border-color: var(--accent-dim); }
textarea { min-height: 120px; resize: vertical; }
select[multiple] { min-height: 130px; }
input[type=color] { width: 54px; height: 36px; padding: 2px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; }
.row > * { flex: 1; min-width: 160px; }
.check { display: flex; align-items: center; gap: 8px; margin-top: 12px; color: var(--text); text-transform: none; font-size: 14px; letter-spacing: 0; }
.check input { width: auto; }

.btn { display: inline-block; background: var(--panel-2); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 9px 16px; cursor: pointer; font: inherit; font-weight: 500; text-decoration: none; }
.btn:hover { border-color: var(--accent-dim); }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.12); }
.btn.green { background: var(--green); border-color: var(--green); color: #fff; }
.btn.red { background: var(--red); border-color: var(--red); color: #fff; }
.btn.small { padding: 4px 10px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* Hierarquia: cargos escolhidos / disponíveis */
.role-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 0 14px; max-height: 210px; overflow-y: auto; padding: 4px 10px 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
.role-checks .check { margin-top: 6px; }
.hq-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.hq-list { list-style: none; margin: 0; padding: 0; max-height: 460px; overflow-y: auto; }
.hq-list li { display: flex; align-items: center; gap: 10px; padding: 8px 4px; border-bottom: 1px solid var(--line); }
.hq-n { flex: 0 0 22px; color: var(--muted); font-size: 12px; text-align: right; }
.hq-sub { font-size: 12px; }
.hq-acts { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.rolepill { display: inline-block; padding: 2px 10px; border-radius: 6px; font-size: 13px; font-weight: 500; color: var(--c); background: color-mix(in srgb, var(--c) 18%, transparent); border: 1px solid color-mix(in srgb, var(--c) 45%, transparent); }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; font-weight: 500; }
.table-wrap { overflow-x: auto; }
.tag { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; }
.tag.pending { background: #33290d; color: #f0c14b; }
.tag.approved { background: #12301a; color: #6fcf7f; }
.tag.rejected { background: #3a1412; color: #f08a84; }
.filters { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.filters .btn.on { background: var(--accent-soft); border-color: var(--accent); color: #fff; }

/* editor de mensagens */
.composer { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 1000px) { .composer { grid-template-columns: 1fr; } }
.preview { background: #313338; border-radius: var(--radius); padding: 16px; position: sticky; top: 16px; }
.preview .who { display: flex; gap: 10px; align-items: center; margin-bottom: 6px; }
.preview .who img { width: 38px; height: 38px; border-radius: 50%; background: #1e1f22; }
.preview .who b { color: #fff; }
.preview .who i { font-style: normal; font-size: 10px; background: #5865f2; color: #fff; padding: 1px 5px; border-radius: 4px; margin-left: 6px; }
.preview .content { white-space: pre-wrap; color: #dbdee1; margin: 4px 0 8px 48px; word-break: break-word; }
.pv-embed { margin-left: 48px; background: #2b2d31; border-left: 4px solid var(--accent); border-radius: 4px; padding: 10px 14px; max-width: 480px; position: relative; }
.pv-embed .t { color: #fff; font-weight: 600; margin-bottom: 4px; word-break: break-word; }
.pv-embed .d { color: #dbdee1; white-space: pre-wrap; word-break: break-word; }
.pv-embed .f { color: #949ba4; font-size: 12px; margin-top: 8px; }
.pv-embed img.big { max-width: 100%; border-radius: 4px; margin-top: 10px; display: block; }
.pv-embed img.thumb { position: absolute; top: 10px; right: 10px; width: 64px; height: 64px; object-fit: cover; border-radius: 4px; }

.ranking li { padding: 6px 0; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 10px; }
ul.clean { list-style: none; margin: 0; padding: 0; }

h3.sec { margin: 26px 0 12px; color: var(--accent-text); font-size: 17px; }
.sellers { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); align-items: start; }
details.seller { padding: 12px 14px; }
details.seller summary { cursor: pointer; }
details.seller[open] summary { margin-bottom: 8px; }

.toast { position: fixed; bottom: 22px; right: 22px; background: var(--panel); border: 1px solid var(--accent-dim); color: var(--text); padding: 12px 18px; border-radius: 10px; max-width: 360px; box-shadow: 0 8px 30px #000a; z-index: 10; }
.toast.err { border-color: var(--red); }

@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }  /* o menu não estica para preencher a tela */
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; align-content: flex-start; gap: 10px 14px; padding: 12px 14px; }
  .brand img { width: 56px; }
  nav { flex-direction: row; flex-wrap: wrap; }
  .me { margin: 0 0 0 auto; border: 0; }
  .main { padding: 16px; }
}

/* Logs e Segurança */
.sec-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 0 16px; }
.sec-warn { border-color: var(--red); }
.sec-warn li { margin: 4px 0; }
.num-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }

/* Aviso por DM */
.bar { height: 12px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent-dim), var(--accent)); transition: width .4s; }
.pv-dm { max-width: 520px; }

/* Vendas */
.sales-grid { display: grid; grid-template-columns: minmax(300px, 440px) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1000px) { .sales-grid { grid-template-columns: 1fr; } }
.stack { display: grid; gap: 16px; min-width: 0; }
.stack .stat .n { font-size: 22px; }
.drop { border: 2px dashed var(--accent-dim); border-radius: var(--radius); background: var(--panel-2); padding: 22px 14px; text-align: center; cursor: pointer; }
.drop:hover, .drop:focus-visible, .drop.over { border-color: var(--accent); background: var(--accent-soft); outline: none; }
.drop img { display: block; max-width: 100%; max-height: 220px; margin: 0 auto; border-radius: 8px; }
.hint { margin: 4px 0 0; min-height: 21px; font-size: 13px; }
.picked { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.results, .chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.chips { margin: 8px 0; }
.warn { background: #33290d; color: #f0c14b; border-radius: 8px; padding: 8px 12px; margin: 0 0 4px; }
#sales-search { flex: 1; min-width: 200px; max-width: 360px; margin-left: auto; }
td.what { white-space: pre-wrap; word-break: break-word; min-width: 180px; max-width: 360px; }
td.money { white-space: nowrap; font-weight: 600; }
tr.off td.money { text-decoration: line-through; color: var(--muted); }
td a { white-space: nowrap; }
