:root {
  color-scheme: light;
  --background: #f4f6f8;
  --surface: #ffffff;
  --surface-strong: #eef3f6;
  --text: #17212b;
  --muted: #657384;
  --line: #d9e0e7;
  --brand: #16746b;
  --brand-dark: #0f5c55;
  --accent: #c66a32;
  --danger: #b84242;
  --shadow: 0 18px 45px rgba(23, 33, 43, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--background);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

body.login-active {
  background: #030405;
}

body.legal-page {
  background: #030405;
}

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

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.legal-shell {
  width: min(900px, calc(100% - 32px));
  margin: 0 auto;
  padding: 36px 0 56px;
  color: #edf3f7;
}

.legal-logo {
  display: block;
  width: min(260px, 70vw);
  margin-bottom: 28px;
  border-radius: 8px;
}

.legal-shell h1 {
  margin: 0 0 8px;
  font-size: clamp(2rem, 5vw, 3.2rem);
}

.legal-shell h2 {
  margin: 26px 0 8px;
  color: #f2b84b;
  font-size: 1.15rem;
}

.legal-shell p {
  max-width: 75ch;
  color: #c9d4dd;
  line-height: 1.65;
}

.legal-back {
  display: inline-flex;
  margin-top: 28px;
  padding: 12px 18px;
  border-radius: 8px;
  background: #f2b84b;
  color: #111820;
  font-weight: 800;
  text-decoration: none;
}

.auth-shell {
  display: flex;
  justify-content: center;
  width: 100%;
  min-height: 100vh;
  margin: 0 auto;
  padding: 24px;
  align-items: center;
  background:
    radial-gradient(circle at 50% 28%, rgba(201, 138, 0, 0.2), transparent 30%),
    #030405;
}

.role-choice {
  width: min(1180px, 100%);
  min-height: 92vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 28px;
  padding: 20px;
}

.brand-image {
  display: block;
  width: min(260px, 72vw);
  height: auto;
  border-radius: 8px;
}

.hero-logo {
  width: min(1080px, 96vw);
  border-radius: 16px;
  box-shadow:
    0 0 0 1px rgba(255, 227, 122, 0.16),
    0 28px 80px rgba(0, 0, 0, 0.48);
}

.panel-logo {
  width: 190px;
  margin-bottom: 18px;
}

.role-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr));
  gap: 16px;
  width: min(780px, 100%);
}

.role-button {
  min-height: 62px;
  border: 1px solid rgba(255, 240, 166, 0.42);
  border-radius: 8px;
  background: linear-gradient(135deg, #8e5d00 0%, #f4c44e 46%, #a46a00 100%);
  color: #061b2d;
  font-size: 1rem;
  font-weight: 900;
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.34);
}

.role-button:hover {
  background: linear-gradient(135deg, #b87600 0%, #ffe37a 48%, #b87600 100%);
}

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

.auth-panel {
  width: min(760px, 100%);
  padding: 22px;
}

.back-button {
  min-height: 38px;
  margin-bottom: 14px;
  border: 0;
  border-radius: 6px;
  padding: 0 14px;
  background: var(--surface-strong);
  color: #263442;
  font-weight: 850;
}

.platform-access-button,
.reset-button {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  padding: 0 14px;
  font-weight: 900;
}

.platform-access-button {
  background: linear-gradient(135deg, #0f5c55, #18a091);
  color: #fff;
  box-shadow: 0 10px 24px rgba(15, 92, 85, 0.24);
}

.reset-button {
  background: var(--surface-strong);
  color: #263442;
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 6px;
  margin-bottom: 18px;
  border-radius: 8px;
  background: var(--surface-strong);
}

.auth-tab {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 850;
}

.auth-tab.active {
  background: #fff;
  color: var(--text);
  box-shadow: 0 6px 18px rgba(23, 33, 43, 0.08);
}

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

.auth-form h2 {
  margin: 0;
  font-size: 1.7rem;
}

.helper-text {
  margin: -4px 0 2px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.provider-button {
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font-weight: 850;
}

.provider-button.apple {
  background: #17212b;
  border-color: #17212b;
  color: #fff;
}

.provider-button span {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: var(--surface-strong);
  color: var(--brand-dark);
  font-weight: 900;
}

.provider-button.apple span {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.divider {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 750;
}

.divider::before,
.divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--line);
}

.form-message {
  min-height: 20px;
  margin: 0;
  color: var(--danger);
  font-size: 0.88rem;
  font-weight: 750;
}

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

.topbar {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 24px;
  padding: 26px;
  background: #17212b;
  color: #fff;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.topbar h1,
.panel h2 {
  margin: 0;
}

.topbar h1 {
  font-size: clamp(2rem, 4vw, 4.2rem);
  line-height: 1;
}

.current-user {
  margin: 12px 0 0;
  color: #cbd4dc;
  font-weight: 700;
}

.topbar-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: stretch;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(96px, 1fr));
  gap: 12px;
  min-width: min(420px, 100%);
}

.metric {
  display: grid;
  align-content: center;
  min-height: 96px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
}

.metric span {
  font-size: 2rem;
  font-weight: 850;
}

.metric small {
  color: #cbd4dc;
}

.logout-button {
  min-width: 74px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.09);
  color: #fff;
  font-weight: 850;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 24px;
  margin-top: 24px;
}

