/* Gestão v2 — dark theme: zinc profundo + violeta/rosa + brilhos sutis */
:root {
  color-scheme: dark;

  /* Fundos (camadas) */
  --bg-root: #060608;
  --bg-sidebar: #0a0a0d;
  --bg-main: #08080b;
  --bg-elevated: #101014;
  --bg-card: #12121a;
  --bg-input: #0e0e12;

  /* Bordas e divisores */
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.12);
  --border-accent: rgba(167, 139, 250, 0.35);

  /* Texto */
  --text: #f4f4f5;
  --text-secondary: #a1a1aa;
  --muted: #71717a;

  /* Acento principal (violeta) */
  --accent: #a78bfa;
  --accent-bright: #c4b5fd;
  --accent-deep: #7c3aed;
  --accent-dim: rgba(139, 92, 246, 0.18);
  --accent-glow: rgba(139, 92, 246, 0.45);
  --accent-hover: #c4b5fd;

  /* Destaques secundários */
  --cyan: #22d3ee;
  --cyan-dim: rgba(34, 211, 238, 0.08);
  --pink-accent: #f472b6;

  /* Estados */
  --success: #4ade80;
  --success-dim: rgba(74, 222, 128, 0.12);
  --warning: #fbbf24;
  --danger: #fb7185;
  --danger-dim: rgba(251, 113, 133, 0.12);

  --sidebar-w: 268px;
  --radius: 12px;
  --radius-sm: 8px;
  --font: "DM Sans", system-ui, -apple-system, sans-serif;

  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.45);
  --shadow-glow: 0 0 40px rgba(139, 92, 246, 0.12);
}

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

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  background: var(--bg-root);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: var(--accent-dim);
  color: var(--text);
}

/* Scrollbar (WebKit) */
::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}
::-webkit-scrollbar-track {
  background: var(--bg-root);
}
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 6px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(167, 139, 250, 0.35);
}

a {
  color: inherit;
  text-decoration: none;
}

.app-shell {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: linear-gradient(165deg, #0c0c10 0%, #0a0a0e 40%, #08080c 100%);
  border-right: 1px solid var(--border);
  box-shadow: 4px 0 32px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  transition: transform 0.22s ease;
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid var(--border);
}

.sidebar__logo {
  width: 40px;
  height: 40px;
  font-size: 0.72rem;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent-deep) 0%, #db2777 50%, var(--cyan) 100%);
  background-size: 150% 150%;
  box-shadow: 0 4px 16px rgba(124, 58, 237, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.1) inset;
  display: grid;
  place-items: center;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.02em;
}

.sidebar__titles h1 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.sidebar__titles .sidebar__legal {
  display: block;
  font-size: 0.62rem;
  font-weight: 500;
  color: var(--text-secondary);
  line-height: 1.25;
  margin-top: 0.12rem;
  opacity: 0.92;
}

.sidebar__titles .sidebar__role {
  display: block;
  font-size: 0.72rem;
  color: var(--text-secondary);
  margin-top: 0.4rem;
}

.sidebar__nav {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem 0.75rem 1rem;
}

.nav-section {
  margin-bottom: 1.25rem;
}

