/*!*************************************************************************************************************************************************************************************************************************************************************!*\
  !*** css ./node_modules/next/dist/build/webpack/loaders/css-loader/src/index.js??ruleSet[1].rules[13].oneOf[12].use[2]!./node_modules/next/dist/build/webpack/loaders/postcss-loader/src/index.js??ruleSet[1].rules[13].oneOf[12].use[3]!./app/globals.css ***!
  \*************************************************************************************************************************************************************************************************************************************************************/
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: #f3f6fb;
  color: #0f2451;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: #2563eb;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* ============================================================
   Animations
   ============================================================ */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes pulseDot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%      { transform: scale(1.4); opacity: 0.6; }
}

@keyframes shimmer {
  from { background-position: -200% 0; }
  to   { background-position: 200% 0; }
}

.container {
  max-width: 880px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
  animation: fadeIn 0.3s ease-out;
}

.container:has(.company-table-wrap) {
  max-width: 1500px;
}

h1 {
  font-size: 1.8rem;
  letter-spacing: -0.01em;
  margin: 0;
}

h2 {
  letter-spacing: -0.01em;
}

p {
  color: #7a8294;
  margin: 0.5rem 0;
}

strong {
  color: #2563eb;
}

/* ============================================================
   Page header + Brand (with logo upload)
   ============================================================ */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.75rem;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex-wrap: wrap;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: #1947a7;
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.05rem;
  transition: transform 0.25s ease, background 0.2s, box-shadow 0.25s;
}

.brand-mark:hover {
  background: #2563eb;
  transform: rotate(-4deg) scale(1.05);
  box-shadow: 0 8px 18px rgba(25, 71, 167, 0.28);
}

.brand-logo {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  object-fit: cover;
  background: #ffffff;
  border: 1px solid #dfe5ef;
  transition: transform 0.25s ease;
}

.brand-logo:hover {
  transform: scale(1.05);
}

.brand-name {
  font-weight: 700;
  letter-spacing: 0.02em;
  font-size: 1.05rem;
  color: #1947a7;
}

.brand-actions {
  display: flex;
  gap: 0.15rem;
  margin-left: 0.2rem;
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}

.brand:hover .brand-actions,
.brand:focus-within .brand-actions {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

.brand-icon-btn {
  background: transparent;
  border: none;
  color: #95a0b5;
  cursor: pointer;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: color 0.15s ease, background 0.15s ease;
}

.brand-icon-btn:hover {
  color: #1947a7;
  background: #e8eef9;
}

.brand-icon-btn:focus-visible {
  outline: 2px solid #bdd0ed;
  outline-offset: 1px;
}

.brand-icon-btn--muted:hover {
  color: #991b1b;
  background: #fef2f2;
}

.logo-error {
  margin-bottom: 1rem;
  animation: fadeUp 0.2s ease-out;
}

/* ============================================================
   Buttons
   ============================================================ */
.btn-primary {
  background: #1947a7;
  border: none;
  border-radius: 10px;
  color: #ffffff;
  cursor: pointer;
  font-size: 0.92rem;
  font-weight: 600;
  padding: 0.62rem 1.2rem;
  letter-spacing: 0.01em;
  transition: background 0.18s, transform 0.12s, box-shadow 0.2s;
  align-self: flex-start;
  position: relative;
  overflow: hidden;
}

.btn-primary::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(255, 255, 255, 0.18) 50%, transparent 70%);
  transform: translateX(-100%);
  transition: transform 0.6s ease;
  pointer-events: none;
}

.btn-primary:hover:not(:disabled) {
  background: #2563eb;
  transform: translateY(-1px);
  box-shadow: 0 8px 20px -6px rgba(25, 71, 167, 0.45);
}

.btn-primary:hover:not(:disabled)::after {
  transform: translateX(100%);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
  background: #0f2451;
}

.btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-sm {
  font-size: 0.78rem;
  padding: 0.34rem 0.9rem;
  align-self: center;
}

.btn-ghost {
  background: #ffffff;
  border: 1px solid #dfe5ef;
  border-radius: 8px;
  color: #536179;
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0.42rem 0.95rem;
  transition: all 0.18s ease;
}

.btn-ghost:hover {
  border-color: #2563eb;
  color: #1947a7;
  background: #e8eef9;
  transform: translateY(-1px);
}

.back-link {
  margin-top: 0.5rem;
}

/* ============================================================
   Search bar
   ============================================================ */
.search-bar {
  margin-top: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.search-bar input {
  flex: 1 1;
  background: #ffffff;
  border: 1.5px solid #dfe5ef;
  border-radius: 10px;
  color: #0f2451;
  font-size: 0.92rem;
  padding: 0.62rem 0.9rem;
  transition: border-color 0.18s, box-shadow 0.18s;
}

.search-bar input::placeholder {
  color: #95a0b5;
}

.search-bar input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 4px rgba(25, 71, 167, 0.14);
  outline: none;
}

.search-count {
  color: #7a8294;
  font-size: 0.8rem;
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  transition: color 0.2s;
}

/* ============================================================
   Company table (landing list)
   ============================================================ */
.company-table-wrap {
  margin-top: 0.75rem;
  background: #ffffff;
  border: 1px solid #dfe5ef;
  border-radius: 14px;
  overflow-x: auto;
  animation: fadeUp 0.35s ease-out;
}

.company-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.88rem;
  table-layout: fixed;
  min-width: 1310px;
}

.company-table .col-ruc { width: 115px; }
.company-table .col-name { width: 215px; }
.company-table .col-sol-user { width: 130px; }
.company-table .col-sol-pass { width: 115px; }
.company-table .col-client-id { width: 315px; }
.company-table .col-client-secret { width: 215px; }
.company-table .col-action { width: 130px; }

/* Sticky action column — always visible during horizontal scroll */
.company-table th:last-child,
.company-table td:last-child {
  position: -webkit-sticky;
  position: sticky;
  right: 0;
  z-index: 2;
}

.company-table thead th:last-child {
  background: #e8eef9;
  box-shadow: -6px 0 12px -8px rgba(15, 36, 81, 0.18);
}

.company-table tbody td:last-child {
  background: #ffffff;
  box-shadow: -6px 0 12px -8px rgba(15, 36, 81, 0.12);
}

.company-table tbody tr:hover td:last-child {
  background: #e8eef9;
}

.company-table thead th {
  text-align: center;
  font-weight: 700;
  color: #0f2451;
  font-size: 0.88rem;
  letter-spacing: 0.01em;
  padding: 0.85rem 1.15rem;
  background: #e8eef9;
  border-bottom: 2px solid #bdd0ed;
  position: relative;
}

.company-table thead th + th {
  border-left: 1px solid #d6e0f0;
}


.company-table tbody tr {
  cursor: pointer;
}

.company-table tbody td {
  border-bottom: 1px solid #eaeef6;
  transition: background 0.18s;
}

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

.company-table tbody tr:hover td {
  background: #e8eef9;
}

.company-table tbody tr:hover td:first-child {
  box-shadow: inset 3px 0 0 #2563eb;
}

.company-table td {
  padding: 0.82rem 1.15rem;
  color: #0f2451;
  vertical-align: middle;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.88rem;
}

.company-table td + td {
  border-left: 1px solid #eaeef6;
}

.company-table td.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: #1947a7;
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
}

.company-table td.mono-sm {
  color: #0f2451;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: -0.005em;
}

.company-table td.cell-truncate {
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}

.company-table td.col-name-cell {
  text-align: center;
  font-weight: 500;
}

.row-action {
  white-space: nowrap;
  text-align: center;
}

.row-action-group {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.row-action-group {
  gap: 0.4rem;
}

.row-action-group .btn-primary {
  align-self: center;
  padding: 0.4rem 1rem;
  min-width: 92px;
  font-size: 0.82rem;
}

/* Inline action icons (edit / delete) */
.row-icon-btn {
  background: transparent;
  border: 1px solid #dfe5ef;
  color: #7a8294;
  cursor: pointer;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}

.row-icon-btn:hover:not(:disabled) {
  color: #1947a7;
  background: #e8eef9;
  border-color: #bdd0ed;
}

.row-icon-btn--danger:hover:not(:disabled) {
  color: #b91c1c;
  background: #fef2f2;
  border-color: #fecaca;
}

.row-icon-btn--primary {
  background: #1947a7;
  border-color: #1947a7;
  color: #ffffff;
  box-shadow: 0 4px 10px -4px rgba(25, 71, 167, 0.55);
}

.row-icon-btn--primary:hover:not(:disabled) {
  background: #2563eb;
  border-color: #2563eb;
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 6px 14px -4px rgba(25, 71, 167, 0.65);
}

.row-icon-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-new {
  margin-left: 0.25rem;
  align-self: center;
  white-space: nowrap;
}

/* ============================================================
   Mobile card list (replaces the table on small screens)
   ============================================================ */
.company-mobile-list {
  display: none;
}

.company-mobile-card {
  background: #ffffff;
  border: 1px solid #dfe5ef;
  border-radius: 14px;
  padding: 1rem 1.1rem 1.1rem;
  cursor: pointer;
  box-shadow: 0 6px 16px -10px rgba(15, 36, 81, 0.18);
  transition: border-color 0.18s, transform 0.05s;
  animation: fadeUp 0.25s ease-out both;
}

.company-mobile-card:active {
  transform: scale(0.99);
}

.company-mobile-card:hover {
  border-color: #bdd0ed;
}

.company-mobile-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.8rem;
}

