*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  font-family: var(--font-family-text);
  font-size: var(--font-size-default);
  color: var(--totvs-blue-dark);
  background: var(--color-neutral-light-05, #f4f7f9);
}

a {
  color: var(--totvs-blue-dark);
}

.brand-mark,
.totvs-mark {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--totvs-blue-dark);
  text-decoration: none;
}

.brand-mark img {
  display: block;
  width: 48px;
  height: 48px;
  object-fit: contain;
  background: var(--totvs-white);
  border-radius: 8px;
}

.topbar-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.topbar-brand img {
  width: 22px;
  height: 22px;
  object-fit: contain;
  background: var(--totvs-white);
  border-radius: 4px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--totvs-blue-dark);
  padding-bottom: 0.85rem;
}

.brand-logo {
  width: 36px;
  height: 36px;
  object-fit: contain;
  background: var(--totvs-white);
  border-radius: 6px;
}

/* —— Login (TOTVS License Server Monitor) —— */
body.login-body {
  min-height: 100vh;
  background: linear-gradient(160deg, var(--totvs-blue-dark) 0%, #005f73 48%, var(--totvs-blue) 100%);
}

.support-btn {
  position: fixed;
  top: 1rem;
  right: 1rem;
  width: 2.5rem;
  height: 2.5rem;
  border: 0;
  border-radius: 4px;
  background: var(--totvs-white);
  color: var(--totvs-blue-dark);
  font-weight: 700;
  cursor: default;
  box-shadow: var(--shadow-md, 0 4px 8px rgba(0, 0, 0, 0.12));
}

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem 1rem;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--totvs-white);
  border-radius: 4px;
  overflow: hidden;
  box-shadow: var(--shadow-xl, 0 16px 24px rgba(0, 0, 0, 0.12));
}

.login-card__header {
  background: #ececee;
  padding: 1.1rem 1.5rem;
}

.login-card__body {
  padding: 1.5rem 1.75rem 1.75rem;
}

.login-card h1 {
  margin: 0 0 0.35rem;
  font-family: var(--font-family-heading);
  font-size: 1.5rem;
  font-weight: 700;
}

.login-card .lede {
  margin: 0 0 1.25rem;
  color: #515162;
  font-size: 0.95rem;
  line-height: 1.4;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

.field label {
  font-size: 0.875rem;
  font-weight: 600;
}

.ani-field {
  font-family: var(--font-family-text);
  font-size: 1rem;
  color: var(--totvs-blue-dark);
  background: var(--totvs-white);
  padding: 8px 16px;
  border: 1px solid #b4b4c0;
  border-radius: 4px;
  min-height: 2.75em;
  width: 100%;
}

.ani-field:hover {
  border-color: var(--totvs-blue-dark);
}

.ani-field:focus {
  border-color: var(--totvs-blue);
  outline: 4px solid var(--totvs-blue);
  outline-offset: 2px;
}

.forgot {
  display: inline-block;
  margin: 0.15rem 0 1.25rem;
  font-size: 0.875rem;
  color: #0a66c2;
}

.login-actions {
  display: flex;
  justify-content: flex-end;
}

.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  height: 2.75em;
  min-height: 2.75em;
  padding: 0 1.25rem;
  border: 1px solid var(--totvs-blue-dark);
  border-radius: 4px;
  background: var(--totvs-blue-dark);
  color: var(--totvs-white);
  font-family: var(--font-family-text);
  font-size: 0.9375rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
}

.btn:hover {
  background: #00364d;
  border-color: #00364d;
}

.btn:focus-visible {
  outline: 4px solid var(--totvs-blue);
  outline-offset: 2px;
}

.btn:active {
  background: #00141f;
}

