/* NEX Editor - tema escuro */
:root {
  --bg: #0c0e13;
  --bg2: #10131a;
  --panel: #151922;
  --panel2: #1b2030;
  --panel3: #222839;
  --line: #262c3a;
  --line2: #323a4d;
  --text: #e8ebf2;
  --muted: #8e97a8;
  --dim: #646d7e;
  --accent: #5aa2ff;
  --accent2: #3b82f6;
  --accent-soft: rgba(90, 162, 255, .14);
  --gold: #f4b740;
  --ok: #3ddc84;
  --ok-soft: rgba(61, 220, 132, .13);
  --warn: #f4b740;
  --warn-soft: rgba(244, 183, 64, .13);
  --bad: #ff6b6b;
  --bad-soft: rgba(255, 107, 107, .13);
  --changed: #b48cff;
  --changed-soft: rgba(180, 140, 255, .14);
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
.noscript { padding: 40px; text-align: center; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.mono { font-family: var(--mono); }
.nowrap { white-space: nowrap; }

/* inicio */
.boot { min-height: 100vh; display: grid; place-items: center; }
.boot-spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--line2); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* botoes e campos */
.btn { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: var(--radius-sm); border: 1px solid var(--line2); background: var(--panel2); cursor: pointer; transition: background .15s, border-color .15s, opacity .15s; white-space: nowrap; }
.btn:hover:not(:disabled) { background: var(--panel3); border-color: #3d475d; }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: var(--accent2); border-color: var(--accent2); color: #fff; font-weight: 600; }
.btn.primary:hover:not(:disabled) { background: #4c8ff7; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover:not(:disabled) { background: var(--panel2); }
.btn.small { height: 28px; padding: 0 10px; font-size: 13px; }
.btn.icon { width: 32px; padding: 0; justify-content: center; }
.btn.danger { color: var(--bad); }
.input { width: 100%; height: 36px; padding: 0 12px; border-radius: var(--radius-sm); border: 1px solid var(--line2); background: var(--bg2); outline: none; transition: border-color .15s, box-shadow .15s; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input.bad { border-color: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }
.input.changed { border-color: var(--changed); }
.input:disabled { opacity: .6; }
textarea.input { height: auto; padding: 10px 12px; resize: vertical; }
label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; margin-bottom: 6px; color: var(--muted); font-size: 13px; }

/* login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(900px 500px at 50% -10%, rgba(90, 162, 255, .12), transparent 60%), var(--bg); }
.login-card { width: 100%; max-width: 380px; padding: 34px 32px 28px; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); box-shadow: var(--shadow); }
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.brand-logo { width: 40px; height: 40px; border-radius: 11px; background: var(--panel2) url(/favicon.svg) center/100% no-repeat; flex: none; }
.brand h1 { margin: 0; font-size: 19px; letter-spacing: .3px; }
.brand p { margin: 0; color: var(--muted); font-size: 13px; }
.login-card .btn.primary { width: 100%; justify-content: center; height: 40px; margin-top: 6px; }
.form-error { min-height: 20px; margin: 4px 0 0; color: var(--bad); font-size: 13px; }

/* barra de cima */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; height: 58px; padding: 0 16px; border-bottom: 1px solid var(--line); background: rgba(16, 19, 26, .92); backdrop-filter: blur(8px); }
.topbar .brand { margin: 0; gap: 10px; }
.topbar .brand-logo { width: 32px; height: 32px; border-radius: 9px; }
.topbar .brand h1 { font-size: 16px; }
.topbar .title { min-width: 0; flex: 1; display: flex; align-items: center; gap: 10px; }
.topbar .title strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crumb { color: var(--muted); }
.spacer { flex: 1; }
.save-pill { display: inline-flex; align-items: center; gap: 7px; height: 28px; padding: 0 11px; border-radius: 99px; background: var(--panel2); color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.save-pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.save-pill.saving::before { background: var(--accent); animation: pulse 1s infinite; }
.save-pill.error::before { background: var(--bad); }
.save-pill.error { color: var(--bad); }
@keyframes pulse { 50% { opacity: .3; } }
.badge { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--changed-soft); color: var(--changed); font-size: 12px; font-weight: 600; }
.user-chip { display: inline-flex; align-items: center; gap: 8px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--panel3); color: var(--accent); font-weight: 700; font-size: 13px; }

/* menu */
.menu { position: absolute; z-index: 60; min-width: 200px; padding: 6px; border: 1px solid var(--line2); border-radius: var(--radius-sm); background: var(--panel); box-shadow: var(--shadow); }
.menu button { display: block; width: 100%; padding: 8px 10px; border: 0; border-radius: 6px; background: transparent; text-align: left; cursor: pointer; }
.menu button:hover { background: var(--panel2); }

/* projetos */
.page { max-width: 1080px; margin: 0 auto; padding: 28px 20px 60px; }
.page h2 { margin: 0 0 4px; font-size: 22px; }
.page .lead { margin: 0 0 22px; color: var(--muted); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.card { padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.project-card { display: flex; flex-direction: column; gap: 10px; cursor: pointer; transition: border-color .15s, transform .15s; }
.project-card:hover { border-color: var(--line2); transform: translateY(-1px); }
.project-card h3 { margin: 0; font-size: 16px; }
.project-card .meta { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--muted); font-size: 13px; }
.status { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 99px; font-size: 12px; font-weight: 600; width: fit-content; }
.status.editing { background: var(--accent-soft); color: var(--accent); }
.status.submitted { background: var(--warn-soft); color: var(--warn); }
.status.approved { background: var(--ok-soft); color: var(--ok); }
.status.returned { background: var(--bad-soft); color: var(--bad); }
.empty { padding: 50px 20px; text-align: center; color: var(--muted); border: 1px dashed var(--line2); border-radius: var(--radius); }

/* editor */
.editor { display: grid; grid-template-columns: 330px 1fr; height: calc(100vh - 58px); }
.sidebar { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); background: var(--bg2); }
.sidebar .tools { padding: 12px; border-bottom: 1px solid var(--line); display: grid; gap: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { height: 28px; padding: 0 11px; border-radius: 99px; border: 1px solid var(--line2); background: transparent; color: var(--muted); font-size: 12.5px; cursor: pointer; }
.chip.on { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.range { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; }
.range .input { height: 30px; padding: 0 8px; }
.list { flex: 1; overflow-y: auto; padding: 6px; }
.list-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; border-radius: var(--radius-sm); background: transparent; text-align: left; cursor: pointer; }
.list-item:hover { background: var(--panel); }
.list-item.on { background: var(--panel2); box-shadow: inset 3px 0 0 var(--accent); }
.list-item .name { flex: 1; min-width: 0; }
.list-item .name strong { display: block; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item .name small { color: var(--dim); font-size: 12px; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.dot.changed { background: var(--changed); }
.dot.warn { background: var(--warn); }
.list-more { padding: 10px; text-align: center; color: var(--dim); font-size: 12.5px; }
.count-line { padding: 8px 12px; border-top: 1px solid var(--line); color: var(--dim); font-size: 12px; }

.main { min-width: 0; overflow-y: auto; }
.main-inner { max-width: 1100px; padding: 22px 26px 80px; }
.monster-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 18px; }
.monster-head h2 { margin: 0; font-size: 23px; }
.monster-head .sub { color: var(--muted); }
.banner { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; margin-bottom: 16px; border-radius: var(--radius-sm); border: 1px solid transparent; }
.banner.info { background: var(--accent-soft); border-color: rgba(90, 162, 255, .25); }
.banner.warn { background: var(--warn-soft); border-color: rgba(244, 183, 64, .3); }
.banner.bad { background: var(--bad-soft); border-color: rgba(255, 107, 107, .3); }
.banner.ok { background: var(--ok-soft); border-color: rgba(61, 220, 132, .3); }
.banner ul { margin: 4px 0 0; padding-left: 18px; }
.banner strong { display: block; }
.section { margin-bottom: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.section > header { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.section > header h3 { margin: 0; font-size: 15px; }
.section > header .hint { color: var(--muted); font-size: 12.5px; }
.section > .body { padding: 16px; }
.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px 16px; }
.fgroup-title { grid-column: 1 / -1; margin-top: 4px; color: var(--dim); font-size: 12px; text-transform: uppercase; letter-spacing: .6px; }
.fbox > .lbl { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; color: var(--muted); font-size: 13px; }
.fbox .orig { display: flex; align-items: center; justify-content: space-between; gap: 6px; min-height: 20px; margin-top: 5px; font-size: 12px; color: var(--changed); }
.fbox .err { margin-top: 5px; font-size: 12px; color: var(--bad); }
.help { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; background: var(--panel3); color: var(--muted); font-size: 11px; cursor: help; }
.lock { color: var(--dim); font-size: 12px; }
.link-btn { padding: 0; border: 0; background: none; color: var(--accent); cursor: pointer; font-size: 12px; }

/* drops */
.drop-config { display: grid; grid-template-columns: 180px repeat(4, minmax(110px, 1fr)); gap: 12px; align-items: end; margin-bottom: 14px; }
.sum-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; margin: 4px 0 14px; color: var(--muted); font-size: 13px; }
.sumbar { position: relative; flex: 1; min-width: 160px; height: 8px; border-radius: 99px; background: var(--panel3); overflow: hidden; }
.sumbar > i { position: absolute; inset: 0 auto 0 0; background: var(--ok); border-radius: 99px; }
.sumbar.over > i { background: var(--bad); }
.drops { width: 100%; border-collapse: collapse; }
.drops th { padding: 8px 10px; border-bottom: 1px solid var(--line); color: var(--dim); font-size: 12px; font-weight: 500; text-align: left; white-space: nowrap; }
.drops td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.drops tr:last-child td { border-bottom: 0; }
.drops tr.changed td:first-child { box-shadow: inset 3px 0 0 var(--changed); }
.drops .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.item-cell { display: flex; align-items: center; gap: 10px; min-width: 220px; }
.item-cell .txt { min-width: 0; }
.item-cell .txt strong { display: block; font-weight: 500; }
.item-cell .txt small { color: var(--dim); font-size: 12px; }
.icon { width: 32px; height: 32px; flex: none; border-radius: 6px; background-color: var(--panel3); background-repeat: no-repeat; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06); image-rendering: auto; }
.icon.none { display: grid; place-items: center; color: var(--dim); font-size: 13px; }
.icon.big { width: 48px; height: 48px; }
.chance { display: flex; align-items: center; gap: 10px; min-width: 240px; }
.chance input[type=range] { flex: 1; accent-color: var(--accent); }
.chance .input { width: 92px; height: 32px; text-align: right; }
.row-actions { display: flex; gap: 4px; justify-content: flex-end; }
.add-row { margin-top: 12px; }

/* descricao do item (cores do jogo) */
.desc { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--bg2); border: 1px solid var(--line); font-size: 13px; line-height: 1.55; white-space: normal; max-height: 260px; overflow-y: auto; }
.desc-row td { padding-top: 0; }

/* simulacao */
.sim-controls { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; margin-bottom: 14px; }
.sim-controls label.field { margin: 0; }
.sim-table { width: 100%; border-collapse: collapse; }
.sim-table th, .sim-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; }
.sim-table th { color: var(--dim); font-size: 12px; font-weight: 500; }
.sim-table td.num, .sim-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.up { color: var(--ok); }
.down { color: var(--bad); }
.note { color: var(--dim); font-size: 12px; margin-top: 10px; }

