:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-muted: #eef2f5;
  --text: #17212b;
  --muted: #65717e;
  --line: #d8dee5;
  --brand: #f26a00;
  --brand-dark: #c85100;
  --accent: #126c72;
  --warning: #9a6200;
  --success: #1d7444;
  --shadow: 0 14px 34px rgba(23, 33, 43, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}

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

.app-shell {
  min-height: 100vh;
}

.login-screen {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(244, 246, 248, 0.96)),
    var(--bg);
}

.login-screen[hidden],
.app-shell[hidden] {
  display: none;
}

.login-card {
  display: grid;
  width: min(420px, 100%);
  gap: 18px;
  padding: clamp(22px, 4vw, 32px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.login-brand {
  display: grid;
  grid-template-columns: 1fr;
  justify-items: start;
  align-items: center;
  gap: 10px;
  padding-bottom: 12px;
  text-align: left;
  width: 100%;
}

.login-title {
  display: grid;
  gap: 6px;
}

.login-title p {
  margin: 0;
  color: var(--brand);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.login-title h1 {
  margin: 0;
  font-size: 30px;
  letter-spacing: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px clamp(16px, 2vw, 28px);
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

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

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(242, 106, 0, 0.35);
  border-radius: 8px;
  color: var(--brand);
  font-weight: 800;
  letter-spacing: 0;
}

.official-logo {
  display: block;
  width: 320px;
  max-width: 28vw;
  height: 86px;
  object-fit: contain;
  object-position: left center;
}

.login-brand .official-logo {
  width: 100%;
  max-width: 340px;
  height: 88px;
  object-position: left center;
}

.official-logo[hidden],
.brand-mark[hidden],
.brand-logo-text[hidden] {
  display: none;
}

.brand-logo-text {
  display: block;
  color: var(--brand);
  font-size: 30px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0;
}

.topbar .brand-logo-text {
  font-size: 24px;
}

.brand-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.login-brand .brand-copy {
  max-width: 140px;
  justify-items: start;
  text-align: left;
  line-height: 1.2;
}

.brand-copy strong {
  font-size: 16px;
  line-height: 1.15;
}

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

.topnav {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  padding: 4px;
  background: var(--surface-muted);
  border-radius: 8px;
  flex: 1 1 auto;
  justify-content: flex-end;
}

.nav-button,
.ghost-button,
.primary-button,
.icon-nav-button,
.icon-button {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.nav-button {
  padding: 0 14px;
  background: transparent;
  color: var(--muted);
  white-space: nowrap;
}

.nav-button.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 4px 14px rgba(23, 33, 43, 0.08);
}

.settings-menu {
  position: relative;
}

.icon-nav-button {
  display: grid;
  width: 44px;
  place-items: center;
  background: transparent;
  color: var(--muted);
  font-size: 20px;
}

.icon-nav-button:hover,
.icon-nav-button.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 4px 14px rgba(23, 33, 43, 0.08);
}

.settings-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 20;
  display: grid;
  min-width: 230px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.settings-dropdown[hidden] {
  display: none;
}

.settings-dropdown button {
  min-height: 40px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.settings-dropdown button:hover {
  background: var(--surface-muted);
}

main {
  width: min(1160px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0 52px;
}

.view {
  display: none;
}

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

.page-title {
  display: grid;
  gap: 7px;
  margin-bottom: 22px;
}

.page-title p {
  margin: 0;
  color: var(--brand);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

.page-title h1 {
  margin: 0;
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.08;
  letter-spacing: 0;
}

.page-title span {
  color: var(--muted);
  line-height: 1.5;
}

.home-hero {
  display: grid;
  grid-template-columns: 1fr minmax(240px, 320px);
  gap: 24px;
  align-items: start;
  margin-bottom: 20px;
}

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

.home-user {
  display: grid;
  gap: 6px;
  padding: 18px;
}

.home-user span,
.home-card span {
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.home-user strong {
  font-size: 22px;
}

.home-user small,
.home-card small {
  color: var(--muted);
  line-height: 1.4;
}

.home-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.home-card {
  display: grid;
  min-height: 150px;
  gap: 8px;
  align-content: start;
  padding: 18px;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.home-card:hover {
  border-color: rgba(242, 106, 0, 0.5);
  transform: translateY(-1px);
}

.home-card strong {
  font-size: 28px;
  line-height: 1.1;
}

.ticket-form,
.user-form,
.report-filters,
.user-row,
.ticket-card,
.metrics > div,
.close-dialog {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.ticket-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  padding: clamp(18px, 3vw, 28px);
}

.user-form {
  display: grid;
  gap: 16px;
  padding: clamp(18px, 3vw, 24px);
}

.report-filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) minmax(360px, auto);
  gap: 16px;
  align-items: end;
  padding: clamp(18px, 3vw, 24px);
  margin-bottom: 18px;
}

.report-actions {
  grid-column: auto;
  align-self: end;
}

.field-group {
  display: grid;
  gap: 8px;
}

.field-wide {
  grid-column: 1 / -1;
}

label {
  color: #344250;
  font-size: 13px;
  font-weight: 700;
}

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

textarea {
  min-height: 120px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(18, 108, 114, 0.14);
}

input[readonly],
select:disabled {
  background: #eef2f5;
  color: #344250;
  cursor: not-allowed;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  grid-column: 1 / -1;
  flex-wrap: wrap;
}

.primary-button,
.ghost-button {
  padding: 0 16px;
  font-weight: 700;
}

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

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

.ghost-button {
  background: var(--surface-muted);
  color: var(--text);
}

.ghost-button:hover {
  background: #e1e7ed;
}

.board-header {
  display: grid;
  grid-template-columns: 1fr minmax(280px, 420px);
  gap: 24px;
  align-items: end;
}

.board-tools {
  display: grid;
  grid-template-columns: 1fr 160px auto;
  gap: 10px;
  margin-bottom: 22px;
}

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

.report-metrics {
  margin-top: 0;
}

.metrics > div {
  display: grid;
  gap: 4px;
  padding: 16px;
}

.metrics strong {
  font-size: 28px;
}

.metrics span {
  color: var(--muted);
  font-size: 13px;
}

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

.report-table-wrap {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

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

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

.report-table th {
  background: #f8fafb;
  color: #344250;
  font-size: 12px;
  text-transform: uppercase;
}

.report-table td {
  color: var(--text);
  line-height: 1.4;
}

.report-table tr:last-child td {
  border-bottom: 0;
}

.users-layout {
  display: grid;
  grid-template-columns: minmax(280px, 360px) 1fr;
  gap: 18px;
  align-items: start;
}

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

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

.user-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.user-row strong {
  display: block;
  margin-bottom: 4px;
}

.user-row span {
  color: var(--muted);
  font-size: 13px;
}

.ticket-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 20px;
  padding: 18px;
}

.ticket-card.is-overdue {
  border-left: 5px solid var(--brand);
}

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

.ticket-title-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.ticket-title-line strong {
  font-size: 18px;
  line-height: 1.25;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: #edf2f7;
  color: #344250;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.status-pill[data-state="Aberto"] {
  background: #f7e9ce;
  color: var(--warning);
}

.status-pill[data-state="Em atendimento"] {
  background: #dceff1;
  color: var(--accent);
}

.status-pill[data-state="Concluido"] {
  background: #def0e6;
  color: var(--success);
}

.ticket-main > p {
  margin: 0 0 14px;
  color: #344250;
  line-height: 1.5;
}

dl {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
}

dl div {
  min-width: 0;
}

dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

dd {
  margin: 4px 0 0;
  overflow-wrap: anywhere;
}

.ticket-actions {
  display: grid;
  align-content: start;
  gap: 10px;
  min-width: 120px;
}

.solution-box {
  margin-top: 16px;
  padding: 12px;
  background: #f7faf9;
  border: 1px solid #d7e6df;
  border-radius: 8px;
}

.solution-box span {
  color: var(--success);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.solution-box p {
  margin: 6px 0 0;
  color: #344250;
  line-height: 1.5;
}

.close-dialog {
  width: min(520px, calc(100% - 24px));
  padding: 0;
}

.close-dialog::backdrop {
  background: rgba(23, 33, 43, 0.42);
}

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

.dialog-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.dialog-title strong {
  font-size: 20px;
}

.icon-button {
  width: 36px;
  min-height: 36px;
  background: var(--surface-muted);
  color: var(--muted);
}

.check-line {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--text);
  font-weight: 600;
  line-height: 1.35;
}

.check-line input {
  width: 18px;
  min-height: 18px;
  margin-top: 1px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 30;
  max-width: min(380px, calc(100% - 36px));
  padding: 13px 15px;
  background: #17212b;
  color: #fff;
  border-radius: 8px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.empty-state {
  padding: 28px;
  color: var(--muted);
  text-align: center;
  background: var(--surface);
  border: 1px dashed #c8d0d8;
  border-radius: 8px;
}

@media (max-width: 820px) {
  .topbar,
  .board-header,
  .home-hero,
  .ticket-card {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
    grid-template-columns: 1fr;
  }

  .official-logo {
    width: 460px;
    max-width: 84vw;
    height: 132px;
  }

  .topnav,
  .board-tools {
    width: 100%;
    grid-template-columns: 1fr 1fr;
  }

  .topnav {
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .ticket-form,
  .users-layout,
  .report-filters,
  .home-grid,
  .metrics,
  dl {
    grid-template-columns: 1fr;
  }

  .report-actions {
    grid-column: 1;
  }

  .ticket-actions {
    grid-template-columns: 1fr 1fr;
  }
}

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

  .login-brand {
    display: grid;
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }

  .brand-copy small {
    display: none;
  }

  .login-brand .official-logo {
    width: 100%;
    max-width: 78vw;
    height: 92px;
  }

  .official-logo {
    width: 100%;
    max-width: 74vw;
    height: 96px;
  }

  .nav-button {
    padding: 0 10px;
    font-size: 13px;
  }

  .board-tools,
  .user-row,
  .ticket-actions {
    grid-template-columns: 1fr;
  }

  .ticket-title-line {
    display: grid;
    justify-items: start;
  }
}