.company-mobile-title {
  min-width: 0;
  flex: 1 1;
}

.company-mobile-title h3 {
  font-size: 1rem;
  color: #0f2451;
  margin: 0 0 0.15rem;
  font-weight: 700;
  letter-spacing: -0.005em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.company-mobile-ruc {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: #1947a7;
  font-size: 0.78rem;
  font-weight: 600;
}

.company-mobile-actions {
  display: flex;
  gap: 0.35rem;
  flex-shrink: 0;
}

.company-mobile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-gap: 0.7rem 1rem;
  gap: 0.7rem 1rem;
  margin-top: 0.9rem;
  padding-top: 0.9rem;
  border-top: 1px solid #eaeef6;
}

.company-mobile-grid > div {
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
  min-width: 0;
}

.company-mobile-grid > div.span-2 {
  grid-column: span 2;
}

.company-mobile-grid dt {
  font-size: 0.68rem;
  color: #7a8294;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.company-mobile-grid dd {
  margin: 0;
  font-size: 0.83rem;
  color: #0f2451;
}

.company-mobile-grid dd.mono-sm {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: #0f2451;
  font-size: 0.78rem;
  font-weight: 500;
}

.company-mobile-grid dd.break {
  word-break: break-all;
  white-space: normal;
}

/* Toggle between table and cards */
@media (max-width: 880px) {
  .company-table-wrap { display: none; }
  .company-mobile-list {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    margin-top: 0.85rem;
  }
}

/* Search bar wraps and "Nueva empresa" goes full width */
@media (max-width: 640px) {
  .container { padding: 2rem 1rem 3rem; }
  .container:has(.company-table-wrap) { max-width: 100%; }

  .search-bar {
    flex-wrap: wrap;
  }
  .search-bar input {
    flex: 1 1 100%;
    order: 1;
  }
  .search-count {
    order: 2;
  }
  .btn-new {
    order: 3;
    margin-left: auto;
  }

  .page-header { flex-wrap: wrap; gap: 0.6rem; }
  .brand { gap: 0.5rem; }
  .brand-actions {
    opacity: 1;
    transform: none;
    pointer-events: auto;
  }
}

/* Company detail (after click) on mobile */
@media (max-width: 640px) {
  .company-detail {
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    padding: 1rem 1.1rem;
  }
  .company-avatar--lg {
    width: 52px;
    height: 52px;
    font-size: 1.2rem;
  }
  .company-detail h2.company-name {
    font-size: 1.05rem;
  }
  .form-card { padding: 1.15rem; }
  .ticket-card { padding: 1.15rem; }
  .ticket-dl {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }
  .ticket-dl dt { margin-top: 0.4rem; }
  .ticket-dl dt:first-child { margin-top: 0; }
}

.empty-row {
  text-align: center;
  color: #a5afc1;
  padding: 1.5rem !important;
  font-style: italic;
}

/* ============================================================
   Company detail (after selection)
   ============================================================ */
.company-detail {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  margin-top: 1rem;
  padding: 1.1rem 1.4rem;
  background: #ffffff;
  border: 1px solid #dfe5ef;
  border-radius: 14px;
  animation: fadeUp 0.3s ease-out;
}

.company-avatar {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #1947a7;
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
  transition: transform 0.25s ease, background 0.2s;
}

.company-avatar:hover {
  background: #2563eb;
  transform: scale(1.05);
}

.company-avatar--lg {
  width: 68px;
  height: 68px;
  font-size: 1.5rem;
}