.btn-danger {
  background: var(--color-feedback-negative-dark, #9b2d27);
  border-color: var(--color-feedback-negative-dark, #9b2d27);
}

.btn-danger:hover {
  background: var(--color-feedback-negative-darker, #72211d);
  border-color: var(--color-feedback-negative-darker, #72211d);
}

.btn-ghost {
  height: 2.25em;
  min-height: 2.25em;
  background: transparent;
  border-color: #d0d0d7;
  color: var(--totvs-blue-dark);
  font-weight: 600;
}

.btn-ghost:hover {
  background: #e6faff;
  border-color: var(--totvs-blue-dark);
}

.btn-sm {
  height: 2em;
  min-height: 2em;
  padding: 0 0.75rem;
  font-size: 0.8125rem;
}

.error {
  color: var(--color-feedback-negative-dark, #9b2d27);
  font-size: 0.875rem;
  margin: 0 0 0.75rem;
}

/* —— App shell —— */
.topbar {
  height: 36px;
  background: var(--totvs-blue-dark);
  color: var(--totvs-white);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  font-size: 0.8rem;
}

.topbar span {
  opacity: 0.9;
}

.header {
  background: var(--totvs-white);
  border-bottom: 1px solid #d0d0d7;
  padding: 0.75rem 1.5rem 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: end;
  gap: 1rem;
}

.brand em {
  font-style: normal;
  font-weight: 400;
  color: #515162;
}

.tabs {
  display: flex;
  gap: 1.75rem;
}

.tabs a,
.tabs button {
  appearance: none;
  background: none;
  border: 0;
  font: inherit;
  font-weight: 600;
  color: #515162;
  padding: 0.6rem 0 0.85rem;
  cursor: pointer;
  text-decoration: none;
  position: relative;
}

.tabs a.is-active,
.tabs button.is-active {
  color: var(--totvs-blue-dark);
}

.tabs a.is-active::after,
.tabs button.is-active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: var(--totvs-blue);
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.85rem;
  font-size: 0.8rem;
  color: #515162;
  padding-bottom: 0.7rem;
}

.main {
  padding: 1.25rem 1.5rem 2.5rem;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.card {
  background: var(--totvs-white);
  border: 1px solid #d0d0d7;
  border-radius: 2px;
  padding: 1rem 1.1rem;
  min-height: 120px;
}

.card h2 {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 600;
  color: #515162;
}

.card .metric {
  margin-top: 0.6rem;
  font-size: 2.4rem;
  font-weight: 700;
  color: var(--totvs-blue-dark);
  line-height: 1;
}

.card .hint {
  margin-top: 0.45rem;
  font-size: 0.8rem;
  color: #69697c;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin: 0.5rem 0 0.75rem;
}

.section-head h1 {
  margin: 0;
  font-size: 1.35rem;
}

.subtabs {
  display: flex;
  border-bottom: 1px solid #d0d0d7;
  margin-bottom: 1rem;
}

.subtabs button {
  appearance: none;
  background: none;
  border: 0;
  font: inherit;
  font-weight: 600;
  color: #515162;
  padding: 0.65rem 1.1rem;
  cursor: pointer;
  border-bottom: 3px solid transparent;
}

.subtabs button.is-active {
  color: var(--totvs-blue-dark);
  border-bottom-color: var(--totvs-blue);
}

.panel {
  display: none;
}

.panel.is-active {
  display: block;
}

.issue-form,
.stack-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: flex-end;
  margin-bottom: 1rem;
}

.issue-form .field,
.stack-form .field {
  margin: 0;
  min-width: 160px;
}

.date-presets {
  display: flex;
  gap: 0.35rem;
  margin-top: 0.35rem;
}

.preset {
  appearance: none;
  border: 1px solid #d0d0d7;
  background: var(--totvs-white);
  color: var(--totvs-blue-dark);
  border-radius: 4px;
  padding: 0.2rem 0.5rem;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}

.preset:hover {
  border-color: var(--totvs-blue-dark);
  background: #e6faff;
}

.field-action {
  min-width: auto;
}

.field-action .btn {
  width: auto;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--totvs-white);
  font-size: 0.875rem;
}

.data-table th {
  background: #3d4a54;
  color: var(--totvs-white);
  font-weight: 600;
  text-align: left;
  padding: 0.55rem 0.7rem;
}

.data-table td {
  padding: 0.5rem 0.7rem;
  border-bottom: 1px solid #e3e9ee;
}

.data-table tbody tr:nth-child(even) {
  background: #eef7fb;
}

.data-table tbody tr:hover:not(.is-empty) {
  background: #e6faff;
}

.data-table tbody tr.is-empty,
.data-table tbody tr.is-empty:nth-child(even) {
  background: var(--totvs-white);
  font-weight: 400;
}

.data-table code {
  font-family: var(--font-family-code);
}

.inline {
  display: inline;
  margin: 0;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: flex-end;
  align-items: center;
}

.muted {
  color: #69697c;
}

body.has-page-slide {
  overflow: hidden;
}

.page-slide {
  position: fixed;
  inset: 0;
  z-index: 80;
  visibility: hidden;
  pointer-events: none;
}

.page-slide.is-open {
  visibility: visible;
  pointer-events: auto;
}

.page-slide__overlay {
  position: absolute;
  inset: 0;
  background: #1d1d29;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.page-slide.is-open .page-slide__overlay {
  opacity: 0.7;
}

.page-slide__panel {
  position: absolute;
  top: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  width: min(50%, 640px);
  min-width: min(100%, 360px);
  height: 100%;
  background: var(--totvs-white);
  border-radius: 4px 0 0 4px;
  box-shadow: -8px 0 24px rgba(0, 34, 51, 0.18);
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.3, 0, 0.1, 1);
}

.page-slide.is-open .page-slide__panel {
  transform: translateX(0);
}

.page-slide__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #d0d0d7;
}

.page-slide__header h2 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--totvs-blue-dark);
}

.page-slide__subtitle {
  margin: 0.25rem 0 0;
  font-size: 0.8125rem;
  color: #69697c;
}

.page-slide__close {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--totvs-blue-dark);
  font-size: 1.75rem;
  line-height: 1;
  width: 2rem;
  height: 2rem;
  cursor: pointer;
  border-radius: 4px;
}

.page-slide__close:hover {
  background: #e6faff;
}

.page-slide__body {
  flex: 1;
  overflow: auto;
  padding: 1.25rem;
}

.slide-form {
  display: none;
  flex-direction: column;
  gap: 0.85rem;
}

.slide-form.is-active {
  display: flex;
}

.slide-form .field {
  min-width: 0;
  width: 100%;
}

.page-slide__footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem 1.5rem;
  border-top: 1px solid #d0d0d7;
}

.page-slide__footer .btn-ghost {
  height: 2.75em;
  min-height: 2.75em;
  border-color: var(--totvs-blue-dark);
}

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

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

  .toolbar {
    justify-content: flex-start;
  }
}
