:root {
  --auth-navy: #101e35;
  --auth-navy-deep: #0a1527;
  --auth-navy-soft: #263955;
  --auth-brand-secondary: #b9c9d8;
  --auth-kicker: #d9b967;
  --auth-ink: #17263a;
  --auth-ink-soft: #2d4055;
  --auth-muted: #606d7e;
  --auth-paper: #f3f5f7;
  --auth-panel: #ffffff;
  --auth-panel-soft: #f8fafb;
  --auth-line: #d9e0e5;
  --auth-line-soft: #e9eef1;
  --auth-green: #287b68;
  --auth-green-deep: #1d6254;
  --auth-green-soft: #e3f0ec;
  --auth-gold: #b98a38;
  --auth-gold-soft: #f6edda;
  --auth-gold-deep: #866521;
  --auth-danger: #b3473c;
  --auth-danger-soft: #f8e8e5;
  --auth-danger-button-text: #ffffff;
  --auth-danger-hover: #8d3028;
  --auth-warn-soft: #fbf3e3;
  --auth-warn-ink: #6e5523;
  --auth-info-soft: #eaf1f5;
  --auth-info-ink: #315467;
  --auth-focus: #236aa7;
  --auth-header-focus: #9acafa;
  --auth-focus-shadow: rgba(40, 123, 104, .14);
  --auth-danger-shadow: rgba(179, 71, 60, .12);
  --auth-control-border: #8293a5;
  --auth-placeholder: #606d7e;
  --auth-button-text: #ffffff;
  --auth-radius: 10px;
  --auth-shadow: 0 1px 2px rgba(16, 30, 53, .06), 0 8px 24px -12px rgba(16, 30, 53, .18);
  --auth-display: Georgia, "Times New Roman", serif;
  --auth-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body.auth-page {
  min-width: 320px;
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  background: var(--auth-navy);
  color: var(--auth-ink);
  font-family: var(--auth-body);
  font-size: 15px;
  line-height: 1.5;
}

.auth-page *,
.auth-page *::before,
.auth-page *::after {
  box-sizing: border-box;
}

.auth-page a {
  color: var(--auth-green-deep);
  font-weight: 700;
}

.auth-page a:hover {
  color: var(--auth-green);
}

.auth-page :where(a, button, input, select):focus-visible {
  outline: 3px solid var(--auth-focus);
  outline-offset: 3px;
}

.auth-page button,
.auth-page input,
.auth-page select {
  font: inherit;
}

.auth-page button {
  cursor: pointer;
}

.auth-page button:disabled {
  cursor: not-allowed;
  opacity: .58;
}

.auth-header {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  padding: 25px 0 18px;
}

.auth-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  text-decoration: none;
}

.auth-brand:hover {
  color: #fff;
}

.auth-brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 9px;
  background: var(--auth-gold);
  color: var(--auth-navy);
  font-family: var(--auth-display);
  font-size: 14px;
  font-weight: 700;
}

.auth-brand-copy {
  display: grid;
  gap: 2px;
}

.auth-brand-copy strong {
  color: #fff;
  font-family: var(--auth-display);
  font-size: 18px;
  line-height: 1.15;
}

.auth-brand-copy small {
  color: var(--auth-brand-secondary);
  font-size: 10.5px;
  letter-spacing: .08em;
  line-height: 1.35;
  text-transform: uppercase;
}

.auth-main {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  padding: 24px 0 42px;
}

.auth-frame {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 460px);
  gap: 42px;
  align-items: center;
  min-height: min(620px, calc(100vh - 145px));
}

.auth-intro {
  color: #edf2f5;
}

.auth-kicker {
  margin: 0 0 8px;
  color: var(--auth-kicker);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .13em;
  text-transform: uppercase;
}

.auth-admin-header .auth-kicker { color: var(--auth-kicker); }
.auth-intro .auth-kicker { color: var(--auth-kicker); }

.auth-intro h1 {
  max-width: 610px;
  margin: 0 0 13px;
  color: #fff;
  font-family: var(--auth-display);
  font-size: clamp(30px, 5vw, 48px);
  font-weight: 600;
  letter-spacing: .005em;
  line-height: 1.08;
}

.auth-intro > p {
  max-width: 590px;
  margin: 0;
  color: rgba(237, 242, 245, .79);
  font-size: 16px;
}

.auth-intro-notes {
  display: grid;
  gap: 13px;
  max-width: 590px;
  margin-top: 28px;
}

.auth-intro-note {
  padding-left: 15px;
  border-left: 3px solid rgba(185, 138, 56, .72);
  color: rgba(237, 242, 245, .72);
  font-size: 13px;
  line-height: 1.55;
}

.auth-intro-note strong {
  display: block;
  margin-bottom: 2px;
  color: #fff;
}

.auth-card {
  overflow: hidden;
  border: 1px solid var(--auth-line);
  border-radius: 13px;
  background: var(--auth-panel);
  box-shadow: 0 20px 50px -20px rgba(0, 0, 0, .46);
}