.nav-section__label {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0.35rem 0.65rem 0.5rem;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.nav-link[aria-current="page"] {
  background: linear-gradient(90deg, var(--accent-dim), rgba(34, 211, 238, 0.06));
  color: var(--accent-bright);
  box-shadow: 0 0 0 1px var(--border-accent);
}

.nav-link svg {
  flex-shrink: 0;
  opacity: 0.85;
}

.sidebar__footer {
  padding: 0.75rem 1rem 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.dev-switch {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.dev-switch button {
  flex: 1;
  padding: 0.4rem 0.5rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
}

.dev-switch button:hover {
  border-color: var(--accent);
}

.dev-switch button.is-active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

/* Main */
.main-wrap {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(14, 14, 18, 0.92) 0%, rgba(8, 8, 11, 0.88) 100%);
  backdrop-filter: blur(12px) saturate(1.2);
  position: sticky;
  top: 0;
  z-index: 20;
  overflow: visible;
}

.topbar__left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  cursor: pointer;
}

.menu-toggle:hover {
  border-color: var(--border-accent);
  background: var(--bg-elevated);
}

.page-heading {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.badge-env {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  background: var(--success-dim);
  color: var(--success);
  border: 1px solid rgba(74, 222, 128, 0.35);
}

.topbar__right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  overflow: visible;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(145deg, var(--bg-elevated), #1a1a22);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent-bright);
}

.content {
  flex: 1;
  padding: 1.5rem;
  background:
    radial-gradient(ellipse 900px 500px at 85% -15%, rgba(124, 58, 237, 0.14), transparent 55%),
    radial-gradient(ellipse 700px 400px at 10% 100%, rgba(34, 211, 238, 0.06), transparent 50%),
    var(--bg-main);
}

/* Grid de KPIs (placeholder) */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.kpi-card {
  background: linear-gradient(160deg, var(--bg-card) 0%, var(--bg-elevated) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.15rem;
  box-shadow: var(--shadow-card);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.kpi-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-card), var(--shadow-glow);
}

.kpi-card__label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 500;
  margin-bottom: 0.35rem;
}

.kpi-card__value {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  background: linear-gradient(90deg, var(--text), var(--accent-bright));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.kpi-card__value--negative {
  background: none;
  -webkit-background-clip: initial;
  background-clip: initial;
  color: #fb7185;
}

.kpi-card__hint {
  margin-top: 0.4rem;
  font-size: 0.72rem;
  color: var(--muted);
}

/* KPIs clicáveis por casa (portal fornecedor): mais contraste */
.kpi-card.plataforma-surface {
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.35);
}
.kpi-card.plataforma-surface .kpi-card__label {
  color: rgba(244, 244, 245, 0.92); /* próximo de --text */
  font-weight: 650;
}
.kpi-card.plataforma-surface .kpi-card__value {
  background: none;
  -webkit-background-clip: initial;
  background-clip: initial;
  color: var(--text);
}
.kpi-card.plataforma-surface .kpi-card__hint {
  color: rgba(244, 244, 245, 0.82);
}

.panel {
  background: linear-gradient(165deg, var(--bg-card) 0%, var(--bg-elevated) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow-card);
}

.panel__title {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
  font-weight: 600;
}

/* Overlay mobile */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 35;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

body.nav-open .sidebar-backdrop {
  opacity: 1;
  pointer-events: auto;
}

/* Mensagens flash */
.flash-stack {
  max-width: 52rem;
  margin: 0 0 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.flash {
  padding: 0.65rem 0.9rem;
  border-radius: 8px;
  font-size: 0.88rem;
  border: 1px solid var(--border);
}

.flash--success {
  background: var(--success-dim);
  border-color: rgba(74, 222, 128, 0.35);
  color: #86efac;
}

.flash--danger {
  background: var(--danger-dim);
  border-color: rgba(251, 113, 133, 0.4);
  color: #fecdd3;
}

/* Página de login (sem sidebar) */
.auth-body {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: max(1.5rem, env(safe-area-inset-top)) max(1.5rem, env(safe-area-inset-right)) max(1.5rem, env(safe-area-inset-bottom)) max(1.5rem, env(safe-area-inset-left));
  background:
    radial-gradient(ellipse 800px 500px at 50% -10%, rgba(124, 58, 237, 0.2), transparent 55%),
    radial-gradient(ellipse 600px 400px at 100% 80%, rgba(34, 211, 238, 0.08), transparent 45%),
    var(--bg-root);
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: linear-gradient(165deg, var(--bg-card) 0%, var(--bg-elevated) 100%);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 1.75rem;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55), var(--shadow-glow);
}

.auth-brand-mark {
  margin: 0 0 0.5rem;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 0.95rem;
  letter-spacing: -0.03em;
  color: #fff;
  background: linear-gradient(135deg, var(--accent-deep) 0%, #db2777 50%, var(--cyan) 100%);
  box-shadow: 0 8px 24px rgba(124, 58, 237, 0.35);
}

.auth-card h1 {
  margin: 0 0 0.25rem;
  font-size: 1.35rem;
}

.auth-card p.auth-legal {
  margin: 0 0 0.75rem;
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--muted);
  line-height: 1.35;
}

.auth-card p.sub {
  margin: 0 0 1.25rem;
  color: var(--text-secondary);
  font-size: 0.88rem;
}

.auth-field {
  margin-bottom: 1rem;
}

.auth-field label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.auth-field input {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text);
  font-size: 0.95rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.auth-field input:focus {
  outline: none;
  border-color: var(--accent-deep);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.auth-submit {
  width: 100%;
  margin-top: 0.25rem;
  padding: 0.7rem 1rem;
  border: none;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent-deep), #9333ea);
  color: #fff;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(124, 58, 237, 0.35);
  transition: transform 0.15s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.auth-submit:hover {
  filter: brightness(1.08);
  box-shadow: 0 6px 28px rgba(124, 58, 237, 0.45);
}

.auth-submit:active {
  transform: scale(0.98);
}

/* Tabelas administrativas */
.data-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.data-table th,
.data-table td {
  padding: 0.65rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.data-table th {
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: rgba(255, 255, 255, 0.02);
}

.data-table tr:last-child td {
  border-bottom: none;
}

.form-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.form-panel h3 {
  margin: 0 0 1rem;
  font-size: 1rem;
}

.form-grid {
  display: grid;
  gap: 0.85rem;
}

@media (min-width: 720px) {
  .form-grid.cols-2 {
    grid-template-columns: 1fr 1fr;
  }
}

.form-field label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
}

.form-field input,
.form-field select {
  width: 100%;
  padding: 0.55rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text);
  font-size: 0.9rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-field input:focus,
.form-field select:focus {
  outline: none;
  border-color: var(--accent-deep);
  box-shadow: 0 0 0 2px var(--accent-dim);
}

.perm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.perm-item {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.45rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.btn:hover {
  border-color: var(--border-strong);
  background: var(--bg-elevated);
}

.btn--primary {
  background: linear-gradient(135deg, var(--accent-deep), #7c3aed);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 2px 12px rgba(124, 58, 237, 0.3);
}

.btn--primary:hover {
  filter: brightness(1.06);
  border-color: transparent;
}

.btn--sm {
  padding: 0.35rem 0.55rem;
  font-size: 0.78rem;
}

/* Botão só ícone (ex.: devolver ao estoque na listagem de contas) */
.btn.btn--sm.btn--icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem;
  min-width: 2rem;
  min-height: 2rem;
  line-height: 0;
}

.btn.btn--sm.btn--icon svg {
  display: block;
  flex-shrink: 0;
}

/* Botão «Demanda» — compacto e destaque visual (todas as telas) */
.btn.btn--demanda {
  padding: 0.22rem 0.5rem;
  font-size: 0.68rem;
  font-weight: 650;
  line-height: 1.15;
  letter-spacing: 0.04em;
  border-radius: 7px;
  white-space: nowrap;
  border-width: 1px;
  border-style: solid;
  transition:
    transform 0.16s ease,
    box-shadow 0.16s ease,
    border-color 0.16s ease,
    filter 0.16s ease;
}

a.btn.btn--demanda.btn--secondary:not(.btn--muted) {
  background: linear-gradient(
    135deg,
    rgba(34, 211, 238, 0.22) 0%,
    rgba(124, 58, 237, 0.18) 55%,
    rgba(167, 139, 250, 0.12) 100%
  );
  border-color: rgba(34, 211, 238, 0.55);
  color: #e0f2fe;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.2) inset,
    0 2px 10px rgba(34, 211, 238, 0.12);
}

a.btn.btn--demanda.btn--secondary:not(.btn--muted):hover {
  border-color: rgba(103, 232, 249, 0.85);
  color: #fff;
  filter: brightness(1.08);
  box-shadow:
    0 0 0 1px rgba(34, 211, 238, 0.35) inset,
    0 4px 16px rgba(34, 211, 238, 0.22);
  transform: translateY(-1px);
}

button.btn.btn--demanda.btn--secondary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  background: rgba(148, 163, 184, 0.12);
  border-color: rgba(148, 163, 184, 0.28);
  color: var(--muted);
  box-shadow: none;
}

/* Estado «Aberta» / bloqueado — mesmo chip, visual atenuado */
.btn.btn--demanda.btn--muted,
span.btn.btn--demanda.btn--muted {
  pointer-events: none;
  opacity: 0.72;
  cursor: default;
  background: rgba(148, 163, 184, 0.14) !important;
  border-color: rgba(148, 163, 184, 0.35) !important;
  color: #cbd5e1 !important;
  box-shadow: none !important;
  transform: none !important;
}

.btn--outline {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--text-secondary);
}

.btn--outline:hover {
  border-color: var(--accent);
  color: var(--text);
  background: var(--accent-dim);
}

.btn--danger {
  background: var(--danger-dim);
  border-color: rgba(251, 113, 133, 0.45);
  color: #fecdd3;
}

.btn--danger:hover {
  background: rgba(251, 113, 133, 0.22);
  border-color: #fb7185;
  color: #fff;
}

.btn--confirm {
  background: var(--success-dim);
  border-color: rgba(74, 222, 128, 0.45);
  color: var(--success);
  min-width: 2rem;
  padding-left: 0.4rem;
  padding-right: 0.4rem;
}

.btn--confirm:hover {
  background: rgba(74, 222, 128, 0.22);
  border-color: var(--success);
  color: #fff;
}

.btn--muted,
span.btn--muted {
  opacity: 0.42;
  cursor: not-allowed;
  pointer-events: none;
}

.acao-contas {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.acao-contas__form {
  display: inline;
  margin: 0;
}

/* Listagem de contas — ações coloridas */
.btn-contas-detalhes {
  background: rgba(34, 211, 238, 0.14);
  border-color: rgba(34, 211, 238, 0.45);
  color: #67e8f9;
  box-shadow: 0 0 0 1px rgba(34, 211, 238, 0.1);
}

.btn-contas-detalhes:hover {
  background: rgba(34, 211, 238, 0.18);
  border-color: var(--cyan);
  color: #ecfeff;
}

.btn-contas-editar {
  background: rgba(167, 139, 250, 0.14);
  border-color: rgba(167, 139, 250, 0.45);
  color: var(--accent-bright);
  box-shadow: 0 0 0 1px rgba(139, 92, 246, 0.12);
}

.btn-contas-editar:hover {
  background: rgba(167, 139, 250, 0.26);
  border-color: var(--accent);
  color: #fff;
}

/* Barra de título + ação */
.page-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.page-toolbar h2 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.filter-bar {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  padding: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

@media (min-width: 900px) {
  .filter-bar.cols {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    align-items: end;
  }
}

.muted {
  color: var(--muted);
  font-size: 0.85rem;
}

.text-mono {
  font-variant-numeric: tabular-nums;
}

.contas-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.contas-tabs__link {
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 0.75rem;
  font-size: 0.82rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.contas-tabs__link:hover {
  color: var(--text);
  border-color: var(--accent-muted);
  background: var(--surface-2);
}

.contas-tabs__link.is-active {
  color: var(--text);
  border-color: var(--accent);
  background: rgba(139, 92, 246, 0.12);
}

.contas-situacao-badge {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* Conta com custo ao fornecedor ainda não liquidado (contas a pagar) */
.conta-row--cp {
  box-shadow: inset 3px 0 0 0 var(--warning, #eab308);
  background: rgba(234, 179, 8, 0.07);
}

.conta-cp-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.18rem 0.5rem;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-radius: 999px;
  white-space: nowrap;
  background: rgba(234, 179, 8, 0.22);
  color: #fde68a;
  border: 1px solid rgba(234, 179, 8, 0.45);
}

.conta-cp-pill--fornecedor {
  text-transform: none;
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0;
}

.contas-tabs__link.contas-tabs__link--alert:not(.is-active) {
  border-color: rgba(234, 179, 8, 0.45);
  color: #fde68a;
  background: rgba(234, 179, 8, 0.08);
}

.contas-tabs__link.contas-tabs__link--alert.is-active {
  border-color: rgba(234, 179, 8, 0.65);
  background: rgba(234, 179, 8, 0.18);
  color: #fef9c3;
}

/* Lista geral /contas: blocos estoque vs operação */
.contas-lista-sec {
  margin-bottom: 1.75rem;
  border-radius: var(--radius-md, 10px);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
  overflow: hidden;
}

.contas-lista-sec--estoque {
  border-left: 4px solid rgba(34, 211, 238, 0.65);
  background: linear-gradient(
    135deg,
    rgba(34, 211, 238, 0.06) 0%,
    transparent 42%
  );
}

.contas-lista-sec--operacao {
  border-left: 4px solid var(--accent-deep, #7c3aed);
  background: linear-gradient(
    135deg,
    rgba(124, 58, 237, 0.08) 0%,
    transparent 42%
  );
}

.contas-lista-sec__title {
  margin-top: 0;
  margin-bottom: 0.35rem;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
}

.contas-lista-sec__hint {
  margin: 0 0 1rem;
  font-size: 0.88rem;
  line-height: 1.45;
  max-width: 48rem;
}

.contas-lista-sec .data-table-wrap {
  margin-top: 0;
}

/* Linha com demanda aberta/em andamento — listagens de contas (operador / todas as contas) */
.data-table tbody tr.demanda-aberta-row {
  background: rgba(148, 163, 184, 0.16);
  box-shadow: inset 3px 0 0 0 rgba(148, 163, 184, 0.55);
}

.data-table tbody tr.demanda-aberta-row:hover {
  background: rgba(148, 163, 184, 0.24);
}

.auth-erro {
  margin-bottom: 1rem;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  background: var(--danger-dim);
  border: 1px solid rgba(251, 113, 133, 0.4);
  color: #fecdd3;
}

@media (max-width: 960px) {
  .menu-toggle {
    display: inline-flex;
  }

  .sidebar {
    transform: translateX(-100%);
  }

  body.nav-open .sidebar {
    transform: translateX(0);
    z-index: 60;
  }

  .main-wrap {
    margin-left: 0;
  }

  .sidebar-backdrop {
    display: block;
  }

  body.nav-open .sidebar-backdrop {
    z-index: 55;
  }

  .topbar {
    padding-left: max(0.85rem, env(safe-area-inset-left));
    padding-right: max(0.85rem, env(safe-area-inset-right));
    padding-top: max(0.65rem, env(safe-area-inset-top));
  }

  .content {
    padding: 1.15rem max(1rem, env(safe-area-inset-left)) 1.25rem max(1rem, env(safe-area-inset-right));
    padding-bottom: max(1.25rem, env(safe-area-inset-bottom));
  }

  /* Evita zoom automático no foco (iOS Safari) em campos pequenos */
  .form-field input,
  .form-field select,
  .form-field textarea,
  .auth-field input {
    font-size: 16px;
  }

  .data-table-wrap {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
  }

  .data-table th,
  .data-table td {
    padding: 0.55rem 0.6rem;
    font-size: 0.82rem;
  }

  .page-toolbar {
    gap: 0.75rem;
  }

  .page-toolbar h2 {
    font-size: 1rem;
    line-height: 1.35;
  }

  .flash-stack {
    max-width: none;
  }

  .panel {
    padding: 1rem;
  }
}

/* Celulares estreitos */
@media (max-width: 480px) {
  .topbar__left {
    min-width: 0;
    flex: 1;
  }

  .page-heading {
    font-size: 0.95rem;
    line-height: 1.3;
    word-break: break-word;
    hyphens: auto;
  }

  .topbar__right .nav-link {
    font-size: 0.75rem;
    padding: 0.3rem 0.4rem;
  }

  .content {
    padding-left: max(0.75rem, env(safe-area-inset-left));
    padding-right: max(0.75rem, env(safe-area-inset-right));
  }

  .btn {
    min-height: 40px;
  }

  .btn--sm {
    min-height: 38px;
  }

  .btn.btn--demanda {
    min-height: unset;
    min-width: unset;
  }

  .btn.btn--sm.btn--icon {
    min-height: 2.35rem;
    min-width: 2.35rem;
    padding: 0.4rem;
  }
}

/* Tablet em pé: um pouco mais de respiro que o telefone */
@media (min-width: 601px) and (max-width: 960px) {
  .content {
    padding-left: max(1.25rem, env(safe-area-inset-left));
    padding-right: max(1.25rem, env(safe-area-inset-right));
  }
}

/* Admin · trocar senha de outros usuários (lista) */
.usuario-senha-details summary {
  user-select: none;
  list-style: none;
}
.usuario-senha-details summary::-webkit-details-marker {
  display: none;
}
.usuario-senha-details[open] summary {
  margin-bottom: 0.35rem;
}
.usuario-senha-form {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding-top: 0.25rem;
}
.usuario-senha-form input {
  font-size: 0.8rem;
  padding: 0.4rem 0.55rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text);
  width: 100%;
  max-width: 12rem;
}

/* Sininho · notificações (operador, fornecedor, staff) — painel em camada */
.notif-bell-wrap {
  position: relative;
  z-index: 30;
  flex-shrink: 0;
}
.notif-bell-btn {
  position: relative;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
}
.notif-bell-btn:hover {
  border-color: var(--border-accent);
  color: var(--accent-bright);
  background: var(--bg-elevated);
}
.notif-bell-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 1.1rem;
  height: 1.1rem;
  padding: 0 0.28rem;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1.1rem;
  text-align: center;
  background: var(--danger);
  color: #fff;
  border: 1px solid rgba(0, 0, 0, 0.2);
}
.notif-bell-wrap .notif-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  width: min(360px, 92vw);
  max-height: min(70vh, 420px);
  display: flex;
  flex-direction: column;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-card);
  z-index: 200;
  overflow: hidden;
  transform-origin: top right;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px) scale(0.98);
  pointer-events: none;
  transition:
    opacity 0.2s ease,
    transform 0.24s cubic-bezier(0.2, 0.85, 0.25, 1),
    visibility 0.2s;
}
.notif-bell-wrap.notif-bell-wrap--open .notif-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}
@media (prefers-reduced-motion: reduce) {
  .notif-bell-wrap .notif-dropdown {
    transition: opacity 0.12s ease, visibility 0.12s;
  }
  .notif-bell-wrap.notif-bell-wrap--open .notif-dropdown {
    transform: none;
  }
}
.notif-dropdown__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.82rem;
}
.notif-dropdown__title {
  font-weight: 600;
  color: var(--text);
}
.notif-link-btn {
  border: none;
  background: none;
  padding: 0;
  font: inherit;
  font-size: 0.75rem;
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.notif-link-btn:hover {
  color: var(--accent-bright);
}
.notif-list-wrap {
  overflow: auto;
  flex: 1;
  min-height: 0;
}
.notif-list {
  list-style: none;
  margin: 0;
  padding: 0.35rem 0;
}
.notif-empty {
  margin: 0;
  padding: 1rem 0.85rem;
  font-size: 0.85rem;
}
.notif-item {
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.notif-item:last-child {
  border-bottom: none;
}
.notif-item--unread {
  background: rgba(167, 139, 250, 0.06);
}
.notif-item__link,
.notif-item__static {
  display: block;
  padding: 0.65rem 0.85rem;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}
.notif-item__link:hover {
  background: rgba(255, 255, 255, 0.04);
}
.notif-item__titulo-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.2rem;
}
.notif-item__titulo-row .notif-item__titulo {
  font-size: 0.84rem;
  font-weight: 600;
  flex: 1;
  min-width: 0;
}
.notif-item__when {
  font-size: 0.72rem;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
  padding-top: 0.05rem;
}
.notif-item__corpo {
  font-size: 0.78rem;
  line-height: 1.35;
}

/* Ordenação client-side (table_sort_contas.js) */
.data-table thead th.th-sortable {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.data-table thead th.th-sortable:hover {
  color: var(--accent-bright);
}
.table-sort-ind {
  display: inline-flex;
  flex-direction: column;
  margin-left: 0.35rem;
  vertical-align: middle;
  line-height: 0.75;
  font-size: 0.55rem;
  opacity: 0.42;
  gap: 0;
}
.th-sort--asc .table-sort-ind__up {
  color: var(--accent-bright);
  opacity: 1;
}
.th-sort--desc .table-sort-ind__down {
  color: var(--accent-bright);
  opacity: 1;
}
