:root {
  --bg: #f6f5f2;
  --surface: #ffffff;
  --surface-2: #efede8;
  --line: #e0ddd6;
  --text: #1d1c1a;
  --muted: #6b6860;
  --accent: #0f6b5c;
  --accent-ink: #ffffff;
  --accent-soft: #e2f0ec;
  --danger: #b4321f;
  --danger-soft: #fbe9e6;
  --ok: #1d7a3f;
  --focus: #0f6b5c55;
  --shadow: 0 1px 2px rgb(0 0 0 / .05), 0 4px 16px rgb(0 0 0 / .04);
  --radius: 10px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151514;
    --surface: #1e1e1c;
    --surface-2: #262624;
    --line: #34332f;
    --text: #ecebe7;
    --muted: #a19e95;
    --accent: #3cb39c;
    --accent-ink: #0b1f1b;
    --accent-soft: #1a332d;
    --danger: #ef7a66;
    --danger-soft: #3a1f1a;
    --ok: #5cc584;
    --focus: #3cb39c66;
    --shadow: 0 1px 2px rgb(0 0 0 / .4);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
a { color: var(--accent); }
[hidden] { display: none !important; }
.sr-copy { position: fixed; left: -9999px; top: 0; opacity: 0; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }

/* ---------- Botões e campos ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 14px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--surface); cursor: pointer;
  font-weight: 500; white-space: nowrap; text-decoration: none; color: var(--text);
  transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--surface-2); }
.btn:focus-visible, .field:focus-visible, .tab:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.danger { color: var(--danger); }
.btn.danger.solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.small { height: 30px; padding: 0 10px; font-size: 13px; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.copied { color: var(--ok); border-color: var(--ok); }

.field {
  width: 100%; height: 40px; padding: 0 12px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--surface);
}
.field:focus { border-color: var(--accent); }
label.lbl { display: block; font-size: 13px; font-weight: 600; margin: 14px 0 6px; }
.check { display: flex; align-items: center; gap: 8px; margin-top: 14px; font-size: 14px; }
.msg { min-height: 20px; margin-top: 12px; font-size: 14px; }
.msg.err { color: var(--danger); }
.msg.ok { color: var(--ok); }

/* ---------- Topo ---------- */
.top {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.top .wrap { display: flex; align-items: center; gap: 16px; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; letter-spacing: -.01em; }
.brand-mark {
  width: 28px; height: 28px; border-radius: 7px; background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center;
}
.top .spacer { flex: 1; }
.stat { color: var(--muted); font-size: 13px; }
.menu { position: relative; }
.menu-list {
  position: absolute; right: 0; top: 44px; min-width: 200px; padding: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.menu-list button {
  display: block; width: 100%; text-align: left; padding: 8px 10px; border: 0; border-radius: 6px;
  background: transparent; cursor: pointer;
}
.menu-list button:hover { background: var(--surface-2); }
.menu-list hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }

/* ---------- Envio ---------- */
main.wrap { padding-top: 28px; padding-bottom: 60px; }
.drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  min-height: 180px; padding: 28px; text-align: center;
  border: 2px dashed var(--line); border-radius: 14px; background: var(--surface);
  cursor: pointer; transition: border-color .15s, background .15s;
}
.drop:hover, .drop:focus-visible { border-color: var(--accent); outline: none; }
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop-icon { color: var(--accent); margin-bottom: 4px; }
.drop strong { font-size: 17px; }
.drop span { color: var(--muted); font-size: 14px; }
.drop kbd {
  font: 12px var(--mono); padding: 1px 6px; border: 1px solid var(--line); border-bottom-width: 2px;
  border-radius: 4px; background: var(--surface-2);
}

.queue { display: grid; gap: 8px; margin-top: 14px; }
.qitem {
  display: grid; grid-template-columns: 52px 1fr auto; align-items: center; gap: 14px;
  padding: 10px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.qitem img, .qitem .ph { width: 52px; height: 52px; object-fit: cover; border-radius: 6px; background: var(--surface-2); }
.qitem .name { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qitem .sub { font-size: 13px; color: var(--muted); }
.qitem .sub.err { color: var(--danger); }
.qitem .sub.warn { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.drop .drop-note { font-size: 13px; max-width: 560px; }
.qitem .link { font: 13px var(--mono); color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qitem .min { min-width: 0; }
.qitem .actions { display: flex; gap: 6px; }
.bar { height: 4px; border-radius: 2px; background: var(--surface-2); margin-top: 6px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .15s; }

/* ---------- Galeria ---------- */
.gallery-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 36px 0 16px; }
.gallery-head h2 { font-size: 18px; margin: 0 8px 0 0; letter-spacing: -.01em; }
.tabs { display: inline-flex; padding: 3px; background: var(--surface-2); border-radius: 9px; }
.tab { border: 0; background: transparent; padding: 5px 12px; border-radius: 7px; cursor: pointer; font-size: 14px; color: var(--muted); }
.tab[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); font-weight: 600; }
.search { margin-left: auto; width: 240px; height: 36px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.card .thumb {
  aspect-ratio: 1 / 1; background: #fff;
  display: block; position: relative;
}
.card .thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
.card .info { padding: 10px 12px 4px; min-width: 0; }
.card .name { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .meta { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .actions { display: flex; gap: 6px; padding: 8px 12px 12px; margin-top: auto; }
.card .actions .grow { flex: 1; }

.empty { padding: 48px 20px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); }
.more { display: flex; justify-content: center; margin-top: 20px; }

/* ---------- Diálogos ---------- */
dialog {
  width: min(460px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--line); border-radius: 14px;
  background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgb(0 0 0 / .25);
}
dialog.wide { width: min(720px, calc(100vw - 32px)); }
dialog::backdrop { background: rgb(0 0 0 / .4); }
.dlg-body { padding: 22px 24px 8px; }
.dlg-body h3 { margin: 0 0 4px; font-size: 18px; }
.dlg-body p { margin: 0; color: var(--muted); font-size: 14px; }
.dlg-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 24px 20px; }

.team { width: 100%; border-collapse: collapse; margin-top: 14px; font-size: 14px; }
.team th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.team td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.team td.r { text-align: right; white-space: nowrap; }
.team .off { color: var(--muted); text-decoration: line-through; }
.pill { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); margin-left: 6px; vertical-align: 1px; }
.team-new { display: grid; grid-template-columns: 1fr 1fr 1fr auto; gap: 8px; align-items: end; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.team-new label.lbl { margin-top: 0; }

/* ---------- Aviso flutuante ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); opacity: 0;
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 9px; font-size: 14px; font-weight: 500;
  transition: opacity .18s, transform .18s; pointer-events: none; z-index: 50;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Login ---------- */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: min(380px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 30px 28px; box-shadow: var(--shadow); }
.login-card .brand { margin-bottom: 18px; }
.login-card p { color: var(--muted); margin: 0 0 6px; font-size: 14px; }
.login-card .btn { width: 100%; height: 42px; margin-top: 20px; }

@media (max-width: 640px) {
  .wrap { padding: 0 16px; }
  .stat { display: none; }
  .search { width: 100%; margin-left: 0; }
  .qitem { grid-template-columns: 44px 1fr; }
  .qitem img, .qitem .ph { width: 44px; height: 44px; }
  .qitem .actions { grid-column: 1 / -1; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .card .actions { flex-wrap: wrap; }
  .team-new { grid-template-columns: 1fr; }
  .team .hide-sm { display: none; }
}
