/* Bretas Fiscal — uma mesa de trabalho clara, com a nota como peça central. */
@font-face {font-family:"IBM Plex Sans";src:url('/fonts/ibm-plex-sans-latin.woff2') format('woff2');font-style:normal;font-weight:400 600;font-display:swap}
:root {
  --ground:#f3f6f7; --surface:#fff; --raised:#f8fafb; --active:#e9eef0;
  --border:#e3e9ec; --rule:#edf1f2; --control:#c6d0d5;
  --text:#19272d; --muted:#53656e; --accent:#17677d;
  --positive:#1f7651; --negative:#a83c37; --warning:#835813;
  --radius-card:8px; --radius-control:6px; --radius-sheet:16px;
  font-family:"IBM Plex Sans",system-ui,sans-serif; color:var(--text);
  background:var(--ground); font-size:14px; line-height:1.45;
}
html {scroll-behavior:smooth}
body {color:var(--text); background:var(--ground)}
button,input,select,textarea {font-family:inherit}
button {touch-action:manipulation}
button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible,summary:focus-visible {outline:2px solid var(--accent);outline-offset:2px}
h1,h2,h3 {color:var(--text);font-weight:600;letter-spacing:-.025em}
h1 {font-size:clamp(21px,2vw,25px);line-height:1.22}
h2 {font-size:17px;line-height:1.3}
h3 {font-size:15px;line-height:1.3}
p,small,.muted,.field-help {color:var(--muted)}