.company-meta {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.company-name {
  color: #0f2451;
  font-weight: 600;
  font-size: 0.98rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.company-ruc {
  color: #7a8294;
  font-size: 0.82rem;
}

.company-detail h2.company-name {
  font-size: 1.2rem;
  margin: 0;
}

.company-detail .company-ruc {
  margin: 0.15rem 0 0;
}

/* ============================================================
   Form card (period + kind)
   ============================================================ */
.form-card {
  margin-top: 1.25rem;
  background: #ffffff;
  border: 1px solid #dfe5ef;
  border-radius: 14px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  animation: fadeUp 0.35s ease-out 0.05s both;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-group label {
  font-size: 0.85rem;
  color: #536179;
  font-weight: 500;
}

.form-group input,
.form-group select {
  background: #f3f6fb;
  border: 1.5px solid #dfe5ef;
  border-radius: 10px;
  color: #0f2451;
  font-size: 0.92rem;
  padding: 0.68rem 0.9rem;
  width: 100%;
  transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
}

.form-group input:focus,
.form-group select:focus {
  background: #ffffff;
  border-color: #2563eb;
  box-shadow: 0 0 0 4px rgba(25, 71, 167, 0.14);
  outline: none;
}

.form-error {
  color: #b91c1c;
  background: #fef2f2;
  border: 1px solid #fecaca;
  font-size: 0.85rem;
  padding: 0.55rem 0.8rem;
  border-radius: 10px;
  margin: 0;
  animation: fadeUp 0.2s ease-out;
}

/* ============================================================
   Ticket card
   ============================================================ */
.ticket-card {
  margin-top: 1.25rem;
  background: #ffffff;
  border: 1px solid #dfe5ef;
  border-radius: 14px;
  padding: 1.4rem 1.6rem;
  animation: fadeUp 0.3s ease-out;
}

.ticket-card h2 {
  font-size: 1.1rem;
  margin-bottom: 0.85rem;
  color: #0f2451;
}

.ticket-dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  grid-column-gap: 1.25rem;
  column-gap: 1.25rem;
  grid-row-gap: 0.45rem;
  row-gap: 0.45rem;
}

.ticket-dl dt {
  color: #7a8294;
  font-size: 0.85rem;
}

.ticket-dl dd {
  font-size: 0.9rem;
  color: #0f2451;
}

.status-pending,
.status-processing {
  color: #d97706;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.status-pending::before,
.status-processing::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #f59e0b;
  display: inline-block;
  animation: pulseDot 1.2s ease-in-out infinite;
}

.status-done {
  color: #16a34a;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.status-done::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #16a34a;
  display: inline-block;
}

.status-error {
  color: #dc2626;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.status-error::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #dc2626;
  display: inline-block;
}

.polling-note {
  margin-top: 0.85rem;
  font-size: 0.82rem;
  color: #7a8294;
  font-style: italic;
  background: linear-gradient(90deg, transparent, #e8eef9, transparent);
  background-size: 200% 100%;
  background-repeat: no-repeat;
  animation: shimmer 1.8s linear infinite;
  padding: 0.3rem 0.55rem;
  border-radius: 6px;
  display: inline-block;
}

.download-link {
  display: inline-block;
  margin-top: 1rem;
  text-decoration: none;
}

/* ============================================================
   SIRE records report (SUNAT-style)
   ============================================================ */
.sire-report {
  margin-top: 1.5rem;
  background: #ffffff;
  border: 1px solid #dfe5ef;
  border-radius: 14px;
  overflow: hidden;
  animation: fadeUp 0.35s ease-out;
}

.sire-report-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: #ffffff;
  border-bottom: 1px solid #eaeef6;
  flex-wrap: wrap;
}

.sire-report-title {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.sire-report-title h2 {
  font-size: 1.15rem;
  color: #1947a7;
  margin: 0;
  font-weight: 800;
  letter-spacing: -0.005em;
}

.sire-report-id {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: #0f2451;
  font-size: 0.78rem;
  font-weight: 600;
  background: #e8eef9;
  border: 1px solid #bdd0ed;
  padding: 0.18rem 0.55rem;
  border-radius: 6px;
  align-self: flex-start;
}

.sire-badge {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.05rem;
  background: #1947a7;
  color: #ffffff;
  padding: 0.4rem 0.9rem;
  border-radius: 8px;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  box-shadow: 0 8px 18px -8px rgba(25, 71, 167, 0.55);
}

.sire-badge strong {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.sire-report-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 1.25rem;
  background: #e8eef9;
  border-bottom: 1px solid #bdd0ed;
  font-size: 0.82rem;
  color: #0f2451;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.sire-report-meta strong {
  color: #1947a7;
  font-weight: 700;
}

.sire-loading {
  color: #7a8294;
  font-style: italic;
  font-size: 0.78rem;
}

.sire-export-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sire-export-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: #ffffff;
  border: 1px solid #1947a7;
  color: #1947a7;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.4rem 0.85rem;
  border-radius: 8px;
  transition: background 0.15s, color 0.15s, transform 0.05s;
  font-family: inherit;
}

.sire-export-btn:hover:not(:disabled) {
  background: #1947a7;
  color: #ffffff;
  transform: translateY(-1px);
}

.sire-export-btn:active:not(:disabled) {
  transform: translateY(0);
}

.sire-export-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.sire-export-btn--pdf {
  border-color: #dc1a25;
  color: #dc1a25;
}

.sire-export-btn--pdf:hover:not(:disabled) {
  background: #dc1a25;
  color: #ffffff;
}

/* Visual-only selection toolbar over the SIRE report table */
.sire-selection-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin: 0.75rem 0;
  padding: 0.5rem 0.85rem;
  background: #f3f6fb;
  border: 1px solid #e3e9f2;
  border-radius: 10px;
}

.sire-selection-info {
  font-size: 0.82rem;
  font-weight: 600;
  color: #536179;
}

.sire-selection-removed {
  font-weight: 500;
  color: #95a0b5;
}

.sire-selection-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.sire-doc-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.sire-doc-btn {
  background: #ffffff;
  border: 1px solid #dfe5ef;
  border-radius: 8px;
  color: #536179;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.18s ease;
}

.sire-doc-btn:hover:not(:disabled) {
  border-color: #2563eb;
  color: #1947a7;
  background: #e8eef9;
  transform: translateY(-1px);
}

.sire-doc-btn--primary {
  background: #1947a7;
  border-color: #1947a7;
  color: #ffffff;
}

.sire-doc-btn--primary:hover:not(:disabled) {
  background: #0f2451;
  border-color: #0f2451;
  color: #ffffff;
}

.sire-doc-btn--active {
  background: #0f2451;
  border-color: #0f2451;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.25);
}

.sire-doc-btn--download {
  background: #15803d;
  border-color: #15803d;
  color: #ffffff;
}

.sire-doc-btn--download:hover:not(:disabled) {
  background: #166534;
  border-color: #166534;
  color: #ffffff;
}

/* PDF/CDR/XML availability columns */
.sire-col-doc {
  width: 46px;
  text-align: center;
}

.sire-doc-cell {
  text-align: center;
}

.doc-status {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.08rem 0.34rem;
  border-radius: 999px;
  line-height: 1.4;
}

.doc-status--ok {
  background: #dcfce7;
  color: #15803d;
}

.doc-status--none {
  background: #f1f3f7;
  color: #95a0b5;
}

.doc-status--pending {
  background: #fef3c7;
  color: #b45309;
}

.doc-status--anulado {
  background: #fee2e2;
  color: #b91c1c;
}

.doc-status--na {
  background: #f1f3f7;
  color: #64748b;
}

.doc-status--ext {
  background: #e0e7ff;
  color: #4338ca;
}

.doc-status--error {
  background: #fde68a;
  color: #92400e;
}

.sire-doctype-picker {
  display: inline-flex;
  gap: 0.25rem;
  align-items: center;
}

.sire-doctype-chip {
  border: 1px solid #c7cdd9;
  background: #ffffff;
  color: #475569;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.12s ease;
}

.sire-doctype-chip:hover {
  border-color: #1d4ed8;
  color: #1d4ed8;
}

.sire-doctype-chip--on {
  background: #1d4ed8;
  border-color: #1d4ed8;
  color: #ffffff;
}

.sire-doc-btn--verify {
  background: #1d4ed8;
  border-color: #1d4ed8;
  color: #ffffff;
}

.sire-doc-btn--verify:hover:not(:disabled) {
  background: #1e40af;
  border-color: #1e40af;
  color: #ffffff;
}

.sire-doc-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.sire-doc-hint {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #95a0b5;
}

.sire-actions-divider {
  width: 1px;
  align-self: stretch;
  min-height: 22px;
  background: #d7deea;
  margin: 0 0.15rem;
}

.btn-danger {
  background: #dc2626;
  border: 1px solid #dc2626;
  border-radius: 8px;
  color: #ffffff;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.18s ease;
}

.btn-danger:hover:not(:disabled) {
  background: #b91c1c;
  border-color: #b91c1c;
  transform: translateY(-1px);
}

.btn-danger:disabled,
.btn-ghost:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.sire-col-check {
  width: 38px;
  text-align: center;
}

.sire-col-check input[type="checkbox"] {
  width: 15px;
  height: 15px;
  cursor: pointer;
  accent-color: #2563eb;
}

/* Hide the selection column when printing/exporting to PDF */
@media print {
  .sire-selection-bar { display: none !important; }
  .sire-col-check { display: none !important; }
}

.sire-table-wrap {
  overflow-x: auto;
  max-width: 100%;
}

.sire-table {
  width: 100%;
  min-width: 1500px;
  border-collapse: collapse;
  font-size: 0.74rem;
}

.sire-table th,
.sire-table td {
  border: 1px solid #1947a7;
  padding: 0.42rem 0.55rem;
  text-align: center;
  vertical-align: middle;
  color: #0f2451;
}

.sire-table thead th {
  background: #1947a7;
  color: #ffffff;
  font-weight: 700;
  font-size: 0.7rem;
  letter-spacing: 0.02em;
  line-height: 1.15;
}

.sire-table .sire-th-col th {
  background: #5fa5d9;
  color: #ffffff;
  font-size: 0.72rem;
  padding: 0.3rem 0.4rem;
}

.sire-table .sire-th-section th {
  background: #1947a7;
  font-size: 0.7rem;
  padding: 0.5rem 0.5rem;
}

.sire-table .sire-th-subsection th {
  background: #2c5fb8;
  padding: 0.35rem 0.5rem;
  font-size: 0.66rem;
  font-weight: 500;
}

.sire-table .sire-th-field th {
  background: #2c5fb8;
  font-size: 0.66rem;
  padding: 0.45rem 0.4rem;
  font-weight: 600;
  border-top: 2px solid #ffffff;
}

.sire-table tbody tr:nth-child(odd) {
  background: #ffffff;
}

.sire-table tbody tr:nth-child(even) {
  background: #f3f6fb;
}

.sire-table tbody tr:hover {
  background: #e8eef9;
}

.sire-table tbody tr.sire-row-selected,
.sire-table tbody tr.sire-row-selected:hover {
  background: #dbeafe;
}

.sire-table td.sire-row-num {
  background: #5fa5d9;
  color: #ffffff;
  font-weight: 700;
}

.sire-table td.sire-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.72rem;
}

.sire-table td.sire-text-left {
  text-align: left;
}

.sire-empty {
  padding: 1.5rem !important;
  color: #7a8294 !important;
  font-style: italic;
  background: #ffffff !important;
}

@media (max-width: 640px) {
  .sire-report-header { padding: 0.85rem 1rem; }
  .sire-report-title h2 { font-size: 0.98rem; }
  .sire-badge { padding: 0.3rem 0.7rem; }
  .sire-badge strong { font-size: 0.7rem; }
}


/* ============================================================
   Auth (login) — Belissa-style card with wavy palette
   ============================================================ */
.auth-stage {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
  background:
    radial-gradient(80% 60% at 20% 30%, rgba(95, 165, 217, 0.18), transparent 60%),
    radial-gradient(70% 60% at 85% 75%, rgba(220, 26, 37, 0.12), transparent 60%),
    #f3f6fb;
}

.auth-card-wide {
  position: relative;
  width: 100%;
  max-width: 1100px;
  aspect-ratio: 1100 / 680;
  min-height: 600px;
  background: #ffffff;
  border-radius: 22px;
  box-shadow:
    0 30px 60px -25px rgba(7, 17, 49, 0.35),
    0 12px 28px -15px rgba(7, 17, 49, 0.18);
  overflow: hidden;
  animation: fadeUp 0.35s ease-out;
  isolation: isolate;
}

@media (max-width: 760px) {
  .auth-card-wide {
    aspect-ratio: auto;
    min-height: 90vh;
  }
}

