/* Bravas Toolbox — sistema visual. Tema: automático (segue o navegador), claro ou escuro (escolha manual). */
:root {
  --bg: #f4f6fb; --surface: #ffffff; --surface-2: #eef1f8; --surface-3: #e4e9f4;
  --text: #11162b; --text-2: #4b5575; --text-3: #6b7493;
  --border: #dde2ef; --border-strong: #c3cbe0;
  --accent: #2456f0; --accent-hover: #1b45c9; --accent-ink: #ffffff; --accent-soft: #e7edff;
  --ok: #0f7a56; --ok-soft: #e1f5ec; --ok-border: #a7dcc4;
  --warn: #8f5200; --warn-soft: #fff2d9; --warn-border: #f1cf8b;
  --err: #bf2335; --err-soft: #fde9ec; --err-border: #f1b0b9;
  --info: #1f5bbf; --info-soft: #e5efff; --info-border: #b3cdf5;
  --shadow: 0 1px 2px rgba(17, 22, 43, .06), 0 8px 24px rgba(17, 22, 43, .06);
  --shadow-lg: 0 20px 60px rgba(17, 22, 43, .22);
  --radius: 14px; --radius-sm: 9px;
  --font: Inter, "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c0f1f; --surface: #151a31; --surface-2: #1c2240; --surface-3: #262d52;
    --text: #edf0fd; --text-2: #a8b0d0; --text-3: #8189ad;
    --border: #2a3158; --border-strong: #3a4272;
    --accent: #7d99ff; --accent-hover: #9bb1ff; --accent-ink: #0a0f2e; --accent-soft: #1f2853;
    --ok: #4fd7a2; --ok-soft: #12322a; --ok-border: #1f5a47;
    --warn: #f5b94c; --warn-soft: #3a2d10; --warn-border: #6b521a;
    --err: #ff8190; --err-soft: #3d1a21; --err-border: #7a2a37;
    --info: #86b0ff; --info-soft: #17284d; --info-border: #2d4a85;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, .6);
  }
}
:root[data-theme="dark"] {
  --bg: #0c0f1f; --surface: #151a31; --surface-2: #1c2240; --surface-3: #262d52;
  --text: #edf0fd; --text-2: #a8b0d0; --text-3: #8189ad;
  --border: #2a3158; --border-strong: #3a4272;
  --accent: #7d99ff; --accent-hover: #9bb1ff; --accent-ink: #0a0f2e; --accent-soft: #1f2853;
  --ok: #4fd7a2; --ok-soft: #12322a; --ok-border: #1f5a47;
  --warn: #f5b94c; --warn-soft: #3a2d10; --warn-border: #6b521a;
  --err: #ff8190; --err-soft: #3d1a21; --err-border: #7a2a37;
  --info: #86b0ff; --info-soft: #17284d; --info-border: #2d4a85;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, .6);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.55 var(--font); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { line-height: 1.2; margin: 0; letter-spacing: -.01em; }
h1 { font-size: clamp(1.6rem, 2.6vw, 2.1rem); font-weight: 750; }
h2 { font-size: 1.25rem; font-weight: 700; }
h3 { font-size: 1.05rem; font-weight: 650; }
p { margin: 0; }
a { color: var(--accent); }
.muted { color: var(--text-2); }
.small { font-size: .875rem; }
.mono { font-family: var(--mono); font-size: .9em; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.icon { width: 1.25em; height: 1.25em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- botões ---------- */
.btn { --b: var(--surface-2); --c: var(--text); display: inline-flex; align-items: center; justify-content: center; gap: .55em; min-height: 44px; padding: 0 1.15em; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--b); color: var(--c); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; transition: background .15s, transform .05s, box-shadow .15s; }
.btn:hover:not(:disabled) { background: var(--surface-3); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { --b: var(--accent); --c: var(--accent-ink); border-color: transparent; box-shadow: 0 2px 10px color-mix(in srgb, var(--accent) 35%, transparent); }
.btn.primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn.ghost { --b: transparent; border-color: transparent; }
.btn.ghost:hover:not(:disabled) { background: var(--surface-2); }
.btn.danger { --b: var(--err); --c: #fff; border-color: transparent; }
.btn.lg { min-height: 52px; padding: 0 1.6em; font-size: 1.05rem; }
.btn.sm { min-height: 34px; padding: 0 .8em; font-size: .875rem; }
.btn.block { width: 100%; }
.btn .spin { width: 1em; height: 1em; }
.spin { display: inline-block; width: 1.1em; height: 1.1em; border: 2.5px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- campos ---------- */
.field { display: grid; gap: .4rem; }
.field > label, .field > .label { font-weight: 600; font-size: .95rem; }
.field .hint { color: var(--text-2); font-size: .85rem; }
.field .req { color: var(--err); margin-left: .15em; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], select, textarea {
  width: 100%; min-height: 46px; padding: .6rem .85rem; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); font: inherit; transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 150px; resize: vertical; font-family: var(--mono); font-size: .85rem; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
input[aria-invalid=true], select[aria-invalid=true], textarea[aria-invalid=true] { border-color: var(--err); }
::placeholder { color: var(--text-3); }
.input-group { position: relative; }
.input-group input { padding-right: 3rem; }
.input-group .btn { position: absolute; right: 4px; top: 4px; min-height: 38px; padding: 0 .6rem; }
.check { display: flex; align-items: flex-start; gap: .65rem; cursor: pointer; }
.check input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--accent); flex: none; }
.checklist { display: grid; gap: .25rem; max-height: 260px; overflow: auto; padding: .5rem; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); }
.checklist .check { padding: .45rem .5rem; border-radius: 8px; }
.checklist .check:hover { background: var(--surface-2); }
.row { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.seg { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.seg button { display: inline-flex; align-items: center; gap: .4em; min-height: 34px; padding: 0 .75em; border: 0; border-radius: 9px; background: transparent; color: var(--text-2); font: inherit; font-size: .875rem; font-weight: 600; cursor: pointer; }
.seg button[aria-pressed=true] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* ---------- blocos ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow); }
.stack { display: grid; gap: 1.1rem; }
.badge { display: inline-flex; align-items: center; gap: .35em; padding: .15em .65em; border-radius: 999px; font-size: .78rem; font-weight: 650; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); border-color: var(--ok-border); }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: var(--warn-border); }
.badge.err { background: var(--err-soft); color: var(--err); border-color: var(--err-border); }
.badge.info { background: var(--info-soft); color: var(--info); border-color: var(--info-border); }
.banner { display: flex; gap: .85rem; padding: 1rem 1.1rem; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface-2); }
.banner > .icon { margin-top: .15rem; }
.banner .title { font-weight: 700; }
.banner.ok { background: var(--ok-soft); border-color: var(--ok-border); color: var(--ok); }
.banner.warn { background: var(--warn-soft); border-color: var(--warn-border); color: var(--warn); }
.banner.err { background: var(--err-soft); border-color: var(--err-border); color: var(--err); }
.banner.info { background: var(--info-soft); border-color: var(--info-border); color: var(--info); }
.banner .body { color: var(--text); }
.banner .body .muted { color: var(--text-2); }
details.more > summary { cursor: pointer; font-weight: 600; color: var(--text-2); padding: .4rem 0; list-style: none; display: flex; align-items: center; gap: .4rem; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::before { content: "▸"; transition: transform .15s; }
details.more[open] > summary::before { transform: rotate(90deg); }
.progress { height: 12px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.progress > i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 60%, #7ee0c3)); border-radius: 999px; transition: width .3s ease; }
.progress.indet > i { width: 40%; animation: slide 1.2s ease-in-out infinite; }
@keyframes slide { 0% { margin-left: -40%; } 100% { margin-left: 100%; } }

/* tabela */
.tbl-wrap { overflow: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); max-height: 460px; background: var(--surface); }
table.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tbl th { position: sticky; top: 0; background: var(--surface-2); text-align: left; font-weight: 650; padding: .6rem .8rem; border-bottom: 1px solid var(--border); white-space: nowrap; z-index: 1; }
.tbl td { padding: .55rem .8rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: var(--surface-2); }

/* contadores */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .8rem; }
.tile { padding: 1rem 1.1rem; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); }
.tile .n { font-size: 1.9rem; font-weight: 750; line-height: 1; font-variant-numeric: tabular-nums; }
.tile .l { color: var(--text-2); font-size: .85rem; margin-top: .35rem; }
.tile.ok .n { color: var(--ok); } .tile.warn .n { color: var(--warn); } .tile.err .n { color: var(--err); } .tile.info .n { color: var(--info); }

