:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-strong: #eef6f9;
  --ink: #33373d;
  --muted: #686c72;
  --line: #d8dee5;
  --graphite: #585858;
  --green: #009040;
  --blue-deep: #004870;
  --blue: #0080c0;
  --yellow: #f0c800;
  --red: #b80010;
  --amber: #a86f00;
  --shadow: 0 18px 45px rgba(51, 55, 61, 0.11);
  --font: Arial, Helvetica, sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-weight: 400;
}

button,
input,
select,
textarea {
  font: inherit;
  font-weight: 400;
}

button {
  cursor: pointer;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px clamp(18px, 4vw, 56px);
  border-bottom: 1px solid rgba(216, 222, 229, 0.9);
  background: rgba(246, 247, 249, 0.92);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  color: inherit;
  text-decoration: none;
}

.brand img {
  display: block;
  width: clamp(154px, 20vw, 242px);
  height: auto;
}

.brand small {
  display: block;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.nav-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.tab-button,
.ghost-button,
.secondary-link {
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  padding: 0 14px;
}

.tab-button.active {
  background: var(--graphite);
  color: #fff;
}

main {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 56px;
}

.hero-shell {
  display: flex;
  justify-content: flex-start;
  padding-bottom: 18px;
}

.eyebrow {
  margin: 0;
  color: var(--green);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 26px;
}

.primary-link,
.primary-button {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  background: var(--blue);
  color: #fff;
  padding: 0 18px;
  font-weight: 500;
  text-decoration: none;
}

.primary-link:hover,
.primary-button:hover {
  background: var(--blue-deep);
}

.secondary-link {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-weight: 400;
}

.primary-link {
  border: 0;
}

.hero-visual {
  margin: 0;
  width: 100%;
}

.hero-visual img {
  display: block;
  width: 100%;
  aspect-ratio: 21 / 7;
  object-fit: cover;
  object-position: left center;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metrics-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  overflow: hidden;
  margin: 0 0 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
}

.metrics-strip article {
  min-height: 96px;
  padding: 18px;
  background: var(--surface);
}

.metrics-strip span {
  display: block;
  color: var(--ink);
  font-size: 30px;
  font-weight: 500;
}

.metrics-strip p {
  margin: 6px 0 0;
  color: var(--muted);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.section-heading h2 {
  margin: 8px 0 0;
  font-size: 28px;
  font-weight: 500;
}

.client-layout,
.module-grid,
.product-grid {
  display: grid;
  gap: 18px;
}

.client-layout,
.ticket-form,
.login-form,
.password-form,
.status-panel,
.management-panel,
.module-card,
.product-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 10px 28px rgba(23, 32, 41, 0.06);
}

.module-grid,
.product-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.module-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.module-card,
.product-card {
  display: grid;
  gap: 12px;
  min-height: 210px;
  padding: 18px;
}

.module-card h2,
.module-card h3,
.product-card h3 {
  margin: 0;
  font-size: 24px;
  font-weight: 500;
}

.module-card p,
.product-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.module-accent {
  display: block;
  width: 46px;
  height: 6px;
  border-radius: 999px;
}

.module-accent.green {
  background: var(--green);
}

.module-accent.blue {
  background: var(--blue);
}

.module-accent.yellow {
  background: var(--yellow);
}

.module-accent.red {
  background: var(--red);
}

.text-action {
  align-self: end;
  justify-self: start;
  min-height: 34px;
  border: 0;
  border-bottom: 2px solid var(--blue);
  background: transparent;
  color: var(--blue-deep);
  padding: 0;
  font-weight: 500;
}

.product-kicker {
  color: var(--green) !important;
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
}

.access-stack {
  display: grid;
  gap: 14px;
}

.ticket-form {
  display: grid;
  gap: 16px;
  padding: 20px;
}

.login-form {
  display: grid;
  gap: 16px;
  padding: 18px;
}

.login-layout {
  display: grid;
  gap: 16px;
}

.internal-login-form {
  margin-bottom: 16px;
}

.internal-access-message {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff7e0;
  color: #755300;
  margin-bottom: 16px;
  padding: 14px 16px;
}

.password-form {
  display: grid;
  gap: 16px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 10px 28px rgba(23, 32, 41, 0.06);
}

.password-form[hidden] {
  display: none;
}

.ticket-form.is-locked,
.password-form.is-locked {
  opacity: 0.55;
}

.session-pill {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  border-radius: 999px;
  background: #f1f2f4;
  color: var(--muted);
  padding: 0 10px;
  font-size: 12px;
  font-weight: 500;
}

.session-pill.active {
  background: #eaf7ef;
  color: var(--green);
}

.form-row {
  display: grid;
  gap: 16px;
}

.form-row.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

label {
  display: grid;
  gap: 7px;
  color: var(--ink);
  font-weight: 500;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  color: var(--ink);
  padding: 12px 13px;
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0, 128, 192, 0.14);
}

.password-field {
  position: relative;
  display: block;
}

.password-field input {
  padding-right: 96px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 8px;
  min-height: 34px;
  transform: translateY(-50%);
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--blue-deep);
  padding: 0 10px;
  font-size: 12px;
  font-weight: 500;
}

.status-panel {
  padding: 18px;
}

.management-panel {
  display: grid;
  gap: 18px;
  padding: 18px;
}

.management-subview[hidden] {
  display: none !important;
}

.management-filters {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr 1.2fr;
  gap: 14px;
}

.management-list {
  display: grid;
  gap: 12px;
}