.auth-card-bg,
.auth-card-blob {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.auth-card-bg { z-index: 0; }
.auth-card-blob { z-index: 1; filter: drop-shadow(8px 0 24px rgba(7, 17, 49, 0.18)); }

/* Header bar (brand + badge) */
.auth-wide-header {
  position: absolute;
  inset: 1.6rem 1.8rem auto 1.8rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 3;
}

.auth-wide-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.auth-wide-logo-mark {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: #1947a7;
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1rem;
  box-shadow: 0 6px 14px rgba(25, 71, 167, 0.35);
}

.auth-wide-logo-img {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  object-fit: cover;
  background: #ffffff;
  padding: 3px;
  box-shadow: 0 6px 14px rgba(7, 17, 49, 0.18);
}

.auth-wide-brand-name {
  font-weight: 700;
  font-size: 0.98rem;
  color: #1947a7;
  letter-spacing: 0.04em;
}

.auth-wide-badge {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: #ffffff;
  background: rgba(7, 17, 49, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.4);
  padding: 0.34rem 0.7rem;
  border-radius: 999px;
  -webkit-backdrop-filter: blur(4px);
          backdrop-filter: blur(4px);
}

/* Form area inside the blob */
.auth-wide-form-area {
  position: absolute;
  top: 0;
  left: 0;
  width: 56%;
  height: 100%;
  z-index: 2;
  padding: 5rem 3.5rem 2rem 3.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 1.1rem;
  overflow-y: auto;
}

@media (max-width: 880px) {
  .auth-wide-form-area {
    width: 70%;
    padding: 5.5rem 2.5rem 2rem;
  }
}

@media (max-width: 580px) {
  .auth-stage { padding: 0; }
  .auth-card-wide {
    border-radius: 0;
    min-height: 100vh;
    box-shadow: none;
  }
  .auth-card-blob {
    /* On phones, blob covers the entire card so form has clean bg */
    transform: scaleX(2.3);
    transform-origin: left center;
  }
  .auth-wide-form-area {
    width: 100%;
    padding: 5rem 1.5rem 2rem;
  }
  .auth-wide-h1 { font-size: 1.5rem; }
  .auth-wide-h2 { font-size: 1.7rem; }
  .auth-wide-header {
    inset: 1.1rem 1.25rem auto 1.25rem;
  }
  .auth-wide-badge {
    font-size: 0.62rem;
    letter-spacing: 0.14em;
    padding: 0.25rem 0.55rem;
    color: #1947a7;
    background: rgba(232, 238, 249, 0.95);
    border-color: #bdd0ed;
  }
  .auth-wide-submit {
    align-self: stretch;
    text-align: center;
  }
}

.auth-wide-greeting h1,
.auth-wide-greeting h2 {
  font-weight: 400;
  letter-spacing: -0.01em;
}

.auth-wide-h1 {
  font-size: 1.7rem;
  color: #7a8294;
  margin: 0;
}

.auth-wide-h2 {
  font-size: 1.95rem;
  color: #0f2451;
  font-weight: 700;
  margin: 0;
}

.auth-wide-form {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  margin-top: 0.3rem;
  width: 100%;
  max-width: 320px;
  align-items: stretch;
}

.auth-wide-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  position: relative;
  text-align: center;
}

.auth-wide-field > span {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: #0f2451;
  text-align: center;
}

.auth-wide-field input {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1.5px solid #d9deeb;
  padding: 0.55rem 0 0.4rem;
  font-size: 0.95rem;
  color: #0f2451;
  font-family: inherit;
  text-align: center;
  transition: border-color 0.18s;
}

.auth-wide-field input::placeholder {
  color: #b3bccd;
  font-weight: 300;
  text-align: center;
}

.auth-wide-field input:focus {
  outline: none;
  border-bottom-color: #1947a7;
}

.auth-wide-pw {
  position: relative;
  display: flex;
  align-items: center;
}

.auth-wide-pw input {
  padding-right: 2.2rem;
  padding-left: 2.2rem;
}

.auth-wide-eye {
  position: absolute;
  right: 0;
  bottom: 0.55rem;
  background: transparent;
  border: none;
  color: #95a0b5;
  cursor: pointer;
  padding: 0.15rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s;
}

.auth-wide-eye:hover {
  color: #1947a7;
}

.auth-wide-forgot {
  align-self: center;
  font-size: 0.78rem;
  color: #95a0b5;
  text-decoration: none;
  margin-top: 0.45rem;
  transition: color 0.15s;
}

.auth-wide-forgot:hover {
  color: #1947a7;
  text-decoration: underline;
}

.auth-wide-error {
  color: #b91c1c;
  background: #fef2f2;
  border: 1px solid #fecaca;
  font-size: 0.85rem;
  padding: 0.55rem 0.8rem;
  border-radius: 10px;
  margin: 0;
  animation: fadeUp 0.2s ease-out;
}

.auth-wide-submit {
  margin-top: 0.4rem;
  background: linear-gradient(135deg, #1947a7 0%, #2563eb 60%, #dc1a25 110%);
  border: none;
  border-radius: 999px;
  color: #ffffff;
  font-weight: 700;
  font-size: 0.88rem;
  letter-spacing: 0.15em;
  padding: 0.78rem 2.4rem;
  cursor: pointer;
  align-self: center;
  min-width: 200px;
  box-shadow:
    0 14px 24px -10px rgba(25, 71, 167, 0.55),
    0 6px 12px -8px rgba(220, 26, 37, 0.35);
  transition: transform 0.12s, box-shadow 0.2s, filter 0.2s;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}

.auth-wide-submit::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(255, 255, 255, 0.22) 50%, transparent 70%);
  transform: translateX(-100%);
  transition: transform 0.7s ease;
  pointer-events: none;
}

.auth-wide-submit:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(1.06);
  box-shadow:
    0 20px 32px -10px rgba(25, 71, 167, 0.6),
    0 8px 18px -8px rgba(220, 26, 37, 0.45);
}

.auth-wide-submit:hover:not(:disabled)::after {
  transform: translateX(100%);
}

.auth-wide-submit:active:not(:disabled) {
  transform: translateY(0);
}

.auth-wide-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.auth-wide-footer {
  margin-top: auto;
  font-size: 0.72rem;
  color: #95a0b5;
  text-align: center;
}
/* ============================================================
   Modal (create / edit company)
   ============================================================ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  -webkit-backdrop-filter: blur(2px);
          backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 1.5rem;
  animation: fadeIn 0.18s ease-out;
}

.modal {
  background: #ffffff;
  border-radius: 16px;
  border: 1px solid #dfe5ef;
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  overflow: auto;
  box-shadow: 0 24px 60px -20px rgba(15, 23, 42, 0.35);
  animation: fadeUp 0.22s ease-out;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.4rem;
  border-bottom: 1px solid #eaeef6;
}

.modal-header h2 {
  font-size: 1.1rem;
  margin: 0;
  color: #0f2451;
}

.modal-body {
  padding: 1.25rem 1.4rem 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.modal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-gap: 0.85rem 1rem;
  gap: 0.85rem 1rem;
}

.modal-grid-full {
  grid-column: 1 / -1;
}

@media (max-width: 560px) {
  .modal-grid {
    grid-template-columns: 1fr;
  }
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  margin-top: 0.25rem;
}

/* ============================================================
   Print — PDF export via window.print()
   ============================================================ */
