:root {
  color-scheme: light;
  --brand-500: #cf2e2e;
  --brand-600: #b32121;
  --ink-900: #1f2430;
  --ink-700: #434956;
  --muted-600: #6b7280;
  --bg-100: #f4f5f9;
  --card-100: #ffffff;
  --border-200: #e5e7eb;
  --shadow-200: 0 18px 45px rgba(23, 24, 30, 0.08);
}

.profile-panel {
  position: fixed;
  top: 0;
  left: 200px;
  right: 0;
  z-index: 3000;
  pointer-events: none;
  background: var(--bg-100);
  min-height: 64px;
  padding-inline: 32px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  box-shadow: inset 0 -1px 0 rgba(15, 23, 42, 0.05);
}
.profile-panel__inner {
  width: 100%;
  margin: 0;
  padding: 0;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
}
.profile-panel__role-chip {
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-right: 12px;
  background: rgba(31, 36, 48, 0.08);
  color: var(--ink-900);
}

.profile-panel__avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid transparent;
  display: grid;
  place-items: center;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(31, 36, 48, 0.2);
  pointer-events: auto;
}

.profile-panel__popup {
  position: absolute;
  top: 68px;
  right: 32px;
  width: 240px;
  padding: 16px;
  border-radius: 18px;
  background: #fff;
  box-shadow: var(--shadow-200);
  display: none;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: auto;
}

.profile-panel__popup.is-visible {
  display: flex;
}

.profile-panel__chip {
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: rgba(31, 36, 48, 0.08);
}

.profile-panel__name {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.profile-panel__username,
.profile-panel__meta {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted-600);
}
.profile-panel__logout-btn {
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(207, 46, 46, 0.1);
  color: var(--brand-500);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.85rem;
  transition: background-color 0.2s ease, color 0.2s ease;
  border: 1px solid rgba(207, 46, 46, 0.3);
  cursor: pointer;
}
.profile-panel__logout-btn svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}
.profile-panel__logout-btn:hover {
  background: rgba(207, 46, 46, 0.2);
  color: var(--brand-600);
}

.profile-panel[data-role="admin"] .profile-panel__avatar {
  border-color: rgba(239, 68, 68, 0.5);
  color: #dc2626;
  background: rgba(239, 68, 68, 0.15);
}

.profile-panel[data-role="revisor"] .profile-panel__avatar {
  border-color: rgba(59, 130, 246, 0.5);
  color: #2563eb;
  background: rgba(59, 130, 246, 0.15);
}

.profile-panel[data-role="gestoria"] .profile-panel__avatar {
  border-color: rgba(14, 165, 233, 0.5);
  color: #0ea5e9;
  background: rgba(14, 165, 233, 0.15);
}

.profile-panel .profile-panel__avatar + .profile-panel__avatar {
  display: none;
}

.profile-panel__popup .profile-panel__avatar {
  width: 52px;
  height: 52px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Poppins", "Segoe UI", "Helvetica Neue", sans-serif;
  background: var(--bg-100);
  color: var(--ink-900);
}

