/* Lugar — sistema visual */
:root {
  --paper: #f6f4ef;
  --card: #ffffff;
  --ink: #17181c;
  --ink-2: #3a3b40;
  --muted: #6f6d64;
  --faint: #a5a296;
  --line: #e7e3da;
  --line-2: #d9d4c7;
  --accent: #e4572e;
  --accent-soft: #fdeee8;
  --green: #1f8a5b;
  --green-soft: #e6f4ec;
  --amber: #b7790b;
  --amber-soft: #fdf3dc;
  --blue: #3550c8;
  --blue-soft: #eaeefc;
  --red: #c23a2b;
  --red-soft: #fbe9e6;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(23, 24, 28, 0.04), 0 6px 24px rgba(23, 24, 28, 0.06);
  --shadow-lg: 0 18px 60px rgba(23, 24, 28, 0.16);
  --display: 'Bricolage Grotesque', 'Instrument Sans', system-ui, sans-serif;
  --body: 'Instrument Sans', system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body { font-family: var(--body); background: var(--paper); color: var(--ink); line-height: 1.55; font-size: 15px; min-height: 100vh; }
a { color: inherit; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { font-family: var(--display); line-height: 1.15; letter-spacing: -0.01em; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--accent); color: #fff; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.wrap-sm { max-width: 720px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.mono { font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; letter-spacing: 0.04em; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.grow { flex: 1; }
.stack > * + * { margin-top: 14px; }
.hide { display: none !important; }
.center { text-align: center; }
.mt-1 { margin-top: 6px; } .mt-2 { margin-top: 12px; } .mt-3 { margin-top: 20px; } .mt-4 { margin-top: 32px; }
.mb-2 { margin-bottom: 12px; } .mb-3 { margin-bottom: 20px; }

/* Logótipo */
.logo { font-family: var(--display); font-weight: 800; font-size: 21px; letter-spacing: -0.03em; text-decoration: none; display: inline-flex; align-items: center; gap: 8px; }
.logo-mark { width: 26px; height: 26px; border-radius: 8px; background: var(--ink); position: relative; display: inline-block; }
.logo-mark::before { content: ''; position: absolute; left: 7px; top: 6px; width: 12px; height: 14px; border-radius: 6px 6px 2px 2px; background: var(--accent); }
.logo-mark::after { content: ''; position: absolute; left: 11px; top: 10px; width: 4px; height: 4px; border-radius: 50%; background: var(--ink); }
.logo .dot { color: var(--accent); }

/* Botões */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1.5px solid var(--line-2); background: var(--card); padding: 10px 16px; border-radius: var(--radius-sm); font-weight: 600; font-size: 14px; cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s, transform .08s, box-shadow .15s; white-space: nowrap; }
.btn:hover { border-color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn-primary:hover { background: #000; }
.btn-accent { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-accent:hover { filter: brightness(.94); border-color: var(--accent); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: rgba(23, 24, 28, .05); border-color: transparent; }
.btn-danger { color: var(--red); }
.btn-danger:hover { border-color: var(--red); background: var(--red-soft); }
.btn-sm { padding: 6px 11px; font-size: 13px; border-radius: 8px; }
.btn-lg { padding: 14px 22px; font-size: 16px; border-radius: 12px; }
.btn-block { width: 100%; }
.icon-btn { width: 38px; height: 38px; padding: 0; border-radius: 10px; }

/* Cartões */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.card-flat { box-shadow: none; }
.card h3 { font-size: 17px; margin-bottom: 4px; }
.section-title { font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 12px; font-family: var(--body); }

/* Formulários */
.field { display: block; margin-bottom: 16px; }
.field > span, .label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.field .hint { display: block; font-size: 12px; color: var(--muted); margin-top: 5px; font-weight: 400; }
.req { color: var(--accent); }
.input, select.input, textarea.input { width: 100%; padding: 11px 13px; border: 1.5px solid var(--line-2); border-radius: var(--radius-sm); background: #fff; outline: none; transition: border-color .15s, box-shadow .15s; font-size: 15px; }
textarea.input { min-height: 96px; resize: vertical; }
.input:focus { border-color: var(--ink); box-shadow: 0 0 0 4px rgba(23, 24, 28, .07); }
.input::placeholder { color: var(--faint); }
.input.invalid { border-color: var(--red); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 16px; }
@media (max-width: 640px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; font-size: 14px; padding: 4px 0; }
.check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--ink); flex-shrink: 0; }
.phone-row { display: flex; gap: 8px; }
.phone-row select { width: 118px; flex-shrink: 0; }

/* Interruptor */
.switch { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.switch:last-child { border-bottom: 0; }
.switch input { appearance: none; width: 42px; height: 24px; background: var(--line-2); border-radius: 20px; position: relative; cursor: pointer; transition: background .2s; flex-shrink: 0; }
.switch input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: left .2s; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); }
.switch input:checked { background: var(--green); }
.switch input:checked::after { left: 21px; }
.switch strong { display: block; font-size: 14px; }
.switch small { color: var(--muted); font-size: 12.5px; }

/* Opções segmentadas */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; }
.seg label { border: 1.5px solid var(--line-2); border-radius: 11px; padding: 12px; cursor: pointer; text-align: center; font-weight: 600; font-size: 14px; background: #fff; transition: all .15s; }
.seg label small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; margin-top: 2px; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:checked) { border-color: var(--ink); background: var(--ink); color: #fff; }
.seg label:has(input:checked) small { color: #c9c7be; }
@media (max-width: 520px) { .seg { grid-auto-flow: row; } }

/* Distintivos */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 30px; background: var(--paper); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap; }
.badge.green { background: var(--green-soft); color: var(--green); border-color: transparent; }
.badge.amber { background: var(--amber-soft); color: var(--amber); border-color: transparent; }
.badge.blue { background: var(--blue-soft); color: var(--blue); border-color: transparent; }
.badge.red { background: var(--red-soft); color: var(--red); border-color: transparent; }
.badge.dark { background: var(--ink); color: #fff; border-color: transparent; }
.badge.accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }

/* Barra superior */
.topbar { position: sticky; top: 0; z-index: 30; background: rgba(246, 244, 239, .86); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.topbar .wrap { display: flex; align-items: center; gap: 14px; height: 62px; }
.topbar nav { display: flex; gap: 4px; margin-left: 14px; }
.topbar nav a { text-decoration: none; font-weight: 600; font-size: 14px; padding: 7px 12px; border-radius: 8px; color: var(--muted); }
.topbar nav a:hover, .topbar nav a.on { color: var(--ink); background: rgba(23, 24, 28, .05); }
@media (max-width: 640px) { .topbar nav { display: none; } }

/* Sino de alertas */
.bell { position: relative; }
.bell .count { position: absolute; top: -4px; right: -4px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; min-width: 19px; height: 19px; border-radius: 10px; display: flex; align-items: center; justify-content: center; padding: 0 5px; border: 2px solid var(--paper); }
.dropdown { position: absolute; right: 0; top: calc(100% + 8px); width: min(380px, calc(100vw - 24px)); background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); z-index: 50; overflow: hidden; }
.dropdown header { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.notif-list { max-height: 380px; overflow-y: auto; }
.notif { display: block; padding: 12px 16px; border-bottom: 1px solid var(--line); text-decoration: none; font-size: 14px; }
.notif:hover { background: var(--paper); }
.notif.unread { background: #fffaf7; border-left: 3px solid var(--accent); }
.notif time { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }

/* Estatísticas */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.stat b { display: block; font-family: var(--display); font-size: 28px; line-height: 1.1; }
.stat span { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.meter { height: 8px; background: var(--paper); border-radius: 10px; overflow: hidden; margin-top: 10px; }
.meter i { display: block; height: 100%; background: var(--ink); border-radius: 10px; transition: width .5s; }
.meter.hot i { background: var(--accent); }

/* Tabelas */
.table-wrap { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; padding: 12px 14px; border-bottom: 1px solid var(--line); background: #fcfbf8; white-space: nowrap; }
td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tbody tr { cursor: pointer; }
tbody tr:hover td { background: #fcfbf8; }

/* Separadores */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 22px; overflow-x: auto; scrollbar-width: none; }
.tabs a, .tabs button { background: none; border: 0; padding: 11px 14px; font-weight: 600; font-size: 14px; color: var(--muted); text-decoration: none; border-bottom: 2.5px solid transparent; margin-bottom: -1px; cursor: pointer; white-space: nowrap; }
.tabs a.on, .tabs button.on { color: var(--ink); border-bottom-color: var(--accent); }

/* Notificação flutuante */
#toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 12px; font-size: 14px; box-shadow: var(--shadow-lg); animation: tin .25s ease-out; pointer-events: auto; max-width: calc(100vw - 32px); }
.toast.err { background: var(--red); }
.toast.ok { background: var(--green); }
@keyframes tin { from { opacity: 0; transform: translateY(10px); } }

/* Janela modal */
.modal-bg { position: fixed; inset: 0; background: rgba(23, 24, 28, .45); z-index: 80; display: flex; align-items: flex-end; justify-content: center; padding: 0; animation: fin .2s; }
@media (min-width: 640px) { .modal-bg { align-items: center; padding: 20px; } }
.modal { background: #fff; width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto; border-radius: 18px 18px 0 0; padding: 24px; animation: up .25s ease-out; }
@media (min-width: 640px) { .modal { border-radius: 18px; } }
@keyframes fin { from { opacity: 0; } }
@keyframes up { from { transform: translateY(30px); opacity: 0; } }

/* Estado vazio */
.empty { text-align: center; padding: 56px 20px; color: var(--muted); }
.empty .big { font-size: 40px; margin-bottom: 8px; }
.empty h3 { color: var(--ink); margin-bottom: 6px; }

/* Bilhete */
.ticket { background: #fff; border-radius: 18px; box-shadow: var(--shadow-lg); position: relative; overflow: hidden; }
.ticket-top { padding: 26px 24px 22px; }
.ticket-cut { position: relative; height: 0; border-top: 2px dashed var(--line-2); margin: 0 20px; }
.ticket-cut::before, .ticket-cut::after { content: ''; position: absolute; top: -13px; width: 24px; height: 24px; border-radius: 50%; background: var(--paper); }
.ticket-cut::before { left: -32px; }
.ticket-cut::after { right: -32px; }
.ticket-bottom { padding: 22px 24px 26px; display: flex; gap: 18px; align-items: center; }
.ticket-code { font-family: var(--display); font-size: 28px; font-weight: 800; letter-spacing: .06em; }
.qr-box { background: #fff; padding: 6px; border: 1px solid var(--line); border-radius: 10px; line-height: 0; flex-shrink: 0; }

.spinner { width: 18px; height: 18px; border: 2.5px solid rgba(255, 255, 255, .35); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media print {
  .topbar, .no-print, #toasts { display: none !important; }
  body { background: #fff; }
}

/* Ícones */
.ic { display: inline-block; vertical-align: -0.18em; flex-shrink: 0; }
.icon-tile { width: 46px; height: 46px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--accent); }
.icon-hero { width: 72px; height: 72px; border-radius: 20px; display: inline-flex; align-items: center; justify-content: center; background: var(--card); border: 1px solid var(--line); color: var(--ink); box-shadow: var(--shadow); }
