/* Lazari Atendimento: identidade visual Grupo Lazari (grafite + vermelho) */

:root {
  --red: #db3c3e;
  --red-strong: #c42f31;
  --red-soft: rgba(219, 60, 62, 0.14);
  --bg: #161616;
  --bg-2: #1d1d1d;
  --surface: #232323;
  --surface-2: #2b2b2b;
  --surface-3: #343434;
  --border: #3a3a3a;
  --text: #f3f3f3;
  --text-2: #c9c9c9;
  --muted: #9a9a9a;
  --green: #3fb67a;
  --amber: #e5a53a;
  --blue: #5b9be6;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-title: 'Montserrat', var(--font);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
h1, h2, h3, h4 { font-family: var(--font-title); margin: 0 0 0.5em; line-height: 1.2; letter-spacing: -0.01em; }
h1 { font-size: 1.7rem; font-weight: 700; }
h2 { font-size: 1.3rem; font-weight: 700; }
h3 { font-size: 1.05rem; font-weight: 600; }
p { margin: 0 0 1em; }
a { color: var(--red); }
small, .muted { color: var(--muted); }
.hidden { display: none !important; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.grow { flex: 1; min-width: 0; }
.mono { font-family: ui-monospace, 'SF Mono', Menlo, monospace; }
svg.icon { width: 18px; height: 18px; flex: none; }
.q-meta svg.icon { width: 14px; height: 14px; }
.empty svg.icon { width: 40px; height: 40px; color: var(--red); }
.eyebrow { font-family: var(--font-title); letter-spacing: 0.32em; text-transform: uppercase; font-size: 0.72rem; color: var(--muted); }

/* ---------------------------------------------------------------- marca */
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text); }
.brand img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
.brand .brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand .brand-text small { letter-spacing: 0.35em; font-size: 0.62rem; text-transform: uppercase; color: var(--muted); font-family: var(--font-title); }
.brand .brand-text strong { font-family: var(--font-title); font-size: 1.15rem; letter-spacing: 0.02em; }

