* {
  box-sizing: border-box;
}
:root {
  font-family: Manrope, system-ui, sans-serif;
  color: var(--text-primary);
  background: var(--surface-page);
  font-synthesis: none;
  --accent: var(--brand-blue);
  --line: #e5eaed;
}
body {
  margin: 0;
}
button,
input,
select,
textarea,
a {
  -webkit-tap-highlight-color: transparent;
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
a {
  touch-action: manipulation;
}
button {
  cursor: pointer;
}
a {
  color: inherit;
  text-decoration: none;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--brand-focus);
  outline-offset: 4px;
}
[hidden] {
  display: none !important;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}
.skip-link {
  position: fixed;
  top: -80px;
  left: 20px;
  z-index: 100;
  background: var(--surface-card);
  padding: 15px;
}
.skip-link:focus {
  top: 10px;
}
/* Navegação lateral */
.sidebar {
  width: 272px;
  position: fixed;
  inset: 0 auto 0 0;
  background: var(--surface-card);
  border-right: 1px solid var(--line);
  padding: 32px 18px 20px;
  display: flex;
  flex-direction: column;
  z-index: 20;
  transition: width 0.2s;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.sidebar-close-button {
  display: none;
}
.brand {
  display: flex;

  gap: 10px;

  align-items: flex-start;

  padding: 0 12px 18px;
  flex-direction: column;
}
.brand strong {
  font-size: 20px;

  letter-spacing: -0.4px;
  display: block;
}
.brand small {
  font-size: 11px;

  letter-spacing: 0;
  white-space: nowrap;
  color: var(--text-secondary);
  display: block;
  margin-top: 4px;
}
.sidebar-section {
  font-size: 12px;
  font-weight: 800;

  letter-spacing: 1.2px;

  color: var(--text-secondary);
  margin: 22px 15px 12px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;

  min-height: 50px;
  padding: 10px 15px;
  border-radius: 8px;

  font-size: 15px;
  font-weight: 600;
  margin: 4px 0;

  color: var(--text-secondary);
  white-space: nowrap;
  width: 100%;
  border: 0;
  text-align: left;
  background: transparent;
}
.nav-item:hover {
  background: var(--surface-hover);
}
.nav-item.active {
  background: var(--brand-soft);
  color: var(--brand-blue);
}
.nav-icon {
  font-family: system-ui;
  width: 20px;
  text-align: center;
  font-size: 21px;
  flex-shrink: 0;
}
.nav-icon svg {
  display: block;
  width: 20px;
  height: 20px;
  margin: auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
/* Área de trabalho e cabeçalho */
.workspace {
  margin-left: 272px;
  transition: margin-left 0.2s;
}
.topbar {
  height: 72px;
  background: var(--surface-card);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;

  padding: 0 32px;

  font-size: 14px;
}
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 18px;

  color: var(--text-secondary);
}
.breadcrumb strong {
  font-weight: 600;
  color: var(--text-primary);
}
.divider {
  color: #ccd4d8;
}
.icon-button {
  border: 1px solid var(--line);
  background: var(--surface-card);

  width: 40px;

  height: 40px;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--text-secondary);
}
.icon-button:hover {
  background: var(--brand-soft);
  color: var(--brand-blue);
}
main {
  max-width: none;

  margin: 0;

  padding: 32px;
}
.eyebrow {
  color: var(--brand-blue-hover);

  font-size: 12px;
  font-weight: 800;
  letter-spacing: 2px;
  margin: 0 0 10px;
}
h1 {
  font-size: 28px;

  letter-spacing: -0.6px;

  margin: 0;
  font-weight: 800;
}
/* Catálogo e busca */
.library {
  padding-top: 0;
  scroll-margin-top: 25px;
}
.library-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
}
.count {
  font-size: 14px;

  color: var(--brand-blue-hover);
  background: var(--brand-soft);

  padding: 4px 9px;
  border-radius: 5px;
  margin-left: 6px;
  vertical-align: middle;
}
.search {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-card);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px 13px;

  width: 320px;
  min-height: 46px;
}
.search > span {
  font-size: 23px;
  line-height: 18px;
  color: #83939b;
}
.search input {
  min-width: 0;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text-primary);

  font-size: 15px;
  outline-offset: 2px;
}
.search input::placeholder {
  color: var(--text-secondary);
}
.search kbd {
  font-size: 12px;

  color: var(--text-secondary);
  border: 1px solid #e8edf0;
  border-radius: 3px;
  padding: 1px 5px;
}
.filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 22px 0;
}
.filter {
  border: 1px solid transparent;

  color: var(--text-secondary);
  background: transparent;
  padding: 8px 14px;
  border-radius: 6px;

  font-size: 14px;
  font-weight: 700;
}
.filter:hover {
  background: var(--surface-hover);
}
.filter.active {
  background: var(--brand-soft);
  border-color: var(--brand-border);
  color: var(--brand-blue);
}
/* Cards */
.reports-grid {
  display: grid;

  grid-template-columns: repeat(auto-fill, minmax(280px, 340px));
  grid-auto-rows: 310px;

  gap: 18px;
}
.report-card {
  display: grid;
  grid-template-rows: 176px minmax(0, 1fr);
  position: relative;
  min-width: 0;

  border: 1px solid var(--brand-border);
  background: var(--surface-card);

  border-radius: 14px;
  overflow: hidden;
  transition:
    transform 0.2s,
    box-shadow 0.2s;
  box-shadow: 0 3px 12px #14294b05;
}
.report-card:hover {
  transform: translateY(-2px);

  box-shadow: 0 8px 24px #14294b10;

  border-color: var(--brand-focus);
}
.card-open {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  width: 100%;
  height: 100%;
  text-align: left;
  border: 0;
  background: none;
  color: inherit;

  padding: 0;
}
.card-open::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
}
.card-preview {
  position: relative;
  overflow: hidden;
  pointer-events: none;
  background:
    linear-gradient(135deg, rgba(15, 91, 216, 0.18), rgba(19, 199, 213, 0.2)), var(--surface-page);
  border-bottom: 1px solid var(--brand-border);
}
.card-preview::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(20, 41, 75, 0.12), transparent 45%);
}
.card-preview iframe {
  width: 400%;
  height: auto;
  aspect-ratio: 16 / 9;
  border: 0;
  pointer-events: none;
  transform: scale(0.25);
  transform-origin: top left;
}
.card-preview-placeholder {
  display: grid;
  place-items: center;
  height: 100%;
  color: var(--brand-blue);
  font-size: 38px;
}
.favorite-button {
  position: absolute;

  right: 14px;

  top: 14px;

  border: 1px solid var(--brand-border);

  background: rgba(12, 29, 52, 0.88);

  color: white;

  font-size: 22px;
  z-index: 3;

  border-radius: 9px;

  width: 34px;

  height: 34px;
}
.favorite-button[aria-pressed="true"] {
  color: #ffd36a;
  background: rgba(12, 29, 52, 0.92);
  border-color: rgba(255, 211, 106, 0.72);
}
.card-admin-actions {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 3;
  display: flex;
  gap: 6px;
}
.card-admin-actions button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 9px;
  background: rgba(12, 29, 52, 0.88);
  color: white;
  font-size: 18px;
  box-shadow: 0 3px 12px rgba(20, 41, 75, 0.12);
}
.card-admin-actions button:hover {
  color: white;
  border-color: rgba(255, 255, 255, 0.7);
  background: rgba(24, 90, 219, 0.95);
}
.card-admin-actions svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.card-body {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  padding: 13px 16px 0;
}
.card-body h2 {
  display: -webkit-box;
  overflow: hidden;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  font-size: 16px;
  line-height: 1.3;
  letter-spacing: -0.3px;

  margin: 0 0 8px;
}
.card-body p {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
  font-size: 13px;

  line-height: 1.5;

  color: var(--text-secondary);
  margin: 0;

  min-height: 0;
}
.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--line);

  margin-top: auto;

  padding: 12px 0;

  font-size: 13px;

  color: var(--text-secondary);
  gap: 12px;
}
.card-action {
  flex-shrink: 0;
  font-weight: 800;

  color: var(--brand-blue);
}
.card-action span {
  font-size: 20px;
  margin-left: 7px;
}
.empty-state {
  text-align: center;
  padding: 50px 20px;

  color: var(--text-secondary);
}
.empty-state > span {
  font-size: 40px;
}
.empty-state h3 {
  color: var(--brand-navy);
}
.empty-state p {
  font-size: 15px;
}
.primary-button {
  border: 0;
  background: var(--brand-blue);
  color: white;
  padding: 12px 20px;
  border-radius: 7px;
  font-weight: 700;

  font-size: 15px;
}
body.sidebar-collapsed .sidebar {
  width: 78px;
  padding-left: 12px;
  padding-right: 12px;
}
body.sidebar-collapsed .sidebar-label {
  display: none;
}
body.sidebar-collapsed .brand {
  padding: 0 5px 18px;
  align-items: center;
}
body.sidebar-collapsed .nav-item {
  justify-content: center;
  padding: 10px;
}
body.sidebar-collapsed .workspace {
  margin-left: 78px;
}
body.sidebar-collapsed .sidebar-overlay {
  position: fixed;
  inset: 0;
  background: #14294b60;
  border: 0;
  z-index: 19;
}
.sidebar-overlay:not([hidden]) {
  display: block;
}
/* Modal de relatório */
dialog {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0;
  width: min(1500px, 96vw);
  max-width: 100vw;
  height: 92dvh;
  max-height: 100dvh;
  color: var(--text-primary);
  background: var(--surface-card);
  box-shadow: 0 30px 100px #14294b40;
}
dialog::backdrop {
  background: #14294b99;
  backdrop-filter: blur(4px);
}
body.modal-open {
  overflow: hidden;
}
dialog.expanded {
  width: 100vw;
  height: 100dvh;
  border-radius: 0;
}
dialog.expanded .report-dialog-content {
  grid-template-columns: minmax(0, 1fr);
}
dialog.expanded .report-switcher {
  display: none;
}
.report-stage:fullscreen {
  width: 100vw;
  height: 100vh;
  background: #071329;
}
.dialog-shell {
  display: flex;
  flex-direction: column;
  height: 100%;
}
.report-dialog-content {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  flex: 1;
  min-height: 0;
}
.report-switcher {
  display: flex;
  min-height: 0;
  flex-direction: column;
  padding: 16px 12px;
  overflow-y: auto;
  background: var(--surface-raised);
  border-right: 1px solid var(--line);
}
.report-switcher-heading {
  padding: 0 10px 10px;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.report-switcher-item {
  display: flex;
  width: 100%;
  flex-direction: column;
  gap: 4px;
  padding: 11px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text-primary);
  text-align: left;
}
.report-switcher-item:hover {
  background: var(--surface-hover);
}
.report-switcher-item.active {
  border-color: var(--brand-border);
  background: var(--brand-soft);
  color: var(--brand-blue);
}
.report-switcher-item strong {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  font-size: 13px;
  line-height: 1.35;
}
.report-switcher-item span,
.report-switcher-hint {
  color: var(--text-secondary);
  font-size: 11px;
}
.report-switcher-hint {
  margin: auto 10px 0;
  padding-top: 18px;
  line-height: 1.5;
}
.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 18px 23px;
  border-bottom: 1px solid var(--line);
}
.dialog-header h2 {
  font-size: 22px;
  margin: 0;
}
.dialog-header .eyebrow {
  font-size: 12px;
  margin-bottom: 6px;
}
.dialog-actions {
  display: flex;
  gap: 7px;
}
.report-stage {
  flex: 1;
  min-height: 0;
  position: relative;
  background: var(--surface-page);
}
.report-stage iframe {
  width: 100%;
  height: 100%;
  border: 0;
  background: white;
}
.report-message {
  text-align: center;
  padding: 30px;
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;

  color: var(--text-secondary);

  font-size: 15px;
  background: var(--surface-page);
}
.report-message strong {
  font-size: 22px;
  color: var(--brand-navy);
}
.report-message p {
  max-width: 410px;
  margin: 0;
  line-height: 1.8;
}
.report-message .message-icon {
  width: 65px;
  height: 65px;
  display: grid;
  place-items: center;
  background: var(--brand-soft);
  border-radius: 18px;
  font-size: 30px;
  color: var(--brand-blue);
}
.dialog-footer {
  display: flex;
  justify-content: space-between;
  padding: 12px 23px;

  font-size: 12px;

  color: var(--text-secondary);
  border-top: 1px solid var(--line);
}
.dialog-footer span span {
  margin: 0 8px;
}

