/* Emissor Plus — ajustes sobre o Nightdesk: shell em tela cheia, variante clara (padrão), drawer no celular. */

/* ---------- Variante clara (padrão). Só superfícies, tintas e linhas mudam; sinais continuam. ---------- */
:root[data-theme="light"] {
  --nd-canvas: #e7e9ec;
  --nd-shell: #ffffff;
  --nd-panel: #f6f7f9;
  --nd-raised: #eef0f3;
  --nd-raised-hover: #e4e7eb;
  --nd-hairline: #e2e5e9;
  --nd-hairline-strong: #cfd4da;
  --nd-ink: #15181d;
  --nd-ink-muted: #5c6470;
  --nd-ink-faint: #99a1ab;
  --nd-ink-inverse: #ffffff;
  --nd-gain: #1f9d47;
  --nd-loss: #d53a41;
  --nd-progress: #2563eb;
  --nd-caution: #b8791d;
  --nd-gain-fill: rgba(31, 157, 71, 0.14);
  --nd-loss-fill: rgba(213, 58, 65, 0.14);
  --nd-focus: #15181d;
  --nd-focus-ring: 0 0 0 1px #ffffff, 0 0 0 3px rgba(21, 24, 29, 0.35);
  --nd-shadow-shell: none;
  --nd-shadow-tooltip: 0 1px 2px rgba(0, 0, 0, 0.08), 0 8px 24px -8px rgba(0, 0, 0, 0.18);
}
:root[data-theme="light"] .nd-btn--primary:hover { background: #000; border-color: #000; }
:root[data-theme="light"] .nd-table tbody tr:hover td { background: rgba(0, 0, 0, 0.025); }
:root[data-theme="light"] .nd-input, :root[data-theme="light"] .nd-search, :root[data-theme="light"] .nd-select { background: #fff; }

/* ---------- Shell em tela cheia (o pack centraliza um cartão; aqui é o app) ---------- */
html, body { height: 100%; }
.ep-stage { min-height: 100vh; }
.ep-stage .nd-shell { max-width: none; min-height: 100vh; border-radius: 0; box-shadow: none; }
.ep-stage .nd-sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.ep-stage .nd-main { padding: var(--nd-space-4) var(--nd-space-6) var(--nd-space-8); }
.nd-sidebar .ep-sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: var(--nd-space-2); }

/* ---------- Complementos de formulário ---------- */
.nd-select { appearance: none; -webkit-appearance: none; display: block; width: 100%; height: var(--nd-control-h); padding: 0 32px 0 var(--nd-space-3);
  background: var(--nd-shell) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%238a8a8a' stroke-width='1.5'><path d='m4 6 4 4 4-4'/></svg>") no-repeat right 10px center;
  border: 1px solid var(--nd-hairline); border-radius: var(--nd-radius-md); color: var(--nd-ink); font: 400 var(--nd-text-base)/1 var(--nd-font-ui); }
.nd-select:hover { border-color: var(--nd-hairline-strong); }
.nd-select:focus { outline: none; border-color: var(--nd-ink-muted); box-shadow: none; }
.nd-input { width: 100%; }
.nd-input[aria-invalid="true"], .nd-select[aria-invalid="true"] { border-color: var(--nd-loss); }
.nd-help { font-size: var(--nd-text-sm); color: var(--nd-ink-faint); }
.nd-error { font-size: var(--nd-text-sm); color: var(--nd-loss); display: flex; align-items: center; gap: 6px; }
.nd-error svg { width: 13px; height: 13px; }
.ep-form-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--nd-space-4); }
.ep-col-3 { grid-column: span 3; } .ep-col-4 { grid-column: span 4; } .ep-col-6 { grid-column: span 6; } .ep-col-8 { grid-column: span 8; } .ep-col-12 { grid-column: span 12; }
.ep-form-actions { display: flex; gap: var(--nd-space-2); padding-top: var(--nd-space-2); flex-wrap: wrap; }
.ep-section-title { font-size: var(--nd-text-sm); color: var(--nd-ink-muted); text-transform: uppercase; letter-spacing: .06em; padding-top: var(--nd-space-2); border-bottom: 1px solid var(--nd-hairline); padding-bottom: 6px; }
.nd-panel__body { padding: var(--nd-space-5); display: flex; flex-direction: column; gap: var(--nd-space-4); }

