:root {
  --bg-0: #f4f7f3;
  --bg-1: #dcefe4;
  --bg-2: #f7f1dc;
  --ink-900: #1b2a24;
  --ink-700: #334a41;
  --ink-500: #50685f;
  --line-soft: rgba(27, 42, 36, 0.14);
  --line-strong: rgba(27, 42, 36, 0.24);
  --card: rgba(255, 255, 255, 0.86);
  --card-strong: #ffffff;
  --brand-600: #1f7a5a;
  --brand-700: #146246;
  --active-400: #d9f4e6;
  --active-500: #b8e8cf;
  --active-600: #8fd5b0;
  --accent-600: #d67b2c;
  --danger-600: #b63f2f;
  --warn-600: #ad7a00;
  --ok-600: #1a7f45;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shadow-soft: 0 16px 48px rgba(22, 38, 31, 0.12);
  --shadow-btn: 0 10px 24px rgba(31, 122, 90, 0.28);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  color: var(--ink-900);
  font-family: "Manrope", "Segoe UI", sans-serif;
  line-height: 1.45;
  background:
    radial-gradient(1000px 560px at 8vw -15vh, #c6e6d4 0%, transparent 60%),
    radial-gradient(900px 520px at 92vw -15vh, #f3d9b8 0%, transparent 58%),
    linear-gradient(155deg, var(--bg-0) 0%, var(--bg-1) 52%, var(--bg-2) 100%);
  background-attachment: fixed, fixed, fixed;
}

.app-shell {
  position: relative;
  overflow: clip;
  min-height: 100vh;
}

.bg-orb {
  position: fixed;
  border-radius: 999px;
  filter: blur(0);
  z-index: 0;
  pointer-events: none;
  opacity: 0.45;
}

.bg-orb-a {
  width: 320px;
  height: 320px;
  top: 130px;
  left: -100px;
  background: radial-gradient(circle at 30% 30%, #9ad8bc 0%, #9ad8bc 18%, transparent 70%);
}

.bg-orb-b {
  width: 420px;
  height: 420px;
  right: -150px;
  top: 40vh;
  background: radial-gradient(circle at 40% 35%, #f1c795 0%, #f1c795 20%, transparent 70%);
}

.page-wrap {
  position: relative;
  z-index: 1;
  width: min(1220px, 94vw);
  margin: 0 auto;
  padding: 34px 0 48px;
}

.page-header {
  position: relative;
  z-index: 40;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 18px;
  animation: reveal-up 460ms ease both;
}

.page-title-wrap {
  max-width: min(760px, 100%);
}

.page-title {
  margin: 0;
  font-family: "Space Grotesk", "Manrope", sans-serif;
  font-size: clamp(1.6rem, 1.05rem + 2.2vw, 2.6rem);
  letter-spacing: -0.03em;
  color: var(--ink-900);
}

.page-subtitle {
  margin: 10px 0 0;
  color: var(--ink-700);
  font-size: clamp(0.94rem, 0.88rem + 0.3vw, 1.05rem);
}

.page-subtitle:empty {
  display: none;
}

.page-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.page-actions:empty {
  display: none;
}

.header-notifications {
  position: relative;
}

.header-notifications[open] {
  z-index: 60;
}

.header-notifications > summary {
  list-style: none;
}

.header-notifications > summary::-webkit-details-marker {
  display: none;
}

.notifications-trigger {
  position: relative;
}

.notifications-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.35rem;
  min-height: 1.35rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: var(--danger-600);
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 800;
  line-height: 1;
}

.notifications-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: min(450px, 92vw);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 16px 42px rgba(18, 35, 28, 0.2);
  padding: 10px;
  z-index: 1200;
}

.notifications-title {
  margin: 0;
  font-family: "Space Grotesk", "Manrope", sans-serif;
  font-weight: 700;
  color: var(--ink-900);
}

.notifications-scope {
  margin: 4px 0 0;
  color: var(--ink-500);
  font-size: 0.81rem;
}

.notifications-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: grid;
  gap: 8px;
  max-height: min(68vh, 480px);
  overflow: auto;
}

.notifications-item {
  border: 1px solid var(--line-soft);
  border-radius: 11px;
  background: #ffffff;
  padding: 8px 9px;
}

.notifications-item-warning {
  border-color: #e9b1ae;
  background: rgba(254, 238, 238, 0.85);
}

.notifications-item-info {
  border-color: #bad7ee;
  background: rgba(238, 247, 255, 0.82);
}

.notifications-domain {
  margin: 0;
  font-family: "Space Grotesk", "Manrope", sans-serif;
  color: var(--ink-900);
  font-size: 0.82rem;
  font-weight: 700;
}

.notifications-message {
  margin: 4px 0 0;
  color: var(--ink-700);
  font-size: 0.86rem;
  line-height: 1.35;
}

.notifications-item-scope {
  margin: 4px 0 0;
  color: var(--ink-500);
  font-size: 0.78rem;
}

.notifications-link {
  margin-top: 6px;
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  color: var(--brand-700);
  font-family: "Space Grotesk", "Manrope", sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
}

.notifications-link:hover {
  text-decoration: underline;
}

.content-card {
  position: relative;
  border-radius: var(--radius-lg);
  background: linear-gradient(155deg, var(--card) 0%, rgba(255, 255, 255, 0.95) 100%);
  border: 1px solid rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow-soft);
  padding: clamp(16px, 2vw, 28px);
  animation: reveal-up 540ms ease both;
}