.auth-card-head {
  padding: 25px 27px 18px;
  border-bottom: 1px solid var(--auth-line-soft);
}

.auth-card-head h2 {
  margin: 0 0 5px;
  color: var(--auth-navy);
  font-family: var(--auth-display);
  font-size: 25px;
  font-weight: 600;
  line-height: 1.18;
}

.auth-card-head p {
  margin: 0;
  color: var(--auth-muted);
  font-size: 13px;
}

.auth-form {
  display: grid;
  gap: 16px;
  padding: 23px 27px 27px;
}

.auth-field {
  display: grid;
  gap: 6px;
}

.auth-field label,
.auth-filter label {
  color: var(--auth-muted);
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: .055em;
  line-height: 1.25;
  text-transform: uppercase;
}

.auth-required {
  color: var(--auth-danger);
}

.auth-field input,
.auth-filter input,
.auth-filter select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--auth-control-border);
  border-radius: 8px;
  outline: none;
  background: var(--auth-panel);
  color: var(--auth-ink);
  font-size: 15px;
  padding: 9px 11px;
}

.auth-field input::placeholder,
.auth-filter input::placeholder { color: var(--auth-placeholder); }

.auth-field input:focus,
.auth-filter input:focus,
.auth-filter select:focus {
  border-color: var(--auth-green);
  box-shadow: 0 0 0 3px var(--auth-focus-shadow);
}

.auth-field input[aria-invalid="true"] {
  border-color: var(--auth-danger);
  box-shadow: 0 0 0 3px var(--auth-danger-shadow);
}

.auth-help {
  margin: 0;
  color: var(--auth-muted);
  font-size: 11.5px;
  line-height: 1.45;
}

.auth-check {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  color: var(--auth-ink-soft);
  font-size: 13px;
  line-height: 1.45;
}

.auth-check input {
  flex: none;
  width: 16px;
  height: 16px;
  margin: 2px 0 0;
  accent-color: var(--auth-green);
}

.auth-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 46px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--auth-green);
  color: var(--auth-button-text);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.2;
  transition: background .16s ease, border-color .16s ease, color .16s ease;
}

.auth-button:hover {
  background: var(--auth-green-deep);
}

.auth-button.secondary {
  background: var(--auth-navy);
}

.auth-button.secondary:hover {
  background: var(--auth-navy-soft);
}

.auth-button.danger {
  border-color: #e8c5c0;
  background: #fff;
  color: var(--auth-danger);
}

.auth-button.danger:hover {
  background: var(--auth-danger-soft);
}

.auth-form-message,
.auth-message {
  min-height: 1.45em;
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
}

.auth-form-message:empty,
.auth-message:empty {
  display: none;
}

.auth-form-message.error,
.auth-message.error {
  padding: 10px 12px;
  border: 1px solid #e7c5c0;
  border-radius: 8px;
  background: var(--auth-danger-soft);
  color: #81372f;
}

.auth-form-message.success,
.auth-message.success {
  padding: 10px 12px;
  border: 1px solid #b9d8ce;
  border-radius: 8px;
  background: var(--auth-green-soft);
  color: var(--auth-green-deep);
}

.auth-form-message.info,
.auth-message.info {
  padding: 10px 12px;
  border: 1px solid #c9d9e1;
  border-radius: 8px;
  background: var(--auth-info-soft);
  color: var(--auth-info-ink);
}

.auth-privacy {
  margin-top: 2px;
  padding: 13px 14px;
  border: 1px solid #ead9ae;
  border-radius: 8px;
  background: var(--auth-warn-soft);
  color: var(--auth-warn-ink);
  font-size: 12px;
  line-height: 1.5;
}

.auth-privacy strong {
  display: block;
  margin-bottom: 2px;
}

.auth-switch {
  margin: 0;
  color: var(--auth-muted);
  font-size: 13px;
  text-align: center;
}

.auth-footer {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  padding: 0 0 24px;
  color: rgba(237, 242, 245, .53);
  font-size: 11.5px;
  text-align: center;
}

.auth-footer a {
  color: rgba(237, 242, 245, .8);
}

.auth-admin-main {
  padding-top: 10px;
}

.auth-admin-frame {
  width: min(1180px, 100%);
  margin: 0 auto;
}

.auth-admin-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
  color: #fff;
}

.auth-admin-header h1 {
  margin: 0 0 6px;
  color: #fff;
  font-family: var(--auth-display);
  font-size: clamp(27px, 4vw, 37px);
  font-weight: 600;
  line-height: 1.12;
}

.auth-admin-header p {
  max-width: 760px;
  margin: 0;
  color: rgba(237, 242, 245, .76);
  font-size: 14px;
}

.auth-admin-actions {
  display: flex;
  flex: none;
  gap: 8px;
  flex-wrap: wrap;
}

.auth-admin-actions a,
.auth-admin-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 8px 13px;
  border: 1px solid rgba(255, 255, 255, .25);
  border-radius: 8px;
  background: transparent;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.auth-admin-actions a:hover,
