/* OnBarber — estilo dos painéis (IA.ON) */
:root {
  --petroleo: #0B3B45; --petroleo-2: #0F4C59; --teal: #14B8A6; --teal-d: #0D9488; --amarelo: #F5B700;
  --bg: #F4F6F7; --card: #FFFFFF; --line: #E3E8EA; --text: #12262B; --muted: #5F7378; --soft: #EEF3F4;
  --ok: #16A34A; --warn: #D97706; --err: #DC2626; --info: #2563EB;
  --accent: var(--teal); --r: 12px; --sh: 0 1px 2px rgba(11,59,69,.06), 0 4px 16px rgba(11,59,69,.06);
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.45; }
body.no-scroll { overflow: hidden; }
a { color: var(--petroleo-2); }
h1, h2, h3, h4 { margin: 0 0 .4em; line-height: 1.2; letter-spacing: -.01em; }
h1 { font-size: 1.55rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1.05rem; }
p { margin: 0 0 .6em; }
small, .muted { color: var(--muted); }
code { background: var(--soft); padding: 1px 6px; border-radius: 6px; font-size: .88em; }

/* Layout */
.layout { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.side { background: var(--petroleo); color: #D7E7EA; padding: 18px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; color: #fff; font-weight: 800; font-size: 1.05rem; }
.brand .logo { width: 34px; height: 34px; border-radius: 9px; background: var(--accent); display: grid; place-items: center; color: #fff; font-size: 1rem; overflow: hidden; flex: none; }
.brand .logo img { width: 100%; height: 100%; object-fit: cover; }
.brand small { display: block; color: #8FB3BA; font-weight: 500; font-size: .74rem; }
.side a.nav { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 9px; color: #CFE1E4; text-decoration: none; font-weight: 600; font-size: .93rem; }
.side a.nav:hover { background: rgba(255,255,255,.06); color: #fff; }
.side a.nav.on { background: rgba(20,184,166,.18); color: #fff; box-shadow: inset 3px 0 0 var(--teal); }
.side .sep { margin: 12px 12px 4px; font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: #6F98A0; font-weight: 700; }
.side .badge { margin-left: auto; }
.side .foot { margin-top: auto; padding: 12px 8px 0; font-size: .78rem; color: #7FA3AA; }
.main { min-width: 0; }
.top { display: flex; align-items: center; gap: 12px; padding: 14px 26px; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.top h1 { margin: 0; font-size: 1.2rem; }
.top .right { margin-left: auto; display: flex; gap: 10px; align-items: center; }
.menu-btn { display: none; }
.content { padding: 22px 26px 60px; max-width: 1280px; }
.banner { padding: 11px 16px; border-radius: 10px; margin-bottom: 16px; font-weight: 600; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.banner.warn { background: #FFF6DB; color: #7A5500; border: 1px solid #F4DE9B; }
.banner.err { background: #FDECEC; color: #8A1C1C; border: 1px solid #F5C2C2; }
.banner.info { background: #E6F7F5; color: #0B5D54; border: 1px solid #BDE9E3; }

/* Cards / grid */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; box-shadow: var(--sh); }
.card + .card { margin-top: 16px; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head h2, .card-head h3 { margin: 0; }
.card-head .right { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; box-shadow: var(--sh); }
.kpi span { color: var(--muted); font-size: .82rem; font-weight: 600; }
.kpi b { display: block; font-size: 1.55rem; margin-top: 4px; letter-spacing: -.02em; }
.kpi small { font-size: .78rem; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.stack > * + * { margin-top: 12px; }

/* Botões */
.btn { appearance: none; border: 1px solid var(--line); background: #fff; color: var(--text); padding: 9px 15px; border-radius: 9px; font: inherit; font-weight: 700; font-size: .9rem; cursor: pointer; display: inline-flex; align-items: center; gap: 7px; text-decoration: none; white-space: nowrap; transition: .15s; }
.btn:hover { border-color: #C9D3D6; background: #FAFCFC; }
.btn.primary { background: var(--petroleo); border-color: var(--petroleo); color: #fff; }
.btn.primary:hover { background: var(--petroleo-2); }
.btn.accent { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn.accent:hover { background: var(--teal-d); }
.btn.danger { background: var(--err); border-color: var(--err); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--soft); }
.btn.sm { padding: 6px 11px; font-size: .83rem; border-radius: 8px; }
.btn:disabled { opacity: .55; cursor: wait; }
.icon-btn { border: 0; background: transparent; cursor: pointer; font-size: 1.05rem; padding: 6px 8px; border-radius: 8px; color: var(--muted); }
.icon-btn:hover { background: var(--soft); color: var(--text); }

/* Formulários */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; min-width: 0; }
.field > span { font-size: .82rem; font-weight: 700; color: #34494E; }
.field small { font-size: .78rem; }
input, select, textarea { font: inherit; color: var(--text); border: 1px solid #CDD7DA; border-radius: 9px; padding: 9px 11px; background: #fff; width: 100%; min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(20,184,166,.35); border-color: var(--teal); }
textarea { min-height: 84px; resize: vertical; }
input[type=color] { padding: 2px; height: 40px; }
.fgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
.fgrid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.fgrid .full { grid-column: 1 / -1; }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; font-weight: 600; font-size: .92rem; margin: 4px 0 10px; }
.switch input { display: none; }
.switch i { width: 40px; height: 23px; border-radius: 20px; background: #CBD5D8; position: relative; transition: .2s; flex: none; }
.switch i::after { content: ''; position: absolute; width: 17px; height: 17px; border-radius: 50%; background: #fff; top: 3px; left: 3px; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch input:checked + i { background: var(--teal); }
.switch input:checked + i::after { left: 20px; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px 14px; }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: .9rem; cursor: pointer; padding: 6px 8px; border-radius: 8px; }
.check:hover { background: var(--soft); }
.check input { flex: none; width: 16px; height: 16px; padding: 0; margin-top: 3px; accent-color: var(--teal); }

/* Tabelas */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); background: #fff; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; padding: 10px 14px; background: #F8FAFA; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 11px 14px; border-bottom: 1px solid #EEF2F3; vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; } tr.click:hover td { background: #F7FBFB; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: .74rem; font-weight: 700; padding: 3px 9px; border-radius: 30px; background: var(--soft); color: #3C5257; white-space: nowrap; }
.badge:empty { display: none; }
.badge.ok, .st-confirmado { background: #DCFCE7; color: #166534; }
.badge.warn { background: #FEF3C7; color: #92400E; }
.badge.err, .st-faltou { background: #FEE2E2; color: #991B1B; }
.badge.info, .st-agendado { background: #E0F2FE; color: #075985; }
.st-concluido { background: #E7E5FF; color: #3730A3; }
.st-cancelado { background: #F1F3F4; color: #6B7B80; text-decoration: line-through; }
.badge.soon { background: #FFF4CC; color: #8A6100; }
.badge.dot::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill-count { background: var(--amarelo); color: #3A2B00; border-radius: 20px; font-size: .72rem; font-weight: 800; padding: 1px 7px; }

/* Modal */
.modal-wrap { position: fixed; inset: 0; background: rgba(8,30,35,.45); display: grid; place-items: center; z-index: 50; padding: 16px; animation: fade .15s; }
.modal { background: #fff; border-radius: 16px; width: min(560px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal.wide { width: min(920px, 100%); }
.modal-head { display: flex; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; } .modal-head .close { margin-left: auto; }
.modal-body { padding: 18px 20px; overflow-y: auto; }
.modal-foot { padding: 12px 20px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.modal-foot:empty { display: none; }
@keyframes fade { from { opacity: 0; } }

/* Toast */
#toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { background: var(--petroleo); color: #fff; padding: 11px 16px; border-radius: 10px; font-weight: 600; box-shadow: 0 8px 24px rgba(0,0,0,.2); max-width: 360px; transition: .4s; }
.toast.err { background: var(--err); }
.toast.out { opacity: 0; transform: translateY(8px); }

.empty { text-align: center; padding: 34px 16px; color: var(--muted); }
.empty div { font-size: 2rem; margin-bottom: 6px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 10px 14px; font: inherit; font-weight: 700; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button.on { color: var(--petroleo); border-color: var(--teal); }
.meter { height: 8px; background: var(--soft); border-radius: 8px; overflow: hidden; margin-top: 6px; }
.meter i { display: block; height: 100%; background: var(--teal); border-radius: 8px; }
.meter.hot i { background: var(--warn); }
.bars .bar { display: grid; grid-template-columns: 130px 1fr 90px; gap: 10px; align-items: center; font-size: .86rem; margin-bottom: 7px; }
.bars .bar .track { height: 12px; background: var(--soft); border-radius: 6px; overflow: hidden; }
.bars .bar .track i { display: block; height: 100%; background: var(--teal); border-radius: 6px; }
.bars .bar span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bars .bar span:last-child { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid #CDD7DA; background: #fff; border-radius: 20px; padding: 5px 11px; font: inherit; font-size: .84rem; font-weight: 700; cursor: pointer; }
.chip.on, .chip:hover { background: var(--petroleo); border-color: var(--petroleo); color: #fff; }

/* Agenda */
.ag-toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.ag-toolbar input[type=date] { width: auto; }
.ag-date { font-weight: 800; font-size: 1.05rem; margin: 0 6px; }
.agenda { display: grid; border: 1px solid var(--line); border-radius: var(--r); background: #fff; overflow: auto; max-height: calc(100vh - 210px); }
.ag-head { position: sticky; top: 0; z-index: 3; background: #fff; display: contents; }
.ag-hcell { position: sticky; top: 0; z-index: 3; background: #F8FAFA; border-bottom: 1px solid var(--line); padding: 10px; font-weight: 800; font-size: .88rem; text-align: center; border-left: 1px solid var(--line); white-space: nowrap; }
.ag-hcell:first-child { border-left: 0; left: 0; z-index: 4; }
.ag-hcell i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; }
.ag-times { position: sticky; left: 0; z-index: 2; background: #fff; border-right: 1px solid var(--line); }
.ag-time { position: absolute; right: 8px; font-size: .72rem; color: var(--muted); transform: translateY(-50%); font-variant-numeric: tabular-nums; }
.ag-col { position: relative; border-left: 1px solid #EEF2F3; min-width: 170px; }
.ag-line { position: absolute; left: 0; right: 0; border-top: 1px solid #F0F3F4; }
.ag-line.hour { border-top-color: #E3E9EB; }
.ag-off { position: absolute; left: 0; right: 0; background: repeating-linear-gradient(135deg, #F6F8F9, #F6F8F9 6px, #EEF2F3 6px, #EEF2F3 12px); }
.ag-slot { position: absolute; left: 0; right: 0; cursor: pointer; }
.ag-slot:hover { background: rgba(20,184,166,.08); }
.ag-slot:hover::after { content: '+ agendar'; position: absolute; left: 8px; top: 2px; font-size: .72rem; font-weight: 700; color: var(--teal-d); }
.ag-ev { position: absolute; left: 4px; right: 4px; border-radius: 8px; padding: 4px 8px; font-size: .78rem; overflow: hidden; cursor: pointer; border-left: 4px solid var(--c, var(--teal)); background: #F0FBFA; box-shadow: 0 1px 3px rgba(0,0,0,.08); z-index: 1; line-height: 1.25; }
.ag-ev:hover { box-shadow: 0 3px 10px rgba(0,0,0,.14); z-index: 2; }
.ag-ev b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .82rem; }
.ag-ev.confirmado { background: #ECFDF3; } .ag-ev.concluido { background: #EEF0FF; } .ag-ev.faltou { background: #FEF0F0; } .ag-ev.cancelado { opacity: .45; }
.ag-ev .tag { font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .03em; opacity: .7; }
.ag-block { position: absolute; left: 4px; right: 4px; border-radius: 8px; background: #E9EDEF; border: 1px dashed #B8C3C7; font-size: .75rem; padding: 4px 8px; color: #55666B; z-index: 1; cursor: pointer; overflow: hidden; }
.ag-now { position: absolute; left: 0; right: 0; border-top: 2px solid var(--err); z-index: 2; pointer-events: none; }

/* Conversas */
.chat { display: grid; grid-template-columns: 320px 1fr; height: calc(100vh - 150px); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: #fff; }
.chat-list { border-right: 1px solid var(--line); overflow-y: auto; }
.chat-item { padding: 12px 14px; border-bottom: 1px solid #EEF2F3; cursor: pointer; display: flex; gap: 10px; align-items: center; }
.chat-item:hover, .chat-item.on { background: #F2F8F8; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: #D6E6E9; color: var(--petroleo); display: grid; place-items: center; font-weight: 800; flex: none; }
.chat-item .meta { min-width: 0; flex: 1; }
.chat-item .meta b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-item .meta small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-pane { display: flex; flex-direction: column; min-width: 0; background: #EFEAE2; }
.chat-head { background: #F0F2F5; padding: 10px 16px; display: flex; gap: 10px; align-items: center; border-bottom: 1px solid #DDE1E3; flex-wrap: wrap; }
.chat-msgs { flex: 1; overflow-y: auto; padding: 16px 6%; display: flex; flex-direction: column; gap: 4px; background-image: radial-gradient(rgba(0,0,0,.035) 1px, transparent 1px); background-size: 18px 18px; }
.msg { max-width: 72%; padding: 7px 10px 18px; border-radius: 9px; font-size: .92rem; position: relative; white-space: pre-wrap; word-wrap: break-word; box-shadow: 0 1px .5px rgba(0,0,0,.13); background: #fff; align-self: flex-start; min-width: 90px; }
.msg.out { align-self: flex-end; background: #D9FDD3; }
.msg.out.ia { background: #D1F4EE; }
.msg time { position: absolute; right: 8px; bottom: 3px; font-size: .68rem; color: #667781; }
.msg .who { font-size: .7rem; font-weight: 800; color: var(--teal-d); display: block; margin-bottom: 2px; }
.chat-send { display: flex; gap: 8px; padding: 10px 14px; background: #F0F2F5; }
.chat-send textarea { min-height: 42px; height: 42px; border-radius: 20px; padding: 10px 16px; }
.qr-box { display: grid; place-items: center; min-height: 260px; background: var(--soft); border-radius: var(--r); padding: 16px; }
.qr-box img { width: 260px; height: 260px; image-rendering: pixelated; background: #fff; border-radius: 8px; }

/* Planos */
.plans-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.plan-card { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 20px; display: flex; flex-direction: column; gap: 10px; position: relative; box-shadow: var(--sh); }
.plan-card.hl { border-color: var(--teal); box-shadow: 0 0 0 2px rgba(20,184,166,.25), var(--sh); }
.plan-card.off { opacity: .6; }
.plan-card .price { font-size: 1.7rem; font-weight: 800; letter-spacing: -.02em; }
.plan-card .price small { font-size: .85rem; font-weight: 600; }
.plan-card ul { margin: 0; padding-left: 18px; font-size: .88rem; }
.plan-card .flags { display: flex; gap: 6px; flex-wrap: wrap; }
.feat-group { margin-bottom: 12px; }
.feat-group h4 { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 6px 0; }

.login-page { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(140deg, var(--petroleo), #072A31 60%); padding: 20px; }
.login-card { background: #fff; border-radius: 18px; padding: 30px; width: min(420px, 100%); box-shadow: 0 30px 80px rgba(0,0,0,.35); }
.login-card .brand { color: var(--text); padding: 0 0 18px; }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 250px; z-index: 40; transform: translateX(-100%); transition: .25s; }
  .side.open { transform: none; box-shadow: 10px 0 40px rgba(0,0,0,.3); }
  .menu-btn { display: inline-flex; }
  .content { padding: 16px 14px 60px; }
  .top { padding: 12px 14px; }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3, .g2 { grid-template-columns: 1fr; }
  .fgrid, .fgrid.c3 { grid-template-columns: 1fr; }
  .chat { grid-template-columns: 1fr; height: auto; }
  .chat-list { max-height: 260px; border-right: 0; border-bottom: 1px solid var(--line); }
  .chat-pane { height: 70vh; }
  .bars .bar { grid-template-columns: 90px 1fr 70px; }
  .msg { max-width: 88%; }
}