.content-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 1px solid rgba(255, 255, 255, 0.55);
  pointer-events: none;
}

h1, h2, h3 {
  margin-top: 0;
  letter-spacing: -0.02em;
}

h2 {
  font-family: "Space Grotesk", "Manrope", sans-serif;
  font-size: clamp(1.25rem, 1.05rem + 0.8vw, 1.7rem);
  margin-bottom: 14px;
  color: var(--ink-900);
}

h3 {
  font-family: "Space Grotesk", "Manrope", sans-serif;
  margin: 24px 0 10px;
  font-size: 1.05rem;
  color: var(--ink-700);
}

p {
  margin: 0 0 10px;
  color: var(--ink-700);
}

a {
  color: var(--brand-700);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.button-link,
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  appearance: none;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.58rem 1.05rem;
  font-family: "Space Grotesk", "Manrope", sans-serif;
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: #ffffff;
  background: linear-gradient(135deg, var(--brand-600), var(--brand-700));
  box-shadow: var(--shadow-btn);
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, filter 0.16s ease;
  min-height: 38px;
}

.button-link:hover,
button:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 20px rgba(20, 98, 70, 0.32);
  filter: saturate(1.08);
  text-decoration: none;
}

.button-link:active,
button:active {
  transform: translateY(0);
}

.nav-icon {
  font-family: "Material Symbols Outlined";
  font-size: 1.08rem;
  font-style: normal;
  line-height: 1;
  font-weight: 500;
  letter-spacing: normal;
  text-transform: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.1em;
  white-space: nowrap;
  direction: ltr;
  -webkit-font-feature-settings: "liga";
  -webkit-font-smoothing: antialiased;
  font-variation-settings: "FILL" 0, "wght" 500, "GRAD" 0, "opsz" 20;
}

.nav-icon.nav-icon-fallback {
  font-family: "Space Grotesk", "Manrope", "Segoe UI", sans-serif;
  font-size: 0.92rem;
  font-weight: 700;
  font-variation-settings: normal;
}

.page-actions .button-link {
  min-height: 38px;
}

.button-link.secondary,
button.secondary {
  color: var(--ink-900);
  background: #f4f8f5;
  border-color: var(--line-soft);
  box-shadow: none;
}

.button-link.is-active,
.button-link[aria-current="page"],
button.is-active {
  color: var(--ink-900);
  background: linear-gradient(90deg, var(--active-500), var(--active-400));
  border-color: rgba(31, 122, 90, 0.34);
  box-shadow: 0 0 0 3px rgba(96, 189, 145, 0.22), 0 8px 14px rgba(76, 156, 120, 0.18);
}

.button-link.is-active:hover,
.button-link[aria-current="page"]:hover,
button.is-active:hover {
  box-shadow: 0 0 0 3px rgba(96, 189, 145, 0.25), 0 8px 14px rgba(76, 156, 120, 0.2);
  filter: none;
}