.auth-admin-actions button:hover {
  border-color: rgba(255, 255, 255, .55);
  background: rgba(255, 255, 255, .1);
  color: #fff;
}

.auth-admin-note {
  margin-bottom: 18px;
  padding: 13px 15px;
  border: 1px solid rgba(217, 185, 103, .45);
  border-radius: 9px;
  background: rgba(246, 237, 218, .1);
  color: rgba(255, 255, 255, .84);
  font-size: 13px;
  line-height: 1.5;
}

.auth-admin-card {
  overflow: hidden;
  border: 1px solid var(--auth-line);
  border-radius: 12px;
  background: var(--auth-panel);
  box-shadow: var(--auth-shadow);
}

.auth-admin-toolbar {
  display: flex;
  gap: 12px;
  align-items: end;
  padding: 17px 19px;
  border-bottom: 1px solid var(--auth-line-soft);
  background: var(--auth-panel-soft);
  flex-wrap: wrap;
}

.auth-filter {
  display: grid;
  gap: 6px;
  min-width: 170px;
}

.auth-filter.search {
  flex: 1 1 260px;
}

.auth-filter input,
.auth-filter select {
  min-height: 40px;
  font-size: 14px;
}

.auth-table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.auth-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  font-size: 13.5px;
}

.auth-table th {
  padding: 10px 12px;
  border-bottom: 1px solid var(--auth-line);
  color: var(--auth-muted);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .065em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

.auth-table td {
  padding: 12px;
  border-bottom: 1px solid var(--auth-line-soft);
  color: var(--auth-ink);
  vertical-align: middle;
}

.auth-table tbody tr:last-child td {
  border-bottom: 0;
}

.auth-table .auth-id {
  color: var(--auth-muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

.auth-table .auth-name {
  font-weight: 700;
}

.auth-table .auth-email {
  color: var(--auth-ink-soft);
  overflow-wrap: anywhere;
}

.auth-table .auth-date {
  white-space: nowrap;
}

.auth-status-tag {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 800;
  white-space: nowrap;
}

.auth-status-tag.pending {
  background: var(--auth-gold-soft);
  color: var(--auth-gold-deep);
}

.auth-status-tag.active {
  background: var(--auth-green-soft);
  color: var(--auth-green-deep);
}

.auth-status-tag.revoked {
  background: var(--auth-danger-soft);
  color: var(--auth-danger);
}

.auth-table-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid var(--auth-line);
  border-radius: 7px;
  background: var(--auth-panel);
  color: var(--auth-green-deep);
  font-size: 12.5px;
  font-weight: 800;
}

.auth-table-action:hover {
  border-color: #bdd0cc;
  background: var(--auth-green-soft);
}

.auth-table-action.danger {
  border-color: #e8c5c0;
  color: var(--auth-danger);
}

.auth-table-action.danger:hover {
  background: var(--auth-danger-soft);
}

.auth-empty {
  padding: 42px 20px;
  color: var(--auth-muted);
  text-align: center;
}

.auth-empty strong {
  display: block;
  margin-bottom: 5px;
  color: var(--auth-ink);
  font-family: var(--auth-display);
  font-size: 20px;
}

.auth-empty p {
  margin: 0;
}

.auth-modal-backdrop {
  position: fixed;
  z-index: 20;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(10, 21, 39, .62);
}

.auth-modal {
  width: min(100%, 470px);
  border-radius: 12px;
  background: var(--auth-panel);
  box-shadow: 0 24px 60px -12px rgba(10, 21, 39, .42);
}

.auth-modal-content {
  padding: 23px 24px 8px;
}

.auth-modal h2 {
  margin: 0 0 9px;
  color: var(--auth-navy);
  font-family: var(--auth-display);
  font-size: 21px;
  font-weight: 600;
}

.auth-modal p {
  margin: 0;
  color: var(--auth-ink-soft);
  font-size: 14px;
  line-height: 1.55;
}

.auth-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  padding: 17px 24px 21px;
  flex-wrap: wrap;
}

.auth-modal-actions button {
  min-height: 39px;
  padding: 8px 13px;
  border: 1px solid var(--auth-line);
  border-radius: 8px;
  background: var(--auth-panel);
  color: var(--auth-ink-soft);
  font-weight: 700;
}

.auth-modal-actions button:last-child {
  border-color: var(--auth-danger);
  background: var(--auth-danger);
  color: var(--auth-danger-button-text);
}

.auth-modal-actions button:last-child:hover {
  background: var(--auth-danger-hover);
}

.auth-client-box {
  display: grid;
  gap: 8px;
}

.auth-client-identity {
  display: grid;
  gap: 1px;
}

.auth-client-identity strong {
  overflow-wrap: anywhere;
  color: inherit;
  font-size: 13px;
}

.auth-client-identity span {
  overflow-wrap: anywhere;
  color: inherit;
  font-size: 11.5px;
  opacity: .76;
}

.auth-client-actions {
  display: flex;
  gap: 7px;
  align-items: center;
  flex-wrap: wrap;
}

.auth-client-actions a,
.auth-client-actions button {
  min-height: 30px;
  padding: 5px 8px;
  border: 1px solid currentColor;
  border-radius: 7px;
  background: transparent;
  color: inherit;
  font-size: 11.5px;
  font-weight: 700;
  text-decoration: none;
}

.auth-client-actions a:hover,
.auth-client-actions button:hover {
  background: rgba(255, 255, 255, .1);
  color: inherit;
}

.auth-client-status {
  color: inherit;
  font-size: 11px;
  opacity: .76;
}

@media (max-width: 800px) {
  .auth-frame {
    grid-template-columns: 1fr;
    gap: 25px;
    min-height: 0;
  }

  .auth-intro {
    max-width: 650px;
  }

  .auth-intro h1 {
    font-size: clamp(29px, 7vw, 42px);
  }

  .auth-intro-notes {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .auth-card {
    width: min(100%, 520px);
  }
}

@media (max-width: 560px) {
  .auth-header,
  .auth-main,
  .auth-footer {
    width: calc(100% - 28px);
  }

  .auth-header {
    padding-top: 17px;
    padding-bottom: 7px;
  }

  .auth-main {
    padding-top: 17px;
    padding-bottom: 31px;
  }

  .auth-intro-notes {
    grid-template-columns: 1fr;
    gap: 9px;
    margin-top: 21px;
  }

  .auth-intro > p {
    font-size: 14px;
  }

  .auth-card-head,
  .auth-form {
    padding-right: 18px;
    padding-left: 18px;
  }

  .auth-card-head {
    padding-top: 20px;
    padding-bottom: 15px;
  }

  .auth-form {
    gap: 14px;
    padding-top: 19px;
    padding-bottom: 20px;
  }

  .auth-admin-header {
    display: block;
  }

  .auth-admin-actions {
    margin-top: 14px;
  }

  .auth-admin-actions a,
  .auth-admin-actions button {
    flex: 1;
  }

  .auth-admin-toolbar {
    display: grid;
    padding: 14px;
  }

  .auth-filter,
  .auth-filter.search {
    width: 100%;
    min-width: 0;
  }

  .auth-modal-actions {
    display: grid;
  }

  .auth-modal-actions button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* Controles visuais complementares, temas e cores auditadas. */
.auth-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.auth-password-control { position: relative; width: 100%; }
.auth-password-control input { padding-right: 52px; }
.auth-password-toggle { position:absolute; top:50%; right:7px; display:inline-flex; align-items:center; justify-content:center; width:36px; height:36px; padding:7px; border:1px solid transparent; border-radius:7px; transform:translateY(-50%); background:transparent; color:var(--auth-muted); }
.auth-password-toggle:hover { background:var(--auth-panel-soft); color:var(--auth-ink); }
.auth-password-toggle svg { width:19px; height:19px; }
.auth-password-toggle svg[hidden] { display:none; }
.auth-field input, .auth-filter input, .auth-filter select { border-color:var(--auth-control-border); }
.theme-picker { position:relative; display:inline-flex; align-items:center; }
.theme-toggle { display:inline-flex; align-items:center; justify-content:center; gap:6px; min-height:34px; padding:5px 8px; border:1px solid currentColor; border-radius:7px; background:transparent; color:inherit; font:inherit; font-size:11.5px; font-weight:700; cursor:pointer; }
.theme-toggle svg { width:16px; height:16px; flex:none; }
.theme-toggle svg[hidden] { display:none; }
.auth-header .auth-theme-picker .theme-toggle { color:rgba(255,255,255,.92); border-color:rgba(255,255,255,.48); }
.auth-header .theme-toggle:focus-visible { outline:3px solid var(--auth-header-focus); outline-offset:3px; }
.auth-header :where(a,button):focus-visible,
.auth-admin-actions :where(a,button):focus-visible { outline-color:var(--auth-header-focus); }
.auth-theme-picker .theme-menu { position:absolute; z-index:100; top:calc(100% + 8px); right:0; width:184px; padding:10px; border:1px solid var(--auth-control-border); border-radius:9px; background:var(--auth-panel); color:var(--auth-ink); box-shadow:var(--auth-shadow); }
.auth-theme-picker .theme-menu[hidden] { display:none; }
.theme-options { display:grid; gap:3px; min-width:0; margin:0; padding:0; border:0; }
.theme-options legend { margin:0 0 5px; color:var(--auth-ink); font-size:12px; font-weight:800; }
.theme-option { display:flex; align-items:center; gap:9px; padding:8px; border-radius:6px; color:var(--auth-ink); font-size:13px; cursor:pointer; }
.theme-option:hover { background:var(--auth-panel-soft); }
.theme-option input { flex:none; width:16px; height:16px; margin:0; accent-color:var(--auth-green); }
.theme-option:has(input:checked) { background:var(--auth-green-soft); }
:root[data-theme="dark"] { color-scheme:dark; --auth-ink:#e5edf4; --auth-ink-soft:#c3d0dd; --auth-muted:#a9b8c8; --auth-paper:#101a2b; --auth-panel:#17263a; --auth-panel-soft:#1d2e44; --auth-line:#354a61; --auth-line-soft:#293b51; --auth-control-border:#657d95; --auth-placeholder:#a9b8c8; --auth-focus:#6fb1e8; --auth-header-focus:#6fb1e8; --auth-focus-shadow:rgba(114,195,170,.24); --auth-danger-shadow:rgba(225,141,131,.22); --auth-button-text:#092019; --auth-danger-button-text:#301916; --auth-danger-hover:#f3b9af; --auth-green:#3d9b82; --auth-green-deep:#72c1aa; --auth-green-soft:#1e403b; --auth-gold-soft:#413820; --auth-gold-deep:#e0c681; --auth-danger:#e18d83; --auth-danger-soft:#462a27; --auth-warn-soft:#3b3325; --auth-warn-ink:#e0c681; --auth-info-soft:#21394a; --auth-info-ink:#c3d8e2; }
:root[data-theme="dark"] body.auth-page { background:#091321; color:var(--auth-ink); }
:root[data-theme="dark"] .auth-card, :root[data-theme="dark"] .auth-admin-card, :root[data-theme="dark"] .auth-modal { background:var(--auth-panel); color:var(--auth-ink); }
:root[data-theme="dark"] .auth-field input, :root[data-theme="dark"] .auth-filter input, :root[data-theme="dark"] .auth-filter select, :root[data-theme="dark"] .auth-table-action, :root[data-theme="dark"] .auth-modal-actions button, :root[data-theme="dark"] .auth-button.danger { background:#101b2c; color:var(--auth-ink); }
:root[data-theme="dark"] .auth-table-action { color:var(--auth-green-deep); }
:root[data-theme="dark"] .auth-table-action:hover { background:var(--auth-green-soft); }
:root[data-theme="dark"] .auth-table-action.danger { color:var(--auth-danger); }
:root[data-theme="dark"] .auth-table-action.danger:hover { background:var(--auth-danger-soft); }
:root[data-theme="dark"] .auth-admin-toolbar { background:var(--auth-panel-soft); }
:root[data-theme="dark"] .auth-card-head h2, :root[data-theme="dark"] .auth-modal h2, :root[data-theme="dark"] .auth-empty strong { color:var(--auth-ink); }
:root[data-theme="dark"] .auth-modal p, :root[data-theme="dark"] .auth-table td { color:var(--auth-ink-soft); }
:root[data-theme="dark"] .auth-privacy { border-color:#74643d; }
:root[data-theme="dark"] .auth-form-message.error, :root[data-theme="dark"] .auth-message.error { color:#f3b9af; border-color:#70423b; }
:root[data-theme="dark"] .auth-button:not(.secondary):not(.danger) { color:var(--auth-button-text); }
:root[data-theme="dark"] .auth-button.secondary { color:#fff; }
:root[data-theme="dark"] .auth-button.danger { color:var(--auth-danger); }
:root[data-theme="dark"] .auth-button.danger:hover { background:var(--auth-danger-soft); }
:root[data-theme="dark"] .auth-modal-actions button:last-child { background:var(--auth-danger); color:var(--auth-danger-button-text); }
:root[data-theme="dark"] .auth-modal-actions button:last-child:hover { background:var(--auth-danger-hover); }
.auth-pagination { display:flex; align-items:center; justify-content:flex-end; gap:12px; flex-wrap:wrap; padding:14px 18px; border-top:1px solid var(--auth-line-soft); color:var(--auth-muted); font-size:12.5px; }
.auth-pagination[hidden] { display:none; }
.auth-pagination button { min-height:36px; padding:7px 11px; border:1px solid var(--auth-control-border); border-radius:7px; background:var(--auth-panel); color:var(--auth-ink); font-weight:700; }
.auth-pagination button:disabled { opacity:.52; cursor:not-allowed; }
.auth-pagination button:not(:disabled):hover { border-color:var(--auth-green); color:var(--auth-green-deep); }
@media (max-width:560px) { .auth-header { flex-wrap:wrap; } .auth-theme-picker { margin-left:auto; } .auth-pagination { justify-content:center; gap:8px; padding:12px; } .auth-pagination button { min-width:92px; } }


/* Paleta Padrão 5x2 para páginas internas de administração; login/cadastro não carregam o seletor. */
:root[data-theme="default"] {
  color-scheme: light;
  --auth-navy: #36546a; --auth-navy-deep: #294353; --auth-navy-soft: #405d71;
  --auth-kicker: #e8d99e;
  --auth-ink: #293e50; --auth-ink-soft: #41586b; --auth-muted: #405a6e;
  --auth-paper: #d9e3eb; --auth-panel: #e7eef3; --auth-panel-soft: #ccd9e3;
  --auth-line: #c3d0d9; --auth-line-soft: #d1dbe2;
  --auth-green: #3c695d; --auth-green-deep: #315a50; --auth-green-soft: #d7e8e1;
  --auth-gold: #927947; --auth-gold-soft: #eee7d6; --auth-gold-deep: #67552d;
  --auth-danger: #a3463e; --auth-danger-soft: #f1dfdc; --auth-danger-button-text: #ffffff; --auth-danger-hover: #7e3933;
  --auth-warn-soft: #efe8d6; --auth-warn-ink: #67552d; --auth-info-soft: #dce7ed; --auth-info-ink: #3a596b;
  --auth-focus: #2d6e8b; --auth-header-focus: #b6d3df; --auth-focus-shadow: rgba(78,129,114,.18); --auth-danger-shadow: rgba(163,70,62,.14);
  --auth-control-border: #74899a; --auth-placeholder: #536b7e; --auth-button-text: #ffffff;
  --auth-radius: 10px; --auth-shadow: 0 1px 2px rgba(42,67,86,.08), 0 8px 24px -12px rgba(42,67,86,.22);
}
:root[data-theme="default"] body.auth-page { background: var(--auth-navy); color: var(--auth-ink); }
:root[data-theme="default"] .auth-theme-picker .theme-toggle { color: #ffffff; border-color: rgba(255,255,255,.48); }
:root[data-theme="default"] .auth-theme-picker .theme-toggle:hover { background: rgba(255,255,255,.12); }
.theme-description { margin: 2px 0 6px; color: var(--auth-muted); font-size: 12px; line-height: 1.4; }

/*
 * Complemento responsivo da Calculadora 5x2.
 * Este arquivo é concatenado depois das folhas principais pelo build.
 * As cores permanecem nos tokens existentes para acompanhar tema e contraste.
 */

:root {
  --responsive-touch: 44px;
  --responsive-backdrop-opacity: .62;
  --responsive-drawer-width: min(286px, 88vw);
  --responsive-table-hint-size: 11.5px;
}

/* ---------- shell principal ---------- */

html,
body {
  min-width: 320px;
}

body {
  overflow-x: clip;
}

.app,
.main,
#pages,
.page {
  min-width: 0;
}

.app {
  min-height: 100vh;
  min-height: 100svh;
  min-height: 100dvh;
}

.main {
  min-height: 100vh;
  min-height: 100svh;
  min-height: 100dvh;
}

.sidebar {
  min-height: 100vh;
  min-height: 100svh;
  height: 100dvh;
  max-height: 100dvh;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.topbar {
  min-width: 0;
  flex-wrap: wrap;
}

#tbActions {
  min-width: 0;
  max-width: 100%;
  justify-content: flex-end;
}

#tbActions .btn {
  max-width: 100%;
  overflow-wrap: anywhere;
}

.app-intro[hidden],
.audit-menu-backdrop[hidden],
.chart-data[hidden] {
  display: none !important;
}

/* O app-intro completo fica no Dashboard; o appagent controla hidden nas demais rotas. */
.app-intro {
  max-width: 1264px;
}

.app-intro-copy,
.intro-access-note,
.panel,
.panel-b,
.panel-h,
.hero-intro,
.grp-card,
.kpi {
  min-width: 0;
}

/* Ações de decisão e navegação mantêm alvo confortável, inclusive quando têm btn-sm. */
.btn-p,
.btn-s,
.result-actions .btn,
.wiz-nav .btn,
.wiz-nav .btn-row .btn,
#tbActions .btn {
  min-height: var(--responsive-touch);
}

/* Campos criados pelo simulador não perdem área útil ao reduzir o viewport. */
.fld input,
.fld select,
.fld textarea,
.grp-card input:not(.nm),
.range-pair input[type="number"] {
  min-height: var(--responsive-touch);
}

.fld input,
.fld select,
.grp-card input:not(.nm) {
  height: auto;
  padding-block: 10px;
}

.fld textarea {
  min-height: 88px;
}

.chk,
.seg button {
  min-height: var(--responsive-touch);
}

/* Tabelas continuam contendo todos os dados; somente o contêiner recebe rolagem. */
.tb-wrap,
.auth-table-wrap {
  position: relative;
  min-width: 0;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-gutter: stable;
  -webkit-overflow-scrolling: touch;
}

.tb-wrap .tb,
.auth-table-wrap .auth-table {
  max-width: none;
}

.tb-wrap .tb caption,
.auth-table-wrap .auth-table caption {
  padding: 8px 0;
  color: var(--muted);
  font-size: var(--responsive-table-hint-size);
  line-height: 1.4;
  text-align: left;
}

.audit-section-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  margin: 0 0 14px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  flex-wrap: wrap;
}

.audit-section-nav :where(a, button) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--responsive-touch);
  max-width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.audit-section-nav :where(a, button):hover,
.audit-section-nav :where(a, button)[aria-current="page"],
.audit-section-nav :where(a, button).active {
  border-color: var(--green);
  background: var(--green-soft);
  color: var(--green-deep);
}

.chart-data {
  min-width: 0;
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--ink);
  font-size: 12.5px;
  line-height: 1.5;
  overflow-wrap: anywhere;
  overflow-x: auto;
}

.chart-data :where(table, pre) {
  max-width: 100%;
}

.chart-data table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.chart-data :where(th, td) {
  padding: 7px 9px;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  vertical-align: top;
}

.chart-data th {
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.chart-data caption {
  padding: 0 0 7px;
  color: var(--ink-soft);
  font-weight: 700;
  text-align: left;
}

.chart-data pre {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* Fallback seguro enquanto a etapa 5 ainda pode chegar com o g5 e style inline. */
#page-wizard .grid.g5,
#page-wizard .audit-faltas-grid,
.audit-faltas-grid {
  min-width: 0;
  grid-template-columns: repeat(5, minmax(110px, 1fr)) !important;
}

/* ---------- gaveta móvel ---------- */

.audit-menu-backdrop {
  display: none;
}

@media (min-width: 921px) {
  .audit-section-nav {
    position: sticky;
    top: 64px;
    z-index: 10;
  }

  .audit-section-nav + * {
    scroll-margin-top: 84px;
  }
}

@media (max-width: 920px) {
  body:has(.sidebar.open) {
    overflow: hidden;
  }

  .sidebar {
    position: fixed;
    z-index: 40;
    top: 0;
    bottom: 0;
    left: 0;
    width: var(--responsive-drawer-width);
    height: 100svh;
    height: 100dvh;
    max-height: 100dvh;
    padding-block-start: env(safe-area-inset-top);
    padding-block-end: env(safe-area-inset-bottom);
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .audit-menu-backdrop:not([hidden]) {
    position: fixed;
    z-index: 35;
    inset: 0;
    display: block;
    background: var(--navy);
    opacity: var(--responsive-backdrop-opacity);
  }

  .tb-menu {
    flex: 0 0 var(--responsive-touch);
    width: var(--responsive-touch);
    min-width: var(--responsive-touch);
    height: var(--responsive-touch);
    min-height: var(--responsive-touch);
  }

  .nav-item,
  .profile-row select,
  .profile-row .btn,
  .side-foot .btn-g,
  #authBox .theme-toggle,
  #authBox .auth-client-actions :where(a, button) {
    min-height: var(--responsive-touch);
  }

  .topbar {
    align-items: center;
    gap: 10px;
    padding-block-start: max(10px, env(safe-area-inset-top));
    padding-block-end: 10px;
  }

  #tbActions {
    flex: 1 1 100%;
    justify-content: flex-start;
    gap: 8px;
    padding-block-end: 1px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
  }

  #tbActions .btn {
    flex: 0 1 auto;
  }

  #pages {
    padding-inline: 14px;
  }

  .app-intro,
  .app-footer,
  .noscript-warning,
  .storage-notice {
    width: calc(100% - 28px);
  }

  .app-intro {
    gap: 14px;
    margin-top: 14px;
    padding: 15px 16px;
  }

  .app-intro h2 {
    margin-bottom: 5px;
    font-size: clamp(20px, 6vw, 27px);
  }

  .app-intro-copy > p:not(.intro-kicker) {
    font-size: 13px;
  }

  .intro-notes {
    gap: 7px;
    margin-top: 8px;
    font-size: 11.5px;
  }

  .panel-h,
  .panel-b {
    min-width: 0;
  }

  .audit-section-nav {
    position: static;
    margin-bottom: 12px;
  }

  #page-wizard .grid.g5,
  #page-wizard .audit-faltas-grid,
  .audit-faltas-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .tb-wrap::after,
  .auth-table-wrap::after {
    position: sticky;
    left: 0;
    display: block;
    width: 100%;
    padding-top: 7px;
    color: var(--muted);
    font-size: var(--responsive-table-hint-size);
    line-height: 1.35;
    content: "Deslize horizontalmente para consultar todas as colunas.";
    background: var(--panel);
  }

  .auth-table-wrap::after {
    content: "Deslize horizontalmente para consultar colunas e ações.";
  }

  .tb th,
  .tb td,
  .auth-table th,
  .auth-table td {
    padding-inline: 10px;
  }
}

@media (max-width: 800px) {
  .topbar {
    align-items: flex-start;
  }

  .tb-left {
    flex: 1 1 min(100%, 260px);
    min-width: 0;
  }

  #page-wizard .grid.g5,
  #page-wizard .audit-faltas-grid,
  .audit-faltas-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 480px) {
  #page-wizard .grid.g5,
  #page-wizard .audit-faltas-grid,
  .audit-faltas-grid {
    grid-template-columns: 1fr !important;
  }

  .app-intro {
    padding-inline: 14px;
  }

  .audit-section-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .audit-section-nav :where(a, button) {
    width: 100%;
  }
}

@media (max-width: 560px) {
  .tb-left {
    flex-basis: calc(100% - var(--responsive-touch) - 10px);
  }

  .tb-sub {
    max-width: 54vw;
  }

  .tb-wrap .tb {
    min-width: max-content;
  }

  .chart-data {
    margin-inline: -2px;
    padding-inline: 11px;
  }

  .auth-page .theme-menu,
  #authBox .theme-menu {
    width: min(184px, calc(100vw - 28px));
    max-width: calc(100vw - 28px);
    max-height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 24px);
    overflow-y: auto;
  }
}

/* ---------- autenticação: prioridade do formulário e alvos confortáveis ---------- */

.auth-page .auth-password-control input {
  padding-inline-end: 60px;
}

.auth-page .auth-password-toggle {
  width: var(--responsive-touch);
  min-width: var(--responsive-touch);
  height: var(--responsive-touch);
  min-height: var(--responsive-touch);
  padding: 9px;
}

.auth-page .auth-table-wrap {
  overflow-x: auto;
}

.auth-page .auth-table-wrap[hidden],
.auth-page .auth-field-error[hidden],
.auth-page .auth-session-hidden {
  display: none !important;
}

.auth-page .auth-field-error {
  margin: 4px 0 0;
  color: var(--auth-danger);
  font-size: 12.5px;
  line-height: 1.45;
}

.auth-page .auth-table caption {
  color: var(--auth-muted);
}

.auth-page .auth-table-wrap::after {
  color: var(--auth-muted);
  background: var(--auth-panel);
}

.auth-page .auth-admin-actions :where(a, button),
.auth-page .auth-table-action,
.auth-page .auth-pagination button {
  min-height: var(--responsive-touch);
}

.auth-page .auth-admin-actions,
.auth-page .auth-modal-actions {
  align-items: stretch;
}

@media (max-width: 800px) {
  .auth-page .auth-frame {
    align-items: start;
  }

  /* O cartão vem primeiro no fluxo visual sem alterar a ordem DOM ou os dados. */
  .auth-page .auth-card {
    order: -1;
  }

  .auth-page .auth-intro {
    order: 1;
  }

  .auth-page .auth-intro-notes {
    gap: 9px;
    margin-top: 16px;
  }

  .auth-page .auth-intro-note {
    font-size: 12px;
  }
}

@media (max-width: 560px) {
  .auth-page .auth-header,
  .auth-page .auth-main,
  .auth-page .auth-footer {
    width: calc(100% - 28px);
  }

  .auth-page .auth-card {
    width: 100%;
  }

  .auth-page .auth-intro h1 {
    font-size: clamp(27px, 9vw, 38px);
  }

  .auth-page .auth-form {
    gap: 14px;
  }

  .auth-page .auth-field input,
  .auth-page .auth-filter input,
  .auth-page .auth-filter select {
    min-height: var(--responsive-touch);
    padding-block: 10px;
    font-size: 16px;
  }

  .fld :where(input:not([type="checkbox"]):not([type="range"]), select, textarea) {
    font-size: 16px;
  }

  .auth-page .auth-admin-actions,
  .auth-page .auth-modal-actions {
    display: grid;
  }

  .auth-page .auth-admin-actions :where(a, button),
  .auth-page .auth-modal-actions button {
    width: 100%;
  }

  .auth-page .auth-table-wrap::after {
    background: var(--auth-panel, var(--panel));
  }
}

/* ---------- redução de movimento ---------- */

@media (prefers-reduced-motion: reduce) {
  .sidebar {
    transition-duration: .01ms;
  }
}

/* Mesma família visual na instalação e durante o uso. */
.app-brand-icon {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: inherit;
}

/* ---------- entrada de data previsível (DD/MM/AAAA) ---------- */
.date-input-wrap {
  position: relative;
  display: flex;
  align-items: stretch;
  gap: 7px;
  min-width: 0;
}

.date-entry-input {
  flex: 1 1 auto;
  min-width: 0;
  font-variant-numeric: tabular-nums;
}

.date-picker-trigger {
  display: inline-flex;
  flex: 0 0 var(--responsive-touch);
  align-items: center;
  justify-content: center;
  width: var(--responsive-touch);
  min-width: var(--responsive-touch);
  min-height: var(--responsive-touch);
  padding: 8px;
  border: 1px solid var(--control-border);
  border-radius: 8px;
  background: var(--panel);
  color: var(--heading);
}

.date-picker-trigger:hover {
  border-color: var(--focus);
  background: var(--panel-soft);
}

.date-picker-trigger:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.date-picker-trigger svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.date-native-picker {
  position: absolute !important;
  inset-inline-end: 0 !important;
  top: 0 !important;
  width: var(--responsive-touch) !important;
  min-width: var(--responsive-touch) !important;
  height: var(--responsive-touch) !important;
  min-height: var(--responsive-touch) !important;
  padding: 0 !important;
  border: 0 !important;
  opacity: 0;
  pointer-events: none;
}

.date-input-hint,
.date-input-error {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  line-height: 1.4;
}

.date-input-hint {
  color: var(--muted);
}

.date-input-error {
  color: var(--danger);
  font-weight: 700;
}

.date-input-error[hidden] {
  display: none !important;
}

.date-entry-input[aria-invalid="true"] {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px var(--danger-shadow);
}

@media (max-width: 480px) {
  .date-input-wrap {
    gap: 6px;
  }
}