.admin-panel {
  margin-top: 24px;
  padding: 22px;
}

.password-panel {
  margin-top: 24px;
  padding: 22px;
}

.password-form {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin-top: 16px;
}

.technician-tickets {
  margin-top: 24px;
}

.ticket-board {
  display: grid;
  grid-template-columns: repeat(5, minmax(200px, 1fr));
  gap: 16px;
}

.ticket-column {
  padding: 18px;
  min-width: 0;
}

.ticket-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.ticket-card {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafb;
}

.ticket-card span,
.ticket-card small,
.ticket-empty {
  color: var(--muted);
}

.ticket-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.ticket-rat-field {
  display: grid;
  gap: 5px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
}

.ticket-rat-field input {
  min-height: 38px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.company-create-form {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(160px, 0.8fr) minmax(180px, 1fr) minmax(160px, 0.8fr) auto;
  gap: 12px;
  align-items: end;
  margin-top: 16px;
}

.form-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 22px;
  align-self: start;
}

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

label {
  display: grid;
  gap: 7px;
  color: #354252;
  font-size: 0.9rem;
  font-weight: 750;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  background: #fff;
  color: var(--text);
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(22, 116, 107, 0.14);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.primary-button,
.ghost-button,
.danger-button,
.action-button {
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  font-weight: 800;
}

.primary-button {
  margin-top: 4px;
  background: var(--brand);
  color: #fff;
}

.primary-button:hover {
  background: var(--brand-dark);
}

.danger-button {
  margin-top: 4px;
  padding: 0 14px;
  background: var(--danger);
  color: #fff;
}

.danger-button:hover {
  background: #9f2f2f;
}

.ghost-button {
  padding: 0 14px;
  background: var(--surface-strong);
  color: #263442;
}

.list-panel {
  min-width: 0;
  overflow: hidden;
}

.list-heading {
  align-items: end;
  padding: 22px;
  border-bottom: 1px solid var(--line);
}

.filters {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 140px;
  gap: 10px;
  width: min(620px, 100%);
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
}

th,
td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  background: #f8fafb;
  color: #526172;
  font-size: 0.78rem;
  letter-spacing: 0;
  text-transform: uppercase;
}

td {
  color: #24313f;
}

.name-cell {
  display: grid;
  gap: 3px;
}

.name-cell strong {
  font-size: 0.98rem;
}

.name-cell span,
.contact-cell span {
  color: var(--muted);
  font-size: 0.84rem;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 850;
}

.status-ativo {
  background: rgba(22, 116, 107, 0.12);
  color: var(--brand-dark);
}

.status-inativo {
  background: rgba(184, 66, 66, 0.12);
  color: var(--danger);
}

.status-ferias {
  background: rgba(198, 106, 50, 0.14);
  color: #8b461f;
}