@media print {
  @page {
    size: A4 landscape;
    margin: 1cm;
  }

  body * { visibility: hidden; }
  .sire-report, .sire-report * { visibility: visible; }

  .sire-report {
    position: absolute;
    inset: 0 0 auto 0;
    margin: 0;
    border: none;
    box-shadow: none;
    border-radius: 0;
    animation: none;
  }

  .sire-export-actions { display: none !important; }
  .sire-loading { display: none !important; }

  .sire-report-header,
  .sire-report-meta {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .sire-table {
    min-width: 0 !important;
    width: 100%;
    font-size: 0.65rem;
  }

  .sire-table th,
  .sire-table td {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    padding: 0.25rem 0.35rem;
  }

  .sire-table tbody tr {
    page-break-inside: avoid;
  }
}

@media (max-width: 560px) {
  .modal-backdrop { padding: 0.75rem; align-items: flex-end; }
  .modal {
    max-height: 92vh;
    border-radius: 16px 16px 0 0;
    animation: fadeUp 0.22s ease-out;
  }
  .modal-header { padding: 1rem 1.1rem; }
  .modal-body { padding: 1rem 1.1rem 1.2rem; }
  .modal-footer {
    flex-direction: column-reverse;
  }
  .modal-footer .btn-primary,
  .modal-footer .btn-ghost {
    width: 100%;
    text-align: center;
    align-self: stretch;
  }
}


/* ============================================================
   Profile + Users — polished modals (2026-06-11)
   ============================================================ */

@keyframes toastSlide {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes tabUnderline {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}

/* Larger modal variant */
.modal.modal--lg {
  max-width: 760px;
}

/* Hero header inside modal */
.profile-hero {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.1rem 1.4rem;
  border-bottom: 1px solid #eaeef6;
  background:
    linear-gradient(180deg, #f6f9ff 0%, #ffffff 100%);
}

.profile-hero-meta {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

.profile-hero-name {
  font-weight: 600;
  font-size: 1rem;
  color: #0f2451;
  word-break: break-word;
}

.profile-hero-username {
  color: #6b7280;
  font-size: 0.82rem;
}

.profile-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.3rem;
}

/* Avatar */
.user-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1947a7 0%, #2563eb 100%);
  color: #ffffff;
  font-weight: 700;
  font-size: 1.15rem;
  flex-shrink: 0;
  box-shadow: 0 8px 18px -8px rgba(25, 71, 167, 0.55);
  letter-spacing: 0.01em;
}

.user-avatar--sm {
  width: 38px;
  height: 38px;
  font-size: 0.85rem;
  box-shadow: 0 4px 10px -6px rgba(25, 71, 167, 0.5);
}

/* Permission chips */
.permission-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.22rem 0.65rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: #eef2ff;
  color: #1947a7;
  border: 1px solid #dbe4fb;
  animation: fadeUp 0.25s ease-out;
  white-space: nowrap;
}

.permission-chip--admin {
  background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
  color: #991b1b;
  border-color: #fecaca;
}

.permission-chip--empty {
  background: #f3f4f6;
  color: #6b7280;
  border-color: #e5e7eb;
}

.permission-chip-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* Tabs */
.tab-bar {
  display: flex;
  border-bottom: 1px solid #eaeef6;
  padding: 0 1.4rem;
  gap: 0.1rem;
  background: #ffffff;
}

.tab-btn {
  background: transparent;
  border: none;
  color: #6b7280;
  font-size: 0.88rem;
  font-weight: 500;
  padding: 0.85rem 1rem;
  cursor: pointer;
  position: relative;
  transition: color 0.18s;
  font-family: inherit;
}

.tab-btn:hover {
  color: #1947a7;
}

.tab-btn--active {
  color: #1947a7;
  font-weight: 600;
}

.tab-btn--active::after {
  content: "";
  position: absolute;
  inset: auto 0.6rem -1px 0.6rem;
  height: 2px;
  background: linear-gradient(90deg, #1947a7, #2563eb);
  border-radius: 2px;
  transform-origin: left;
  animation: tabUnderline 0.22s ease-out;
}

.tab-panel {
  animation: fadeUp 0.22s ease-out;
}

/* Inputs (pill) */
.input-pill {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.input-pill > span {
  font-size: 0.72rem;
  color: #6b7280;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.input-pill > input {
  border: 1px solid #dfe5ef;
  background: #ffffff;
  border-radius: 10px;
  padding: 0.7rem 0.85rem;
  font-size: 0.95rem;
  color: #0f2451;
  transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
  font: inherit;
  width: 100%;
}

.input-pill > input::placeholder {
  color: #9ca3af;
}

.input-pill > input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.input-pill > input:disabled,
.input-pill > input[readonly] {
  background: #f5f7fb;
  color: #6b7280;
  cursor: not-allowed;
}

/* Password wrap with show/hide */
.pw-input-wrap {
  position: relative;
}

.pw-input-wrap > input {
  padding-right: 4.2rem;
  width: 100%;
  border: 1px solid #dfe5ef;
  background: #ffffff;
  border-radius: 10px;
  padding-top: 0.7rem;
  padding-bottom: 0.7rem;
  padding-left: 0.85rem;
  font-size: 0.95rem;
  color: #0f2451;
  transition: border-color 0.18s, box-shadow 0.18s;
  font: inherit;
}

.pw-input-wrap > input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.pw-toggle {
  position: absolute;
  top: 50%;
  right: 0.4rem;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: #6b7280;
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.3rem 0.55rem;
  border-radius: 6px;
  transition: background 0.18s, color 0.18s;
  font-family: inherit;
}

.pw-toggle:hover {
  background: #eef2ff;
  color: #1947a7;
}

/* Password strength meter */
.pw-strength {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  margin-top: -0.25rem;
}

.pw-strength-bar {
  flex: 1 1;
  height: 4px;
  border-radius: 999px;
  background: #e5e7eb;
  transition: background 0.25s;
}

.pw-strength-bar--on { background: #fbbf24; }
.pw-strength-bar--1 { background: #fb923c; }
.pw-strength-bar--2 { background: #fbbf24; }
.pw-strength-bar--3 { background: #10b981; }

.pw-strength-label {
  font-size: 0.7rem;
  color: #6b7280;
  margin-left: 0.5rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}

/* Toast feedback */
.field-feedback {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  padding: 0.42rem 0.8rem;
  border-radius: 10px;
  animation: toastSlide 0.22s ease-out;
  align-self: flex-start;
  font-weight: 500;
}

.field-feedback--success {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #bbf7d0;
}

.field-feedback--error {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

/* Section helpers */
.modal-section {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.modal-section + .modal-section {
  padding-top: 1.1rem;
  border-top: 1px solid #eaeef6;
}

.modal-section-title {
  font-size: 0.72rem;
  color: #6b7280;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Toggle switch */
.toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem 0.95rem;
  border: 1px solid #eaeef6;
  border-radius: 12px;
  background: #ffffff;
  transition: border-color 0.18s, background 0.18s, transform 0.12s;
  cursor: pointer;
  -webkit-user-select: none;
     -moz-user-select: none;
          user-select: none;
}

.toggle:hover {
  border-color: #c7d2fe;
  background: #f8fafc;
}

.toggle:active {
  transform: scale(0.997);
}

.toggle-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.toggle-title {
  font-weight: 600;
  color: #0f2451;
  font-size: 0.92rem;
}

.toggle-desc {
  color: #6b7280;
  font-size: 0.78rem;
  line-height: 1.35;
}

.toggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.toggle-knob {
  position: relative;
  width: 40px;
  height: 22px;
  background: #d1d5db;
  border-radius: 999px;
  flex-shrink: 0;
  transition: background 0.2s;
}

.toggle-knob::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background: #ffffff;
  border-radius: 50%;
  transition: transform 0.24s cubic-bezier(0.34, 1.4, 0.64, 1);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.18);
}

.toggle input:checked + .toggle-knob {
  background: linear-gradient(135deg, #1947a7 0%, #2563eb 100%);
}

.toggle input:checked + .toggle-knob::after {
  transform: translateX(18px);
}

.toggle input:disabled + .toggle-knob {
  opacity: 0.5;
  cursor: not-allowed;
}

.toggle input:focus-visible + .toggle-knob {
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25);
}

/* Users toolbar */
.users-toolbar {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  margin-bottom: 0.6rem;
}

.users-search {
  flex: 1 1;
  position: relative;
}

.users-search input {
  width: 100%;
  border: 1px solid #dfe5ef;
  background: #ffffff;
  border-radius: 10px;
  padding: 0.6rem 0.9rem 0.6rem 2.4rem;
  font: inherit;
  font-size: 0.92rem;
  transition: border-color 0.18s, box-shadow 0.18s;
}

.users-search input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.users-search-icon {
  position: absolute;
  top: 50%;
  left: 0.85rem;
  transform: translateY(-50%);
  color: #94a3b8;
  pointer-events: none;
}

/* Users list (cards) */
.users-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.user-row {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid #eaeef6;
  border-radius: 12px;
  background: #ffffff;
  transition: border-color 0.18s, transform 0.18s, box-shadow 0.18s;
  cursor: pointer;
  animation: fadeUp 0.25s ease-out both;
  outline: none;
}

.user-row:hover {
  border-color: #c7d2fe;
  box-shadow: 0 12px 24px -16px rgba(25, 71, 167, 0.4);
  transform: translateY(-1px);
}

.user-row:focus-visible {
  border-color: #2563eb;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15);
}

.user-row-meta {
  flex: 1 1;
  min-width: 0;
}

.user-row-name {
  font-weight: 600;
  color: #0f2451;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.95rem;
}

.user-row-email {
  color: #6b7280;
  font-size: 0.8rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 0.05rem;
}

.user-row-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.4rem;
}

.user-row-actions {
  display: flex;
  gap: 0.35rem;
  flex-shrink: 0;
}

.user-row:nth-child(1)  { animation-delay: 0.02s; }
.user-row:nth-child(2)  { animation-delay: 0.05s; }
.user-row:nth-child(3)  { animation-delay: 0.08s; }
.user-row:nth-child(4)  { animation-delay: 0.11s; }
.user-row:nth-child(5)  { animation-delay: 0.14s; }
.user-row:nth-child(6)  { animation-delay: 0.17s; }
.user-row:nth-child(7)  { animation-delay: 0.2s; }
.user-row:nth-child(8)  { animation-delay: 0.23s; }
.user-row:nth-child(n+9) { animation-delay: 0.26s; }

/* Reset-password inline form */
.reset-pw-form {
  display: flex;
  gap: 0.6rem;
  align-items: flex-end;
  flex-wrap: wrap;
}

.reset-pw-form .btn-primary {
  align-self: flex-end;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 2rem 1rem 2.5rem;
  color: #6b7280;
  animation: fadeUp 0.25s ease-out;
}

.empty-state-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 0.75rem;
  border-radius: 50%;
  background: #eef2ff;
  color: #1947a7;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Header actions row */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

@media (max-width: 560px) {
  .profile-hero { flex-wrap: wrap; padding: 1rem 1.1rem; }
  .user-row { flex-wrap: wrap; }
  .user-row-actions { width: 100%; justify-content: flex-end; }
  .modal.modal--lg { max-width: 100%; }
  .reset-pw-form { flex-direction: column; align-items: stretch; }
  .reset-pw-form .btn-primary { width: 100%; }
}

/* ============================================================
   Polish v2 — entrance, micro-interactions, session banner
   ============================================================ */

/* Smoother modal entrance: scale + fade together */
@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes backdropIn {
  from { opacity: 0; -webkit-backdrop-filter: blur(0px); backdrop-filter: blur(0px); }
  to   { opacity: 1; -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
}

.modal-backdrop {
  animation: backdropIn 0.22s ease-out;
}

.modal {
  animation: modalIn 0.28s cubic-bezier(0.25, 1.1, 0.5, 1.05);
  transform-origin: center top;
}

/* Tab content cross-fade with slight horizontal slide */
@keyframes tabPanelIn {
  from { opacity: 0; transform: translateX(6px); }
  to   { opacity: 1; transform: translateX(0); }
}
.tab-panel {
  animation: tabPanelIn 0.22s ease-out;
}

/* Avatar — soft pulse on mount */
@keyframes avatarPop {
  0%   { transform: scale(0.85); opacity: 0; }
  60%  { transform: scale(1.04); opacity: 1; }
  100% { transform: scale(1);   opacity: 1; }
}
.user-avatar {
  animation: avatarPop 0.42s cubic-bezier(0.34, 1.4, 0.64, 1);
}

/* Hero gets a faint shifting gradient halo */
.profile-hero {
  position: relative;
  overflow: hidden;
}
.profile-hero::before {
  content: "";
  position: absolute;
  inset: -40% -10% auto auto;
  width: 240px;
  height: 240px;
  background: radial-gradient(circle, rgba(37, 99, 235, 0.18) 0%, transparent 60%);
  pointer-events: none;
  animation: haloDrift 8s ease-in-out infinite alternate;
}
@keyframes haloDrift {
  from { transform: translate(0, 0); }
  to   { transform: translate(-20px, 18px); }
}

/* Toggle ripple on activate */
.toggle-knob {
  overflow: visible;
}
.toggle input:checked + .toggle-knob::before {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.25);
  animation: toggleRipple 0.45s ease-out;
  pointer-events: none;
}
@keyframes toggleRipple {
  0%   { transform: scale(0.4); opacity: 0.55; }
  100% { transform: scale(1.6); opacity: 0; }
}

/* Field feedback — animated checkmark stroke */
.field-feedback--success svg polyline {
  stroke-dasharray: 22;
  stroke-dashoffset: 22;
  animation: drawCheck 0.4s 0.05s ease-out forwards;
}
@keyframes drawCheck {
  to { stroke-dashoffset: 0; }
}

/* Buttons — gentle press */
.btn-primary {
  will-change: transform;
}
.btn-primary:active:not(:disabled) {
  transform: translateY(1px) scale(0.985);
}

/* Card hover lift becomes parallax-y */
.user-row {
  will-change: transform;
}
.user-row:hover .user-avatar--sm {
  transform: scale(1.05) rotate(-2deg);
  transition: transform 0.22s ease;
}

/* Permission chips — staggered entrance */
.profile-chips .permission-chip:nth-child(1) { animation-delay: 0.02s; }
.profile-chips .permission-chip:nth-child(2) { animation-delay: 0.08s; }
.profile-chips .permission-chip:nth-child(3) { animation-delay: 0.14s; }

/* Tab button — subtle hover lift */
.tab-btn {
  transition: color 0.18s, transform 0.12s;
}
.tab-btn:not(.tab-btn--active):hover {
  transform: translateY(-1px);
}

/* Input focus halo */
.input-pill > input:focus,
.pw-input-wrap > input:focus,
.users-search input:focus {
  animation: focusHalo 0.3s ease-out;
}
@keyframes focusHalo {
  from { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.0); }
  to   { box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12); }
}

/* Pw strength bar morph */
.pw-strength-bar {
  position: relative;
  overflow: hidden;
}
.pw-strength-bar--on::after {
  content: "";
  position: absolute;
  inset: 0;
  background: inherit;
  animation: strengthFill 0.35s ease-out;
}
@keyframes strengthFill {
  from { transform: translateX(-100%); }
  to   { transform: translateX(0); }
}

/* Empty state icon — gentle float */
.empty-state-icon {
  animation: floatY 3.2s ease-in-out infinite;
}
@keyframes floatY {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-4px); }
}

/* Session expired banner in login */
.session-banner {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.7rem 0.95rem;
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border: 1px solid #f59e0b;
  color: #78350f;
  border-radius: 10px;
  font-size: 0.84rem;
  font-weight: 500;
  margin-bottom: 0.6rem;
  animation: fadeUp 0.3s ease-out;
}
.session-banner svg {
  flex-shrink: 0;
  color: #b45309;
}

/* Reduced-motion — respect user preference */
@media (prefers-reduced-motion: reduce) {
  .modal,
  .modal-backdrop,
  .tab-panel,
  .user-avatar,
  .profile-hero::before,
  .empty-state-icon,
  .user-row,
  .permission-chip,
  .field-feedback--success svg polyline,
  .pw-strength-bar--on::after {
    animation: none !important;
  }
}


/* ============================================================
   Users management v3 — filters, presets, type cards
   ============================================================ */

.filter-tabs {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 0.85rem;
  flex-wrap: wrap;
  padding: 0.3rem;
  background: #f5f7fb;
  border-radius: 12px;
}

.filter-tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 0.85rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: #6b7280;
  background: transparent;
  border: none;
  border-radius: 9px;
  cursor: pointer;
  transition: color 0.18s, background 0.18s, transform 0.12s;
  font-family: inherit;
}

.filter-tab:hover:not(.filter-tab--active) {
  color: #1947a7;
  background: rgba(37, 99, 235, 0.06);
}

.filter-tab--active {
  background: #ffffff;
  color: #1947a7;
  box-shadow: 0 4px 12px -6px rgba(15, 36, 81, 0.25);
}

.filter-tab--active::before {
  content: "";
  position: absolute;
  inset: auto 25% -3px 25%;
  height: 2px;
  background: linear-gradient(90deg, #1947a7, #2563eb);
  border-radius: 2px;
  animation: tabUnderline 0.22s ease-out;
}

.filter-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  padding: 0 0.45rem;
  height: 20px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  background: #eef2ff;
  color: #1947a7;
  transition: background 0.18s, color 0.18s;
}

.filter-tab--active .filter-tab-count {
  background: linear-gradient(135deg, #1947a7 0%, #2563eb 100%);
  color: #ffffff;
}

/* "Tú" tag in users list */
.self-tag {
  display: inline-flex;
  align-items: center;
  padding: 0.08rem 0.45rem;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #1947a7;
  background: #eef2ff;
  border-radius: 999px;
}

/* Preset cards — quick role selector */
.preset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  grid-gap: 0.6rem;
  gap: 0.6rem;
}

.preset-card {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.75rem 0.85rem;
  border: 1.5px solid #eaeef6;
  border-radius: 12px;
  background: #ffffff;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.2s, transform 0.15s, box-shadow 0.2s, background 0.2s;
  font-family: inherit;
  outline: none;
  overflow: hidden;
}

.preset-card::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(25, 71, 167, 0.08) 0%, rgba(37, 99, 235, 0.0) 100%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s;
}

