:root {
  --bg-app: #e8e8e8;
  --bg-screen: #efefee;
  --header-bg: #45474b;
  --navbar-bg: #141414;
  --ink: #1a1a1a;
  --ink-soft: #58595b;
  --brand: #0060af;
  --brand-dark: #004a87;
  --brand-light: #cfe0f0;
  --info-bg: #eaf2fb;
  --info-ink: #0d4f8a;
  --danger: #d0202a;
  --success: #2f8f4e;
  --amber-bg: #fff3e0;
  --amber-ink: #a8620a;
  --violet-bg: #efe7f8;
  --violet-ink: #6a3fb0;
  --green-bg: #e4f3e9;
  --green-ink: #1f7a3d;
  --grey-bg: #eef0f2;
  --grey-ink: #6b7280;
  --rose-bg: #fdecec;
  --rose-ink: #b02a34;
  --line: #e2e4e8;
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg-app);
  font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  padding: 24px;
}

.app-container {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-start;
  gap: 40px;
  width: max-content;
  max-width: 100%;
  margin: 0 auto;
}

.device-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  flex: 0 0 auto;
}

.device-column--wide {
  align-items: stretch;
  flex: 1 1 auto;
  min-width: 0;
  max-width: 920px;
}

.device-label {
  margin: 0;
  align-self: center;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
}

/* ---------- MOCKUP DE CELULAR ---------- */
.phone {
  position: relative;
  width: 375px;
  height: 780px;
  background: #111;
  border-radius: 46px;
  padding: 14px;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.25);
}

.notch {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  width: 140px;
  height: 22px;
  background: #111;
  border-radius: 0 0 16px 16px;
  z-index: 5;
}

.screen-area {
  position: relative;
  width: 100%;
  height: 100%;
  background: var(--bg-screen);
  border-radius: 32px;
  overflow: hidden;
}

/* ---------- TELAS DO PARTICIPANTE ---------- */
.screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: stretch;
  text-align: center;
  overflow-y: auto;
}

.screen.active {
  display: flex;
}

.app-topbar {
  background: var(--header-bg);
  height: 32px;
  flex-shrink: 0;
}

.app-header {
  background: var(--header-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.app-logo {
  width: 100%;
  height: auto;
  display: block;
}

.app-navbar {
  background: var(--navbar-bg);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 11px 0;
  flex-shrink: 0;
}

.screen-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 26px 26px 22px;
  text-align: center;
}

.screen-body--center {
  justify-content: center;
  gap: 6px;
}

.title {
  font-size: 20px;
  margin: 4px 0 6px;
  color: var(--ink);
}

.title--xl {
  font-size: 24px;
}

.subtitle {
  font-size: 13.5px;
  color: var(--ink-soft);
  margin: 0 0 22px;
  line-height: 1.5;
}

/* ---------- FORMULÁRIO (TELA 1) ---------- */
#form-cadastro {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 14px;
  text-align: left;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-soft);
}

.field input {
  border: 1px solid #d5d5d5;
  background: #fff;
  border-radius: 10px;
  padding: 11px 12px;
  font-size: 14px;
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s;
}

.field input:focus {
  border-color: var(--brand);
}

.field input.invalid {
  border-color: var(--danger);
}

.error {
  min-height: 14px;
  font-size: 11.5px;
  color: var(--danger);
}

/* ---------- BOTÕES ---------- */
.btn {
  border: none;
  border-radius: 4px;
  padding: 13px 18px;
  font-size: 13.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: pointer;
  width: 100%;
  display: block;
  text-align: center;
  text-decoration: none;
  transition: background-color 0.15s, transform 0.1s;
}

.btn:active {
  transform: scale(0.98);
}

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

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

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--danger);
  color: var(--danger);
  margin-top: 14px;
}

.btn-outline:hover {
  background: rgba(208, 32, 42, 0.06);
}

.btn-plain {
  background: transparent;
  border: 1.5px solid #c8ccd2;
  color: var(--ink-soft);
  margin-top: 10px;
}

.btn-plain:hover {
  background: #f0f0f0;
}

/* ---------- TELA 2 - FILA ---------- */
.greeting {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.5;
  color: var(--ink);
  margin: 0 0 14px;
}

.progress-wrap {
  position: relative;
  width: 180px;
  height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}

.progress-ring {
  transform: rotate(-90deg);
}

.progress-ring__bg {
  fill: none;
  stroke: var(--brand-light);
  stroke-width: 12;
}

.progress-ring__bar {
  fill: none;
  stroke: var(--brand);
  stroke-width: 12;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.6s ease;
}

.progress-number {
  position: absolute;
  font-size: 44px;
  font-weight: 700;
  color: var(--brand);
}

.queue-position-label {
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-soft);
  margin: 0;
}

.queue-ahead {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  margin: 4px 0 16px;
}

