:root {
  --blue: #073f8f;
  --blue-2: #0a5bb8;
  --ink: #10213f;
  --muted: #68738a;
  --line: #dfe6f1;
  --panel: #ffffff;
  --bg: #f4f7fb;
  --green: #079865;
  --green-soft: #dff4ea;
  --amber: #f2a91f;
  --amber-soft: #fff0c9;
  --red: #d64045;
  --red-soft: #fbdadb;
  --violet: #6d55b8;
  --shadow: 0 12px 32px rgba(24, 41, 71, 0.08);
}

:root[data-theme="high-contrast-dark"] {
  --blue: #0868ff;
  --blue-2: #00d4ff;
  --ink: #f8fbff;
  --muted: #d7deea;
  --line: #2a2f3a;
  --panel: #030407;
  --bg: #000000;
  --green: #3cff00;
  --green-soft: #143500;
  --amber: #d8ff00;
  --amber-soft: #343d00;
  --red: #ff6b6b;
  --red-soft: #4a1218;
  --violet: #b7a7ff;
  --shadow: 0 16px 38px rgba(0, 0, 0, 0.45);
}

:root[data-theme="arzani-dark-blue"] {
  --blue: #55a7ff;
  --blue-2: #83c7ff;
  --ink: #eef6ff;
  --muted: #9fb1c9;
  --line: #1d3557;
  --panel: #0d1b2f;
  --bg: #07111f;
  --green: #18b981;
  --green-soft: #0c3d31;
  --amber: #f5b841;
  --amber-soft: #49370b;
  --red: #ef5350;
  --red-soft: #4a1919;
  --violet: #a894ff;
  --shadow: 0 16px 38px rgba(0, 0, 0, 0.32);
}

:root[data-theme="light"] {
  --blue: #073f8f;
  --blue-2: #0a5bb8;
  --ink: #10213f;
  --muted: #68738a;
  --line: #dfe6f1;
  --panel: #ffffff;
  --bg: #f4f7fb;
  --green: #079865;
  --green-soft: #dff4ea;
  --amber: #f2a91f;
  --amber-soft: #fff0c9;
  --red: #d64045;
  --red-soft: #fbdadb;
  --violet: #6d55b8;
  --shadow: 0 12px 32px rgba(24, 41, 71, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, Segoe UI, Arial, sans-serif;
}

@media (min-width: 980px) {
  body:not(.login-body) {
    padding-left: 244px;
  }

  body:not(.login-body) .shell {
    width: min(100% - 28px, 1500px);
  }

  body:not(.login-body) .app-menu {
    display: none;
  }
}

:root[data-theme$="dark"] body {
  color-scheme: dark;
}

.shell {
  width: min(1480px, calc(100% - 32px));
  margin: 0 auto;
  padding: 22px 0 34px;
}

.topbar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 16px;
  align-items: center;
  min-height: 70px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.brand-mark {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  font-weight: 800;
  box-shadow: var(--shadow);
}

.brand-mark span {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 2px solid rgba(255, 255, 255, 0.82);
  border-radius: 50%;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-weight: 700;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  color: var(--blue);
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1;
  text-transform: uppercase;
}

h2 {
  color: var(--ink);
  font-size: 15px;
}

.report-date {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  color: var(--muted);
  white-space: nowrap;
}

.report-copy {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.top-button {
  height: 32px;
  padding: 0 12px;
  background: #eaf0f8;
  color: var(--blue);
}

.app-menu {
  position: relative;
  z-index: 20;
}

.menu-trigger {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  gap: 4px;
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 9px;
  box-shadow: 0 8px 18px rgba(24, 41, 71, 0.1);
}

.menu-trigger span {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: var(--blue);
}

.menu-popover {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  display: none;
  width: 230px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 22px 48px rgba(24, 41, 71, 0.18);
}

.app-menu.is-open .menu-popover {
  display: grid;
}

.menu-item {
  display: flex;
  min-height: 42px;
  align-items: center;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  padding: 0 14px;
  font-weight: 800;
  text-align: left;
  text-decoration: none;
}

.menu-item:hover {
  background: color-mix(in srgb, var(--panel) 75%, var(--blue));
  color: var(--blue);
}

.company-logo {
  width: 58px;
  height: 58px;
  border-radius: 8px;
  object-fit: cover;
  box-shadow: 0 8px 18px rgba(24, 41, 71, 0.14);
}

.header-logo {
  width: 58px;
  height: 58px;
  border-radius: 8px;
  object-fit: cover;
  box-shadow: 0 8px 18px rgba(24, 41, 71, 0.14);
}

.app-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  display: grid;
  width: 230px;
  grid-template-rows: auto 1fr auto;
  border-right: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 88%, var(--bg));
  box-shadow: 18px 0 44px rgba(0, 0, 0, 0.22);
  padding: 18px 12px;
}

