
:root {
  --background: #090b12;
  --surface: #171a25;
  --surface-dark: #10131c;
  --line: rgba(255,255,255,.08);
  --text: #ffffff;
  --muted: #9ba4b5;
  --blue: #2678ff;
  --cyan: #6dd3ff;
  --green: #37d49b;
  --danger: #ff6674;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--background);
  color-scheme: dark;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(
      circle at 85% 0,
      rgba(38,120,255,.12),
      transparent 34%
    ),
    var(--background);
  color: var(--text);
  font-family:
    Inter,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  -webkit-tap-highlight-color: transparent;
}

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

button {
  touch-action: manipulation;
}

.hidden {
  display: none !important;
}

.login-view {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 22px;
}

.login-card {
  width: min(100%, 430px);
  padding: 28px 22px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: rgba(23,26,37,.97);
  box-shadow: 0 28px 80px rgba(0,0,0,.50);
}

.brand-logo {
  display: block;
  width: 124px;
  height: 78px;
  margin: 0 auto 20px;
  object-fit: contain;
  border-radius: 18px;
}

.eyebrow {
  color: var(--cyan);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .14em;
}

.login-card h1 {
  margin: 8px 0;
  font-size: 32px;
}

.login-card p {
  margin: 0 0 24px;
  color: var(--muted);
}

label {
  display: block;
  margin-bottom: 16px;
  color: #e8ebf1;
  font-size: 13px;
  font-weight: 800;
}

input,
textarea,
select {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #11141d;
  color: white;
  outline: none;
}

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

input:focus,
textarea:focus,
select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(38,120,255,.14);
}

.button {
  width: 100%;
  min-height: 56px;
  padding: 14px 18px;
  border: 0;
  border-radius: 15px;
  color: white;
  font-weight: 900;
}

.button-primary {
  background:
    linear-gradient(
      135deg,
      #146eff,
      #4599ff
    );
}

.button-secondary {
  border: 1px solid var(--line);
  background: #242835;
}

.button-danger {
  margin-top: 12px;
  border: 1px solid rgba(255,102,116,.35);
  background: rgba(255,102,116,.12);
  color: #ff9ca6;
}

.application {
  min-height: 100vh;
  min-height: 100dvh;
  padding-bottom:
    calc(
      102px +
      var(--safe-bottom)
    );
}

.app-header {
  padding:
    max(
      26px,
      env(safe-area-inset-top)
    )
    20px
    18px;
}

.user-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 15px;
}

.hello {
  display: block;
  font-size: 20px;
  font-weight: 750;
}

.user-row h1 {
  margin: 2px 0 6px;
  font-size: 34px;
  line-height: 1.05;
}

.user-row small {
  color: var(--muted);
}

.avatar {
  display: grid;
  place-items: center;
  flex: 0 0 62px;
  width: 62px;
  height: 62px;
  border-radius: 21px;
  background:
    linear-gradient(
      135deg,
      #146eff,
      #6dd3ff
    );
  font-size: 27px;
  font-weight: 900;
}

.online-card {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-top: 22px;
  padding: 18px;
  border: 1px solid rgba(38,120,255,.48);
  border-radius: 23px;
  background: #11141d;
}

.online-icon {
  display: grid;
  place-items: center;
  flex: 0 0 50px;
  width: 50px;
  height: 50px;
  border-radius: 17px;
  background: rgba(38,120,255,.14);
  color: #438cff;
  font-size: 24px;
}

.online-copy {
  flex: 1;
  min-width: 0;
}

.online-copy strong,
.online-copy span {
  display: block;
}

.online-copy strong {
  margin-bottom: 4px;
  font-size: 15px;
}

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

.switch {
  position: relative;
  flex: 0 0 54px;
  width: 54px;
  height: 31px;
}

.switch input {
  position: absolute;
  opacity: 0;
}

.switch span {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #303442;
  transition: .2s ease;
}

.switch span::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 23px;
  height: 23px;
  border-radius: 50%;
  background: white;
  transition: .2s ease;
}

.switch input:checked + span {
  background: var(--blue);
}

.switch input:checked + span::after {
  transform: translateX(23px);
}

.content {
  padding: 0 18px 24px;
}

.page {
  display: none;
}

.page.active {
  display: block;
}

.summary-grid,
.finance-grid {
  display: grid;
  grid-template-columns:
    repeat(
      2,
      minmax(0,1fr)
    );
  gap: 15px;
}

.summary-grid article,
.finance-grid article {
  min-height: 160px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
}

.summary-icon {
  display: block;
  min-height: 48px;
  font-size: 34px;
}

.summary-grid strong,
.finance-grid strong {
  display: block;
  margin-top: 18px;
  font-size: 24px;
  line-height: 1.1;
}

.summary-grid small,
.finance-grid span {
  display: block;
  margin-top: 10px;
  color: var(--muted);
  font-size: 14px;
}

.section {
  margin-top: 27px;
  padding: 19px;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: var(--surface);
}

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