.button-link.warn,
button.warn {
  background: linear-gradient(90deg, #d79231, #efc27f);
}

.button-link.mid-green,
button.mid-green {
  color: #ffffff;
  background: linear-gradient(90deg, #42a06b, #2f8455);
  border-color: rgba(31, 122, 90, 0.34);
  box-shadow: 0 10px 18px rgba(47, 132, 85, 0.28);
}

.button-link.danger,
button.danger {
  background: linear-gradient(90deg, #cf5a49, #ef9d93);
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(31, 122, 90, 0.28);
  outline-offset: 2px;
}

.flashes {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
  position: fixed;
  top: 14px;
  right: 14px;
  width: min(420px, calc(100vw - 28px));
  z-index: 2500;
  pointer-events: none;
}

.flash-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: flex-start;
  gap: 8px;
  border-radius: 13px;
  padding: 11px 12px;
  border: 1px solid transparent;
  backdrop-filter: blur(8px);
  box-shadow: 0 12px 24px rgba(27, 42, 36, 0.2);
  pointer-events: auto;
  opacity: 1;
  transform: translateY(0) scale(1);
  transition: opacity 0.26s ease, transform 0.26s ease, filter 0.26s ease;
}

.flash-item.is-closing {
  opacity: 0;
  transform: translateY(-10px) scale(0.98);
  filter: blur(1px);
}

.flash-icon {
  margin-top: 2px;
  font-size: 1.08rem;
}

.flash-text {
  line-height: 1.38;
  font-size: 0.92rem;
}

.flash-close {
  appearance: none;
  border: 0;
  border-radius: 999px;
  min-height: 28px;
  min-width: 28px;
  width: 28px;
  padding: 0;
  margin: 0;
  box-shadow: none;
  background: transparent;
  color: inherit;
}

.flash-close:hover {
  transform: none;
  filter: none;
  box-shadow: none;
  background: rgba(0, 0, 0, 0.09);
}

.flash-close:active {
  transform: none;
}

.flash-success {
  border-color: #b7e5c9;
  background: rgba(237, 251, 242, 0.96);
  color: #1f6440;
}

.flash-error {
  border-color: #e9b1ae;
  background: rgba(254, 238, 238, 0.97);
  color: #8c2b25;
}

.flash-warning {
  border-color: #e7d094;
  background: rgba(255, 249, 231, 0.97);
  color: #805a02;
}

.flash-info {
  border-color: #bad7ee;
  background: rgba(238, 247, 255, 0.97);
  color: #1c4f76;
}

form {
  width: 100%;
}

form div {
  margin-bottom: 10px;
  border: 1px dashed var(--line-soft);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.82);
  padding: 10px 12px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}

label {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.95rem;
  color: var(--ink-900);
  font-weight: 700;
}

input[type="text"],
input[type="number"],
input[type="time"],
input[type="password"],
input[type="email"],
input[type="tel"],
input[type="date"],
input[type="datetime-local"],
input[type="month"],
input[type="week"],
input[type="url"],
input[type="search"],
select,
textarea {
  min-height: 38px;
  border: 1px solid var(--line-soft);
  border-radius: 11px;
  padding: 0.45rem 0.65rem;
  background: var(--card-strong);
  color: var(--ink-900);
  font-size: 0.92rem;
  font-family: "Manrope", "Segoe UI", sans-serif;
  max-width: 100%;
  min-width: 0;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease;
}

input[type="number"] {
  width: clamp(96px, 18vw, 140px);
  max-width: 100%;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="tel"],
input[type="url"],
input[type="search"] {
  width: min(340px, 100%);
}

input[type="time"] {
  width: clamp(112px, 20vw, 150px);
  max-width: 100%;
}

input[type="date"],
input[type="datetime-local"],
input[type="month"],
input[type="week"] {
  width: min(220px, 100%);
}

form div > * {
  min-width: 0;
}

label {
  min-width: 0;
}

input[readonly] {
  background: #eff4f0;
  color: var(--ink-700);
}

input[type="radio"] {
  accent-color: var(--brand-600);
  transform: none;
  vertical-align: middle;
}

input:not([type="radio"]):not([type="checkbox"]):focus,
select:focus,
textarea:focus {
  border-color: rgba(31, 122, 90, 0.45);
  box-shadow: 0 0 0 3px rgba(31, 122, 90, 0.12);
}

small {
  color: var(--ink-500);
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  overflow: hidden;
}

thead th {
  background: #f0f6f2;
  color: var(--ink-700);
  font-family: "Space Grotesk", "Manrope", sans-serif;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-bottom: 1px solid var(--line-soft);
}

th,
td {
  padding: 9px 8px;
  border-bottom: 1px solid rgba(27, 42, 36, 0.08);
  text-align: center;
  font-size: 0.87rem;
}

tbody tr:hover {
  background: rgba(197, 232, 214, 0.36);
}

tbody tr:last-child td {
  border-bottom: 0;
}

.table-wrap {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: auto;
  overscroll-behavior-x: auto;
  scroll-snap-type: none;
  touch-action: pan-x pan-y;
  border-radius: 12px;
}

.table-scroll-top {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: auto;
  overscroll-behavior-x: auto;
  touch-action: pan-x;
  margin-bottom: 8px;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  height: 16px;
  scrollbar-width: thin;
}

.table-scroll-top-inner {
  height: 1px;
}

.pagination {
  margin-top: 14px;
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.pagination a,
.pagination .current {
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  padding: 0.36rem 0.7rem;
  font-size: 0.84rem;
  text-decoration: none;
}

.pagination .current {
  background: #e1f3e9;
  color: var(--brand-700);
  border-color: rgba(31, 122, 90, 0.25);
}

.pagination + .chart-panel {
  margin-top: 12px;
}

.quick-actions,
.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 16px 0;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.metric {
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.82);
  min-width: 0;
}

.metric-title {
  margin: 0;
  color: var(--ink-500);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-weight: 800;
}

.metric-value {
  margin: 4px 0 0;
  color: var(--ink-900);
  font-family: "Space Grotesk", "Manrope", sans-serif;
  font-size: 1.15rem;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.3;
}

.section-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.section-card {
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.82);
  padding: 14px;
}