.sidebar-brand {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 10px;
  align-items: center;
  min-height: 58px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
  color: var(--ink);
  font-weight: 900;
}

.sidebar-brand img {
  width: 44px;
  height: 44px;
  border-radius: 7px;
  object-fit: cover;
}

.sidebar-nav {
  display: grid;
  align-content: start;
  gap: 7px;
  padding-top: 16px;
}

.sidebar-section-label {
  margin: 10px 8px 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0;
}

.sidebar-section-label.nested {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.sidebar-link {
  display: grid;
  grid-template-columns: 26px 1fr;
  min-height: 40px;
  align-items: center;
  border: 1px solid transparent;
  border-radius: 7px;
  color: var(--muted);
  padding: 0 10px;
  font-weight: 850;
  text-decoration: none;
}

.sidebar-link.app-link {
  margin-left: 12px;
  border-left: 2px solid color-mix(in srgb, var(--blue) 55%, var(--line));
  border-radius: 0 7px 7px 0;
}

.sidebar-link span {
  color: var(--blue-2);
  font-weight: 900;
}

.sidebar-link:hover,
.sidebar-link.is-active {
  border-color: color-mix(in srgb, var(--blue) 42%, var(--line));
  background: color-mix(in srgb, var(--blue) 34%, transparent);
  color: #fff;
}

.sidebar-help {
  display: grid;
  gap: 6px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  padding-top: 14px;
  font-size: 12px;
}

.sidebar-help a {
  color: var(--blue-2);
  text-decoration: none;
}

.source-panel,
.panel,
.table-panel,
.kpi {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

:root[data-theme$="dark"] .source-panel,
:root[data-theme$="dark"] .panel,
:root[data-theme$="dark"] .table-panel,
:root[data-theme$="dark"] .kpi,
:root[data-theme$="dark"] .content-panel,
:root[data-theme$="dark"] .cloud-card,
:root[data-theme$="dark"] .login-panel {
  background: color-mix(in srgb, var(--panel) 86%, #111827);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 18px 42px rgba(0, 0, 0, 0.4);
}

.source-panel {
  padding: 14px;
  margin-bottom: 14px;
}

.source-panel label {
  display: block;
  margin-bottom: 8px;
  color: var(--blue);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.source-row,
.private-source {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
}

.private-source {
  grid-template-columns: 1fr auto;
  align-items: center;
}

.private-source strong {
  display: flex;
  min-height: 40px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: color-mix(in srgb, var(--panel) 88%, var(--line));
  color: var(--ink);
  padding: 0 12px;
}

input,
select,
textarea,
button {
  border-radius: 7px;
  font: inherit;
}

input,
select,
button {
  height: 40px;
}

input,
select,
textarea {
  min-width: 0;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  padding: 0 12px;
}

textarea {
  height: auto;
  padding-top: 10px;
  resize: vertical;
}

button {
  border: 0;
  background: var(--blue);
  color: #fff;
  padding: 0 16px;
  font-weight: 800;
  cursor: pointer;
}

button.secondary {
  background: color-mix(in srgb, var(--panel) 80%, var(--blue));
  color: var(--blue);
}

#sourceStatus {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.kpi {
  min-height: 150px;
  padding: 20px 18px;
  text-align: center;
}

.kpi-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  margin: 0 auto 12px;
  border-radius: 50%;
  border: 2px solid currentColor;
  font-size: 10px;
  font-weight: 900;
}

.kpi span {
  display: block;
  min-height: 30px;
  color: currentColor;
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

.kpi strong {
  display: block;
  margin: 10px 0;
  color: var(--ink);
  font-size: clamp(22px, 2.4vw, 28px);
}

.kpi small {
  color: var(--muted);
  font-size: 14px;
}

.kpi.blue {
  color: var(--blue);
}

.kpi.green {
  color: var(--green);
}

.kpi.amber {
  color: var(--amber);
}

.kpi.violet {
  color: var(--violet);
}

.chart-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.panel {
  padding: 14px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 24px;
  margin-bottom: 12px;
}

.bar-chart {
  display: grid;
  gap: 10px;
}

.bar-row {
  display: grid;
  grid-template-columns: 170px 1fr 108px;
  gap: 10px;
  align-items: center;
  min-height: 23px;
  font-size: 13px;
}

.bar-label {
  overflow: hidden;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-track {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel) 78%, var(--line));
}

.bar-value {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--blue-2));
}