body.page-login {
  background: radial-gradient(
      circle at 20% 10%,
      rgba(207, 46, 46, 0.12),
      transparent 45%
    ),
    radial-gradient(circle at 80% 20%, rgba(31, 36, 48, 0.08), transparent 50%),
    linear-gradient(120deg, #f7f7fb 0%, #f2f4fb 100%);
}

body.page-login .page-header__text {
  display: none;
}

.app {
  display: flex;
  min-height: 100vh;
  align-items: stretch;
}

.menu {
  --menu-pad-x: 22px;
  width: 200px;
  flex: 0 0 200px;
  background: #1f232b;
  color: #fff;
  padding: 28px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  transition: width 0.2s ease;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

.menu__item {
  color: #e5e7eb;
  text-decoration: none;
  font-size: 1rem;
  padding: 6px 10px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
}

.menu__badge {
  background: #e93c3c;
  color: #fff;
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 999px;
  line-height: 1;
  margin-left: auto;
  min-width: 20px;
  text-align: center;
}

.menu__item:hover {
  background: rgba(207, 46, 46, 0.18);
  color: #fff;
}

.menu__item.is-active {
  background: #2a2f39;
  color: #fff;
}

.menu__item.is-active::after {
  content: "";
  position: absolute;
  right: calc(var(--menu-pad-x) * -1);
  top: 1px;
  bottom: 1px;
  width: 5px;
  background: #cf2e2e;
  border-radius: 4px;
}

.menu__brand {
  font-weight: 600;
  font-size: 2rem;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
}

.menu__brand-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
}

.menu__brand-link:hover {
  color: inherit;
}

.menu__logo {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  object-fit: cover;
}

.menu__brand-text {
  flex: 1;
}

.menu__toggle {
  position: absolute;
  right: -34px;
  top: 8px;
  border: none;
  background: #f5f6fb;
  color: #1f2430;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(31, 36, 48, 0.2);
}

.menu__toggle svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.menu__hamburger {
  display: none;
  border: none;
  background: #fff;
  color: #1f2430;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 10px 20px rgba(31, 36, 48, 0.12);
  align-items: center;
  justify-content: center;
}

.menu__hamburger svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.menu-overlay {
  display: none;
}

.menu__icon {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
}

.menu__icon svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.menu__logout-btn {
  width: 100%;
  border: none;
  background: transparent;
  text-align: left;
}

.menu__logout button {
  cursor: pointer;
}

.menu__logout {
  margin: 0;
}

.menu__footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.menu.is-collapsed {
  --menu-pad-x: 14px;
  width: 78px;
  flex: 0 0 78px;
  padding: 24px 14px;
}

.menu.is-collapsed .menu__brand-text,
.menu.is-collapsed .menu__text {
  display: none;
}

.menu.is-collapsed .menu__item {
  justify-content: center;
}

.menu.is-collapsed .menu__toggle svg {
  transform: rotate(180deg);
}

.content {
  flex: 1;
  padding: 70px 40px 60px;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.page-header__title {
  margin: 0;
  font-size: 1.6rem;
  color: var(--ink-900);
}

.page-header__subtitle {
  margin: 4px 0 0;
  color: var(--muted-600);
  font-size: 0.95rem;
}

.page-header__spacer {
  height: 18px;
}

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

.breadcrumbs ol {
  list-style: none;
  display: flex;
  gap: 8px;
  padding: 0;
  margin: 0;
  align-items: center;
}

.breadcrumbs li::after {
  content: "/";
  margin-left: 8px;
  color: #cbd5f5;
}

.breadcrumbs li:last-child::after {
  content: "";
  margin: 0;
}

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

.flash {
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 16px;
  background: rgba(207, 46, 46, 0.1);
  color: var(--brand-600);
  border: 1px solid rgba(207, 46, 46, 0.18);
}

.auth {
  width: 100%;
  min-height: calc(100vh - 80px);
  display: grid;
  place-items: center;
  position: relative;
}

.auth::before,
.auth::after {
  content: "";
  position: absolute;
  border-radius: 24px;
  background: rgba(207, 46, 46, 0.08);
  filter: blur(0.5px);
  z-index: 0;
}

.auth::before {
  width: 160px;
  height: 160px;
  top: 10%;
  left: 12%;
}

.auth::after {
  width: 220px;
  height: 220px;
  bottom: 8%;
  right: 12%;
}

.auth__card {
  position: relative;
  z-index: 1;
  width: min(420px, 92vw);
  background: var(--card-100);
  padding: 36px 38px 32px;
  border-radius: 18px;
  box-shadow: var(--shadow-200);
  border: 1px solid rgba(229, 231, 235, 0.7);
}

.auth__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
  justify-content: center;
}

.auth__logo {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: rgba(207, 46, 46, 0.12);
  color: var(--brand-500);
  font-weight: 700;
}

.auth__logo-img {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  object-fit: cover;
  box-shadow: 0 6px 16px rgba(31, 36, 48, 0.12);
}

.auth__name {
  font-weight: 600;
  font-size: 1.85rem;
}

.auth__title {
  margin: 0 0 6px;
  font-size: 1.5rem;
}

.auth__subtitle {
  margin: 0 0 24px;
  color: var(--muted-600);
  font-size: 0.95rem;
}

.auth__form {
  display: flex;
  flex-direction: column;
  gap: 26px;
}

.auth__field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--ink-700);
}

.auth__input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border-200);
  background: #fbfbfd;
  font-size: 0.95rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.auth__input:focus {
  outline: none;
  border-color: rgba(207, 46, 46, 0.5);
  box-shadow: 0 0 0 3px rgba(207, 46, 46, 0.15);
  background: #fff;
}

.auth__button {
  margin-top: 4px;
  padding: 12px 16px;
  border: none;
  border-radius: 12px;
  background: var(--brand-500);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 12px 20px rgba(207, 46, 46, 0.22);
}

.auth__button:hover {
  background: var(--brand-600);
}

.auth__help {
  margin-top: 18px;
  color: var(--muted-600);
  font-size: 0.85rem;
}

@media (max-width: 720px) {
  .content {
    padding: 24px;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 1100px) {
  .menu {
    position: fixed;
    inset: 0 auto 0 0;
    width: 240px;
    flex: 0 0 240px;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    z-index: 2100;
    height: 100vh;
    overflow-y: auto;
  }

  .menu.is-open {
    transform: translateX(0);
  }

  .menu.is-collapsed {
    width: 240px;
    flex: 0 0 240px;
    padding: 28px 22px;
  }

  .menu__toggle {
    display: none;
  }

  .menu.is-collapsed .menu__brand-text,
  .menu.is-collapsed .menu__text {
    display: inline;
  }

  .menu.is-collapsed .menu__item {
    justify-content: flex-start;
  }

  .menu-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 2000;
  }

  .menu-overlay.is-active {
    display: block;
  }

  .menu__hamburger {
    display: inline-flex;
  }

  .page-header__text {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
  }
}

.content--no-menu {
  padding: 60px 24px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.access-denied {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.access-denied__panel {
  background: #fff;
  border: 1px solid var(--border-200);
  border-radius: 20px;
  padding: 48px;
  text-align: center;
  max-width: 420px;
  box-shadow: var(--shadow-200);
}

.access-denied__panel h1 {
  margin: 0 0 12px;
  font-size: 1.8rem;
}

.access-denied__panel p {
  margin: 0 0 8px;
  color: var(--muted-600);
}

.access-denied__icon {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  margin: 0 auto 16px;
  background: rgba(207, 46, 46, 0.1);
  border-radius: 18px;
}

.access-denied__icon svg {
  width: 32px;
  height: 32px;
  fill: var(--brand-500);
}