/* Origem do relatório. */
.card-source {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.card-source::before {
  content: "";
  width: 10px;
  height: 14px;
  border-radius: 2px;
  background: #e9be31;
}
.card-open:focus-visible {
  outline-offset: -4px;
}
.favorite-button:hover {
  border-color: var(--brand-focus);
}

/* Identidade compartilhada pelas duas empresas. */
.brand-logos {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand-logos img {
  object-fit: contain;
  border-radius: 50%;
}
.brand-plus {
  color: var(--text-secondary);
  font-size: 16px;
}
body.sidebar-collapsed .brand-logos {
  flex-direction: column;
  gap: 8px;
}
body.sidebar-collapsed .brand-plus {
  display: none;
}

/* Responsividade: conserva fontes legíveis em telas menores. */
@media (max-width: 700px), (max-height: 600px) and (orientation: landscape) {
  .organization-name {
    display: none;
  }
  .breadcrumb .divider {
    display: none;
  }
  body.sidebar-collapsed .brand-logos {
    flex-direction: row;
    gap: 12px;
  }
  body.sidebar-collapsed .brand-plus {
    display: inline;
  }

  .sidebar,
  body.sidebar-collapsed .sidebar {
    width: min(320px, calc(100vw - 56px));
    height: 100dvh;
    padding: 24px 18px 18px;
    transform: translateX(-100%);
    visibility: hidden;
    box-shadow: 16px 0 40px rgba(20, 41, 75, 0.2);
    transition:
      transform 0.22s ease,
      visibility 0.22s;
  }
  .sidebar-label,
  body.sidebar-collapsed .sidebar-label {
    display: initial;
  }
  body.mobile-nav-open .sidebar {
    transform: translateX(0);
    visibility: visible;
  }
  body.mobile-nav-open {
    overflow: hidden;
  }
  .sidebar-close-button {
    position: absolute;
    top: 16px;
    right: 16px;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--surface-card);
    color: var(--text-primary);
    font-size: 24px;
  }
  .sidebar-overlay:not([hidden]) {
    position: fixed;
    inset: 0;
    z-index: 19;
    background: rgba(20, 41, 75, 0.48);
    backdrop-filter: blur(2px);
  }
  .workspace,
  body.sidebar-collapsed .workspace {
    margin-left: 0;
  }
  .topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    height: 64px;
    padding: 0 18px;
  }
  .breadcrumb {
    gap: 10px;
    font-size: 12px;
  }
  main {
    padding: 22px 16px 32px;
  }
  .library-heading {
    align-items: stretch;
    flex-direction: column;
    gap: 20px;
  }
  .search {
    width: 100%;
  }
  .reports-grid {
    grid-template-columns: minmax(0, 1fr);
    grid-auto-rows: 292px;
  }
  .report-card {
    grid-template-rows: 158px minmax(0, 1fr);
  }
  .filter {
    padding: 8px 10px;
  }
  .card-body {
    padding: 13px 16px 0;
  }
  .card-footer {
    font-size: 13px;
  }
  .dialog-header {
    min-height: 72px;
    padding: 10px 14px;
  }
  .dialog-header h2 {
    font-size: 18px;
  }
  .dialog-actions {
    gap: 4px;
  }
  .dialog-footer {
    display: none;
  }
  #reportDialog,
  #reportDialog.expanded {
    inset: 0;
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0;
    border: 0;
    border-radius: 0;
  }
  #reportDialog .dialog-header .eyebrow {
    margin-bottom: 2px;
    font-size: 10px;
  }
  #reportDialog .dialog-header h2 {
    max-width: calc(100vw - 110px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 17px;
  }
  #reportDialog .dialog-actions {
    flex-shrink: 0;
  }
  #reportDialog .report-dialog-content {
    grid-template-columns: minmax(0, 1fr);
  }
  #reportDialog .report-switcher {
    display: none;
  }
  #reportDialog .report-stage {
    height: calc(100dvh - 72px);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* A tela só é exibida após validar sessão e perfil. */