.bar-money {
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  text-align: right;
}

.donut-wrap {
  display: grid;
  grid-template-columns: 210px 1fr;
  gap: 22px;
  align-items: center;
  min-height: 220px;
}

.donut {
  width: 190px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: conic-gradient(var(--green) 0 80%, var(--amber) 80% 100%);
  position: relative;
  margin: auto;
}

.donut::after {
  content: "";
  position: absolute;
  inset: 52px;
  border-radius: 50%;
  background: var(--panel);
}

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

.legend-item {
  display: grid;
  grid-template-columns: 12px 1fr;
  gap: 8px;
  align-items: center;
  font-size: 13px;
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.table-panel {
  overflow: hidden;
  margin-bottom: 16px;
}

.table-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 14px;
}

.table-actions span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.filters {
  display: grid;
  grid-template-columns: 150px 190px 220px;
  gap: 8px;
}

.table-scroll {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th {
  background: var(--blue);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  text-align: center;
}

:root[data-theme$="dark"] th {
  background: #05070c;
  color: var(--ink);
}

:root[data-theme$="dark"] td {
  color: var(--ink);
}

th,
td {
  border: 1px solid var(--line);
  padding: 10px 9px;
  vertical-align: middle;
}

td {
  background: var(--panel);
}

tbody tr:nth-child(even) td {
  background: color-mix(in srgb, var(--panel) 92%, var(--line));
}

tfoot td,
.total-row td {
  background: color-mix(in srgb, var(--panel) 72%, var(--blue));
  color: var(--ink);
  font-weight: 900;
}

.num {
  text-align: right;
  white-space: nowrap;
}

.center {
  text-align: center;
}

.employee {
  min-width: 180px;
  font-weight: 800;
}

.saldo {
  color: var(--green);
  font-weight: 900;
}

.progress-cell {
  min-width: 130px;
}

.progress-line {
  display: grid;
  grid-template-columns: 1fr 44px;
  gap: 8px;
  align-items: center;
}

.progress-track {
  height: 14px;
  border: 1px solid #cfdae6;
  background: var(--panel);
}

.progress-fill {
  height: 100%;
  background: var(--green);
}

.badge {
  display: inline-flex;
  min-width: 112px;
  height: 27px;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  padding: 0 10px;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  white-space: nowrap;
}

.state-en-curso {
  background: var(--green-soft);
  color: var(--green);
}

.state-proximo-a-finalizar {
  background: var(--amber-soft);
  color: #bb7600;
}

.state-atrasado {
  background: var(--red-soft);
  color: var(--red);
}

.state-finalizado {
  background: color-mix(in srgb, var(--panel) 70%, var(--line));
  color: var(--muted);
}

.is-hidden {
  display: none !important;
}

.admin-link,
.form-link {
  color: var(--blue);
  font-weight: 900;
  text-decoration: none;
}

.form-link {
  display: inline-block;
  text-align: center;
}

.mini-button {
  height: 32px;
  margin: 2px;
  padding: 0 10px;
  font-size: 12px;
}

.mini-button.reject {
  background: var(--red);
}

.bottom-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 0.8fr;
  gap: 16px;
}

.site-footer {
  margin: 24px auto 0;
  padding: 16px 12px 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
  text-align: center;
}

.site-footer p {
  margin: 2px 0;
}

.site-footer a {
  color: var(--blue);
}

.content-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  margin-bottom: 16px;
  padding: 18px;
}

.content-panel h2 {
  margin-bottom: 10px;
  color: var(--blue);
  font-size: 18px;
}

.content-panel p {
  margin: 8px 0;
  color: var(--muted);
  line-height: 1.55;
}

.portal-shell {
  max-width: 1180px;
}