.ticket-workspace {
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.ticket-navigator {
  display: grid;
  gap: 10px;
  position: sticky;
  top: 84px;
}

.ticket-navigator-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.ticket-navigator-heading h4 {
  margin: 0;
  font-size: 15px;
  font-weight: 500;
}

.ticket-nav-list {
  display: grid;
  gap: 8px;
  max-height: 68vh;
  overflow: auto;
  padding-right: 4px;
}

.ticket-nav-button {
  display: grid;
  gap: 6px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 10px;
  text-align: left;
}

.ticket-nav-button.active {
  border-color: var(--blue);
  box-shadow: inset 3px 0 0 var(--blue);
}

.ticket-nav-button span:first-child {
  font-weight: 500;
}

.ticket-nav-button small {
  color: var(--muted);
  line-height: 1.35;
}

.ticket-detail {
  min-width: 0;
}

.user-form,
.collaborator-form,
.client-form {
  display: grid;
  gap: 16px;
}

.form-row.three {
  grid-template-columns: 2fr 1fr 1fr;
}

.form-row.four {
  grid-template-columns: 2fr 1fr 0.9fr 0.9fr;
}

.user-list,
.collaborator-list {
  display: grid;
  gap: 10px;
}

.company-drilldown {
  display: grid;
  gap: 10px;
}

.client-choice-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 56px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  padding: 10px;
}

.client-choice {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 6px 10px;
  color: var(--ink);
}

.client-choice input {
  width: 16px;
  height: 16px;
}

.muted-note {
  color: var(--muted);
  font-weight: 400;
}

.company-node {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.company-node summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  cursor: pointer;
  padding: 12px;
}

.company-node summary span:first-child {
  margin-right: auto;
  font-weight: 500;
}

.company-users {
  display: grid;
  gap: 6px;
  padding: 0 12px 12px;
}

.drilldown-user {
  display: grid;
  grid-template-columns: 1.4fr 1fr auto;
  gap: 8px;
  align-items: center;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfd;
  color: var(--ink);
  padding: 6px 8px;
  text-align: left;
}

.drilldown-user span:nth-child(2),
.drilldown-user span:nth-child(3) {
  color: var(--muted);
  font-size: 12px;
}

.user-card,
.collaborator-card,
.client-card {
  display: grid;
  grid-template-columns: minmax(180px, 1.5fr) minmax(180px, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.user-card h4,
.user-card p,
.collaborator-card h4,
.collaborator-card p,
.client-card h4,
.client-card p {
  margin: 0;
}

.user-card h4,
.collaborator-card h4,
.client-card h4 {
  font-size: 15px;
  font-weight: 500;
}

.user-card p,
.collaborator-card p,
.client-card p {
  color: var(--muted);
}

.status-active {
  background: #eaf7ef;
  color: var(--green);
}

.status-inactive {
  background: #f1f2f4;
  color: var(--muted);
}

.management-card {
  display: grid;
  gap: 14px;
}

.management-card .ticket-card {
  border-color: #c9d4de;
}

.management-edit {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}

.management-edit .wide-field {
  grid-column: span 2;
}

.management-edit textarea {
  min-height: 44px;
  max-height: 120px;
}

.management-edit input[type="file"] {
  min-height: 44px;
  padding: 10px;
}

.management-edit > button[type="submit"] {
  align-self: end;
  justify-self: stretch;
  min-width: 220px;
}

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

.panel-heading h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 500;
}

.ghost-button {
  border: 1px solid var(--line);
  color: var(--ink);
}

.ticket-list {
  display: grid;
  gap: 12px;
}

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

.ticket-card header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.ticket-card h4 {
  margin: 0;
  font-size: 16px;
  font-weight: 500;
}

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

.meta-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  border-radius: 999px;
  background: var(--surface-strong);
  color: var(--ink);
  padding: 0 9px;
  font-size: 12px;
  font-weight: 500;
}

.pill.priority-Alta {
  background: #fdeeee;
  color: var(--red);
}

.pill.priority-Critica {
  background: var(--red);
  color: #fff;
}

.pill.priority-Media {
  background: #fff8d6;
  color: var(--amber);
}

.pill.priority-Baixa {
  background: #eaf7ef;
  color: var(--green);
}

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

.management-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.small-action {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  padding: 0 10px;
  font-weight: 500;
}

.small-action.strong {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

.small-action.active {
  border-color: var(--graphite);
  background: var(--graphite);
  color: #fff;
}

.attachment-link {
  justify-self: start;
  color: var(--blue-deep);
  font-weight: 500;
  text-decoration-color: rgba(0, 72, 112, 0.35);
  text-underline-offset: 3px;
}

.primary-button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  padding: 22px;
  text-align: center;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  max-width: min(420px, calc(100vw - 44px));
  transform: translateY(20px);
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  padding: 14px 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

@media (max-width: 900px) {
  .topbar,
  .section-heading,
  .client-layout,
  .module-grid,
  .product-grid,
  .management-filters,
  .management-edit,
  .ticket-workspace,
  .form-row.three,
  .form-row.four,
  .user-card,
  .collaborator-card,
  .drilldown-user,
  .hero-shell {
    grid-template-columns: 1fr;
  }

  .topbar,
  .section-heading {
    align-items: stretch;
  }

  .topbar {
    display: grid;
  }

  .nav-tabs {
    overflow-x: auto;
  }

  .hero-shell {
    min-height: auto;
  }

  .ticket-navigator {
    position: static;
  }

  .ticket-nav-list {
    max-height: none;
  }
}

@media (max-width: 620px) {
  main {
    width: min(100% - 24px, 1180px);
    padding-top: 18px;
  }

  .form-row.two,
  .metrics-strip {
    grid-template-columns: 1fr;
  }

  .hero-copy h1 {
    font-size: 38px;
  }

  .hero-visual img {
    aspect-ratio: 16 / 10;
  }

  .tab-button {
    flex: 1 0 auto;
  }
}
