/* Gestor controls only. Keep existing colors, geometry, transforms and disabled states. */
body:not(.os-standalone):not(.pre-sale-standalone):not(.mic-standalone) :is(.app,.backup-confirm-modal,.restore-modal) :is(button,input[type="button"],input[type="submit"],a.primary,a.secondary,a.danger,a[role="button"]):not(:disabled):not([aria-disabled="true"]) {
  transition: box-shadow var(--gestor-feedback-duration,150ms) ease, outline-color var(--gestor-feedback-duration,150ms) ease;
}
@media (hover:hover) and (pointer:fine) {
  body:not(.os-standalone):not(.pre-sale-standalone):not(.mic-standalone) :is(.app,.backup-confirm-modal,.restore-modal) :is(button,input[type="button"],input[type="submit"],a.primary,a.secondary,a.danger,a[role="button"]):not(:disabled):not([aria-disabled="true"]):hover {
    box-shadow: 0 0 0 2px color-mix(in srgb,currentColor 22%,transparent),0 3px 9px #173d2b20;
    outline: 1px solid color-mix(in srgb,currentColor 36%,transparent);
    outline-offset: 1px;
  }
  body:not(.os-standalone):not(.pre-sale-standalone):not(.mic-standalone) .app input[type="file"]:enabled::file-selector-button:hover {
    box-shadow: inset 0 0 0 2px color-mix(in srgb,currentColor 25%,transparent);
  }
}
body:not(.os-standalone):not(.pre-sale-standalone):not(.mic-standalone) :is(.app,.backup-confirm-modal,.restore-modal) :is(button,input[type="button"],input[type="submit"],a.primary,a.secondary,a.danger,a[role="button"]):not(:disabled):not([aria-disabled="true"]):focus-visible {
  outline: 3px solid var(--primary,#087f5b);
  outline-offset: 3px;
}
body:not(.os-standalone):not(.pre-sale-standalone):not(.mic-standalone) .app input[type="file"]:enabled:focus-visible { outline: 3px solid var(--primary,#087f5b); outline-offset: 3px; }

.nfse-schema-state {
  --fiscal-confirmed: #08764d;
  --fiscal-pending: #996510;
  --fiscal-unknown: #64766e;
}
.nfse-schema-state .nfse-schema-heading,
.nfse-certificate-card .nfse-config-head {
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:16px;
}
.nfse-schema-state .nfse-schema-heading h2,
.nfse-certificate-card .nfse-config-head h2 { margin:0; }
.nfse-schema-state .nfse-schema-state-label,
.nfse-certificate-card .nfse-certificate-badge {
  display:inline-flex;
  align-items:center;
  gap:7px;
  flex:0 0 auto;
  padding:7px 12px;
  border-radius:999px;
  background:#fff4d9;
  color:#805508;
  font-size:.8rem;
  font-weight:700;
  line-height:1.3;
  white-space:nowrap;
}
.nfse-schema-state[data-schema-status="applied"] .nfse-schema-state-label,
.nfse-certificate-card .nfse-certificate-badge.ready { background:#e3f5eb; color:#08764d; }
.nfse-schema-state:is([data-schema-status="blocked"],[data-schema-status="failed"],[data-schema-status="unavailable"]) .nfse-schema-state-label { background:#fbe9e6; color:#a13f32; }
.nfse-schema-state[data-schema-status="checking"] .nfse-schema-state-label { background:#e8f0fa; color:#305c8a; }
.nfse-schema-state [data-nfse-schema-message] { margin:10px 0 18px; color:var(--muted,#61766c); line-height:1.5; }
.nfse-schema-state .nfse-schema-checklist-title { margin:0 0 10px; font-size:.86rem; font-weight:700; color:var(--text,#193d2d); }
.nfse-schema-state .nfse-schema-checklist {
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:10px;
  padding:0;
  margin:0;
  list-style:none;
}
.nfse-schema-state .nfse-schema-check {
  display:flex;
  align-items:center;
  gap:12px;
  min-width:0;
  padding:13px 14px;
  border:1px solid var(--border,#dae5df);
  border-radius:12px;
  background:var(--panel,#f8fbf9);
}
.nfse-schema-state .nfse-check-icon {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:28px;
  height:28px;
  flex:0 0 28px;
  box-sizing:border-box;
  border-radius:50%;
  background:#fff0cf;
  color:var(--fiscal-pending);
  font-size:19px;
  font-weight:800;
  line-height:1;
}
.nfse-schema-state [data-check-state="confirmed"] .nfse-check-icon { background:var(--fiscal-confirmed); color:#fff; }
.nfse-schema-state [data-check-state="unknown"] .nfse-check-icon { background:#e9eeeb; color:var(--fiscal-unknown); }
.nfse-schema-state [data-check-state="checking"] .nfse-check-icon {
  border:3px solid #d7e6f6;
  border-top-color:#305c8a;
  background:transparent;
  color:transparent;
  animation:nfse-check-spin 850ms linear infinite;
}
.nfse-schema-state .nfse-check-copy { display:grid; gap:3px; min-width:0; }
.nfse-schema-state .nfse-check-copy b { color:var(--text,#193d2d); font-size:.91rem; overflow-wrap:anywhere; }
.nfse-schema-state .nfse-check-copy small { color:var(--fiscal-pending); font-size:.78rem; font-weight:600; }
.nfse-schema-state [data-check-state="confirmed"] .nfse-check-copy small { color:var(--fiscal-confirmed); }
.nfse-schema-state [data-check-state="unknown"] .nfse-check-copy small { color:var(--fiscal-unknown); }
.nfse-schema-state [data-check-state="checking"] .nfse-check-copy small { color:#305c8a; }
.nfse-schema-state .nfse-schema-progress { display:flex; justify-content:space-between; gap:10px; flex-wrap:wrap; margin:14px 0; color:var(--muted,#61766c); font-size:.8rem; }
.nfse-schema-state .nfse-schema-notes { padding-left:20px; margin:8px 0 14px; overflow-wrap:anywhere; font-size:.82rem; }
.nfse-schema-state .nfse-schema-actions { display:flex; align-items:center; justify-content:flex-end; gap:10px; flex-wrap:wrap; padding-top:16px; border-top:1px solid var(--border,#dae5df); }
.nfse-schema-state .nfse-schema-actions form { margin:0; }

.nfse-certificate-card .nfse-config-head > div { min-width:0; }
.nfse-certificate-card .nfse-config-head p { margin:7px 0 0; line-height:1.5; max-width:65ch; }
.nfse-certificate-card .nfse-certificate-title { display:flex; align-items:center; gap:10px; }
.nfse-certificate-card .nfse-certificate-title svg { width:24px; height:24px; flex:0 0 24px; color:var(--primary,#087f5b); }
.nfse-certificate-card .nfse-integration-state {
  display:grid;
  gap:6px;
  margin:20px 0;
  padding:14px 16px;
  border:1px solid #dde4f2;
  border-radius:12px;
  background:var(--panel,#f5f7fc);
  color:var(--text,#263b55);
  line-height:1.45;
}
.nfse-certificate-card .nfse-integration-heading { display:flex; align-items:center; gap:8px 16px; justify-content:space-between; flex-wrap:wrap; }
.nfse-certificate-card .nfse-integration-heading b { font-size:.93rem; }
.nfse-certificate-card .nfse-integration-heading span { font-size:.77rem; color:var(--muted,#61766c); }
.nfse-certificate-card .nfse-integration-endpoint { font-size:.75rem; color:var(--muted,#61766c); overflow-wrap:anywhere; }
.nfse-certificate-card .nfse-integration-note { margin:0; font-size:.79rem; }
.nfse-certificate-card .nfse-certificate-form { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; align-items:start; }
.nfse-certificate-card .nfse-certificate-form label { display:grid; gap:7px; min-width:0; font-size:.83rem; font-weight:600; }
.nfse-certificate-card .nfse-certificate-form :is(input,select) { width:100%; min-width:0; box-sizing:border-box; }
.nfse-certificate-card .nfse-certificate-form input[type="file"] { font-size:.78rem; padding:7px; }
.nfse-certificate-card .nfse-certificate-form input[type="file"]::file-selector-button { margin-right:9px; padding:8px 10px; border:1px solid #cfe1d7; border-radius:7px; background:#eef8f2; color:#08764d; font-weight:700; cursor:pointer; }
.nfse-certificate-card .nfse-certificate-actions { grid-column:1/-1; display:flex; align-items:center; justify-content:space-between; gap:16px; padding-top:4px; }
.nfse-certificate-card .nfse-certificate-actions p { margin:0; max-width:55ch; color:var(--muted,#61766c); font-size:.78rem; font-weight:400; line-height:1.5; }
.nfse-certificate-card .nfse-certificate-actions button { flex:0 0 auto; width:auto; margin:0; }
.nfse-certificate-card .certificate-expiry { margin-top:20px; padding-top:16px; border-top:1px solid var(--border,#dae5df); }
.nfse-certificate-card .nfse-certificate-metadata { display:grid; grid-template-columns:minmax(130px,.6fr) minmax(0,1.4fr); gap:12px 20px; margin:0; }
.nfse-certificate-card .nfse-certificate-metadata div { min-width:0; }
.nfse-certificate-card .nfse-certificate-metadata dt { margin:0 0 4px; font-size:.76rem; color:var(--muted,#61766c); }
.nfse-certificate-card .nfse-certificate-metadata dd { margin:0; font-size:.84rem; color:var(--text,#193d2d); overflow-wrap:anywhere; }

@keyframes nfse-check-spin { to { transform:rotate(360deg); } }
@media(max-width:600px) {
  .nfse-schema-state .nfse-schema-heading,.nfse-certificate-card .nfse-config-head { flex-wrap:wrap; gap:10px; }
  .nfse-schema-state .nfse-schema-checklist,.nfse-certificate-card .nfse-certificate-form,.nfse-certificate-card .nfse-certificate-metadata { grid-template-columns:1fr; }
  .nfse-schema-state .nfse-schema-actions { justify-content:flex-start; }
  .nfse-certificate-card .nfse-certificate-actions { align-items:stretch; flex-direction:column; gap:12px; }
  .nfse-certificate-card .nfse-certificate-actions button { align-self:stretch; }
}
@media(prefers-reduced-motion:reduce) {
  :is(.app,.backup-confirm-modal,.restore-modal) { --gestor-feedback-duration:0ms; }
  .nfse-schema-state [data-check-state="checking"] .nfse-check-icon { animation:none; }
}
@media(forced-colors:active) {
  .nfse-schema-state .nfse-check-icon { border:1px solid currentColor; }
  .nfse-schema-state [data-check-state="checking"] .nfse-check-icon { color:CanvasText; }
}


/* O.S. action link: same module palette and geometry, existing route preserved. */
body.os-standalone .os-app-nav .os-app-new {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  min-height:44px;
  box-sizing:border-box;
  flex:0 0 auto;
  padding:0 18px !important;
  border:1px solid rgba(255,255,255,.65) !important;
  border-radius:9px;
  background:#8d3503 !important;
  color:#fff !important;
  font:inherit;
  font-weight:800;
  line-height:1.25;
  white-space:nowrap;
  text-decoration:none !important;
  cursor:pointer;
  transition:background-color 150ms ease,box-shadow 150ms ease,transform 150ms ease;
}
body.os-standalone .os-app-nav .os-app-new:focus-visible {
  outline:3px solid #fff;
  outline-offset:3px;
  box-shadow:0 0 0 6px #542100 !important;
}
@media(hover:hover) and (pointer:fine) {
  body.os-standalone .os-app-nav .os-app-new:hover {
    background:#702900 !important;
    color:#fff !important;
    transform:translateY(-1px);
  }
}
body.os-standalone .os-app-nav .os-app-new:active { transform:none; }
@media(prefers-reduced-motion:reduce) {
  body.os-standalone .os-app-nav .os-app-new { transition:none; }
  body.os-standalone .os-app-nav .os-app-new:hover { transform:none; }
}
@media(forced-colors:active) {
  body.os-standalone .os-app-nav .os-app-new {
    background:ButtonFace !important;
    color:ButtonText !important;
    border-color:ButtonText !important;
    box-shadow:none !important;
  }
  body.os-standalone .os-app-nav .os-app-new:focus-visible { outline-color:Highlight; }
}
