:root {
  color-scheme: dark;
  font-family: "Segoe UI", system-ui, sans-serif;
  color: var(--text);
  background: var(--background);
  --background: #101010;
  --surface: #181818;
  --field: #151515;
  --control: #202020;
  --hover: #252525;
  --border: #3b3b3b;
  --text: #f5f5f5;
  --muted: #a9a9a9;
  --strong-border: #b6b6b6;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font-size: 14px; min-width: 280px; }
button, input, select, textarea { font: inherit; }
button, select, input, textarea { color: inherit; border: 1px solid var(--border); border-radius: 8px; }
button, select { background: var(--control); min-height: 38px; }
button { padding: 8px 13px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; white-space: nowrap; }
button:hover:not(:disabled) { border-color: #696969; background: var(--hover); }
button:disabled { cursor: default; opacity: .45; }
button.primary { background: var(--background); border-color: var(--strong-border); font-weight: 650; }
button.primary:hover:not(:disabled) { background: var(--hover); border-color: var(--text); }
button.danger { background: var(--background); border-color: var(--strong-border); font-weight: 650; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
input, textarea { background: var(--field); padding: 10px 12px; min-height: 39px; width: 100%; }
input::placeholder { color: var(--muted); }
textarea { resize: vertical; }
select { padding: 0 31px 0 10px; }
a { color: inherit; text-decoration: none; }
svg { width: 18px; height: 18px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
.symbols { position: absolute; width: 0; height: 0; overflow: hidden; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(1.95rem, 4vw, 2.45rem); font-weight: 650; letter-spacing: -.045em; line-height: 1.12; }
h2 { font-size: 1.5rem; letter-spacing: -.025em; overflow-wrap: anywhere; }
h3 { font-size: 1rem; }
p, small { color: var(--muted); line-height: 1.45; }
code, .mono { font-family: Consolas, ui-monospace, monospace; font-size: .91em; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.gate { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.sign-in { min-width: 0; padding: clamp(24px, 5vw, 68px); display: grid; grid-template-rows: auto 1fr; }
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; font-weight: 750; letter-spacing: .13em; }
.brand img { width: 38px; height: 38px; object-fit: contain; }
.brand small { display: block; letter-spacing: 0; font-weight: 450; margin-top: 3px; }
.sign-in-content { width: min(100%, 390px); justify-self: center; align-self: center; padding: 44px 0; }
.sign-in-content > p { margin-top: 11px; font-size: 15px; }
#login { margin-top: 30px; }
#login label, #issue-form label { display: grid; gap: 7px; font-weight: 570; margin-bottom: 15px; }
#login input { min-height: 44px; }
#login small { font-weight: 400; }
#gate-submit { width: 100%; min-height: 44px; margin-top: 8px; }
.feedback { color: var(--text); overflow-wrap: anywhere; }
.feedback:empty { display: none; }
#gate-error, #issue-error { margin-top: 12px; }
.sign-in-art { display: grid; place-items: center; }
.sign-in-art img { display: block; width: min(42%, 204px); height: auto; }

.shell { min-height: 100vh; display: grid; grid-template-columns: 232px minmax(0, 1fr); }
.sidebar { background: var(--field); border-right: 1px solid var(--border); min-width: 0; padding: 23px 15px 15px; display: flex; flex-direction: column; gap: 35px; height: 100vh; position: sticky; top: 0; }
.sidebar .brand { padding: 0 9px; }
.sidebar nav { display: grid; gap: 5px; }
.sidebar nav a { border-radius: 8px; min-height: 42px; display: flex; align-items: center; gap: 11px; padding: 0 12px; color: var(--muted); }
.sidebar nav a:hover { color: var(--text); }
.sidebar nav [aria-current=page] { box-shadow: inset 2px 0 var(--text); color: var(--text); font-weight: 650; }
.sidebar footer { margin-top: auto; display: flex; align-items: center; gap: 8px; padding-top: 13px; border-top: 1px solid var(--border); }
.avatar { width: 33px; height: 33px; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 9px; color: var(--text); flex: none; }
.operator { min-width: 0; flex: 1; font-size: .8rem; }
.operator small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-button { padding: 0; min-width: 34px; min-height: 34px; }
.content { min-width: 0; }
.topbar { height: 62px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; padding: 0 clamp(18px, 4vw, 47px); color: var(--muted); }
.topbar button { min-height: 34px; }
.main { max-width: 1460px; margin: 0 auto; padding: 35px clamp(18px, 4vw, 47px) 45px; }
.section-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 13px; margin-bottom: 24px; }
.section-head p { margin-top: 9px; }
.panel { border: 1px solid var(--border); background: var(--surface); border-radius: 12px; min-width: 0; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 11px; padding: 14px 17px; }
.search { width: min(100%, 330px); min-width: 0; position: relative; }
.search svg { position: absolute; pointer-events: none; left: 11px; top: 11px; color: var(--muted); }
.search input { padding-left: 36px; }
.table-wrap { overflow-x: auto; scrollbar-color: #646464 var(--field); }
table { width: 100%; border-collapse: collapse; text-align: left; }
th { font-size: .81rem; font-weight: 600; color: var(--muted); background: var(--control); white-space: nowrap; }
th, td { padding: 12px 15px; border-top: 1px solid var(--border); }
td { overflow-wrap: anywhere; }
td small { display: block; margin-top: 3px; }
tr:last-child td:first-child { border-bottom-left-radius: 12px; }
tr:last-child td:last-child { border-bottom-right-radius: 12px; }
td:last-child button + button { margin-left: 6px; }
.reference, .row-open { text-align: left; padding: 0; background: none; border: 0; min-height: 0; white-space: normal; }
.row-open:hover:not(:disabled) { background: transparent; text-decoration: underline; }
.empty { text-align: center; color: var(--muted); padding: 42px 17px; }
.pill { display: inline-flex; white-space: nowrap; border: 1px solid var(--border); border-radius: 5px; padding: 4px 7px; color: var(--muted); font-size: .78rem; font-weight: 600; }
.pill.active, .pill.blocked { color: var(--text); border-color: #747474; }
.pill.blocked { border-style: dashed; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 15px; }
.metric { display: grid; gap: 5px; padding: 13px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); }
.metric strong { font-size: 1.32rem; }
.pagination { display: flex; align-items: center; justify-content: end; gap: 8px; border-top: 1px solid var(--border); padding: 12px 15px; }
.pagination span { margin-right: auto; color: var(--muted); }
.audit-dates { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.audit-dates label { display: inline-flex; align-items: center; gap: 6px; }
.audit-dates input { width: auto; min-width: 0; }
#page-error { margin-top: 14px; }
.release-form { padding: 16px; margin-bottom: 15px; display: flex; flex-wrap: wrap; align-items: end; gap: 12px; }
.release-form label { display: grid; gap: 6px; min-width: 0; max-width: 100%; }
#release-confirm .release-form { padding-inline: 0; margin-bottom: 0; }

dialog { color: inherit; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; width: min(480px, calc(100% - 28px)); max-height: calc(100% - 28px); padding: 24px; overflow: auto; }
dialog::backdrop { background: #080808bf; }
dialog.detail { width: min(780px, calc(100% - 28px)); }
.dialog-head { display: flex; justify-content: space-between; align-items: start; gap: 12px; margin-bottom: 20px; }
.dialog-head p { overflow-wrap: anywhere; }
.dialog-actions { display: flex; justify-content: end; flex-wrap: wrap; gap: 8px; margin: 16px 0; }
.detail h3 { margin: 25px 0 9px; }
.detail-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.detail-fields div { min-width: 0; padding: 11px; border-radius: 8px; background: var(--control); }
.detail-fields .wide { grid-column: 1 / -1; }
.detail-fields dd { margin: 4px 0 0; overflow-wrap: anywhere; }
.detail-fields dt { color: var(--muted); font-size: .83rem; }
#confirm p, #issue-result p { margin: 10px 0; }
#toast { position: fixed; inset: auto 18px 18px auto; padding: 12px 16px; max-width: calc(100% - 36px); background: var(--control); border: 1px solid var(--strong-border); border-radius: 8px; color: var(--text); }
@media (max-width: 860px) {
  .shell { grid-template-columns: 174px minmax(0, 1fr); }
  .sidebar { padding-inline: 10px; }
  .sidebar .operator strong { display: none; }
}
@media (max-width: 680px) {
  .gate { grid-template-columns: 1fr; }
  .sign-in-art { display: none; }
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; gap: 12px; padding: 10px; display: grid; grid-template-columns: 1fr auto; }
  .sidebar nav { grid-row: 2; grid-column: 1 / -1; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sidebar nav a { justify-content: center; padding: 0 4px; gap: 4px; }
  .sidebar nav svg { width: 15px; height: 15px; }
  .sidebar footer { margin: 0; padding: 0; border: 0; }
  .sidebar footer .operator, .sidebar footer .avatar { display: none; }
  .topbar { height: 51px; }
  .main { padding-top: 23px; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pagination { flex-wrap: wrap; }
  .table-wrap th, .table-wrap td { padding: 10px; }
  dialog { padding: 16px; }
}

/* Prazo livre na emissão: quantidade e unidade lado a lado. */
.linha-prazo { display: flex; gap: 8px; align-items: stretch; }
.linha-prazo input { flex: 0 0 92px; }
.linha-prazo select { flex: 1 1 auto; }
.hint { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }
details.avancado { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; }
details.avancado > summary { cursor: pointer; color: var(--muted); font-size: 13px; }
details.avancado[open] > summary { margin-bottom: 10px; color: var(--text); }
details.avancado label { display: block; }
/* Ficha da conta: uma grade de rótulo e valor, separada da ficha básica. */
.detail-fields.ficha { margin-top: 14px; }
.detail-fields.ficha:empty { display: none; }
.detail-fields.ficha > h3 { grid-column: 1 / -1; margin: 0 0 4px; font-size: 14px; }