/* Toast de retorno */
.ep-toast { display: flex; align-items: center; gap: var(--nd-space-2); padding: 10px var(--nd-space-4); border-radius: var(--nd-radius-md); border: 1px solid var(--nd-hairline-strong); background: var(--nd-panel); color: var(--nd-ink); font-size: var(--nd-text-nav); }
.ep-toast--ok { border-color: var(--nd-gain); } .ep-toast--erro { border-color: var(--nd-loss); }
.ep-toast svg { width: 16px; height: 16px; }
.ep-toast--ok svg { color: var(--nd-gain); } .ep-toast--erro svg { color: var(--nd-loss); }

/* Página de login */
.ep-login { min-height: 100vh; display: grid; place-items: center; padding: var(--nd-space-6); background: var(--nd-canvas); }
.ep-login .nd-panel { width: 100%; max-width: 400px; }
.ep-login-brand { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 500; }
.ep-login-brand .nd-tile { width: 32px; height: 32px; font-size: 14px; }

/* Cartões de seleção de empresa */
/* .ep-cards/.ep-card: ver uiverse.css */


.ep-card__head { display: flex; align-items: center; gap: 10px; }
.ep-card__head .nd-tile { width: 36px; height: 36px; font-size: 14px; }

/* Links na tabela */
.nd-table a.ep-link { color: var(--nd-ink); border-bottom: 1px solid var(--nd-hairline-strong); }
.nd-table a.ep-link:hover { border-bottom-color: var(--nd-ink); }

/* Alpine: esconder antes de inicializar */
[x-cloak] { display: none !important; }

/* ---------- Celular / tablet: sidebar vira drawer, tabela rola ---------- */
.ep-menu-btn { display: none; }
@media (max-width: 860px) {
  .ep-stage .nd-shell { grid-template-columns: 1fr; min-height: 100vh; }
  .ep-stage .nd-sidebar { position: fixed; inset: 0 auto 0 0; width: min(86vw, 300px); height: 100vh; z-index: 40; transform: translateX(-100%); transition: transform 180ms var(--nd-ease); border-right: 1px solid var(--nd-hairline); box-shadow: 0 0 0 100vmax rgba(0,0,0,0); }
  .ep-stage .nd-sidebar.is-open { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.45); }
  .ep-menu-btn { display: inline-flex; }
  .ep-stage .nd-main { padding: var(--nd-space-3) var(--nd-space-4) var(--nd-space-8); }
  .nd-topbar { flex-wrap: wrap; }
  .nd-topbar .nd-search { display: flex; width: 100%; order: 10; }
  .ep-form-grid > * { grid-column: span 12; }
  .nd-table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .nd-table { min-width: 640px; }
  .nd-toolbar { flex-wrap: wrap; }
  .nd-toolbar .nd-search { width: 100%; }
  .nd-toolbar__end { margin-left: 0; width: 100%; }
  .nd-btn { min-height: 44px; }
  .nd-btn--sm { min-height: 36px; }
}

/* Rótulos de duas linhas mantêm os campos alinhados; grid de formulário com mínimo por coluna */
.ep-form-grid .nd-label { min-height: 2.6em; display: flex; align-items: flex-end; line-height: 1.25; }
.ep-form-grid { grid-auto-flow: row dense; }
@media (min-width: 861px) and (max-width: 1280px) { .ep-col-3 { grid-column: span 4; } .ep-col-2 { grid-column: span 4; } }
@media (max-width: 860px) { .nd-topbar { height: auto; min-height: 44px; padding-bottom: 8px; } .nd-main > .nd-page-title { margin-top: 4px; } }
@media (max-width: 860px) { .nd-tabs { overflow-x: auto; white-space: nowrap; scrollbar-width: none; } .nd-tabs .nd-tab { flex: none; } }