.section-card h3 {
  margin: 0 0 10px;
}

.inline-note {
  display: inline-block;
  color: var(--warn-600);
  font-weight: 700;
  font-size: 0.84rem;
}

.danger-text {
  color: var(--danger-600);
  font-weight: 700;
}

.status-ok {
  color: var(--ok-600);
}

.status-warn {
  color: var(--warn-600);
}

.chart-panel {
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.84);
  padding: 12px;
  overflow: hidden;
}

.chart-panel + .chart-panel {
  margin-top: 14px;
}

.chart-panel canvas {
  display: block;
  width: 100% !important;
  height: clamp(280px, 52vh, 560px) !important;
}

.chart-panel--compact canvas {
  height: clamp(250px, 44vh, 460px) !important;
}

.chart-panel--resumo canvas {
  height: clamp(300px, 56vh, 620px) !important;
}

.text-center {
  text-align: center;
}

.compact-note {
  color: var(--ink-500);
  font-size: 0.85rem;
}

.twofa-setup-grid {
  display: grid;
  grid-template-columns: minmax(190px, 230px) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.twofa-qr-panel {
  border: 1px dashed var(--line-soft);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.86);
  padding: 10px;
}

.twofa-qr-image {
  display: block;
  width: min(210px, 100%);
  height: auto;
  aspect-ratio: 1 / 1;
  margin-top: 8px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: #ffffff;
  padding: 8px;
}

.twofa-key-panel {
  display: grid;
  gap: 10px;
}

.stack {
  display: grid;
  gap: 12px;
}

body.page-nav-priority .page-title-wrap {
  max-width: min(540px, 48vw);
}

@media (min-width: 901px) {
  body.home-header-proportion .page-header {
    display: grid;
    grid-template-columns: minmax(0, min(540px, 48vw)) minmax(0, 1fr);
    align-items: start;
  }

  body.home-header-proportion .page-title-wrap {
    max-width: none;
    width: 100%;
  }

  body.home-header-proportion .page-actions {
    min-width: 0;
    justify-content: flex-end;
  }
}

@keyframes reveal-up {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 900px) {
  .page-wrap {
    width: min(1240px, 96vw);
    padding-top: 22px;
  }

  .page-header {
    flex-direction: column;
  }

  .page-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .notifications-panel {
    right: auto;
    left: 0;
  }

  .content-card {
    padding: 14px;
  }

  body.page-nav-priority .page-title-wrap {
    max-width: 100%;
  }


  table {
    min-width: 900px;
  }

  .chart-panel canvas {
    height: min(52vh, 420px) !important;
  }

  .chart-panel--resumo canvas {
    height: min(58vh, 480px) !important;
  }
}

@media (max-width: 640px) {
  .flashes {
    top: 10px;
    right: 10px;
    left: 10px;
    width: auto;
  }

  form div {
    align-items: flex-start;
  }

  input[type="text"],
  input[type="number"],
  input[type="time"],
  input[type="password"],
  input[type="email"],
  input[type="tel"],
  input[type="date"],
  input[type="datetime-local"],
  input[type="month"],
  input[type="week"],
  input[type="url"],
  input[type="search"],
  select,
  textarea {
    max-width: 100%;
  }

  .twofa-setup-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 980px) and (orientation: landscape) {
  .chart-panel--resumo canvas {
    height: min(84vh, 640px) !important;
  }
}