.section-heading h2,
.page-title h2 {
  margin: 0;
  font-size: 24px;
}

.section-heading p,
.page-title p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.page-title {
  margin-bottom: 18px;
  padding-top: 6px;
}

.icon-button {
  flex: 0 0 46px;
  width: 46px;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: #222633;
  color: white;
  font-size: 22px;
}

.ticket-list,
.finance-list {
  display: grid;
  gap: 15px;
}

.ticket-card {
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface-dark);
}

.ticket-card.current {
  border-color: rgba(55,212,155,.55);
}

.ticket-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.ticket-id {
  color: var(--cyan);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .08em;
}

.ticket-card h3 {
  margin: 5px 0 0;
  font-size: 19px;
}

.status {
  flex: 0 0 auto;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(38,120,255,.15);
  color: #72c9ff;
  font-size: 10px;
  font-weight: 900;
}

.ticket-meta {
  display: grid;
  grid-template-columns:
    repeat(
      2,
      minmax(0,1fr)
    );
  gap: 9px;
  margin: 14px 0;
}

.ticket-meta div {
  min-width: 0;
  padding: 10px;
  border-radius: 12px;
  background: rgba(255,255,255,.035);
}

.ticket-meta span,
.ticket-meta strong {
  display: block;
}

.ticket-meta span {
  margin-bottom: 5px;
  color: #8f97aa;
  font-size: 10px;
  text-transform: uppercase;
}

.ticket-meta strong {
  font-size: 12px;
  overflow-wrap: anywhere;
}

.ticket-description {
  margin: 12px 0 14px;
  padding: 13px;
  border-left: 3px solid var(--blue);
  border-radius: 10px;
  background: rgba(38,120,255,.07);
  color: #e7eaf2;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.ticket-actions {
  display: grid;
  gap: 10px;
}

.ticket-action {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 56px;
  border: 0;
  border-radius: 15px;
  color: white;
  font-size: 15px;
  font-weight: 900;
}

.ticket-action.secondary {
  border: 1px solid var(--line);
  background: #202430;
}

.ticket-action.route {
  border: 1px solid rgba(38,120,255,.34);
  background: #18223a;
}

.ticket-action.start {
  background:
    linear-gradient(
      135deg,
      #146eff,
      #4599ff
    );
}

.ticket-action.finish {
  background:
    linear-gradient(
      135deg,
      #12895f,
      #37d49b
    );
}

.timer {
  margin: 12px 0;
  padding: 13px;
  border: 1px solid rgba(55,212,155,.35);
  border-radius: 14px;
  background: rgba(55,212,155,.08);
  color: var(--green);
  text-align: center;
  font-family:
    ui-monospace,
    SFMono-Regular,
    Consolas,
    monospace;
  font-size: 26px;
  font-weight: 900;
}

.finance-grid {
  margin-bottom: 18px;
}

.finance-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
}

.finance-item strong,
.finance-item span {
  display: block;
}

.finance-item span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.finance-item b {
  color: var(--green);
  font-size: 17px;
}

.search {
  width: 100%;
  margin-bottom: 16px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface);
  color: white;
}

.profile-card {
  padding: 28px 22px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
  text-align: center;
}

.profile-avatar {
  width: 84px;
  height: 84px;
  margin: 0 auto 16px;
  font-size: 34px;
}

.profile-card h2 {
  margin: 0;
}

.profile-card p {
  margin: 8px 0 24px;
  color: var(--muted);
}

.empty {
  padding: 28px 16px;
  border-radius: 18px;
  background: var(--surface-dark);
  color: var(--muted);
  text-align: center;
}

.bottom-navigation {
  position: fixed;
  right: 14px;
  bottom:
    calc(
      14px +
      var(--safe-bottom)
    );
  left: 14px;
  z-index: 300;
  display: grid;
  grid-template-columns:
    repeat(
      5,
      1fr
    );
  gap: 4px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: rgba(16,19,28,.96);
  box-shadow: 0 18px 50px rgba(0,0,0,.50);
  backdrop-filter: blur(20px);
}

.nav-button {
  min-height: 58px;
  border: 0;
  border-radius: 20px;
  background: transparent;
  color: var(--muted);
}

.nav-button span,
.nav-button small {
  display: block;
}

.nav-button span {
  margin-bottom: 4px;
  font-size: 20px;
  font-weight: 900;
}

.nav-button small {
  font-size: 9px;
}

.nav-button.active {
  background: #232735;
  color: white;
}

.loading {
  position: fixed;
  inset: 0;
  z-index: 800;
  display: grid;
  place-content: center;
  gap: 13px;
  background: rgba(9,11,18,.88);
  backdrop-filter: blur(8px);
  text-align: center;
}