/* modal e aviso */
.backdrop { position: fixed; inset: 0; background: rgba(8, 11, 28, .55); backdrop-filter: blur(3px); display: grid; place-items: center; padding: 1rem; z-index: 50; animation: fade .15s; }
.modal { width: min(520px, 100%); background: var(--surface); border-radius: 18px; padding: 1.6rem; box-shadow: var(--shadow-lg); border: 1px solid var(--border); display: grid; gap: 1rem; animation: pop .18s; }
.modal .actions { display: flex; gap: .6rem; justify-content: flex-end; flex-wrap: wrap; }
@keyframes fade { from { opacity: 0; } } @keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.toasts { position: fixed; right: 1rem; bottom: 1rem; display: grid; gap: .5rem; z-index: 60; max-width: min(380px, calc(100vw - 2rem)); }
.toast { display: flex; gap: .6rem; align-items: flex-start; padding: .8rem 1rem; border-radius: var(--radius-sm); background: var(--text); color: var(--bg); box-shadow: var(--shadow-lg); animation: pop .2s; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; } }

/* marca */
.brand { display: inline-flex; align-items: center; gap: .6rem; font-weight: 800; letter-spacing: -.02em; color: var(--text); text-decoration: none; }
.brand .logo { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 50%, #22d3a6)); color: var(--accent-ink); }
.brand .logo .icon { width: 20px; height: 20px; }
.brand small { font-weight: 600; color: var(--text-2); font-size: .72rem; display: block; letter-spacing: .02em; margin-top: -2px; }

/* ---------- login ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; background:
  radial-gradient(900px 500px at 15% -10%, color-mix(in srgb, var(--accent) 16%, transparent), transparent),
  radial-gradient(700px 400px at 100% 100%, color-mix(in srgb, var(--ok) 12%, transparent), transparent), var(--bg); }
.auth-card { width: min(440px, 100%); display: grid; gap: 1.3rem; }
.auth-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: .2rem; }
.auth-foot { text-align: center; color: var(--text-2); font-size: .875rem; }

textarea.plain { font-family: var(--font); font-size: 1rem; min-height: 120px; }