.portal-hero {
  display: grid;
  min-height: 190px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--blue) 52%, #000), color-mix(in srgb, var(--green) 55%, #000));
  box-shadow: var(--shadow);
  color: #fff;
  margin-bottom: 16px;
  padding: 26px;
}

.portal-hero .eyebrow,
.portal-hero p,
.portal-hero h2 {
  color: #fff;
}

.portal-hero h2 {
  max-width: 760px;
  margin: 0 0 10px;
  font-size: clamp(28px, 4vw, 44px);
  letter-spacing: 0;
}

.portal-hero p:last-child {
  max-width: 760px;
  margin: 0;
  line-height: 1.55;
}

.cloud-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.cloud-card {
  display: grid;
  min-height: 220px;
  align-content: start;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 18px;
}

.cloud-card span {
  width: fit-content;
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel) 72%, var(--blue));
  color: var(--blue);
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 900;
}

.cloud-card h2 {
  color: var(--ink);
  font-size: 20px;
}

.cloud-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.cloud-button {
  display: inline-flex;
  height: 40px;
  align-items: center;
  justify-content: center;
  align-self: end;
  border-radius: 7px;
  background: var(--blue);
  color: #fff;
  padding: 0 14px;
  font-weight: 900;
  text-decoration: none;
}

.compact table {
  font-size: 12px;
}

.reference p {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 12px;
  align-items: center;
  margin: 0;
  padding: 8px 0;
  color: #2d3b55;
  font-size: 13px;
}

.login-body {
  min-height: 100vh;
  display: grid;
  grid-template-rows: 1fr auto;
  place-items: center;
  background: var(--bg);
}

.login-shell {
  width: min(100% - 28px, 460px);
}

.login-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 28px;
}

.login-brand-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.login-logo {
  width: 62px;
  height: 62px;
}

.login-panel h1 {
  margin-bottom: 20px;
  font-size: 34px;
}

.login-form {
  display: grid;
  gap: 14px;
}

.login-form label {
  display: grid;
  gap: 7px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
}

.login-error,
.login-success {
  min-height: 20px;
  margin: 0;
  font-size: 13px;
  font-weight: 800;
}

.login-error {
  color: var(--red);
}

.login-success {
  color: var(--green);
}

.auth-footer {
  width: 100%;
  margin-top: 12px;
  padding-bottom: 18px;
}

.theme-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.theme-choice {
  display: grid;
  height: auto;
  min-height: 190px;
  align-content: start;
  gap: 10px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  padding: 14px;
  text-align: left;
}

.theme-choice.is-selected {
  outline: 3px solid var(--blue);
}

.theme-choice small {
  color: var(--muted);
  font-weight: 700;
}

.theme-preview {
  display: block;
  width: 100%;
  height: 72px;
  border-radius: 7px;
  border: 1px solid var(--line);
}

.high-contrast-dark-preview {
  background: linear-gradient(135deg, #00040a 0 45%, #080d16 45% 70%, #4da3ff 70% 100%);
}

.arzani-dark-blue-preview {
  background: linear-gradient(135deg, #07111f 0 45%, #0d1b2f 45% 70%, #55a7ff 70% 100%);
}

.light-preview {
  background: linear-gradient(135deg, #f4f7fb 0 45%, #ffffff 45% 70%, #073f8f 70% 100%);
}

@media (max-width: 1100px) {
  .kpi-grid,
  .chart-grid,
  .bottom-grid,
  .cloud-grid,
  .theme-grid {
    grid-template-columns: 1fr 1fr;
  }

  .filters {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .shell {
    width: min(100% - 20px, 1480px);
    padding-top: 14px;
  }

  .topbar,
  .source-row,
  .private-source,
  .kpi-grid,
  .chart-grid,
  .bottom-grid,
  .cloud-grid,
  .theme-grid,
  .table-actions,
  .donut-wrap {
    grid-template-columns: 1fr;
  }

  .report-date {
    justify-content: flex-start;
    flex-wrap: wrap;
    white-space: normal;
  }

  .company-logo {
    width: 48px;
    height: 48px;
  }

  .header-logo {
    width: 48px;
    height: 48px;
  }

  .menu-popover {
    left: 0;
    right: auto;
  }

  .bar-row {
    grid-template-columns: 120px 1fr;
  }

  .bar-money {
    grid-column: 2;
    text-align: left;
  }
}

@media (max-width: 979px) {
  .app-sidebar {
    display: none;
  }
}