/* Frame and navigation */
.topbar {height:58px;background:var(--ground);color:var(--text);border:0;box-shadow:none;padding:0 18px 0 26px;z-index:11}
.brand {gap:10px;min-width:0}
.brand-mark {width:32px;height:32px;flex:none;border:0;border-radius:7px;background:var(--accent);box-shadow:none;color:#fff;font:600 20px/1 "IBM Plex Sans",system-ui,sans-serif}
.brand strong {font-size:15px;font-weight:600;letter-spacing:-.02em}
.brand small {font-size:11px;letter-spacing:0;color:var(--muted)}
.topbar-right {gap:12px}
.local-label {color:var(--muted);font-size:12px}
.badge {font-size:11px;font-weight:600;line-height:1;padding:6px 9px;border-radius:4px}
.badge.production {background:#fff1d8;color:#755012}
.badge.test {background:#ddf4e9;color:#1f6649}
#logoutButton {border:1px solid var(--control);border-radius:6px;padding:6px 10px;color:var(--text);background:transparent;font-weight:500}
#logoutButton:hover {background:var(--active)}
.shell {grid-template-columns:228px minmax(0,1fr);min-height:calc(100vh - 58px)}
nav {background:var(--ground);border:0;padding:14px 10px 24px 14px;gap:2px}
nav a {display:block;color:var(--muted);text-decoration:none;font-weight:500;font-size:13px;line-height:20px;padding:8px 12px;border-radius:6px;min-height:36px}
nav a:hover {color:var(--text);background:#e8edef}
nav a.active {color:var(--text);background:var(--active);font-weight:600;box-shadow:none}
.nav-group-label {padding:18px 12px 6px;color:#667780;font-size:11px;font-weight:600;letter-spacing:0;text-transform:none}
.nav-group-label {color:#566870}
.nav-group-label:first-child {padding-top:7px}
.nav-foot {border-top:1px solid #dce4e7;margin:18px 8px 0;padding:14px 4px 0;color:var(--muted);font-size:11px;line-height:1.4}
.nav-foot strong {display:block;color:var(--text);font-weight:600}
main {max-width:none;min-width:0;margin:0 8px 8px 0;padding:29px clamp(20px,2.5vw,40px) 60px;background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-sheet);min-height:calc(100vh - 66px)}
.page-heading {align-items:center;margin-bottom:22px;gap:16px}
.page-heading h1 {margin:0}
.page-heading h1 {font-size:24px}
.page-heading p {margin:6px 0 0;max-width:690px;font-size:13px}
.eyebrow {color:var(--muted)!important;text-transform:none;letter-spacing:0;font-size:11px;font-weight:500;margin-bottom:6px!important}
.heading-actions {gap:8px;justify-content:flex-end}
#menuToggle {display:none}
.skip-link {color:var(--text);text-decoration:none}

/* Controls and surfaces */
button:not(nav button):not(.step-button) {min-height:36px;padding:7px 12px;border:1px solid var(--control);border-radius:var(--radius-control);box-shadow:none;background:#fff;color:var(--text);font-size:13px;font-weight:500;transition:background-color .14s,border-color .14s}
button:not(nav button):not(.step-button):hover {background:var(--raised);border-color:#8fa3ad}
button.primary:not(nav button) {background:var(--text);border-color:var(--text);color:#fff;box-shadow:none}
button.primary:not(nav button):hover {background:#35474e;border-color:#35474e}
button.danger:not(nav button) {background:#fff;border-color:#d7aaa7;color:var(--negative)}
button.danger:not(nav button):hover {background:#fff2f1;border-color:var(--negative)}
button.quiet:not(nav button) {background:transparent;border-color:transparent;color:var(--muted)}
button.quiet:not(nav button):hover {background:var(--raised)}
.list-panel,.editor-panel,.formcard,.review-card,.grid article,.history article,.history-toolbar,.result-summary {border:1px solid var(--border);border-radius:var(--radius-card);box-shadow:none;background:var(--surface)}
.formcard,.list-panel,.editor-panel {padding:22px}
.notice {margin:18px 0;padding:12px 15px;border:1px solid #eadbb9;border-left:3px solid #b1842c;border-radius:6px;background:#fffaf0;color:#655025;font-size:12px}
.notice * {color:inherit}

/* Home: the real next fiscal number carries the screen. */
.home-layout {display:grid;grid-template-columns:minmax(0,1.35fr) minmax(250px,.8fr);gap:20px;align-items:start}
.hero {grid-template-columns:1fr;min-height:0;border:1px solid var(--border);border-radius:8px;background:var(--surface);box-shadow:none;color:var(--text)}
.hero>div:first-child {padding:27px 28px;border-left:0}
.hero-label {font-size:12px;letter-spacing:0;text-transform:none;font-weight:500;color:var(--muted)}
.hero-number {font-size:clamp(35px,4.5vw,43px);line-height:1.15;letter-spacing:-.03em;font-weight:400;color:var(--accent);margin:8px 0 2px;font-variant-numeric:tabular-nums}
.hero p {margin:0 0 24px;color:var(--muted);font-size:12px}
.hero button.primary {background:var(--text)!important;border-color:var(--text)!important;color:#fff!important}
.hero button.primary:hover {background:#35474e!important}
.hero-detail {border-top:1px solid var(--rule);border-left:0;background:var(--surface);padding:17px 28px 21px;color:var(--muted)}
.hero-detail strong {color:var(--text);font-size:13px;font-weight:600}
.hero-detail ol {display:flex;gap:20px;flex-wrap:wrap;margin:9px 0 0;padding-left:17px;font-size:12px}
.hero-detail li {padding:0 8px 0 0}
.quick-grid {display:grid;grid-template-columns:1fr;margin:0;gap:0;border:1px solid var(--border);border-radius:8px;overflow:hidden}
.quick-grid article {display:block;min-height:0;box-shadow:none;border:0;border-bottom:1px solid var(--rule);border-radius:0;padding:18px 20px}
.quick-grid article:last-child {border-bottom:0}
.quick-grid strong {font-size:13px;font-weight:600}
.quick-grid p {font-size:12px;line-height:1.4;margin:4px 0 9px}
.quick-grid button {min-height:30px!important;padding:4px 8px!important;background:transparent!important;border:1px solid var(--control)!important;color:var(--text)!important;font-size:12px}
.quick-grid button:hover {background:var(--raised)!important}
.quick-icon {display:none}
.home-notice {margin-top:20px}
.home-recent-heading {display:flex;justify-content:space-between;align-items:end;gap:16px;margin:26px 0 12px}
.home-recent-heading h2 {margin:0 0 3px}
.home-recent-heading p {font-size:12px;margin:0}
.home-recent {border:1px solid var(--border);border-radius:8px;overflow:hidden}
.home-recent>p {margin:0;padding:17px;color:var(--muted);font-size:12px}
.home-recent-row {display:grid!important;grid-template-columns:minmax(0,1fr) 100px 90px;align-items:center;gap:12px;width:100%;min-height:47px!important;padding:9px 15px!important;text-align:left;border:0!important;border-bottom:1px solid var(--rule)!important;border-radius:0!important;background:#fff!important}
.home-recent-row:last-child {border-bottom:0!important}
.home-recent-row:hover {background:var(--raised)!important}
.home-recent-row strong {font-weight:600;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.home-recent-row small {font-size:11px}
.home-recent-row .history-status {justify-self:end}

/* Cadastros and the guided NF-e. */
.workspace-grid {grid-template-columns:minmax(240px,.72fr) minmax(0,1.35fr);gap:18px}
.list-panel {position:sticky;top:18px;min-height:220px}
.editor-heading {border-bottom:1px solid var(--rule);padding-bottom:14px;margin-bottom:18px}
.editor-heading h2 {margin:3px 0 0}
.step-tag {background:var(--raised);color:var(--muted);border-radius:4px;font-size:11px;font-weight:500}
.record-list {gap:0}
.record-list button {border:0!important;border-bottom:1px solid var(--rule)!important;border-radius:0!important;padding:12px 7px!important;background:transparent!important;font-weight:400!important}
.record-list button:hover {background:var(--raised)!important}
.record-list button.selected {background:var(--active)!important;box-shadow:none!important}
.record-list strong {font-weight:600}
.record-list small {font-size:11px}
.empty-state {background:var(--raised);border:1px dashed var(--control);border-radius:6px;padding:26px 14px}
.formgrid {gap:0 17px}
.formgrid label,.select-row label,label {font-size:13px;font-weight:500;color:var(--text);gap:7px;margin-bottom:16px}
.formgrid input,.formgrid select,input,select,textarea {min-height:40px;border:1px solid var(--control);border-radius:6px;padding:8px 11px;color:var(--text);background:#fff}
input::placeholder,textarea::placeholder {color:#64757d}
.formgrid input:hover,.formgrid select:hover,input:hover,select:hover,textarea:hover {border-color:#8fa3ad}
input:disabled {background:var(--raised);color:var(--muted)}
.field-help,.label-help {font-size:12px;line-height:1.45}
.lookup-field button {margin-bottom:16px;background:#fff!important;border-color:var(--control)!important;color:var(--accent)!important}
.lookup-field button:hover {background:var(--raised)!important}
.lookup-feedback {background:var(--raised);border:1px solid var(--border);border-radius:6px;color:var(--muted);font-size:12px;padding:10px 12px;margin:-3px 0 16px}
.lookup-feedback.success {background:#eff8f3;border-color:#c9e5d4;color:#236747}
.lookup-feedback.warning {background:#fffaf0;border-color:#eadbb9;color:#75531e}
.stepper {gap:0;margin-bottom:22px;border-bottom:1px solid var(--border)}
.step-button {min-height:43px;margin:0 26px 0 0;padding:9px 0 13px;color:var(--muted);font-size:13px;font-weight:500}
.step-button span {width:21px;height:21px;background:var(--raised);border:1px solid var(--border);border-radius:5px;font-size:11px;color:var(--muted)}
.step-button.active {color:var(--text);font-weight:600}
.step-button.active span {background:var(--accent);border-color:var(--accent);color:#fff}
.step-button.active:after {height:2px;background:var(--accent)}
.step-actions {margin:20px 0 28px}
.itemcard {border:1px solid var(--border);border-radius:8px;background:var(--surface);padding:18px}
.itemtitle {border-bottom:1px solid var(--rule);padding-bottom:11px;margin-bottom:16px}
.itemtitle strong {font-size:14px;font-weight:600}
.itemcard .technical-fields {border-color:var(--rule)}
.itemtotal {color:var(--text);font-size:13px;font-variant-numeric:tabular-nums}
.review-card>div {padding:12px 17px;border-color:var(--rule);font-size:13px}
.review-card span {color:var(--muted)}
.review-total {background:var(--raised);font-size:16px}
.review-total strong {font-variant-numeric:tabular-nums}
.draft-status {border:0;border-radius:4px;background:var(--raised);color:var(--muted);font-size:11px;font-weight:400;padding:6px 8px}
.draft-status.error {color:var(--negative);background:#fff1ef}
.observation-tools {grid-template-columns:minmax(160px,1fr) minmax(160px,1fr) auto}
.observation-card textarea {min-height:118px}
.tax-confirmation {border-radius:6px}
.tax-confirmation input {accent-color:var(--accent)}

/* Lists, events and system feedback. */
.history-toolbar {padding:13px 17px}
.history-toolbar label {margin-bottom:11px}
.history-filters {gap:0;border-bottom:1px solid var(--border);overflow-x:auto}
.history-filters button {border:0!important;border-radius:0!important;margin-right:22px;padding:8px 0!important;min-height:36px!important;background:transparent!important;color:var(--muted)!important;font-size:12px}
.history-filters button.active {background:transparent!important;border-bottom:2px solid var(--accent)!important;color:var(--text)!important;font-weight:600}
.history {gap:0;margin-top:15px;border:1px solid var(--border);border-radius:8px;overflow:hidden}
.history article {border:0;border-bottom:1px solid var(--rule);border-radius:0;padding:14px 17px;min-height:62px}
.history article:last-child {border-bottom:0}
.history article>div:first-child {min-width:0}
.history small {font-size:11px;color:var(--muted)}
.history-status {font-size:11px;font-weight:500;letter-spacing:0;text-transform:none;border-radius:4px;padding:3px 6px}
.history-status.authorized {background:#e8f5ed;color:#236747}
.history-status.canceled {background:#fff0ee;color:#963b35}
.history-status.neutral {background:var(--active);color:var(--muted)}
.history-details {font-size:11px}
.history-details small {overflow-wrap:anywhere}
.grid {gap:16px}
.grid article {padding:20px}
.result-summary {border-left:3px solid var(--accent);padding:20px}
.result-summary.success {border-left-color:var(--positive)}
.result-summary.error {border-left-color:var(--negative)}
pre {background:#1d2b31;color:#f4f9fa;border-radius:6px}
#toast {background:#1d2b31;border-radius:6px;box-shadow:0 8px 24px #19272d33}

/* Team sign-in uses the same paper and frame. */
.login-page {background:var(--ground)}
.login-page main {background:transparent;border:0;border-radius:0;min-height:100vh;margin:auto;padding:48px 28px}
.login-layout {max-width:1000px;grid-template-columns:minmax(0,1fr) minmax(320px,410px);gap:clamp(28px,7vw,100px)}
.login-intro .brand-mark {background:var(--accent);margin-bottom:26px}
.login-company {color:var(--accent);font-size:12px;font-weight:600}
.login-intro h1 {font-size:clamp(27px,3vw,36px);font-weight:600;line-height:1.13;color:var(--text)}
.login-intro>p:last-child {font-size:15px;line-height:1.5;color:var(--muted)}
.login-card {border:1px solid var(--border);border-radius:12px;box-shadow:none;padding:32px}
.login-card h2 {font-size:19px}
.login-card button.primary {width:100%;min-height:42px}

@media(max-width:1000px) {
  .workspace-grid {grid-template-columns:1fr}
  .list-panel {position:static}
}
@media(max-width:900px) {
  .topbar {height:54px;padding:0 16px}
  .shell {display:block;min-height:calc(100vh - 54px)}
  main {margin:0;padding:25px 20px 56px;min-height:calc(100vh - 54px);border-radius:0;border-left:0;border-right:0;border-bottom:0}
  #menuToggle {display:inline-flex;align-items:center;justify-content:center;margin-right:10px;min-width:36px;min-height:36px;padding:0!important}
  nav {display:none;position:absolute;z-index:20;top:54px;left:0;right:0;max-height:calc(100vh - 54px);overflow-y:auto;padding:14px 18px 25px;background:var(--ground);border-bottom:1px solid var(--border);box-shadow:0 15px 25px #19272d20}
  nav.open {display:flex;flex-direction:column}
  nav a {min-height:44px;padding:12px 14px}
  .nav-group-label {padding-top:12px}
  .home-layout {grid-template-columns:1fr}
  .quick-grid {grid-template-columns:repeat(3,minmax(0,1fr))}
  .quick-grid article {border-bottom:0;border-right:1px solid var(--rule)}
  .quick-grid article:last-child {border-right:0}
  .quick-grid article:last-child {grid-column:auto}
}
@media(max-width:640px) {
  main {padding:22px 16px 54px}
  .topbar-right {gap:7px}
  .brand small,.local-label {display:none}
  .page-heading {display:block}
  .page-heading .heading-actions,.page-heading>button {margin-top:15px}
  .heading-actions {justify-content:flex-start}
  #saveNfe {display:none}
  .home-layout,.quick-grid {display:block}
  .quick-grid {margin-top:15px}
  .quick-grid article {border-right:0;border-bottom:1px solid var(--rule)}
  .home-recent-heading {align-items:start;flex-direction:column}
  .home-recent-row {grid-template-columns:minmax(0,1fr) auto}
  .home-recent-row small {display:none}
  .hero>div:first-child {padding:22px}
  .hero-detail {padding:17px 22px}
  .hero-detail ol {display:block;margin-top:10px}
  .hero-detail li {padding-bottom:7px}
  .formgrid,.itemcard .formgrid,.grid {grid-template-columns:1fr}
  .formcard,.list-panel,.editor-panel {padding:18px}
  .stepper {overflow-x:auto}
  .step-button {flex:none;white-space:nowrap;margin-right:20px}
  .select-row,.step-actions {align-items:stretch;flex-direction:column}
  .step-actions>div {flex-direction:column}
  .history article {display:block}
  .history article>div:last-child {justify-content:flex-start;margin-top:9px}
  .observation-tools {grid-template-columns:1fr}
  .observation-tools button {grid-column:1;justify-self:start}
  .lookup-field {display:block}
  .lookup-field button {margin-top:-4px}
  .login-layout {grid-template-columns:1fr;gap:22px;padding:28px 18px}
  .login-page main {padding:28px 18px}
  .login-card {padding:24px}
}
@media(prefers-reduced-motion:reduce) {html{scroll-behavior:auto}button{transition:none!important}}