.access-status {
  padding: 32px;
  color: var(--text-secondary);
}

.sidebar-account {
  margin-top: auto;
  padding: 16px 12px 0;
  border-top: 1px solid var(--line);
}
.sidebar nav {
  margin-bottom: 28px;
}
.account-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.user-avatar {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 10px;
  background: var(--brand-soft);
  color: var(--brand-blue);
  font-size: 13px;
  font-weight: 800;
}
.account-details {
  min-width: 0;
}
.account-details strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}
.account-details > span {
  display: block;
  margin-top: 3px;
  font-size: 12px;
  color: var(--text-secondary);
}
.logout-button {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-card);
  color: var(--text-secondary);
  font-size: 13px;
}
.logout-button:hover {
  color: #b42332;
  background: #fff4f4;
}
button:disabled {
  cursor: wait;
  opacity: 0.6;
}
body.sidebar-collapsed .sidebar-account {
  padding: 16px 0 0;
}
body.sidebar-collapsed .account-heading {
  justify-content: center;
}
.admin-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin: -8px 0 24px;
  flex-wrap: wrap;
}
.secondary-button {
  border: 1px solid var(--brand-border);
  background: var(--surface-card);
  color: var(--brand-blue);
  padding: 11px 16px;
  border-radius: 7px;
  font-size: 14px;
  font-weight: 700;
}
.secondary-button:hover {
  background: var(--brand-soft);
}
.catalog-error {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 16px;
  margin-bottom: 20px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 8px;
}
.form-dialog {
  width: min(520px, calc(100vw - 24px));
  height: fit-content;
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
}
#newUserDialog {
  width: min(640px, calc(100vw - 24px));
}
.panel-form {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.form-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}
.form-header h2 {
  font-size: 21px;
  margin: 0;
}
.panel-form label {
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 14px;
  font-weight: 700;
}
.panel-form input,
.panel-form select,
.panel-form textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  padding: 10px 12px;
  background: var(--surface-input);
  color: var(--text-primary);
  font: inherit;
  font-weight: 400;
}
.panel-form textarea {
  resize: vertical;
}
.field-optional {
  font-weight: 400;
  color: var(--text-secondary);
}
.field-hint {
  font-size: 12px;
  line-height: 1.6;
  margin: -8px 0 0;
  color: var(--text-secondary);
}
.form-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.user-permissions {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}
.user-permissions > legend {
  padding: 0;
  font-size: 14px;
  font-weight: 800;
}
.permissions-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 3px;
  margin-bottom: 10px;
}
.permissions-heading span {
  color: var(--text-secondary);
  font-size: 12px;
}
.permission-actions {
  display: flex;
  gap: 5px;
}
.text-button {
  padding: 5px 7px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--brand-blue);
  font-size: 12px;
  font-weight: 700;
}
.text-button:hover {
  background: var(--brand-soft);
}
.permissions-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  max-height: 210px;
  padding: 8px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-page);
}
.panel-form .permission-option {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 9px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: var(--surface-card);
  cursor: pointer;
}
.panel-form .permission-option:hover {
  border-color: var(--brand-border);
}
.panel-form .permission-option:has(input:checked) {
  border-color: var(--brand-border);
  background: var(--brand-soft);
}
.panel-form .permission-option input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--brand-blue);
}
.permission-copy {
  min-width: 0;
}
.permission-copy strong,
.permission-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.permission-copy strong {
  font-size: 12px;
}
.permission-copy small,
.permissions-empty {
  color: var(--text-secondary);
  font-size: 11px;
}
.permissions-empty {
  grid-column: 1 / -1;
  margin: 14px;
  text-align: center;
}
.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 4px;
}
.form-message {
  padding: 11px 13px;
  border-radius: 7px;
  font-size: 13px;
  line-height: 1.5;
  margin: 0;
}
.form-message.error {
  color: #a51e2d;
  background: #fff1f2;
}
.form-message.success {
  color: #215d45;
  background: #edf8f1;
}
#panelNotice {
  margin-bottom: 18px;
}
.danger-button {
  border: 1px solid #d92d42;
  border-radius: 7px;
  padding: 11px 18px;
  background: #c9283e;
  color: white;
  font: inherit;
  font-weight: 700;
}
.danger-button:hover {
  background: #ad2034;
}
.management-dialog {
  width: min(900px, calc(100vw - 24px));
  height: min(720px, calc(100dvh - 32px));
}
.management-shell {
  display: flex;
  height: 100%;
  flex-direction: column;
  padding: 24px;
}
.management-header {
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
.management-header .eyebrow {
  margin: 0 0 4px;
}
.management-header-actions,
.row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.users-list {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
  gap: 8px;
  padding-top: 14px;
  overflow-y: auto;
}
.user-row {
  display: grid;
  grid-template-columns: 40px minmax(180px, 1fr) auto auto auto;
  align-items: center;
  gap: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-raised);
}
.user-row-main {
  min-width: 0;
}
.user-row-main strong,
.user-row-main span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-row-main strong {
  font-size: 14px;
}
.user-row-main span {
  margin-top: 3px;
  color: var(--text-secondary);
  font-size: 12px;
}
.status-badge,
.profile-badge {
  padding: 5px 8px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-blue);
  font-size: 11px;
  font-weight: 800;
}
.status-badge.active {
  background: #e9f8ef;
  color: #207347;
}
.status-badge.inactive {
  background: #f1f3f5;
  color: #667085;
}
.small-button {
  padding: 7px 9px;
  border: 1px solid var(--brand-border);
  border-radius: 7px;
  background: var(--surface-card);
  color: var(--brand-blue);
  font-size: 12px;
  font-weight: 700;
}
.danger-text {
  color: #c02b3e;
}
.loading-list {
  color: var(--text-secondary);
  text-align: center;
}
.confirm-dialog {
  width: min(440px, calc(100vw - 24px));
  height: fit-content;
}
.confirm-dialog h2 {
  margin: 4px 0 0;
}
.confirm-dialog #confirmMessage {
  margin: 0;
  color: var(--text-secondary);
  line-height: 1.6;
}

