:root {
	--bg: #f4f5f7;
	--card: #ffffff;
	--ink: #0f1b2d;
	--muted: #5b6676;
	--line: #e3e6eb;
	--navy: #172b45;
	--navy-2: #22395a;
	--gold: #e8b64c;
	--gold-ink: #3d2c05;
	--green: #1f9d55;
	--green-bg: #e3f6eb;
	--red: #d33a3a;
	--red-bg: #fde8e8;
	--blue: #2f6fd8;
	--blue-bg: #e6efff;
	--radius: 14px;
	font-family: Inter, "Segoe UI", system-ui, sans-serif;
	color: var(--ink);
}
/* modo escuro (cinza) */
:root[data-theme="escuro"] {
	--bg: #1d2025;
	--card: #282c33;
	--ink: #e7e9ec;
	--muted: #9aa3ae;
	--line: #3a3f48;
	--navy: #121820;
	--navy-2: #1d2733;
	--green-bg: #1f3a2b;
	--red-bg: #45262a;
	--blue-bg: #22324d;
	color-scheme: dark;
}
:root[data-theme="escuro"] .pill,
:root[data-theme="escuro"] .btn:not(.primary):not(.gold):not(.green):not(.red) { background: #31363e; border-color: #444a54; }
:root[data-theme="escuro"] .btn.ghost { background: transparent; border-color: transparent; }
:root[data-theme="escuro"] .input { background: #20242a; border-color: #444a54; color: var(--ink); }
:root[data-theme="escuro"] .chip,
:root[data-theme="escuro"] .tag.nao_iniciado { background: #353a42; }
:root[data-theme="escuro"] .modal { background: var(--card); }
:root[data-theme="escuro"] .modal footer { background: #23272d; }
:root[data-theme="escuro"] .warn { background: #3d3220; border-color: #6b5629; }
:root[data-theme="escuro"] .nav a.on { background: #3a4150; }
:root[data-theme="escuro"] .panel-dark { border: 1px solid var(--line); }
:root[data-theme="escuro"] kbd { background: #3a3f48; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }

/* topo */
.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 24px; padding: 0 28px; height: 60px; background: var(--card); border-bottom: 1px solid var(--line); }
.brand { font-weight: 800; letter-spacing: .02em; }
.brand span { color: var(--gold); }
.logo-topo { height: 40px; display: block; border-radius: 8px; }
.nav { display: flex; gap: 4px; }
.nav a { padding: 8px 14px; border-radius: 9px; text-decoration: none; color: var(--muted); font-weight: 600; font-size: 14px; }
.nav a.on { background: var(--navy); color: #fff; }
.status { margin-left: auto; display: flex; gap: 10px; font-size: 13px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; border: 1px solid var(--line); background: #fff; font-weight: 600; white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #aab2bf; }
.dot.ok { background: var(--green); }
.dot.bad { background: var(--red); }
.dot.rec { background: var(--red); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .25; } }

main { max-width: 1240px; margin: 0 auto; padding: 28px; }
/* abas de dentro de Configurações (Acessos · Ajustes · Agente) */
#subnav { max-width: 1240px; margin: 0 auto; padding: 20px 28px 0; display: flex; gap: 6px; border-bottom: 1px solid var(--line); }
#subnav[hidden] { display: none; }
#subnav a { padding: 9px 16px; text-decoration: none; color: var(--muted); font-weight: 600; font-size: 14px; border-bottom: 3px solid transparent; margin-bottom: -1px; }
#subnav a.on { color: inherit; border-bottom-color: #e8b64c; }
h1 { margin: 0 0 4px; font-size: 26px; }
.sub { margin: 0 0 22px; color: var(--muted); }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.card + .card { margin-top: 18px; }
.card h2 { margin: 0 0 4px; font-size: 17px; }
.card .sub { margin-bottom: 16px; font-size: 14px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border-radius: 10px; border: 1px solid var(--line); background: #fff; font-weight: 600; font-size: 14px; cursor: pointer; transition: filter .12s, transform .08s; }
.btn:hover { filter: brightness(.97); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.gold { background: var(--gold); border-color: var(--gold); color: var(--gold-ink); }
.btn.green { background: var(--green); border-color: var(--green); color: #fff; }
.btn.red { background: var(--red); border-color: var(--red); color: #fff; }
.btn.ghost { background: transparent; }
.btn.sm { padding: 6px 11px; font-size: 13px; }
.btn.lg { padding: 14px 22px; font-size: 16px; border-radius: 12px; }

.input, select.input, textarea.input { width: 100%; padding: 10px 12px; border: 1px solid #cfd5de; border-radius: 10px; background: #fff; outline: none; }
.input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(232, 182, 76, .25); }
label.f { display: block; font-size: 13px; font-weight: 700; margin-bottom: 6px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
.grid2 .full { grid-column: 1 / -1; }

/* tabela */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; padding: 8px 10px; border-bottom: 1px solid var(--line); }
td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td.num { font-variant-numeric: tabular-nums; }
.empty { padding: 40px 10px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: 12px; }

.tag { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.tag.nao_iniciado { background: #eef0f3; color: var(--muted); }
.tag.em_andamento { background: var(--blue-bg); color: var(--blue); }
.tag.vendido { background: var(--green-bg); color: var(--green); }
.tag.defendido { background: var(--red-bg); color: var(--red); }

/* cards de leilão */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.lcard { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; cursor: pointer; transition: box-shadow .15s, transform .15s; }
.lcard:hover { box-shadow: 0 8px 24px rgba(15, 27, 45, .08); transform: translateY(-2px); }
.lcard h3 { margin: 0 0 4px; }
.lcard .meta { color: var(--muted); font-size: 13px; }
.stats { display: flex; gap: 14px; margin-top: 14px; font-size: 13px; }
.stats b { display: block; font-size: 20px; }

/* operação */
.op { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; }
.panel-dark { background: var(--navy); color: #fff; border-radius: var(--radius); padding: 24px; }
.panel-dark .label { text-transform: uppercase; letter-spacing: .14em; font-size: 12px; color: rgba(255, 255, 255, .6); }
.panel-dark .big { font-size: 44px; font-weight: 800; margin: 6px 0 4px; font-variant-numeric: tabular-nums; }
.panel-dark .input { background: var(--navy-2); border-color: #39557d; color: #fff; }
.panel-dark .input::placeholder { color: rgba(255, 255, 255, .45); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.chip { padding: 5px 11px; border-radius: 999px; background: #eef0f3; font-size: 13px; }
.rec { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 700; background: rgba(255, 255, 255, .1); }
.rec.on { background: var(--red); }
.quick { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-top: 10px; }
.quick .btn { background: var(--navy-2); border-color: #39557d; color: #fff; }
.quick .btn.gold { background: var(--gold); border-color: var(--gold); color: var(--gold-ink); }
.finish { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.lances { max-height: 360px; overflow: auto; }
.lances .l { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.lances .l:first-child b { color: var(--green); }

/* modal */
.modal-bg { position: fixed; inset: 0; z-index: 50; background: rgba(15, 27, 45, .45); display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal { width: min(640px, 100%); max-height: 92vh; overflow: auto; background: #fff; border-radius: 16px; box-shadow: 0 30px 80px rgba(0, 0, 0, .3); }
.modal header { padding: 20px 24px 14px; border-bottom: 1px solid var(--line); }
.modal header h3 { margin: 0; }
.modal header p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.modal .body { padding: 20px 24px; }
.modal footer { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 24px; border-top: 1px solid var(--line); background: #f8f9fb; }

/* avisos */
#toasts { position: fixed; right: 20px; bottom: 20px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast { max-width: 420px; padding: 12px 16px; border-radius: 10px; background: var(--ink); color: #fff; font-size: 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, .2); animation: up .2s ease; }
.toast.err { background: var(--red); }
.toast.ok { background: var(--green); }
@keyframes up { from { opacity: 0; transform: translateY(8px); } }

video.preview { width: 100%; border-radius: 10px; background: #000; }
.hint { font-size: 13px; color: var(--muted); }
.warn { padding: 12px 14px; border-radius: 10px; background: #fff7e6; border: 1px solid #f3d699; font-size: 14px; }

.rolagem { overflow-x: auto; -webkit-overflow-scrolling: touch; }

@media (max-width: 900px) {
	.op { grid-template-columns: 1fr !important; }
	.grid2 { grid-template-columns: 1fr; }
	/* topo em duas linhas: marca + botões (tema, sair) em cima, abas roláveis embaixo */
	.top { flex-wrap: wrap; height: auto; gap: 8px; padding: 8px 12px; }
	.top .brand { display: block; font-size: 15px; }
	.nav { order: 3; width: 100%; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 2px; scrollbar-width: none; }
	.nav::-webkit-scrollbar { display: none; }
	.nav a { white-space: nowrap; padding: 7px 12px; }
	.status { margin-left: auto; gap: 6px; }
	/* tabelas largas rolam pro lado dentro do cartão em vez de vazar da tela */
	.card { overflow-x: auto; -webkit-overflow-scrolling: touch; }
	.card table { min-width: 560px; }
	.card .row { flex-wrap: wrap !important; }
	.card .row > .input, .card .row > select.input { max-width: none !important; flex: 1 1 100%; }
	main { padding: 14px 12px; }
	h1 { font-size: 22px; }
	/* operação no celular: painel de lances primeiro, botões grandes pro dedo */
	.op > div:last-child { order: -1; }
	.panel-dark { padding: 18px; }
	.panel-dark .big { font-size: 38px; }
	.quick { grid-template-columns: repeat(3, 1fr); gap: 10px; }
	.quick .btn { padding: 16px 0; font-size: 18px; font-weight: 800; }
	.finish .btn { padding: 18px 0; font-size: 18px; }
	.panel-dark .input { font-size: 18px; padding: 14px; }
	.lances { max-height: 240px; }
	table { font-size: 13px; }
	.cards { grid-template-columns: 1fr; }
	.status .pill { display: none !important; }
	.status .btn { padding: 6px 10px; }
}