/* ---------------------------------------------------------------- botões e campos */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: 10px; padding: 10px 16px;
  font: 600 0.92rem var(--font); cursor: pointer; text-decoration: none;
  background: var(--surface-3); color: var(--text); transition: background 0.15s, border-color 0.15s, transform 0.05s;
  white-space: nowrap;
}
.btn:hover { background: #3d3d3d; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.primary { background: var(--red); color: #fff; }
.btn.primary:hover { background: var(--red-strong); }
.btn.ghost { background: transparent; border-color: var(--border); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { background: transparent; border-color: rgba(219, 60, 62, 0.5); color: #ff8a8b; }
.btn.danger:hover { background: var(--red-soft); }
.btn.success { background: var(--green); color: #0d1f15; }
.btn.sm { padding: 6px 10px; font-size: 0.82rem; border-radius: 8px; }
.btn.lg { padding: 14px 22px; font-size: 1rem; }
.btn.block { width: 100%; }
.btn svg { width: 18px; height: 18px; }

label.field { display: flex; flex-direction: column; gap: 6px; font-size: 0.85rem; color: var(--text-2); font-weight: 500; }
input, select, textarea {
  width: 100%; background: var(--bg-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px; padding: 11px 12px; font: 0.95rem var(--font);
  outline: none; transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }
textarea { resize: vertical; min-height: 84px; }
input[type='checkbox'] { width: 18px; height: 18px; accent-color: var(--red); }
label.check { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 0.9rem; color: var(--text-2); }
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { appearance: none; width: 40px; height: 22px; border-radius: 22px; background: var(--surface-3); border: 1px solid var(--border); position: relative; padding: 0; cursor: pointer; }
.switch input::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #bbb; transition: left 0.15s; }
.switch input:checked { background: var(--red); border-color: var(--red); }
.switch input:checked::after { left: 20px; background: #fff; }

/* ---------------------------------------------------------------- cartões e etiquetas */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.card.flat { background: var(--bg-2); }
.card-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-title h3 { margin: 0; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px; font-size: 0.74rem; font-weight: 600; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.badge.red { background: var(--red-soft); color: #ff8a8b; }
.badge.green { background: rgba(63, 182, 122, 0.15); color: #6fd59f; }
.badge.amber { background: rgba(229, 165, 58, 0.15); color: #f0c06d; }
.badge.blue { background: rgba(91, 155, 230, 0.15); color: #8dbbf0; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); display: inline-block; flex: none; }
.dot.on { background: var(--green); box-shadow: 0 0 0 3px rgba(63, 182, 122, 0.2); }
.dot.off { background: #666; }
.dot.warn { background: var(--amber); }

.empty { text-align: center; color: var(--muted); padding: 28px 12px; font-size: 0.92rem; }

/* ---------------------------------------------------------------- avisos */
.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 1000; max-width: min(380px, calc(100vw - 32px)); }
.toast { background: var(--surface-2); border: 1px solid var(--border); border-left: 4px solid var(--blue); padding: 12px 14px; border-radius: 10px; box-shadow: var(--shadow); font-size: 0.9rem; animation: toast-in 0.2s ease-out; }
.toast.error { border-left-color: var(--red); }
.toast.success { border-left-color: var(--green); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

dialog.modal { background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius); padding: 0; width: min(560px, calc(100vw - 32px)); box-shadow: var(--shadow); }
dialog.modal::backdrop { background: rgba(0, 0, 0, 0.6); }
dialog.modal .modal-head { padding: 18px 20px 0; }
dialog.modal .modal-body { padding: 16px 20px; display: flex; flex-direction: column; gap: 14px; max-height: 70vh; overflow: auto; }
dialog.modal .modal-foot { padding: 0 20px 18px; display: flex; justify-content: flex-end; gap: 10px; }

/* ---------------------------------------------------------------- tabelas */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-weight: 600; color: var(--muted); font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.04em; background: var(--bg-2); white-space: nowrap; }
tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ================================================================ CLIENTE */
.client-page { min-height: 100vh; display: flex; flex-direction: column; background: radial-gradient(1200px 600px at 85% -10%, rgba(219, 60, 62, 0.16), transparent 60%), var(--bg); }
.client-top { display: flex; align-items: center; justify-content: space-between; padding: 18px 24px; }
.client-main { flex: 1; display: flex; align-items: flex-start; justify-content: center; padding: 12px 16px 40px; }
.client-card { width: min(560px, 100%); }
.client-card.wide { width: min(1200px, 100%); }
.hero { border-radius: var(--radius); overflow: hidden; margin-bottom: 18px; border: 1px solid var(--border); aspect-ratio: 1280 / 420; background: #1a1a1a url('/assets/img/lazari-banner.jpg') center / cover no-repeat; }
.ticket-code { font-family: var(--font-title); font-size: 3rem; font-weight: 700; letter-spacing: 0.04em; color: var(--red); line-height: 1; }
.wait-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 18px 0; }
.wait-stat { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px; text-align: center; }
.wait-stat strong { display: block; font-family: var(--font-title); font-size: 1.6rem; }
.wait-stat span { font-size: 0.78rem; color: var(--muted); }
.pulse { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--red); animation: pulse 1.6s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(219, 60, 62, 0.6); } 70% { box-shadow: 0 0 0 12px rgba(219, 60, 62, 0); } 100% { box-shadow: 0 0 0 0 rgba(219, 60, 62, 0); } }
.preview { position: relative; border-radius: var(--radius-sm); overflow: hidden; background: #000; aspect-ratio: 16 / 9; border: 1px solid var(--border); }
.preview video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.meter { height: 6px; border-radius: 6px; background: var(--surface-3); overflow: hidden; }
.meter > i { display: block; height: 100%; width: 0; background: var(--green); transition: width 0.08s; }
.stars { display: flex; gap: 6px; justify-content: center; }
.stars button { background: none; border: none; font-size: 2.1rem; color: var(--surface-3); cursor: pointer; padding: 0 2px; line-height: 1; }
.stars button.on { color: var(--amber); }
.notice { background: var(--red-soft); border: 1px solid rgba(219, 60, 62, 0.35); color: #ffc2c3; padding: 10px 12px; border-radius: 10px; font-size: 0.9rem; }
.notice.info { background: rgba(91, 155, 230, 0.12); border-color: rgba(91, 155, 230, 0.3); color: #c7dcf6; }

/* ================================================================ CHAMADA */
.call { display: grid; grid-template-columns: 1fr 320px; gap: 14px; height: 100%; min-height: 0; }
.call.no-chat { grid-template-columns: 1fr; }
.call-main { display: flex; flex-direction: column; gap: 12px; min-width: 0; min-height: 0; }
.stage { position: relative; flex: 1; min-height: 300px; background: #0b0b0b; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); }
.tile { position: absolute; inset: 0; background: #0b0b0b; }
.tile video { width: 100%; height: 100%; object-fit: contain; background: #0b0b0b; }
.tile .tile-label { position: absolute; left: 12px; bottom: 12px; background: rgba(0, 0, 0, 0.6); padding: 4px 10px; border-radius: 8px; font-size: 0.82rem; display: flex; gap: 8px; align-items: center; }
.tile .tile-empty { position: absolute; inset: 0; display: flex; flex-direction: column; gap: 10px; align-items: center; justify-content: center; color: var(--muted); font-size: 0.95rem; text-align: center; padding: 20px; }
.tile .avatar { width: 84px; height: 84px; border-radius: 50%; background: var(--surface-3); display: flex; align-items: center; justify-content: center; font: 700 2rem var(--font-title); color: var(--text); }
.tile.self { inset: auto; right: 14px; bottom: 14px; width: 24%; min-width: 150px; max-width: 280px; aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden; border: 2px solid rgba(255, 255, 255, 0.15); box-shadow: var(--shadow); z-index: 2; }
.tile.self video { object-fit: cover; }
.tile.self video.mirror { transform: scaleX(-1); }
.tile.self .tile-label { left: 8px; bottom: 8px; font-size: 0.72rem; padding: 2px 8px; }
.sharing-flag { position: absolute; top: 12px; left: 12px; z-index: 3; }
.unmute-audio { position: absolute; top: 12px; right: 12px; z-index: 3; }
.controls { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.ctrl { width: 52px; height: 52px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; transition: background 0.15s; position: relative; }
.ctrl:hover { background: var(--surface-3); }
.ctrl.off { background: #3a2020; border-color: rgba(219, 60, 62, 0.5); color: #ff8a8b; }
.ctrl.active { background: var(--blue); border-color: var(--blue); color: #fff; }
.ctrl.leave { background: var(--red); border-color: var(--red); color: #fff; width: 64px; border-radius: 26px; }
.ctrl svg { width: 22px; height: 22px; }
.ctrl .ctrl-badge { position: absolute; top: -2px; right: -2px; background: var(--red); color: #fff; font-size: 0.65rem; border-radius: 10px; padding: 1px 5px; font-weight: 700; }
.chat { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); min-height: 0; overflow: hidden; }
.chat-head { padding: 12px 14px; border-bottom: 1px solid var(--border); font-weight: 600; }
.chat-list { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; min-height: 200px; }
.msg { max-width: 85%; padding: 8px 11px; border-radius: 12px; background: var(--surface-2); font-size: 0.9rem; word-wrap: break-word; white-space: pre-wrap; }
.msg.mine { align-self: flex-end; background: var(--red); color: #fff; }
.msg .msg-meta { display: block; font-size: 0.7rem; opacity: 0.7; margin-bottom: 2px; }
.chat-form { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--border); }
.chat-form input { padding: 9px 11px; }

/* ================================================================ EQUIPE */
.staff-shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar { background: var(--bg-2); border-right: 1px solid var(--border); padding: 18px 14px; display: flex; flex-direction: column; gap: 22px; position: sticky; top: 0; height: 100vh; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; color: var(--text-2); text-decoration: none; font-weight: 500; font-size: 0.92rem; }
.nav a svg { width: 18px; height: 18px; opacity: 0.85; }
.nav a:hover { background: var(--surface); color: var(--text); }
.nav a.active { background: var(--red-soft); color: #fff; }
.nav a.active svg { color: var(--red); opacity: 1; }
.nav a .nav-count { margin-left: auto; background: var(--red); color: #fff; border-radius: 10px; padding: 0 7px; font-size: 0.72rem; font-weight: 700; }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; font-size: 0.85rem; }
.user-chip { display: flex; gap: 10px; align-items: center; padding: 10px; background: var(--surface); border-radius: 10px; border: 1px solid var(--border); }
.user-chip .avatar-sm { width: 34px; height: 34px; border-radius: 50%; background: var(--red); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-family: var(--font-title); flex: none; }
.main { padding: 22px 26px 40px; min-width: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.menu-btn { display: none; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.kpi span { font-size: 0.78rem; color: var(--muted); display: block; }
.kpi strong { font-family: var(--font-title); font-size: 1.55rem; display: block; margin-top: 2px; }
.kpi small { font-size: 0.75rem; }

/* atendimento */
.desk { display: grid; grid-template-columns: 340px 1fr; gap: 16px; align-items: start; }
.desk-call { min-height: 70vh; display: flex; flex-direction: column; gap: 14px; }
.desk-call .call { flex: 1; min-height: 520px; }
.q-list { display: flex; flex-direction: column; gap: 8px; }
.q-item { background: var(--bg-2); border: 1px solid var(--border); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.q-item.dragging { opacity: 0.5; }
.q-item[draggable='true'] { cursor: grab; }
.q-item .q-top { display: flex; align-items: center; gap: 8px; }
.q-item .q-code { font-family: var(--font-title); font-weight: 700; color: var(--red); font-size: 0.85rem; }
.q-item .q-name { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q-item .q-desc { font-size: 0.84rem; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.q-item .q-meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; font-size: 0.78rem; color: var(--muted); }
.q-item .q-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 2px; }
.client-info dl { display: grid; grid-template-columns: 110px 1fr; gap: 6px 10px; margin: 0; font-size: 0.9rem; }
.client-info dt { color: var(--muted); }
.client-info dd { margin: 0; word-break: break-word; }
.timer { font-variant-numeric: tabular-nums; }

/* painel ao vivo */
.board { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; align-items: start; }
.room-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 10px; transition: border-color 0.15s, background 0.15s; }
.room-card.drop-ok { border-color: var(--red); background: #2a1f1f; }
.room-card.triage { border-top: 3px solid var(--amber); }
.room-card.service { border-top: 3px solid var(--red); }
.room-card.pool { border-top: 3px solid var(--blue); }
.room-card .room-head { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.room-card .room-head h3 { margin: 0; font-size: 1rem; }
.room-host { display: flex; gap: 8px; align-items: center; font-size: 0.85rem; color: var(--text-2); }
.room-current { background: rgba(63, 182, 122, 0.08); border: 1px solid rgba(63, 182, 122, 0.25); border-radius: 10px; padding: 8px 10px; font-size: 0.85rem; }

/* gráficos simples */
.bars { display: flex; align-items: flex-end; gap: 4px; height: 150px; padding-top: 10px; }
.bars .bar { flex: 1; background: var(--red); border-radius: 4px 4px 0 0; min-height: 2px; position: relative; opacity: 0.9; }
.bars .bar:hover { opacity: 1; }
.bars-labels { display: flex; gap: 4px; font-size: 0.66rem; color: var(--muted); margin-top: 4px; }
.bars-labels span { flex: 1; text-align: center; overflow: hidden; }
.hbar { display: grid; grid-template-columns: 140px 1fr 40px; gap: 10px; align-items: center; font-size: 0.85rem; margin-bottom: 6px; }
.hbar .track { background: var(--surface-3); border-radius: 6px; height: 10px; overflow: hidden; }
.hbar .fill { background: var(--red); height: 100%; border-radius: 6px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tabs button { background: var(--surface); border: 1px solid var(--border); color: var(--text-2); padding: 7px 12px; border-radius: 9px; cursor: pointer; font: 500 0.85rem var(--font); }
.tabs button.on { background: var(--red); border-color: var(--red); color: #fff; }

/* login */
.login-page { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-art { background: #1a1a1a url('/assets/img/lazari-banner.jpg') center / cover no-repeat; border-right: 1px solid var(--border); }
.login-box { display: flex; align-items: center; justify-content: center; padding: 32px 20px; }
.login-box .card { width: min(420px, 100%); }

/* ---------------------------------------------------------------- responsivo */
@media (max-width: 1100px) {
  .desk { grid-template-columns: 1fr; }
  .call { grid-template-columns: 1fr; }
  .chat { max-height: 360px; }
}
@media (max-width: 860px) {
  .staff-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 50; left: 0; top: 0; width: 260px; transform: translateX(-100%); transition: transform 0.2s; box-shadow: var(--shadow); }
  .sidebar.open { transform: none; }
  .menu-btn { display: inline-flex; }
  .main { padding: 16px; }
  .grid-2 { grid-template-columns: 1fr; }
  .login-page { grid-template-columns: 1fr; }
  .login-art { min-height: 200px; border-right: none; border-bottom: 1px solid var(--border); }
}
@media (max-width: 560px) {
  .wait-grid { grid-template-columns: 1fr 1fr; }
  .ticket-code { font-size: 2.4rem; }
  .client-top { padding: 14px 16px; }
  .tile.self { width: 34%; min-width: 110px; }
  .ctrl { width: 46px; height: 46px; }
  .hbar { grid-template-columns: 100px 1fr 32px; }
}