:root[data-theme="dark"] .favorite-button[aria-pressed="true"] {
  color: #ffd77a;
  background: #3a3018;
  border-color: #6b5828;
}
:root[data-theme="dark"] .catalog-error {
  background: #382817;
  border-color: #6b4b24;
}
:root[data-theme="dark"] .form-message.error {
  color: #ffb6c0;
  background: #3b1d27;
}
:root[data-theme="dark"] .form-message.success {
  color: #a9e8c5;
  background: #173326;
}
:root[data-theme="dark"] .status-badge.active {
  color: #9ee6bc;
  background: #173a2a;
}
:root[data-theme="dark"] .status-badge.inactive {
  color: #b8c2cf;
  background: #263143;
}
:root[data-theme="dark"] .logout-button:hover {
  color: #ff9eaa;
  background: #351c25;
}
@media (max-width: 700px), (max-height: 600px) and (orientation: landscape) {
  .admin-actions {
    justify-content: flex-start;
    margin-top: 0;
  }
  .admin-actions > button {
    flex: 1 1 145px;
  }
  .panel-form {
    padding: 20px;
  }
  .form-columns {
    grid-template-columns: 1fr;
  }
  .permissions-list {
    grid-template-columns: 1fr;
  }
  .management-dialog {
    inset: 0;
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0;
    border: 0;
    border-radius: 0;
  }
  .management-shell {
    padding: 16px;
  }
  .management-header {
    align-items: flex-start;
  }
  .management-header h2 {
    font-size: 19px;
  }
  .management-header-actions .primary-button {
    padding: 10px 12px;
    font-size: 13px;
  }
  .user-row {
    grid-template-columns: 40px minmax(0, 1fr) auto;
    gap: 10px;
  }
  .user-row .profile-badge {
    grid-column: 2;
    justify-self: start;
  }
  .user-row .status-badge {
    grid-column: 3;
    grid-row: 1;
  }
  .user-row .row-actions {
    grid-column: 2 / -1;
    justify-content: flex-end;
  }
  body.sidebar-collapsed .sidebar-account {
    padding: 16px 12px 0;
  }
  body.sidebar-collapsed .account-heading {
    justify-content: flex-start;
  }
}

@media (max-height: 600px) and (orientation: landscape) {
  #reportDialog .dialog-header {
    min-height: 52px;
    padding: 6px 12px;
  }
  #reportDialog .dialog-header .eyebrow {
    display: none;
  }
  #reportDialog .dialog-header h2 {
    max-width: calc(100vw - 110px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 15px;
  }
  #reportDialog .icon-button {
    width: 38px;
    height: 38px;
  }
  #reportDialog .report-stage {
    height: calc(100dvh - 52px);
  }
}

@media (min-width: 701px) and (max-width: 1100px) and (min-height: 601px) {
  .sidebar {
    width: 236px;
  }
  .workspace {
    margin-left: 236px;
  }
  main {
    padding: 28px 24px;
  }
  .library-heading {
    align-items: stretch;
    flex-direction: column;
  }
  .search {
    width: min(100%, 420px);
  }
  .reports-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  }
}