/* janelas */
.overlay { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; background: rgba(5, 7, 10, .65); backdrop-filter: blur(2px); }
.modal { width: 100%; max-width: 560px; max-height: calc(100vh - 40px); display: flex; flex-direction: column; border: 1px solid var(--line2); border-radius: 16px; background: var(--panel); box-shadow: var(--shadow); }
.modal.wide { max-width: 820px; }
.modal > header { display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.modal > header h3 { margin: 0; font-size: 16px; flex: 1; }
.modal > .body { padding: 18px; overflow-y: auto; }
.modal > footer { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 18px; border-top: 1px solid var(--line); }
.pick-list { display: grid; gap: 4px; margin-top: 12px; max-height: 420px; overflow-y: auto; }
.pick { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px 10px; border: 1px solid transparent; border-radius: var(--radius-sm); background: transparent; text-align: left; cursor: pointer; }
.pick:hover, .pick.on { background: var(--panel2); border-color: var(--line2); }
.pick .txt { flex: 1; min-width: 0; }
.pick .txt strong { display: block; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick .txt small { color: var(--dim); }
.change-group { margin-bottom: 14px; }
.change-group h4 { margin: 0 0 6px; font-size: 14px; }
.change-line { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.change-line:last-child { border-bottom: 0; }
.arrow { color: var(--dim); }

/* avisos rapidos */
#toasts { position: fixed; right: 18px; bottom: 18px; z-index: 80; display: grid; gap: 8px; max-width: 380px; }
.toast { padding: 11px 14px; border-radius: var(--radius-sm); border: 1px solid var(--line2); background: var(--panel); box-shadow: var(--shadow); animation: up .2s ease; }
.toast.bad { border-color: rgba(255, 107, 107, .5); }
.toast.ok { border-color: rgba(61, 220, 132, .5); }
@keyframes up { from { transform: translateY(8px); opacity: 0; } }

/* celular / tela estreita */
.only-mobile { display: none; }
@media (max-width: 900px) {
  .editor { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 30; top: 58px; bottom: 0; left: 0; width: min(340px, 88vw); transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow); }
  .sidebar.open { transform: none; }
  .only-mobile { display: inline-flex; }
  .main-inner { padding: 16px 14px 80px; }
  .drop-config { grid-template-columns: 1fr 1fr; }
  .topbar .hide-mobile { display: none; }
  .drops thead { display: none; }
  .drops tr { display: grid; grid-template-columns: 1fr; padding: 8px 0; border-bottom: 1px solid var(--line); }
  .drops td { border: 0; padding: 4px 6px; }
  .drops .num { text-align: left; }
  .chance { min-width: 0; }
}
