/* HBK Eventos — backoffice do organizador
   Tinta #1B2340 · Fundo #F4F6F9 · Luz de palco #F2B705 · Confirmado #1F6F68 · Alerta #B4361E */
:root {
  --ink: #1B2340; --ink-2: #4A5372; --ink-3: #7C849E;
  --paper: #F4F6F9; --surface: #FFFFFF; --line: #DCE1EA; --line-2: #C6CDDA;
  --stage: #F2B705; --stage-ink: #2A2000; --stage-soft: #FDF3D0;
  --go: #1F6F68; --go-soft: #DDEFEC; --stop: #B4361E; --stop-soft: #F8E1DB;
  --wait: #8A5A00; --wait-soft: #FBEBC8; --info: #2F4A8A; --info-soft: #E2E8F6;
  --r-sm: 6px; --r: 10px;
  --display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --text: "Instrument Sans", "Segoe UI", system-ui, sans-serif;
  --shadow: 0 1px 0 rgba(27, 35, 64, .06), 0 6px 18px -10px rgba(27, 35, 64, .25);
  --side: 220px;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 15px/1.5 var(--text); font-feature-settings: "tnum" 1; }
a { color: var(--ink); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--stage); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { font-family: var(--display); line-height: 1.15; margin: 0 0 .5em; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.6rem, 1.2rem + 1.4vw, 2.2rem); font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: 1.2rem; font-weight: 650; }
h3 { font-size: 1rem; font-weight: 650; }
p { margin: 0 0 1em; }
.muted { color: var(--ink-2); } .faint { color: var(--ink-3); }
.small { font-size: .85rem; } .tiny { font-size: .78rem; }
.num { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.neg { color: var(--stop); } .pos { color: var(--go); }
.pre { white-space: pre-line; }

/* ---------- Estrutura ---------- */
.app { display: grid; grid-template-columns: var(--side) 1fr; min-height: 100vh; background: linear-gradient(to right, var(--ink) var(--side), var(--paper) var(--side)); }
.side { background: var(--ink); color: #D7DCEA; padding: 18px 12px; display: flex; flex-direction: column; gap: 2px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; font: 700 1.05rem var(--display); text-decoration: none; color: #fff; margin: 0 8px 20px; }
.brand-mark { width: 26px; height: 20px; background: var(--stage); border-radius: 4px; position: relative; flex: none; }
.brand-mark::before, .brand-mark::after { content: ""; position: absolute; top: 50%; width: 9px; height: 9px; border-radius: 50%; background: var(--ink); transform: translateY(-50%); }
.brand-mark::before { left: -4.5px; } .brand-mark::after { right: -4.5px; }
.side .group { font-size: .72rem; color: #8F97B3; margin: 14px 12px 4px; }
.side a.nav { color: #D7DCEA; text-decoration: none; padding: 8px 12px; border-radius: var(--r-sm); font-weight: 500; display: flex; justify-content: space-between; align-items: center; }
.side a.nav:hover { background: rgba(255,255,255,.07); color: #fff; }
.side a.nav[aria-current="page"] { background: rgba(242,183,5,.16); color: #fff; box-shadow: inset 3px 0 0 var(--stage); }
.side .count { font-size: .72rem; background: var(--stage); color: var(--stage-ink); border-radius: 999px; padding: 0 7px; font-weight: 700; }
.side .me { margin-top: auto; font-size: .8rem; padding: 12px; border-top: 1px solid rgba(255,255,255,.12); }
.side .me a { color: #fff; }
.side .me button { color: #D7DCEA; padding: 0; border: 0; background: none; text-decoration: underline; cursor: pointer; font: inherit; }
.main { padding: 26px 32px 64px; min-width: 0; max-width: 1400px; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { margin: 0; }
.page-head .sub { color: var(--ink-2); margin-top: 6px; display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.crumb { font-size: .85rem; margin: 0 0 6px; color: var(--ink-2); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line-2); margin: 0 0 22px; overflow-x: auto; scrollbar-width: thin; }
.tabs a { padding: 9px 13px; text-decoration: none; color: var(--ink-2); font-weight: 500; border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--stage); font-weight: 650; }
.tabs .badge { font-size: .72rem; background: var(--stop); color: #fff; border-radius: 999px; padding: 0 6px; margin-left: 4px; }

.panel { background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 18px; }
.panel > h2:first-child, .panel > h3:first-child { margin-top: 0; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.panel-head h2 { margin: 0; }
.panel.flush { padding: 6px 10px; }
.cols { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.cols-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(175px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { background: var(--surface); border-radius: var(--r); padding: 14px 16px; box-shadow: var(--shadow); text-decoration: none; display: block; }
a.kpi:hover { box-shadow: 0 1px 0 rgba(27,35,64,.08), 0 12px 24px -14px rgba(27,35,64,.45); }
.kpi .v { font: 700 1.55rem/1.15 var(--display); }
.kpi .l { color: var(--ink-2); font-size: .84rem; }
.kpi.alert .v { color: var(--stop); }
.meter { height: 6px; background: var(--paper); border-radius: 3px; margin-top: 8px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--go); border-radius: 3px; }
.meter.over i { background: var(--stop); }

/* ---------- Tabelas ---------- */
.t-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: .9rem; }
.t th { text-align: left; font-weight: 600; color: var(--ink-2); font-size: .78rem; padding: 8px 10px; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
.t td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.t tbody tr:last-child td { border-bottom: 0; }
.t .r { text-align: right; } .t .c { text-align: center; }
.t tfoot td { font-weight: 650; border-top: 2px solid var(--ink); }
.t tr.group td { font-weight: 650; padding-top: 14px; background: var(--paper); }
.t tr.late td:first-child { box-shadow: inset 3px 0 0 var(--stop); }
.t a.row-link { font-weight: 600; text-decoration: none; }
.t a.row-link:hover { text-decoration: underline; }

/* ---------- Estados ---------- */
.pill { display: inline-block; font-size: .72rem; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: var(--paper); border: 1px solid var(--line-2); white-space: nowrap; line-height: 1.5; }
.pill.pedido { background: var(--info-soft); color: var(--info); border-color: transparent; }
.pill.proposta, .pill.enviada, .pill.pedido-f, .pill.faturado, .pill.pendente { background: var(--wait-soft); color: #5A3B00; border-color: transparent; }
.pill.confirmado, .pill.aceite, .pill.pago, .pill.recebido { background: var(--go-soft); color: #0F4440; border-color: transparent; }
.pill.realizado { background: var(--ink); color: #fff; border-color: transparent; }
.pill.fechado, .pill.rascunho, .pill.previsto { color: var(--ink-2); }
.pill.perdido, .pill.cancelado, .pill.recusada, .pill.atraso { background: var(--stop-soft); color: #6E1F10; border-color: transparent; }
.pill.proprio { background: var(--stage-soft); color: var(--stage-ink); border-color: transparent; }

/* ---------- Formulários ---------- */
label { display: block; font-weight: 600; font-size: .88rem; margin: 0 0 5px; }
.hint { font-weight: 400; color: var(--ink-2); font-size: .78rem; }
input:not([type]), input[type=text], input[type=email], input[type=tel], input[type=number], input[type=password], input[type=url],
input[type=datetime-local], input[type=date], input[type=search], input[type=month], select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: #fff; border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 8px 10px; min-height: 40px;
}
input[type=file] { font: inherit; max-width: 100%; }
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(242,183,5,.45); }
.field { margin-bottom: 14px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 14px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0 14px; }
.check { display: flex; gap: 9px; align-items: flex-start; font-weight: 400; margin-bottom: 10px; }
.check input { margin-top: 3px; width: 17px; height: 17px; accent-color: var(--ink); flex: none; }
.seg { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.seg label { display: flex; gap: 9px; align-items: center; padding: 9px 11px; border: 1px solid var(--line-2); border-radius: var(--r-sm); font-weight: 500; cursor: pointer; margin: 0; background: #fff; }
.seg input { accent-color: var(--ink); }
.seg label:has(input:checked) { border-color: var(--ink); background: var(--stage-soft); }
fieldset { border: 0; padding: 0; margin: 0 0 14px; } legend { font-weight: 600; font-size: .88rem; margin-bottom: 6px; padding: 0; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filters input, .filters select { width: auto; min-height: 36px; padding: 5px 9px; }
.filters input[type=search] { width: 240px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; font: 600 .88rem var(--text); padding: 8px 15px; min-height: 38px;
  border-radius: var(--r-sm); border: 1px solid var(--ink); background: var(--surface); color: var(--ink); cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--paper); }
.btn-primary { background: var(--stage); border-color: var(--stage); color: var(--stage-ink); }
.btn-primary:hover { background: #E0A800; border-color: #E0A800; }
.btn-dark { background: var(--ink); color: #fff; } .btn-dark:hover { background: #2A355C; }
.btn-ghost { border-color: transparent; background: transparent; padding-inline: 9px; }
.btn-ghost:hover { background: rgba(27,35,64,.06); }
.btn-danger { border-color: var(--stop); color: var(--stop); } .btn-danger:hover { background: var(--stop-soft); }
.btn-sm { min-height: 30px; padding: 3px 9px; font-size: .78rem; }
.btn-block { width: 100%; }
.inline { display: inline; }
.icon-btn { border: 0; background: none; cursor: pointer; color: var(--ink-3); padding: 4px 6px; border-radius: 4px; font-size: 1rem; line-height: 1; }
.icon-btn:hover { color: var(--stop); background: var(--stop-soft); }

.flash { padding: 11px 15px; border-radius: var(--r-sm); margin: 0 0 18px; background: var(--go-soft); color: #0F4440; border-left: 4px solid var(--go); }
.flash.erro { background: var(--stop-soft); color: #6E1F10; border-left-color: var(--stop); }
.flash.aviso { background: var(--wait-soft); color: #5A3B00; border-left-color: var(--wait); }
.empty { padding: 30px 22px; text-align: center; background: var(--surface); border: 1px dashed var(--line-2); border-radius: var(--r); color: var(--ink-2); margin-bottom: 18px; }
.empty p:last-child { margin-bottom: 0; }

details.add { background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); margin-bottom: 18px; }
details.add > summary { padding: 13px 20px; cursor: pointer; font-weight: 600; list-style: none; display: flex; align-items: center; gap: 8px; }
details.add > summary::-webkit-details-marker { display: none; }
details.add > summary::before { content: "+"; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--stage); color: var(--stage-ink); font-weight: 700; }
details.add[open] > summary::before { content: "−"; }
details.add > form, details.add > div { padding: 0 20px 16px; }
details.pop { display: inline-block; position: relative; }
details.pop > summary { list-style: none; } details.pop > summary::-webkit-details-marker { display: none; }
details.pop > .pop-body { position: absolute; right: 0; z-index: 20; width: min(560px, 88vw); margin-top: 6px; background: var(--surface); border-radius: var(--r);
  box-shadow: 0 18px 40px -12px rgba(27,35,64,.45), 0 0 0 1px var(--line); padding: 16px 18px; text-align: left; white-space: normal; }

/* ---------- Listas e linhas ---------- */
.list-row { display: flex; gap: 12px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); }
.list-row:last-child { border-bottom: 0; }
.list-row .grow { flex: 1; min-width: 0; }
.date-chip { width: 48px; text-align: center; flex: none; line-height: 1.05; }
.date-chip .d { font: 700 1.35rem var(--display); display: block; }
.date-chip .m { font-size: .75rem; color: var(--ink-2); }
.due { font-size: .8rem; color: var(--ink-2); white-space: nowrap; }
.due.late { color: var(--stop); font-weight: 600; }

.task { display: flex; gap: 11px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); }
.task:last-child { border-bottom: 0; }
.task form.toggle button { width: 21px; height: 21px; border: 2px solid var(--ink-2); border-radius: 5px; background: #fff; cursor: pointer; padding: 0; display: grid; place-items: center; color: #fff; }
.task.done .title { text-decoration: line-through; color: var(--ink-3); }
.task.done form.toggle button { background: var(--go); border-color: var(--go); }
.task .title { flex: 1; min-width: 0; }

.note { padding: 10px 0; border-bottom: 1px solid var(--line); }
.note:last-child { border-bottom: 0; }
.note .meta { font-size: .78rem; color: var(--ink-3); display: flex; justify-content: space-between; gap: 8px; }

/* Funil */
.funnel { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0; background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); margin-bottom: 18px; overflow: hidden; }
.funnel a { padding: 12px 16px; text-decoration: none; border-right: 1px solid var(--line); position: relative; }
.funnel a:last-child { border-right: 0; }
.funnel a:hover { background: var(--paper); }
.funnel .v { font: 700 1.4rem var(--display); }
.funnel .l { font-size: .8rem; color: var(--ink-2); }
.funnel a[aria-current="true"] { box-shadow: inset 0 -3px 0 var(--stage); }

/* Barras horizontais orçado vs real */
.bars { display: grid; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 1fr auto; gap: 3px 10px; align-items: center; font-size: .85rem; }
.bar-row .bar { grid-column: 1 / -1; grid-row: 2; }
.bar { height: 14px; background: var(--paper); border-radius: 3px; position: relative; overflow: hidden; }
.bar .b { position: absolute; inset: 0 auto 0 0; background: var(--line-2); }
.bar .a { position: absolute; left: 0; top: 4px; bottom: 4px; background: var(--ink); border-radius: 2px; }
.bar .a.over { background: var(--stop); }

/* ---------- Proposta ---------- */
.ql { width: 100%; border-collapse: collapse; font-size: .88rem; }
.ql th { font-size: .75rem; color: var(--ink-2); text-align: left; padding: 6px 4px; font-weight: 600; white-space: nowrap; }
.ql td { padding: 3px 4px; vertical-align: top; }
.ql input, .ql select { min-height: 34px; padding: 5px 7px; font-size: .88rem; }
.ql .desc { min-width: 240px; }
.ql .n { width: 64px; } .ql .m { width: 104px; } .ql .v { width: 82px; } .ql .cat { width: 150px; } .ql .sup { width: 150px; }
.ql .tot { text-align: right; white-space: nowrap; padding-top: 10px; font-variant-numeric: tabular-nums; }
.ql .mg { font-size: .75rem; }
.ql tbody tr:hover { background: var(--paper); }
.sum { display: grid; grid-template-columns: 1fr auto; gap: 4px 18px; font-variant-numeric: tabular-nums; }
.sum .big { font: 700 1.3rem var(--display); }
.sum hr { grid-column: 1 / -1; border: 0; border-top: 1px solid var(--line); margin: 6px 0; width: 100%; }

/* ---------- Calendário ---------- */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); background: var(--line); gap: 1px; border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow); }
.cal .wd { background: var(--surface); padding: 8px; font-size: .78rem; color: var(--ink-2); font-weight: 600; }
.cal .day { background: var(--surface); min-height: 112px; padding: 6px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal .day.out { background: #FAFBFC; } .cal .day.out .dn { color: var(--ink-3); }
.cal .day.today .dn { background: var(--stage); color: var(--stage-ink); border-radius: 999px; padding: 0 7px; }
.cal .dn { font: 600 .85rem var(--display); align-self: flex-start; }
.cal .ev { display: block; font-size: .75rem; line-height: 1.25; padding: 3px 6px; border-radius: 4px; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border-left: 3px solid; }
.cal .ev.confirmado, .cal .ev.realizado, .cal .ev.fechado { background: var(--go-soft); border-color: var(--go); color: #0F4440; }
.cal .ev.proposta { background: var(--wait-soft); border-color: var(--wait); color: #5A3B00; }
.cal .ev.pedido { background: var(--info-soft); border-color: var(--info); color: var(--info); }
.cal .ev.montagem, .cal .ev.desmontagem { background: repeating-linear-gradient(135deg, #fff, #fff 4px, var(--paper) 4px, var(--paper) 8px); color: var(--ink-2); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .8rem; color: var(--ink-2); margin-top: 10px; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; margin-right: 5px; }

/* ---------- Login ---------- */
.bare { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--ink); }
.login { width: min(400px, 100%); background: var(--surface); border-radius: var(--r); padding: 28px; }
.login .brand { color: var(--ink); margin: 0 0 22px; }
.login .brand-mark { background: var(--ink); } .login .brand-mark::before, .login .brand-mark::after { background: var(--surface); }

/* ---------- Responsivo ---------- */
@media (max-width: 1080px) { .cols { grid-template-columns: 1fr; } }
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; background: var(--paper); }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 8px 10px; }
  .side .brand { margin: 0 10px 0 4px; } .side .group { display: none; }
  .side a.nav { padding: 6px 9px; font-size: .88rem; }
  .side .me { margin: 0 0 0 auto; border: 0; padding: 4px; }
  .main { padding: 18px 16px 48px; }
  .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; }
  .cols-2 { grid-template-columns: 1fr; }
  .funnel { grid-template-columns: repeat(3, 1fr); }
  .cal .day { min-height: 70px; } .cal .ev { font-size: .68rem; padding: 2px 4px; }
}
@media (max-width: 600px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .funnel { grid-template-columns: 1fr 1fr; }
  .filters input[type=search] { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
button.pill { font-family: var(--text); }