.wait-note {
  width: 100%;
  background: var(--info-bg);
  color: var(--info-ink);
  border-radius: 12px;
  padding: 14px;
  font-size: 12.5px;
  line-height: 1.5;
}

/* ---------- TELAS 3 / 4 / 5 ---------- */
.turn-icon {
  font-size: 60px;
  margin-bottom: 6px;
}

.called-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-soft);
  margin: 10px 0 0;
}

.success-icon {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: var(--success);
  color: #fff;
  font-size: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
}

#screen-5 .btn {
  margin-top: 10px;
}

/* ---------- TELA 6 (fora da fila / recadastro) ---------- */
.rejoin-data {
  width: 100%;
  margin: 6px 0 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--bg-screen);
  border-radius: 12px;
  padding: 14px 16px;
}

.rejoin-data > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.rejoin-data dt {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-soft);
}

.rejoin-data dd {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

#screen-6 .btn {
  margin-top: 4px;
}

/* ================= PAINEL DO OPERADOR ================= */
.operator-panel {
  width: 100%;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.15);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.op-header {
  background: var(--header-bg);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px 20px;
}

.op-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.op-logo {
  height: 30px;
  width: auto;
  display: block;
  padding: 3px 6px;
  border-radius: 4px;
}

.op-event {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}

.op-event-sub {
  margin: 0;
  font-size: 11.5px;
  opacity: 0.75;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.op-user {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}

.op-user-name {
  opacity: 0.9;
}

.btn-ghost {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.5);
  color: #fff;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.12);
}

.op-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  padding: 18px 20px 6px;
}

.stat-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: #fbfbfc;
}

.stat-value {
  font-size: 26px;
  font-weight: 800;
  line-height: 1;
  color: var(--brand);
}

.stat-label {
  font-size: 12px;
  color: var(--ink-soft);
}

.op-controls {
  display: grid;
  grid-template-columns: 1fr 1fr 1.6fr;
  gap: 12px;
  padding: 14px 20px;
}

.op-input {
  border: 1px solid #d5d5d5;
  border-radius: 8px;
  padding: 9px 11px;
  font-size: 13px;
  font-family: inherit;
  color: var(--ink);
  background: #fff;
  outline: none;
}

.op-input:focus {
  border-color: var(--brand);
}

/* Filtro de status — seleção múltipla */
.op-status-filter {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.op-filter-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-soft);
  margin-right: 2px;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1.5px solid #d0d4da;
  background: #fff;
  color: var(--grey-ink);
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

.status-chip::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.3;
  flex-shrink: 0;
}

.status-chip:hover {
  border-color: var(--ink-soft);
}

.status-chip.is-active::before {
  opacity: 1;
}

.status-chip[data-status="queued"].is-active {
  background: var(--info-bg);
  color: var(--info-ink);
  border-color: var(--info-ink);
}

.status-chip[data-status="called"].is-active {
  background: var(--amber-bg);
  color: var(--amber-ink);
  border-color: var(--amber-ink);
}

.status-chip[data-status="in_activation"].is-active {
  background: var(--violet-bg);
  color: var(--violet-ink);
  border-color: var(--violet-ink);
}

.status-chip[data-status="finished"].is-active {
  background: var(--green-bg);
  color: var(--green-ink);
  border-color: var(--green-ink);
}

.status-chip[data-status="abandoned"].is-active {
  background: var(--grey-bg);
  color: var(--grey-ink);
  border-color: var(--grey-ink);
}

.status-chip[data-status="no_show"].is-active {
  background: var(--rose-bg);
  color: var(--rose-ink);
  border-color: var(--rose-ink);
}

.op-table-wrap {
  padding: 0 20px 20px;
  overflow-x: auto;
}

.op-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 520px;
}

.op-table thead th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-soft);
  padding: 10px 12px;
  border-bottom: 2px solid var(--line);
  background: #fff;
  position: sticky;
  top: 0;
}

.op-group-row td {
  padding: 16px 12px 7px;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  border-bottom: 2px solid var(--line);
  border-left: 5px solid var(--line);
}

.op-group-row td::before {
  content: "";
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 8px;
  vertical-align: middle;
  background: currentColor;
}

.op-group-row--queued td { color: var(--info-ink); border-left-color: var(--info-ink); }
.op-group-row--called td { color: var(--amber-ink); border-left-color: var(--amber-ink); }
.op-group-row--in_activation td { color: var(--violet-ink); border-left-color: var(--violet-ink); }
.op-group-row--finished td { color: var(--green-ink); border-left-color: var(--green-ink); }
.op-group-row--abandoned td { color: var(--grey-ink); border-left-color: var(--grey-ink); }
.op-group-row--no_show td { color: var(--rose-ink); border-left-color: var(--rose-ink); }

.op-row td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

/* Faixa de cor do status na lateral de cada linha */
.op-row td:first-child {
  border-left: 5px solid var(--line);
}