.spinner {
  width: 44px;
  height: 44px;
  margin: auto;
  border: 4px solid rgba(255,255,255,.12);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

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

.toast {
  position: fixed;
  top:
    calc(
      16px +
      env(safe-area-inset-top)
    );
  right: 14px;
  left: 14px;
  z-index: 900;
  display: grid;
  gap: 8px;
  pointer-events: none;
}

.toast-message {
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #202430;
  box-shadow: 0 15px 35px rgba(0,0,0,.38);
}

.toast-message.error {
  border-color: rgba(255,102,116,.45);
}

.bottom-sheet,
.execution-view {
  position: fixed;
  inset: 0;
  z-index: 600;
}

.sheet-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  border: 0;
  background: rgba(0,0,0,.74);
}

.sheet-content {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  max-height: 91dvh;
  overflow-y: auto;
  padding:
    12px
    20px
    calc(
      30px +
      var(--safe-bottom)
    );
  border-radius: 28px 28px 0 0;
  background: var(--surface);
}

.sheet-handle {
  width: 48px;
  height: 5px;
  margin: 0 auto 18px;
  border-radius: 999px;
  background: rgba(255,255,255,.18);
}

.sheet-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  background: #262a38;
  color: white;
  font-size: 25px;
}

.sheet-content h2 {
  padding-right: 48px;
}

.detail {
  margin-bottom: 20px;
}

.detail h3 {
  margin: 0 0 7px;
  color: var(--cyan);
  font-size: 12px;
  text-transform: uppercase;
}

.detail p {
  margin: 0;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.execution-view {
  overflow-y: auto;
  background: var(--background);
}

.execution-header {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 12px;
  padding:
    max(
      14px,
      env(safe-area-inset-top)
    )
    16px
    14px;
  border-bottom: 1px solid var(--line);
  background: rgba(9,11,18,.96);
}

.execution-header button {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 14px;
  background: #202430;
  color: white;
  font-size: 30px;
}

.execution-header small,
.execution-header strong {
  display: block;
}

.execution-header small {
  color: var(--cyan);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .1em;
}

.execution-form {
  padding:
    18px
    18px
    calc(
      30px +
      var(--safe-bottom)
    );
}

.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #11141d;
}

.checkbox-row input {
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  margin: 0;
}

.execution-actions {
  display: grid;
  gap: 10px;
  margin-top: 20px;
}

@media (min-width: 760px) {
  .application {
    max-width: 760px;
    margin: auto;
    border-right: 1px solid var(--line);
    border-left: 1px solid var(--line);
  }

  .bottom-navigation {
    right: 50%;
    left: 50%;
    width: 730px;
    transform: translateX(-50%);
  }
}

@media (max-width: 420px) {
  .app-header {
    padding-right: 16px;
    padding-left: 16px;
  }

  .content {
    padding-right: 16px;
    padding-left: 16px;
  }

  .summary-grid article,
  .finance-grid article {
    min-height: 150px;
    padding: 18px;
  }

  .summary-grid strong,
  .finance-grid strong {
    font-size: 21px;
  }
}


.api-status {
  margin: -10px 0 18px;
  padding: 10px 12px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 12px;
  background: rgba(255,255,255,.035);
  color: #9ba4b5;
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.api-status.online {
  border-color: rgba(55,212,155,.35);
  background: rgba(55,212,155,.08);
  color: #57e0ad;
}

.api-status.offline {
  border-color: rgba(255,102,116,.35);
  background: rgba(255,102,116,.08);
  color: #ff9ca6;
}


.connection-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding: 6px 10px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 999px;
  background: rgba(255,255,255,.04);
  color: #9ba4b5;
  font-size: 11px;
  font-weight: 900;
}

.connection-chip::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #9ba4b5;
}

.connection-chip.online {
  border-color: rgba(55,212,155,.30);
  color: #57e0ad;
}

.connection-chip.online::before {
  background: #37d49b;
  box-shadow: 0 0 10px rgba(55,212,155,.75);
}

.connection-chip.offline {
  border-color: rgba(255,102,116,.30);
  color: #ff9ca6;
}

.connection-chip.offline::before {
  background: #ff6674;
}

.contact-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 10px;
}

.ticket-action.contact {
  min-height: 50px;
  border: 1px solid rgba(109,211,255,.25);
  background: rgba(109,211,255,.08);
  color: #9fe2ff;
}

.finance-extra {
  display: grid;
  grid-template-columns: repeat(2,minmax(0,1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.finance-extra article {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
}

.finance-extra span,
.finance-extra strong {
  display: block;
}

.finance-extra span {
  color: var(--muted);
  font-size: 12px;
}

.finance-extra strong {
  margin-top: 8px;
  font-size: 22px;
}

.today-label {
  margin: 4px 0 -4px;
  padding: 8px 11px;
  border-radius: 10px;
  background: rgba(55,212,155,.10);
  color: #57e0ad;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .08em;
  text-align: center;
}

.ticket-card.priority-urgente,
.ticket-card.priority-alta {
  border-left: 4px solid #ff6674;
}

.ticket-card.priority-normal,
.ticket-card.priority-media {
  border-left: 4px solid #f7c34f;
}

.ticket-card.priority-baixa {
  border-left: 4px solid #37d49b;
}

#openTicketSearch {
  margin-bottom: 14px;
}