.preset-card:hover:not(:disabled) {
  border-color: #c7d2fe;
  transform: translateY(-2px);
  box-shadow: 0 14px 24px -16px rgba(25, 71, 167, 0.4);
}

.preset-card:hover:not(:disabled)::after {
  opacity: 1;
}

.preset-card:focus-visible {
  border-color: #2563eb;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.18);
}

.preset-card--active {
  border-color: #1947a7;
  background: linear-gradient(180deg, #f4f7ff 0%, #ffffff 100%);
  box-shadow: 0 10px 24px -14px rgba(25, 71, 167, 0.5);
}

.preset-card--active::after {
  opacity: 1;
}

.preset-card:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.preset-card-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  flex-shrink: 0;
  transition: transform 0.22s;
}

.preset-card:hover:not(:disabled) .preset-card-badge {
  transform: rotate(-4deg) scale(1.05);
}

.preset-card-badge--admin    { background: linear-gradient(135deg, #fef2f2 0%, #fecaca 100%); color: #b91c1c; }
.preset-card-badge--operator { background: linear-gradient(135deg, #ecfdf5 0%, #a7f3d0 100%); color: #047857; }
.preset-card-badge--viewer   { background: linear-gradient(135deg, #eef2ff 0%, #c7d2fe 100%); color: #1947a7; }
.preset-card-badge--custom   { background: linear-gradient(135deg, #f5f3ff 0%, #ddd6fe 100%); color: #6d28d9; }

.preset-card-text {
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
  min-width: 0;
  flex: 1 1;
}

.preset-card-label {
  font-weight: 700;
  color: #0f2451;
  font-size: 0.88rem;
}

.preset-card-desc {
  color: #6b7280;
  font-size: 0.72rem;
  line-height: 1.35;
}

.preset-card-check {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1947a7 0%, #2563eb 100%);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  animation: avatarPop 0.32s cubic-bezier(0.34, 1.4, 0.64, 1);
}

.preset-card-check svg polyline {
  stroke-dasharray: 22;
  stroke-dashoffset: 22;
  animation: drawCheck 0.32s 0.08s ease-out forwards;
}

/* Advanced permissions — details/summary */
.advanced-permissions {
  border: 1px solid #eaeef6;
  border-radius: 12px;
  background: #ffffff;
  overflow: hidden;
}

.advanced-permissions summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0.95rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #6b7280;
  cursor: pointer;
  list-style: none;
  transition: background 0.18s, color 0.18s;
}

.advanced-permissions summary::-webkit-details-marker {
  display: none;
}

.advanced-permissions summary:hover {
  background: #f8fafc;
  color: #1947a7;
}

.advanced-permissions summary svg {
  transition: transform 0.22s;
}

.advanced-permissions[open] summary svg {
  transform: rotate(180deg);
}

.advanced-permissions[open] {
  background: #f8fafc;
}

.advanced-permissions .toggle {
  margin: 0;
  border-left: none;
  border-right: none;
  border-radius: 0;
  background: #ffffff;
}

.advanced-permissions .toggle + .toggle {
  border-top: none;
}

/* Helper note */
.permission-note {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin: 1rem 0 0;
  padding: 0.6rem 0.85rem;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  color: #1e40af;
  font-size: 0.78rem;
  line-height: 1.4;
}

.permission-note svg {
  flex-shrink: 0;
  color: #1d4ed8;
}

.permission-note strong {
  font-weight: 700;
}

@media (max-width: 560px) {
  .preset-grid { grid-template-columns: 1fr; }
  .filter-tabs { padding: 0.25rem; gap: 0.25rem; }
  .filter-tab { padding: 0.4rem 0.6rem; font-size: 0.78rem; }
}


/* ============================================================
   User detail modal — read-only summary
   ============================================================ */

.detail-role-badge {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.95rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
  position: relative;
  animation: avatarPop 0.32s cubic-bezier(0.34, 1.4, 0.64, 1);
  border: 1.5px solid transparent;
}

.detail-role-badge--admin    { background: linear-gradient(135deg, #fef2f2 0%, #fecaca 100%); color: #b91c1c; border-color: #fca5a5; }
.detail-role-badge--operator { background: linear-gradient(135deg, #ecfdf5 0%, #a7f3d0 100%); color: #047857; border-color: #6ee7b7; }
.detail-role-badge--viewer   { background: linear-gradient(135deg, #eef2ff 0%, #c7d2fe 100%); color: #1947a7; border-color: #a5b4fc; }
.detail-role-badge--custom   { background: linear-gradient(135deg, #f5f3ff 0%, #ddd6fe 100%); color: #6d28d9; border-color: #c4b5fd; }

.detail-role-badge-icon {
  display: inline-flex;
}

.detail-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  grid-gap: 0.7rem;
  gap: 0.7rem;
}

.detail-stat {
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
  padding: 0.85rem 0.95rem;
  border: 1px solid #eaeef6;
  border-radius: 12px;
  background: linear-gradient(180deg, #fbfdff 0%, #ffffff 100%);
  transition: border-color 0.18s, transform 0.18s;
  animation: fadeUp 0.25s ease-out both;
}

.detail-stat:hover {
  border-color: #c7d2fe;
  transform: translateY(-1px);
}

.detail-stat:nth-child(1) { animation-delay: 0.03s; }
.detail-stat:nth-child(2) { animation-delay: 0.06s; }
.detail-stat:nth-child(3) { animation-delay: 0.09s; }
.detail-stat:nth-child(4) { animation-delay: 0.12s; }

.detail-stat-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #6b7280;
}

.detail-stat-value {
  font-weight: 600;
  color: #0f2451;
  font-size: 0.92rem;
  word-break: break-word;
}

.detail-stat-value.mono {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.82rem;
}

.detail-stat-sub {
  font-size: 0.72rem;
  color: #6b7280;
}

/* Access list */
.detail-access-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.detail-access-row {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  align-items: center;
  grid-gap: 0.65rem;
  gap: 0.65rem;
  padding: 0.7rem 0.85rem;
  border: 1px solid #eaeef6;
  border-radius: 12px;
  background: #ffffff;
  transition: border-color 0.18s, background 0.18s;
  animation: fadeUp 0.22s ease-out both;
}

.detail-access-row + .detail-access-row { animation-delay: 0.05s; }
.detail-access-row + .detail-access-row + .detail-access-row { animation-delay: 0.1s; }

.detail-access-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #f3f4f6;
  color: #9ca3af;
  flex-shrink: 0;
  transition: background 0.22s, color 0.22s, transform 0.22s;
}

.detail-access-row--on .detail-access-icon {
  background: linear-gradient(135deg, #1947a7 0%, #2563eb 100%);
  color: #ffffff;
  transform: scale(1.05);
}

.detail-access-row--on .detail-access-icon svg polyline {
  stroke-dasharray: 22;
  stroke-dashoffset: 22;
  animation: drawCheck 0.32s 0.05s ease-out forwards;
}

.detail-access-text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.detail-access-text strong {
  color: #0f2451;
  font-weight: 600;
  font-size: 0.9rem;
}

.detail-access-text small {
  color: #6b7280;
  font-size: 0.74rem;
  line-height: 1.4;
}

.detail-access-state {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #9ca3af;
  padding: 0.22rem 0.6rem;
  border-radius: 999px;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  flex-shrink: 0;
}

.detail-access-row--on .detail-access-state {
  color: #047857;
  background: #ecfdf5;
  border-color: #bbf7d0;
}

@media (max-width: 560px) {
  .detail-role-badge { width: 100%; justify-content: center; margin-left: 0; margin-top: 0.5rem; }
  .detail-access-row { grid-template-columns: 24px 1fr; }
  .detail-access-state { grid-column: 2; justify-self: start; }
}


/* ============================================================
   Inline access toggles in user detail (v4.1)
   ============================================================ */

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.section-head-hint {
  font-size: 0.74rem;
  color: #6b7280;
}

.access-toggle {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  grid-gap: 0.75rem;
  gap: 0.75rem;
  width: 100%;
  padding: 0.8rem 0.95rem;
  border: 1.5px solid #eaeef6;
  border-radius: 12px;
  background: #ffffff;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.18s, background 0.18s, transform 0.12s, box-shadow 0.2s;
  position: relative;
  overflow: hidden;
}

.access-toggle::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(25, 71, 167, 0.08), rgba(37, 99, 235, 0));
  opacity: 0;
  transition: opacity 0.22s;
  pointer-events: none;
}

.access-toggle:hover:not(:disabled) {
  border-color: #c7d2fe;
  transform: translateY(-1px);
  box-shadow: 0 12px 22px -16px rgba(25, 71, 167, 0.35);
}

.access-toggle:hover:not(:disabled)::before {
  opacity: 1;
}

.access-toggle:active:not(:disabled) {
  transform: translateY(0) scale(0.997);
}

.access-toggle:focus-visible {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.18);
}

.access-toggle--on {
  border-color: #bbf7d0;
  background: linear-gradient(180deg, #f4fff8 0%, #ffffff 100%);
}

.access-toggle--on:hover {
  border-color: #6ee7b7;
}

.access-toggle--disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.access-toggle--error {
  border-color: #fecaca;
  background: #fff5f5;
}

.access-toggle-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #f3f4f6;
  color: #9ca3af;
  flex-shrink: 0;
  transition: background 0.25s, color 0.25s, transform 0.25s;
}

.access-toggle--on .access-toggle-icon {
  background: linear-gradient(135deg, #047857 0%, #10b981 100%);
  color: #ffffff;
  transform: scale(1.05);
  box-shadow: 0 6px 14px -8px rgba(16, 185, 129, 0.55);
}

.access-toggle--on .access-toggle-icon svg polyline {
  stroke-dasharray: 24;
  stroke-dashoffset: 24;
  animation: drawCheck 0.4s 0.05s ease-out forwards;
}

.access-toggle-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.access-toggle-text strong {
  color: #0f2451;
  font-weight: 600;
  font-size: 0.92rem;
}

.access-toggle-text small {
  color: #6b7280;
  font-size: 0.76rem;
  line-height: 1.4;
}

.access-toggle-error {
  color: #b91c1c;
  font-size: 0.74rem;
  font-style: normal;
  font-weight: 500;
  margin-top: 0.1rem;
}

.access-toggle-tail {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-shrink: 0;
}

.access-toggle-state {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #9ca3af;
  padding: 0.22rem 0.6rem;
  border-radius: 999px;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  transition: all 0.2s;
  white-space: nowrap;
}

.access-toggle--on .access-toggle-state {
  color: #047857;
  background: #ecfdf5;
  border-color: #bbf7d0;
}

.access-toggle--error .access-toggle-state {
  color: #b91c1c;
  background: #fef2f2;
  border-color: #fecaca;
}

.access-toggle-state--just-saved {
  animation: justSaved 0.5s ease-out;
}

@keyframes justSaved {
  0%   { transform: scale(0.7); opacity: 0; }
  50%  { transform: scale(1.08); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

/* Switch on the right */
.access-toggle-switch {
  position: relative;
  width: 38px;
  height: 22px;
  background: #d1d5db;
  border-radius: 999px;
  flex-shrink: 0;
  transition: background 0.22s;
}

.access-toggle-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background: #ffffff;
  border-radius: 50%;
  transition: transform 0.24s cubic-bezier(0.34, 1.4, 0.64, 1);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.18);
}

.access-toggle--on .access-toggle-switch {
  background: linear-gradient(135deg, #047857 0%, #10b981 100%);
}

.access-toggle--on .access-toggle-knob {
  transform: translateX(16px);
}

.access-toggle:disabled .access-toggle-switch {
  opacity: 0.55;
}

@media (max-width: 560px) {
  .access-toggle { grid-template-columns: 28px 1fr; }
  .access-toggle-tail { grid-column: 2; justify-self: start; }
}


/* ============================================================
   Editable brand name
   ============================================================ */

.brand-name-clickable {
  cursor: pointer;
  border-radius: 6px;
  padding: 0.1rem 0.35rem;
  margin-left: -0.35rem;
  transition: background 0.18s, color 0.18s;
}

.brand-name-clickable:hover {
  background: #eef2ff;
  color: #1947a7;
}

.brand-name-edit {
  font: inherit;
  font-weight: 700;
  font-size: 1.05rem;
  color: #0f2451;
  border: 1.5px solid #2563eb;
  border-radius: 8px;
  padding: 0.15rem 0.55rem;
  background: #ffffff;
  outline: none;
  width: clamp(120px, 26vw, 280px);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
  animation: fadeUp 0.18s ease-out;
}

.brand-name-edit:focus {
  outline: none;
  border-color: #1947a7;
}


/* ============================================================
   Brand menu — single icon popover for name + logo actions
   ============================================================ */

.brand-actions {
  position: relative;
}

.brand-menu {
  position: absolute;
  top: calc(100% + 0.4rem);
  left: 0;
  z-index: 30;
  min-width: 200px;
  background: #ffffff;
  border: 1px solid #eaeef6;
  border-radius: 12px;
  padding: 0.35rem;
  box-shadow: 0 18px 40px -12px rgba(15, 23, 42, 0.25);
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  animation: brandMenuIn 0.18s cubic-bezier(0.25, 1.1, 0.5, 1.05);
  transform-origin: top left;
}

@keyframes brandMenuIn {
  from { opacity: 0; transform: translateY(-4px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.brand-menu-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  padding: 0.55rem 0.7rem;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: #0f2451;
  font-size: 0.86rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background 0.16s, color 0.16s, transform 0.1s;
  font-family: inherit;
}

.brand-menu-item:hover {
  background: #eef2ff;
  color: #1947a7;
}

.brand-menu-item:active {
  transform: scale(0.985);
}

.brand-menu-item svg {
  flex-shrink: 0;
  color: #6b7280;
  transition: color 0.16s;
}

.brand-menu-item:hover svg {
  color: #1947a7;
}

.brand-menu-item--danger {
  color: #b91c1c;
}

.brand-menu-item--danger svg {
  color: #b91c1c;
}

.brand-menu-item--danger:hover {
  background: #fef2f2;
  color: #991b1b;
}

.brand-menu-item--danger:hover svg {
  color: #991b1b;
}

.brand-menu-divider {
  height: 1px;
  background: #eaeef6;
  margin: 0.2rem 0.3rem;
}

/* --- Filtro por tipo de documento + buscador ------------------------------ */
.sire-filter-bar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin: 0.75rem 0;
  padding: 0.55rem 0.85rem;
  background: #fff;
  border: 1px solid #e3e9f2;
  border-radius: 10px;
}

.sire-filter-label {
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 700;
  color: #7a869a;
}

.sire-chips { display: flex; gap: 0.45rem; flex-wrap: wrap; flex: 1 1; }

.sire-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  cursor: pointer;
  border: 1px solid #e3e9f2;
  border-radius: 999px;
  padding: 0.25rem 0.75rem;
  background: #fff;
  color: #536179;
}

.sire-chip:hover { background: #f3f6fb; }

.sire-chip--on {
  background: #1f4e78;
  border-color: #1f4e78;
  color: #fff;
}

.sire-chip-n { font-feature-settings: "tnum"; font-variant-numeric: tabular-nums; opacity: 0.75; font-size: 0.74rem; }

.sire-buscador {
  font-size: 0.82rem;
  padding: 0.35rem 0.8rem;
  border: 1px solid #e3e9f2;
  border-radius: 999px;
  min-width: 250px;
  outline: none;
}

.sire-buscador:focus { border-color: #1f4e78; }

.sire-linkish {
  background: none;
  border: none;
  color: #1f4e78;
  cursor: pointer;
  font-size: 0.76rem;
  text-decoration: underline;
  padding: 0.1rem 0.25rem;
}

/* --- Panel de Recibos por Honorarios -------------------------------------- */
.sire-rhe-box {
  margin: 0.75rem 0;
  padding: 0.9rem 1rem;
  background: #fbfcfe;
  border: 1px solid #e3e9f2;
  border-radius: 10px;
}

.sire-rhe-box h4 { margin: 0 0 0.3rem; font-size: 0.88rem; color: #1f4e78; }
.sire-rhe-box p { margin: 0 0 0.6rem; font-size: 0.76rem; color: #7a869a; line-height: 1.5; }
.sire-rhe-soft { font-weight: 400; color: #95a0b5; }

.sire-rhe-box code {
  background: #eef1f6;
  padding: 0.05rem 0.3rem;
  border-radius: 4px;
  font-size: 0.74rem;
}

.sire-rhe-textarea {
  width: 100%;
  min-height: 80px;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 0.8rem;
  padding: 0.5rem 0.65rem;
  border: 1px solid #e3e9f2;
  border-radius: 8px;
  resize: vertical;
  box-sizing: border-box;
}

/* El placeholder tiene que LEERSE como ejemplo, no como contenido ya cargado:
   con ejemplos en gris oscuro el usuario cree que la lista está guardada y
   aprieta el botón sin escribir nada. */
.sire-rhe-textarea::placeholder { color: #a8b0bd; font-style: italic; }

.sire-rhe-acts {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 0.6rem;
}

.sire-rhe-ok { font-size: 0.8rem; font-weight: 600; color: #2e7d32; }
.sire-rhe-err { font-size: 0.8rem; font-weight: 600; color: #c62828; }

.sire-rhe-log {
  margin-top: 0.6rem;
  font-size: 0.75rem;
  color: #7a869a;
  max-height: 150px;
  overflow: auto;
  line-height: 1.6;
}

/* Filas traídas de api-cpe (RHE): no vienen en la propuesta SIRE. */
.sire-row-rhe > td { background: #f6f9ff; }