.op-row--queued td:first-child { border-left-color: var(--info-ink); }
.op-row--called td:first-child { border-left-color: var(--amber-ink); }
.op-row--in_activation td:first-child { border-left-color: var(--violet-ink); }
.op-row--finished td:first-child { border-left-color: var(--green-ink); }
.op-row--abandoned td:first-child { border-left-color: var(--grey-ink); }
.op-row--no_show td:first-child { border-left-color: var(--rose-ink); }

.op-row:hover td {
  background: #f7f9fb;
}

.op-row .cell-name {
  font-weight: 600;
  color: var(--ink);
}

.row-pos {
  display: inline-block;
  min-width: 22px;
  margin-right: 8px;
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--grey-bg);
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.op-row.is-current td {
  background: #eef6ee;
}

.op-row.is-current .cell-name::after {
  content: "você";
  margin-left: 6px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--success);
  border: 1px solid var(--success);
  border-radius: 4px;
  padding: 1px 4px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  font-weight: 800;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1.5px solid currentColor;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.badge::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.badge-queued {
  background: var(--info-bg);
  color: var(--info-ink);
}

.badge-called {
  background: var(--amber-bg);
  color: var(--amber-ink);
}

.badge-in_activation {
  background: var(--violet-bg);
  color: var(--violet-ink);
}

.badge-finished {
  background: var(--green-bg);
  color: var(--green-ink);
}

.badge-abandoned {
  background: var(--grey-bg);
  color: var(--grey-ink);
}

.badge-no_show {
  background: var(--rose-bg);
  color: var(--rose-ink);
}

.op-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
}

.op-btn {
  border: 1.5px solid transparent;
  border-radius: 6px;
  padding: 8px 12px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
  white-space: nowrap;
  transition: filter 0.15s, background-color 0.15s;
}

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

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

.op-btn-amber {
  background: var(--amber-ink);
  color: #fff;
}

.op-btn-green {
  background: var(--success);
  color: #fff;
}

.op-btn-amber:hover,
.op-btn-green:hover {
  filter: brightness(1.08);
}

.op-btn-outline {
  background: #fff;
  color: var(--ink-soft);
  border-color: #c8ccd2;
}

.op-btn-outline:hover {
  background: #f0f0f0;
}

.op-nudges {
  display: flex;
  gap: 6px;
}

.op-nudges .op-iconbtn {
  flex: 1 1 0;
  width: auto;
}

.op-iconbtn {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  background: #fff;
  transition: background-color 0.15s, border-color 0.15s;
}

.op-iconbtn svg {
  width: 18px;
  height: 18px;
  display: block;
}

button.op-iconbtn {
  font: inherit;
}

.op-iconbtn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.op-iconbtn:disabled:hover {
  background: #fff;
}

.op-iconbtn--wa {
  color: var(--green-ink);
}

.op-iconbtn--wa:hover {
  background: var(--green-bg);
}

.op-iconbtn--sms {
  color: var(--brand);
}

.op-iconbtn--sms:hover {
  background: var(--info-bg);
}

.op-iconbtn--info {
  color: var(--ink-soft);
}

.op-iconbtn--info:hover {
  background: #f0f0f0;
}

.col-info,
.cell-info {
  width: 66px;
  text-align: center;
}

.cell-info {
  white-space: nowrap;
}

.op-called-timer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  margin-top: 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--amber-ink);
  font-variant-numeric: tabular-nums;
}

.op-called-timer svg {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}

.op-none {
  color: var(--grey-ink);
}

.op-empty {
  text-align: center;
  color: var(--ink-soft);
  font-size: 13px;
  padding: 24px 0;
}

@media (max-width: 900px) {
  .op-stats {
    grid-template-columns: repeat(2, 1fr);
  }
  .op-controls {
    grid-template-columns: 1fr 1fr;
  }
  #op-sort {
    grid-column: 1 / -1;
  }
}

/* ---------- MODAL DE DETALHES ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.45);
}

.modal-overlay[hidden] {
  display: none;
}

.modal {
  position: relative;
  width: 320px;
  max-width: 100%;
  background: #fff;
  border-radius: 14px;
  padding: 22px 24px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
}

.modal-close {
  position: absolute;
  top: 8px;
  right: 12px;
  border: none;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  color: var(--ink-soft);
  cursor: pointer;
}

.modal-title {
  margin: 0 0 4px;
  font-size: 15px;
  color: var(--ink);
}

.modal-name {
  margin: 0 0 18px;
  font-size: 13px;
  color: var(--ink-soft);
}

.modal-list {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-list > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal-list dt {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-soft);
}

.modal-list dd {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.modal-text {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.modal-actions .op-btn {
  flex: 1 1 0;
  padding: 10px 14px;
}

.modal-actions--stack {
  flex-direction: column;
}

.modal-actions--stack .op-btn {
  white-space: normal;
}
