:root {
  color-scheme: light;
  --bg: #eef2f6;
  --surface: #ffffff;
  --surface-soft: #f7f9fb;
  --line: #d8e0ea;
  --line-strong: #c4ceda;
  --text: #17212f;
  --muted: #667386;
  --blue: #0b5cab;
  --blue-dark: #073d73;
  --blue-soft: #e7f1fb;
  --green: #16835b;
  --amber: #b7791f;
  --red: #b42318;
  --shadow: 0 12px 28px rgba(15, 34, 55, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

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

button,
input,
select,
textarea {
  font: inherit;
}

button,
.button-link {
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  padding: 8px 12px;
  color: var(--text);
  background: linear-gradient(#ffffff, #edf2f7);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}

button:hover,
.button-link:hover {
  border-color: #8aa7c7;
  background: #e9f2fb;
}

button.secondary {
  color: #344054;
  background: #fff;
}

.text-link {
  color: var(--blue);
  font-weight: 600;
  text-decoration: none;
}

.app-frame {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 100vh;
  transition: grid-template-columns 180ms ease;
}

.app-sidebar {
  position: sticky;
  top: 0;
  width: 248px;
  height: 100vh;
  overflow: auto;
  color: #dce9f7;
  background: #12385f;
  border-right: 1px solid #0c2c4d;
  transition: transform 180ms ease, opacity 160ms ease;
}

body.sidebar-collapsed .app-frame {
  grid-template-columns: 0 minmax(0, 1fr);
}

body.sidebar-collapsed .app-sidebar {
  opacity: 0;
  pointer-events: none;
  transform: translateX(-100%);
}

.sidebar-backdrop {
  display: none;
}

body.logged-out .app-frame {
  grid-template-columns: 1fr;
}

body.logged-out .app-sidebar,
body.logged-out .sidebar-backdrop {
  display: none !important;
}

body.logged-out .app-main {
  min-height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 4px;
  color: #fff;
  background: var(--blue);
  border: 1px solid rgba(255, 255, 255, 0.25);
  font-weight: 700;
  letter-spacing: 0;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  color: #fff;
}

.brand small {
  color: #b6c9dd;
  font-size: 0.78rem;
}

.nav-groups {
  padding: 10px 8px 18px;
}

.nav-groups section {
  margin-bottom: 10px;
}

.nav-groups h3 {
  margin: 12px 8px 6px;
  color: #9eb8d4;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
}

.nav-groups button {
  display: block;
  width: 100%;
  margin: 1px 0;
  border: 0;
  border-radius: 3px;
  padding: 8px 10px;
  color: #e6eef7;
  background: transparent;
  text-align: left;
}

.nav-groups button:hover {
  background: rgba(255, 255, 255, 0.08);
}

.nav-groups button.active {
  color: #fff;
  background: var(--blue);
}

.app-main {
  min-width: 0;
}

.app-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 58px;
  padding: 10px 18px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(15, 34, 55, 0.02);
}

.topbar-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.sidebar-toggle {
  display: inline-grid;
  place-items: center;
  gap: 4px;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  padding: 0;
}

.sidebar-toggle span {
  display: block;
  width: 17px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  transition: transform 180ms ease, opacity 160ms ease;
}

body:not(.sidebar-collapsed) .sidebar-toggle span:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}

body:not(.sidebar-collapsed) .sidebar-toggle span:nth-child(2) {
  opacity: 0;
}

body:not(.sidebar-collapsed) .sidebar-toggle span:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

.app-topbar h1 {
  margin: 0;
  font-size: 1.18rem;
  line-height: 1.2;
}

.section-label {
  display: block;
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 0.75rem;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.user-greeting {
  max-width: 220px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--text);
  background: var(--surface-soft);
  font-size: 0.86rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.global-company-filter,
.global-store-filter,
.global-language-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.global-company-filter select,
.global-store-filter select,
.global-language-filter select {
  min-width: 170px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  padding: 8px 30px 8px 10px;
  color: var(--text);
  background: #fff;
}

.notice {
  margin: 14px 18px 0;
  border: 1px solid var(--line);
  border-left: 4px solid var(--blue);
  border-radius: 4px;
  padding: 9px 12px;
  color: #344054;
  background: var(--surface);
}

.toast-stack {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 50;
  display: grid;
  gap: 10px;
  width: min(360px, calc(100vw - 28px));
  pointer-events: none;
}

.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(10, 24, 42, 0.42);
  backdrop-filter: blur(4px);
}

.loading-overlay[hidden] {
  display: none;
}

.loading-box {
  display: grid;
  justify-items: center;
  gap: 12px;
  min-width: min(360px, calc(100vw - 36px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px 30px;
  color: var(--text);
  background: var(--surface);
  box-shadow: 0 24px 60px rgba(8, 17, 31, 0.28);
}

.loading-spinner {
  width: 72px;
  height: 72px;
  border: 7px solid var(--blue-soft);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: loadingSpin 720ms linear infinite;
}

.loading-box strong {
  font-size: 1.12rem;
}

.loading-box small {
  color: var(--muted);
  font-size: 0.9rem;
}

body.is-loading {
  cursor: progress;
}

.toast {
  border: 1px solid var(--line);
  border-left: 4px solid var(--blue);
  border-radius: 6px;
  padding: 11px 13px;
  color: var(--text);
  background: var(--surface);
  box-shadow: var(--shadow);
  animation: toastIn 180ms ease both;
}

.toast.ok {
  border-left-color: var(--green);
}

.toast.warn {
  border-left-color: var(--amber);
}

.toast.error {
  border-left-color: var(--red);
}

.toast.leaving {
  animation: toastOut 220ms ease both;
}

.notice.ok {
  border-left-color: var(--green);
}

.notice.warn {
  border-left-color: var(--amber);
}

.notice.error {
  border-left-color: var(--red);
  color: var(--red);
}

.content-area {
  padding: 16px 18px 22px;
}

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

.kpi,
.metric-card,
.status-card,
.events-panel,
.form-drawer,
.tool-panel,
.table-wrap,
.empty-state,
.json-panel,
.login-box {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.kpi {
  min-height: 88px;
  padding: 14px;
}

.kpi span,
.label {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
}

.kpi strong {
  display: block;
  margin-top: 8px;
  font-size: 1.75rem;
  line-height: 1;
}

.kpi.ok {
  border-top: 3px solid var(--green);
}

.kpi.warn {
  border-top: 3px solid var(--amber);
}

.form-drawer {
  margin-bottom: 12px;
}

.form-drawer summary {
  padding: 11px 14px;
  color: var(--blue-dark);
  font-weight: 700;
  cursor: pointer;
  border-bottom: 1px solid var(--line);
}

.quick-form,
.tool-panel {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
  padding: 12px;
  box-shadow: none;
}

.tool-panel {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.report-cover,
.report-summary-grid,
.signature-row {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.report-cover {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.report-cover span,
.report-summary-grid span,
.signature-row span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
}

.report-cover strong {
  display: block;
  margin-top: 3px;
  font-size: 0.94rem;
}

.report-summary-grid {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.report-summary-grid article {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 11px;
  background: var(--surface);
}

.report-summary-grid strong {
  display: block;
  margin-top: 5px;
  font-size: 1.15rem;
}

.monthly-wrap {
  margin-bottom: 14px;
}

.monthly-report-table {
  min-width: 1500px;
}

.monthly-report-table th {
  top: 0;
}

.monthly-report-table td:nth-child(5),
.monthly-report-table th:nth-child(5) {
  min-width: 180px;
}

.signature-row {
  grid-template-columns: repeat(3, 1fr);
}

.signature-row div {
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  background: #fff;
}

.quick-form label,
.tool-panel label,
.login-box label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.quick-form input,
.quick-form select,
.tool-panel input,
.login-box input {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  padding: 8px 9px;
  color: var(--text);
  background: #fff;
}

.quick-form select[multiple] {
  min-height: 132px;
}

.scale-planner {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.weekly-schedule-form {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.weekly-schedule-grid {
  display: grid;
  grid-column: 1 / -1;
  gap: 8px;
}

.weekly-schedule-row {
  display: grid;
  grid-template-columns: minmax(88px, 0.6fr) minmax(120px, 0.8fr) minmax(180px, 1.4fr);
  gap: 8px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
}

.weekly-schedule-row strong {
  font-size: 0.9rem;
}

.quick-form button {
  align-self: end;
  color: #fff;
  border-color: var(--blue-dark);
  background: var(--blue);
}

.form-actions {
  display: flex;
  align-items: end;
  gap: 8px;
  flex-wrap: wrap;
}

.form-section-title {
  grid-column: 1 / -1;
  margin-top: 4px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 800;
}

.quick-form .form-actions button.secondary {
  color: #344054;
  border-color: var(--line-strong);
  background: #fff;
}

.table-wrap {
  overflow: auto;
}

.data-table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
  background: #fff;
}

.data-table th,
.data-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

.data-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: #344054;
  background: #f2f5f8;
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
}

.data-table td {
  font-size: 0.9rem;
}

.data-table tbody tr:hover {
  background: #f7fbff;
}

.row-actions {
  text-align: right;
}

.row-actions button {
  padding: 6px 9px;
  color: #fff;
  border-color: var(--blue-dark);
  background: var(--blue);
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 8px;
  border-radius: 999px;
  color: #344054;
  background: #edf2f7;
  font-size: 0.78rem;
  font-weight: 700;
}

.pill.ok {
  color: #05603a;
  background: #dff6ec;
}

.pill.warn {
  color: #92400e;
  background: #fef3c7;
}

.pill.bad {
  color: #991b1b;
  background: #fee2e2;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 230px;
  color: var(--muted);
  text-align: center;
}

.json-panel {
  overflow: auto;
  margin: 0;
  padding: 14px;
  color: #102033;
  background: #fff;
}

.login-panel {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 18px;
}

.login-box {
  display: grid;
  gap: 12px;
  width: min(380px, 100%);
  padding: 18px;
}

.login-brand {
  margin: -18px -18px 4px;
  color: #fff;
  background: #12385f;
  border-radius: 6px 6px 0 0;
}

.login-box button {
  color: #fff;
  border-color: var(--blue-dark);
  background: var(--blue);
}

.form-message {
  min-height: 20px;
  margin: 0;
  color: var(--red);
  font-size: 0.86rem;
}

.shell {
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  padding: 24px 0;
}

.live-shell {
  padding-top: 34px;
}

.public-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 22px;
  align-items: stretch;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 28px;
  color: var(--text);
  background:
    linear-gradient(135deg, rgba(43, 157, 244, 0.16), transparent 46%),
    var(--surface);
  box-shadow: var(--shadow);
}

.public-hero h1 {
  max-width: 720px;
  font-size: clamp(1.85rem, 4vw, 3rem);
  line-height: 1.05;
}

.public-hero p {
  max-width: 720px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.6;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.primary-link,
.secondary-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  padding: 9px 14px;
  font-weight: 700;
  text-decoration: none;
}

.primary-link {
  color: #fff;
  border-color: #168bd0;
  background: linear-gradient(135deg, #20a4f3, #1269aa);
}

.primary-link:hover {
  background: linear-gradient(135deg, #38b6ff, #1678be);
}

.secondary-link {
  color: var(--text);
  background: var(--surface-soft);
}

.hero-summary {
  display: grid;
  place-content: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  text-align: center;
  background: rgba(255, 255, 255, 0.03);
}

.hero-summary .brand-mark {
  margin: 0 auto 6px;
}

.hero-summary strong {
  font-size: 1.2rem;
}

.hero-summary small {
  color: var(--muted);
}

.live-statusbar h2 {
  font-size: 1.1rem;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 14px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--blue);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
}

h1 {
  font-size: 1.65rem;
}

h2 {
  font-size: 1.1rem;
}

.status-card {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 190px;
  padding: 12px;
}

.status-dot {
  width: 11px;
  height: 11px;
  border-radius: 999px;
  background: var(--red);
}

.status-dot.online {
  background: var(--green);
}

.status-dot.offline {
  background: var(--red);
}

.metric-card {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 82px;
  padding: 14px;
}

.icon,
.event-badge {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: 4px;
  color: #fff;
  background: var(--blue);
  font-weight: 700;
}

.events-panel {
  min-height: 380px;
  padding: 14px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

.nav-link {
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  padding: 8px 12px;
  color: var(--blue);
  background: #fff;
  text-decoration: none;
}

.events-list {
  display: grid;
  gap: 8px;
}

.event-card {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
}

.event-card.is-new {
  border-color: var(--blue);
}

.event-content {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.event-content strong {
  overflow-wrap: anywhere;
}

.event-type {
  width: fit-content;
  padding: 2px 7px;
  border-radius: 999px;
  color: #073d73;
  background: var(--blue-soft);
  font-size: 0.76rem;
  font-weight: 700;
}

.event-content span:not(.event-type),
.event-content small,
.status-card span:not(.status-dot) {
  color: var(--muted);
}

[hidden] {
  display: none !important;
}

@media (max-width: 940px) {
  .app-frame {
    grid-template-columns: 1fr;
  }

  .public-hero {
    grid-template-columns: 1fr;
    padding: 22px;
  }

  .app-sidebar {
    position: static;
    height: auto;
  }

  .nav-groups {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 8px;
  }

  .app-topbar,
  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions,
  .tool-panel {
    align-items: stretch;
  }

  .top-actions > *,
  .tool-panel > * {
    width: 100%;
  }
}

@media (max-width: 620px) {
  .content-area {
    padding: 12px;
  }

  .notice {
    margin: 12px 12px 0;
  }

  .dashboard-grid,
  .metrics {
    grid-template-columns: 1fr;
  }

  .weekly-schedule-row {
    grid-template-columns: 1fr;
  }
}

/* Painel RH: overrides visuais para um estilo de app empresarial simples. */
.app-frame {
  grid-template-columns: 236px minmax(0, 1fr);
}

.app-sidebar {
  background: linear-gradient(180deg, #0f3158 0%, #102c4c 52%, #0b213a 100%);
  border-right-color: #071b30;
}

.brand-mark {
  background: #1f9dd6;
}

.nav-groups button {
  margin: 2px 0;
  padding: 9px 10px;
}

.nav-groups button.active {
  background: #168bd0;
  box-shadow: inset 3px 0 0 #7dd3fc;
}

.app-topbar {
  padding: 10px 20px;
}

.content-area {
  padding: 18px 20px 24px;
}

.kpi {
  position: relative;
  min-height: 86px;
  overflow: hidden;
  color: #fff;
  border: 0;
  border-radius: 5px;
  box-shadow: 0 8px 18px rgba(26, 44, 67, 0.12);
}

.kpi span {
  color: inherit;
  opacity: 0.9;
}

.kpi::after {
  content: "";
  position: absolute;
  right: -20px;
  bottom: 12px;
  width: 88px;
  height: 30px;
  border-radius: 3px;
  transform: rotate(-28deg);
  background: rgba(255, 255, 255, 0.16);
}

.dashboard-grid .kpi:nth-child(12n + 1) { background: #2d9cdb; }
.dashboard-grid .kpi:nth-child(12n + 2) { background: #20b99a; }
.dashboard-grid .kpi:nth-child(12n + 3) { background: #f2994a; }
.dashboard-grid .kpi:nth-child(12n + 4) { background: #eb5757; }
.dashboard-grid .kpi:nth-child(12n + 5) { background: #27ae60; }
.dashboard-grid .kpi:nth-child(12n + 6) { color: #1b2a3a; background: #f2c94c; }
.dashboard-grid .kpi:nth-child(12n + 7) { background: #2f80ed; }
.dashboard-grid .kpi:nth-child(12n + 8) { background: #9b51e0; }
.dashboard-grid .kpi:nth-child(12n + 9) { background: #00a676; }
.dashboard-grid .kpi:nth-child(12n + 10) { background: #ff8a3d; }
.dashboard-grid .kpi:nth-child(12n + 11) { background: #1d4e89; }
.dashboard-grid .kpi:nth-child(12n + 12) { background: #607d8b; }

.report-summary-grid article {
  box-shadow: 0 5px 14px rgba(22, 40, 62, 0.06);
}

.data-table th {
  color: #1d3350;
  background: #edf3f8;
}

.data-table tbody tr:hover {
  background: #eef8ff;
}

.row-actions {
  white-space: nowrap;
}

.row-actions button {
  margin-left: 4px;
}

.toolbar-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 12px 0;
}

.dashboard-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 16px;
  background:
    linear-gradient(90deg, rgba(25, 118, 184, 0.08), transparent 46%),
    #fff;
  box-shadow: var(--shadow);
  animation: dashboardEnter 420ms ease both;
}

.dashboard-hero h2,
.dashboard-section-title h2 {
  margin: 0;
  font-size: 1.15rem;
}

.dashboard-hero p {
  max-width: 680px;
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.dashboard-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.dashboard-actions button {
  color: #fff;
  border-color: #0f5f97;
  background: #168bd0;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.dashboard-actions button:hover {
  transform: translateY(-1px);
  background: #0f75b4;
  box-shadow: 0 8px 18px rgba(15, 95, 151, 0.22);
}

.dashboard-metrics {
  grid-template-columns: repeat(auto-fit, minmax(185px, 1fr));
  margin-bottom: 16px;
}

.dashboard-metrics .kpi {
  min-height: 112px;
  padding: 14px;
  animation: cardEnter 420ms ease both;
  animation-delay: calc(var(--i, 0) * 38ms);
  transition: transform 180ms ease, box-shadow 180ms ease, filter 180ms ease;
}

.dashboard-metrics .kpi strong {
  font-size: 1.85rem;
}

.dashboard-metrics .kpi:hover {
  transform: translateY(-3px);
  filter: saturate(1.04);
  box-shadow: 0 14px 26px rgba(26, 44, 67, 0.18);
}

.dashboard-section-title {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin: 16px 0 10px;
  border-top: 1px solid rgba(151, 164, 183, 0.35);
  padding-top: 14px;
}

.dashboard-section-title small {
  color: var(--muted);
  font-size: 0.82rem;
}

.stats-title {
  border-top: 0;
  padding-top: 0;
}

.stat-card {
  color: #16263a;
  border: 1px solid var(--line);
  background: #fff !important;
}

.stat-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: var(--accent, #2d9cdb);
}

.stat-card::after {
  right: 14px;
  bottom: 16px;
  width: 64px;
  height: 22px;
  background: var(--accent-soft, rgba(45, 156, 219, 0.16));
}

.stat-card:nth-child(1) { --accent: #2d9cdb; --accent-soft: rgba(45, 156, 219, 0.16); }
.stat-card:nth-child(2) { --accent: #20b99a; --accent-soft: rgba(32, 185, 154, 0.16); }
.stat-card:nth-child(3) { --accent: #f2994a; --accent-soft: rgba(242, 153, 74, 0.18); }
.stat-card:nth-child(4) { --accent: #eb5757; --accent-soft: rgba(235, 87, 87, 0.16); }
.stat-card:nth-child(5) { --accent: #27ae60; --accent-soft: rgba(39, 174, 96, 0.16); }
.stat-card:nth-child(6) { --accent: #d09a00; --accent-soft: rgba(242, 201, 76, 0.24); }
.stat-card:nth-child(7) { --accent: #2f80ed; --accent-soft: rgba(47, 128, 237, 0.16); }
.stat-card:nth-child(8) { --accent: #9b51e0; --accent-soft: rgba(155, 81, 224, 0.16); }

.stat-card .stat-label {
  color: #31445c;
  opacity: 1;
  font-weight: 700;
}

.stat-card strong {
  color: var(--accent, #2d9cdb);
}

.stat-card small {
  position: relative;
  z-index: 1;
  color: var(--muted);
  line-height: 1.3;
}

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

.module-card {
  display: grid;
  min-height: 136px;
  align-content: start;
  gap: 9px;
  overflow: hidden;
  position: relative;
  border: 0;
  border-radius: 6px;
  padding: 15px;
  color: #fff;
  text-align: left;
  white-space: normal;
  box-shadow: 0 8px 18px rgba(26, 44, 67, 0.12);
  animation: cardEnter 460ms ease both;
  animation-delay: calc(var(--i, 0) * 34ms);
  transition: transform 180ms ease, box-shadow 180ms ease, filter 180ms ease;
}

.module-card:hover,
.module-card:focus-visible {
  transform: translateY(-4px);
  filter: brightness(1.03) saturate(1.04);
  box-shadow: 0 16px 30px rgba(26, 44, 67, 0.2);
}

.module-card::after {
  content: "";
  position: absolute;
  inset: auto -24px 12px auto;
  width: 96px;
  height: 34px;
  transform: rotate(-28deg);
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.14);
  transition: transform 220ms ease, opacity 220ms ease;
}

.module-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 0%, rgba(255, 255, 255, 0.16) 38%, transparent 58%);
  opacity: 0;
  transform: translateX(-45%);
  transition: opacity 180ms ease, transform 420ms ease;
}

.module-card:hover::after,
.module-card:focus-visible::after {
  transform: translateX(-10px) rotate(-28deg);
}

.module-card:hover::before,
.module-card:focus-visible::before {
  opacity: 1;
  transform: translateX(45%);
}

.module-card strong,
.module-card small,
.module-code,
.module-index,
.module-open {
  position: relative;
  z-index: 1;
}

.module-card strong {
  font-size: 1.02rem;
  line-height: 1.2;
}

.module-card small {
  max-width: 100%;
  opacity: 0.9;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.module-code {
  justify-self: start;
  width: fit-content;
  border-radius: 4px;
  padding: 3px 8px;
  color: inherit;
  background: rgba(255, 255, 255, 0.18);
  font-size: 0.72rem;
  font-weight: 700;
}

.module-index {
  position: absolute;
  top: 13px;
  right: 14px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.78rem;
  font-weight: 700;
}

.module-open {
  align-self: end;
  width: fit-content;
  border-radius: 4px;
  padding: 4px 9px;
  color: #102033;
  background: rgba(255, 255, 255, 0.82);
  font-size: 0.75rem;
  font-weight: 700;
}

.module-card-1 { background: linear-gradient(135deg, #2d9cdb, #1976b8); }
.module-card-2 { background: linear-gradient(135deg, #20b99a, #098a73); }
.module-card-3 { background: linear-gradient(135deg, #f2994a, #ca6f1e); }
.module-card-4 { background: linear-gradient(135deg, #eb5757, #c73535); }
.module-card-5 { background: linear-gradient(135deg, #27ae60, #178247); }
.module-card-6 { background: linear-gradient(135deg, #2f80ed, #1d5fbd); }
.module-card-7 { background: linear-gradient(135deg, #9b51e0, #7431b2); }
.module-card-8 { background: linear-gradient(135deg, #1d4e89, #14365f); }

@keyframes dashboardEnter {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes cardEnter {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

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

@keyframes toastOut {
  to {
    opacity: 0;
    transform: translateY(-8px);
  }
}

@keyframes loadingSpin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .dashboard-hero,
  .dashboard-metrics .kpi,
  .module-card,
  .loading-spinner {
    animation: none;
  }

  .dashboard-actions button,
  .dashboard-metrics .kpi,
  .module-card,
  .module-card::before,
  .module-card::after {
    transition: none;
  }
}

@media (max-width: 940px) {
  .app-frame {
    grid-template-columns: 1fr;
  }

  .app-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 40;
    width: min(280px, 86vw);
    box-shadow: 18px 0 36px rgba(0, 0, 0, 0.28);
  }

  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 30;
    border: 0;
    border-radius: 0;
    padding: 0;
    background: rgba(0, 0, 0, 0.42);
  }

  body.admin-page:not(.sidebar-collapsed) .sidebar-backdrop {
    display: block;
  }

  .app-topbar {
    position: sticky;
    top: 0;
    z-index: 20;
  }

  .dashboard-grid,
  .metrics {
    grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  }

  .dashboard-hero {
    align-items: stretch;
    flex-direction: column;
  }
}

/* Dark mode principal: painel de operacao serio, com estatisticas e acoes bem separadas. */
:root {
  color-scheme: dark;
  --bg: #07111f;
  --surface: #0f1b2d;
  --surface-soft: #132237;
  --line: #22344d;
  --line-strong: #36516f;
  --text: #e8f0fb;
  --muted: #99acc3;
  --blue: #2b9df4;
  --blue-dark: #1671b5;
  --blue-soft: #132f4f;
  --green: #2bd092;
  --amber: #f4bd42;
  --red: #ef5b65;
  --shadow: 0 18px 36px rgba(0, 0, 0, 0.24);
}

body.admin-page {
  color: var(--text);
  background: #07111f;
}

.app-main {
  background:
    linear-gradient(180deg, #0a1424 0%, #07111f 42%, #091522 100%);
}

.app-sidebar {
  background: linear-gradient(180deg, #071a30 0%, #071426 56%, #050d18 100%);
  border-right-color: #1d334d;
}

.brand {
  background: rgba(255, 255, 255, 0.02);
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

.brand-mark {
  background: #20a4f3;
  box-shadow: 0 0 0 3px rgba(32, 164, 243, 0.16);
}

.nav-groups h3 {
  color: #7fa1c5;
}

.nav-groups button {
  color: #dbe9f8;
}

.nav-groups button:hover {
  background: rgba(255, 255, 255, 0.08);
}

.nav-groups button.active {
  color: #fff;
  background: linear-gradient(90deg, #168bd0, #0f6dad);
  box-shadow: inset 3px 0 0 #7dd3fc, 0 8px 18px rgba(0, 0, 0, 0.2);
}

.app-topbar {
  background: #08111f;
  border-bottom-color: #1e3149;
  box-shadow: none;
}

.top-actions .text-link,
.top-actions #generateAgenda,
.top-actions #refreshButton {
  display: none !important;
}

button,
.button-link {
  color: #e8f0fb;
  border-color: #35516f;
  background: linear-gradient(#17263c, #111d2f);
}

button:hover,
.button-link:hover {
  border-color: #5d83aa;
  background: #18304b;
}

button.secondary {
  color: #dbe9f8;
  background: #111d2f;
}

.global-company-filter select,
.global-store-filter select,
.global-language-filter select {
  color: #e8f0fb;
  background: #0b1525;
  border-color: #36516f;
}

.global-company-filter select:focus,
.global-store-filter select:focus,
.global-language-filter select:focus {
  outline: 2px solid rgba(32, 164, 243, 0.32);
  border-color: #20a4f3;
}

.notice {
  color: #c7d7e8;
  background: #0d1828;
  border-color: #263a55;
  border-left-color: #20a4f3;
}

.toast {
  color: #dce9f8;
  background: #0f1b2d;
  border-color: #263a55;
}

.notice.error {
  color: #ff9aa1;
}

.dashboard-hero,
.form-drawer,
.tool-panel,
.table-wrap,
.empty-state,
.json-panel,
.login-box,
.report-cover,
.report-summary-grid article,
.signature-row div,
.events-panel,
.status-card,
.metric-card {
  color: var(--text);
  background: #0f1b2d;
  border-color: #263a55;
  box-shadow: var(--shadow);
}

.dashboard-hero {
  background:
    linear-gradient(90deg, rgba(32, 164, 243, 0.11), transparent 52%),
    #0f1b2d;
}

.dashboard-hero p,
.auto-sync-state,
.dashboard-section-title small,
.report-cover span,
.report-summary-grid span,
.signature-row span,
.quick-form label,
.tool-panel label,
.login-box label,
.kpi span,
.label,
.section-label {
  color: var(--muted);
}

.auto-sync-state {
  display: block;
  margin-top: 8px;
  font-size: 0.8rem;
}

.dashboard-actions button {
  color: #fff;
  border-color: #1784cc;
  background: linear-gradient(135deg, #20a4f3, #1269aa);
}

.dashboard-actions button:hover {
  background: linear-gradient(135deg, #38b6ff, #1678be);
  box-shadow: 0 12px 24px rgba(32, 164, 243, 0.22);
}

.dashboard-section-title {
  border-top-color: #263a55;
}

.stats-title {
  margin-top: 6px;
}

.actions-title {
  margin-top: 22px;
}

.stat-card {
  min-height: 106px;
  color: var(--text);
  border: 1px solid #2b405c;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent),
    #101d30 !important;
}

.stat-card::before {
  width: 4px;
  background: var(--accent, #2d9cdb);
}

.stat-card::after {
  right: 12px;
  bottom: 12px;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  transform: none;
  background: color-mix(in srgb, var(--accent, #2d9cdb) 24%, transparent);
}

.stat-card .stat-label {
  color: #c9d8eb;
}

.stat-card strong {
  color: var(--accent, #2d9cdb);
}

.stat-card small {
  color: #8fa5bd;
}

.module-card {
  min-height: 146px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 14px 26px rgba(0, 0, 0, 0.2);
}

.module-card:hover,
.module-card:focus-visible {
  filter: saturate(1.08);
  box-shadow: 0 20px 34px rgba(0, 0, 0, 0.28);
}

.module-card::before {
  display: none;
}

.module-card::after {
  width: 72px;
  height: 72px;
  right: -22px;
  bottom: -18px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.13);
}

.module-code,
.module-open {
  background: rgba(255, 255, 255, 0.16);
}

.module-open {
  color: #fff;
}

.module-card-1 { background: linear-gradient(135deg, #168bd0, #0f5f97); }
.module-card-2 { background: linear-gradient(135deg, #20b99a, #087763); }
.module-card-3 { background: linear-gradient(135deg, #f2994a, #a85618); }
.module-card-4 { background: linear-gradient(135deg, #eb5757, #9f252b); }
.module-card-5 { background: linear-gradient(135deg, #27ae60, #126b39); }
.module-card-6 { background: linear-gradient(135deg, #2f80ed, #174f9f); }
.module-card-7 { background: linear-gradient(135deg, #9b51e0, #60309a); }
.module-card-8 { background: linear-gradient(135deg, #255d9a, #12365f); }

.brand-mark.attendance-icon {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.16), transparent 45%),
    #f7fbff;
  border-color: rgba(125, 211, 252, 0.6);
  box-shadow: 0 0 0 3px rgba(32, 164, 243, 0.14);
}

.brand-mark.attendance-icon::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 7px;
  width: 16px;
  height: 18px;
  border: 3px solid #172b72;
  border-radius: 9px 9px 7px 7px;
  clip-path: polygon(0 0, 100% 0, 100% 78%, 50% 100%, 0 78%);
}

.brand-mark.attendance-icon::after {
  content: "";
  position: absolute;
  right: 7px;
  top: 9px;
  width: 13px;
  height: 18px;
  border-right: 3px solid #172b72;
  border-bottom: 3px solid #172b72;
  background:
    linear-gradient(135deg, transparent 45%, #172b72 46% 58%, transparent 59%) 0 1px / 13px 7px no-repeat,
    linear-gradient(135deg, transparent 45%, #172b72 46% 58%, transparent 59%) 0 9px / 13px 7px no-repeat;
}

.quick-form input,
.quick-form select,
.tool-panel input,
.login-box input,
textarea {
  color: var(--text);
  background: #0b1525;
  border-color: #36516f;
}

.quick-form input:focus,
.quick-form select:focus,
.tool-panel input:focus,
.login-box input:focus,
textarea:focus {
  outline: 2px solid rgba(32, 164, 243, 0.32);
  border-color: #20a4f3;
}

.form-drawer summary {
  color: #b6dfff;
  border-bottom-color: #263a55;
}

.quick-form button {
  border-color: #1784cc;
  background: #168bd0;
}

.quick-form .form-actions button.secondary {
  color: #dbe9f8;
  background: #111d2f;
}

.data-table {
  background: #0f1b2d;
}

.data-table th {
  color: #d7e6f7;
  background: #132237;
  border-bottom-color: #2d4562;
}

.data-table td {
  color: #dbe7f5;
  border-bottom-color: #22344d;
}

.data-table tbody tr:hover {
  background: #15263d;
}

.row-actions button {
  border-color: #1784cc;
  background: #1679bd;
}

.row-actions button.danger {
  border-color: #934046;
  background: #a8323b;
}

.row-actions button.danger:hover {
  border-color: #d95d66;
  background: #c33b45;
}

.pill {
  color: #dbe7f5;
  background: #23344c;
}

.pill.ok {
  color: #9cf2c9;
  background: rgba(43, 208, 146, 0.14);
}

.pill.warn {
  color: #ffe08a;
  background: rgba(244, 189, 66, 0.14);
}

.pill.bad {
  color: #ffa4ab;
  background: rgba(239, 91, 101, 0.14);
}

.json-panel {
  color: #c7d7e8;
}

.signature-row div {
  background: #0f1b2d;
}

.filter-chip {
  min-height: 38px;
  border: 1px solid rgba(125, 163, 204, 0.28);
  border-radius: 6px;
  padding: 4px 6px 4px 10px;
  background: rgba(255, 255, 255, 0.04);
}

.filter-chip span {
  color: #b9cbe0;
}

.weekly-schedule-form {
  align-items: start;
}

.weekly-schedule-grid {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px;
  background: #fff;
}

.weekly-schedule-row {
  min-height: 48px;
}

.weekly-schedule-row select:disabled {
  color: var(--muted);
  background: #eef2f6;
}

.status-card .pill,
.data-table .pill {
  min-width: 72px;
  text-align: center;
}

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

  .public-hero {
    padding: 18px;
  }

  .hero-actions {
    display: grid;
  }

  .live-statusbar {
    align-items: stretch;
    flex-direction: column;
  }
}