.status-cell {
  display: grid;
  gap: 6px;
}

.status-select {
  min-height: 34px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font-weight: 750;
}

.actions {
  display: flex;
  gap: 8px;
  white-space: nowrap;
}

.action-button {
  padding: 0 10px;
  background: #edf2f5;
  color: #1f2b37;
}

.action-button.delete {
  background: rgba(184, 66, 66, 0.1);
  color: var(--danger);
}

.action-button.pay {
  background: rgba(22, 116, 107, 0.1);
  color: var(--brand-dark);
}

.action-button.warning {
  background: rgba(198, 153, 68, 0.16);
  color: #8a681f;
}

.service-panel {
  margin-top: 24px;
  padding: 22px;
}

.report-panel {
  margin-top: 24px;
  padding: 22px;
}

.report-form {
  display: grid;
  grid-template-columns: minmax(150px, 0.8fr) minmax(150px, 0.8fr) minmax(220px, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin-top: 16px;
}

.invoice-box {
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.invoice-heading h3 {
  margin: 0;
  font-size: 1.1rem;
}

.integration-badge {
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(198, 153, 68, 0.16);
  color: #8a681f;
  font-size: 0.78rem;
  font-weight: 850;
}

.invoice-issuer {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 750;
}

.invoice-box.locked .invoice-form,
.invoice-box.locked .invoice-cancel-form {
  opacity: 0.48;
}

.invoice-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(170px, 1fr));
  gap: 12px;
  align-items: end;
  margin-top: 16px;
}

.invoice-description {
  grid-column: span 3;
}

.invoice-lookup-message,
.cpf-lookup-message,
.lookup-message {
  min-height: 18px;
  margin: -6px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
}

.invoice-cancel-box {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px dashed var(--line);
}

.invoice-cancel-box h4 {
  margin: 0;
  font-size: 1rem;
}

.invoice-cancel-form {
  display: grid;
  grid-template-columns: minmax(180px, 0.9fr) minmax(260px, 1.4fr) auto;
  gap: 12px;
  align-items: end;
  margin-top: 12px;
}

.service-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 12px;
  align-items: end;
  margin-top: 16px;
}

.service-form .primary-button {
  min-height: 44px;
}

.file-field input {
  padding-top: 9px;
}

.service-table-wrap {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.service-table-wrap table {
  min-width: 1120px;
}

.rat-link {
  color: var(--brand-dark);
  font-weight: 850;
  text-decoration: none;
}

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

.empty-state {
  display: none;
  padding: 36px 22px;
  text-align: center;
  color: var(--muted);
}

.empty-state strong,
.empty-state span {
  display: block;
}

.empty-state strong {
  margin-bottom: 6px;
  color: var(--text);
}

@media (max-width: 1080px) {
  .topbar,
  .workspace,
  .list-heading,
  .topbar-actions,
  .company-create-form,
  .password-form,
  .service-form,
  .invoice-form,
  .invoice-cancel-form,
  .report-form,
  .ticket-board {
    grid-template-columns: 1fr;
  }

  .invoice-description {
    grid-column: auto;
  }

  .topbar,
  .list-heading {
    display: grid;
  }

  .workspace {
    display: grid;
  }

  .summary-grid {
    min-width: 0;
  }

  .logout-button {
    min-height: 42px;
  }
}

@media (max-width: 680px) {
  .auth-shell,
  .app-shell {
    padding: 14px;
  }

  .auth-shell {
    padding: 12px;
  }

  .topbar,
  .form-panel,
  .list-heading {
    padding: 18px;
  }

  .summary-grid,
  .field-row,
  .filters,
  .auth-tabs,
  .role-actions {
    grid-template-columns: 1fr;
  }

  .role-choice {
    min-height: 94vh;
    padding: 8px;
    gap: 18px;
  }

  .hero-logo {
    width: min(1120px, 98vw);
  }

  .role-button {
    min-height: 54px;
  }

  .topbar h1 {
    font-size: 2.2rem;
  }
}
