/* Sistema de Gerenciamento de Cemitério — CSS próprio, sem dependências. */
:root {
  --brand: #1e3a8a;
  --on-brand: #fff;
  --brand-soft: color-mix(in srgb, var(--brand) 9%, #fff);
  --brand-ink: var(--brand); /* texto/ícone na cor do tema; escurecida automaticamente quando o tema é claro */
  --accent: var(--brand); /* botões de ação seguem a cor do tema escolhida em Configurações */
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --line: #e5e8f0;
  --line-2: #d6dbe6;
  --text: #1f2937;
  --muted: #6b7280;
  --green: #15803d;
  --blue: #1d4ed8;
  --amber: #c2410c;
  --red: #dc2626;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 4px 16px rgba(16, 24, 40, .05);
  --focus: 0 0 0 3px color-mix(in srgb, var(--brand) 30%, transparent);
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--brand-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; font-weight: 600; }
h1 { font-size: 22px; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
p { margin: 0 0 8px; }
.muted { color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: #fff; padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }
.ic { flex: none; vertical-align: middle; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 8px; }
.hide { display: none !important; }
.pad { padding: 4px 20px 16px; }
.right { text-align: right; }

/* ------------------------------------------------ topo */
.topbar { background: var(--brand); color: var(--on-brand); position: sticky; top: 0; z-index: 40; box-shadow: 0 2px 10px rgba(0, 0, 0, .12); }
.topbar-in { display: flex; align-items: center; gap: 8px; height: 60px; padding: 0 16px; max-width: 1600px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--on-brand); font-weight: 700; font-size: 16px; white-space: nowrap; margin-right: 6px; }
.brand:hover { text-decoration: none; }
.brand img { height: 34px; width: auto; max-width: 120px; border-radius: 8px; background: #fff; padding: 2px; }
.brand-ic { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: #fff; color: var(--brand-ink); }
.nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 2px; }
.nav { font-size: 12.6px; } /* menu 10% menor que o texto base (14px) */
.nav-a { display: flex; align-items: center; gap: 6px; height: 38px; padding: 0 11px; border-radius: 10px; color: var(--on-brand); font: inherit; font-weight: 600; background: none; border: 0; cursor: pointer; white-space: nowrap; opacity: .92; }
.nav-a:hover { background: color-mix(in srgb, var(--on-brand) 14%, transparent); text-decoration: none; opacity: 1; }
.nav-a.active { background: #fff; color: var(--brand-ink); opacity: 1; }
.dd { position: relative; }
.dd-menu { display: none; position: absolute; top: calc(100% + 6px); left: 0; min-width: 240px; background: #fff; color: var(--text); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 12px 32px rgba(15, 23, 42, .16); padding: 6px; z-index: 50; }
.dd-menu.right { left: auto; right: 0; }
.dd.open > .dd-menu { display: block; }
.dd-menu a, .dd-menu button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px; border-radius: 8px; color: var(--text); background: none; border: 0; font: inherit; text-align: left; cursor: pointer; }
.dd-menu a:hover, .dd-menu button:hover { background: var(--brand-soft); text-decoration: none; }
.dd-menu a.on { background: var(--brand-soft); color: var(--brand-ink); font-weight: 600; }
.dd-menu a small { margin-left: auto; color: var(--muted); font-size: 12px; }
.dd-menu hr { border: 0; border-top: 1px solid var(--line); margin: 5px 4px; }
.dd-head { padding: 8px 10px 10px; display: grid; }
.dd-head small { color: var(--muted); }
.dd-custom { display: flex; gap: 6px; padding: 8px 6px 4px; border-top: 1px solid var(--line); margin-top: 4px; }
.dd-custom input { flex: 1; min-width: 0; height: 32px; padding: 0 6px; }
.top-search { margin-left: auto; display: flex; align-items: center; gap: 6px; background: color-mix(in srgb, var(--on-brand) 14%, transparent); border-radius: 999px; padding: 0 12px; height: 38px; color: var(--on-brand); }
.top-search input { background: none; border: 0; color: inherit; width: 220px; height: 36px; font: inherit; outline: none; }
.top-search input::placeholder { color: color-mix(in srgb, var(--on-brand) 75%, transparent); }
.nav-btn { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; color: var(--on-brand); border: 1.5px solid color-mix(in srgb, var(--on-brand) 35%, transparent); }
.nav-btn:hover { background: color-mix(in srgb, var(--on-brand) 14%, transparent); }
.user-btn { background: none; border: 0; padding: 0; cursor: pointer; border-radius: 50%; }
.user-btn .avatar { border: 2px solid #fff; }
.nav-toggle { display: none; background: none; border: 0; color: var(--on-brand); padding: 6px; cursor: pointer; margin-left: auto; }

.avatar { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: #eef2ff; color: var(--brand-ink); font-weight: 700; overflow: hidden; flex: none; vertical-align: middle; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.sm { width: 28px; height: 28px; font-size: 12px; }
.avatar.lg { width: 72px; height: 72px; font-size: 26px; border-radius: 14px; }

/* ------------------------------------------------ estrutura */
.main { max-width: 1600px; margin: 0 auto; padding: 22px 20px 60px; }
.main.bare { max-width: none; padding: 0; }
.popup-main { padding: 0; }
.popup-main .form { box-shadow: none; border: 0; background: var(--surface); margin: 0; }
body.popup { background: var(--surface); }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head p { margin: 4px 0 0; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px 10px; flex-wrap: wrap; }
.card-body { padding: 4px 20px 18px; }
.count { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: var(--brand-soft); color: var(--brand-ink); font-size: 12px; font-weight: 600; margin-left: 4px; vertical-align: 2px; }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty .ic { color: var(--line-2); margin-bottom: 8px; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; align-items: start; }
.cols > .card { margin-bottom: 0; }

/* ------------------------------------------------ botões */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 40px; padding: 0 16px; border-radius: 10px; border: 1.5px solid var(--brand); background: var(--brand); color: var(--on-brand); font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; text-decoration: none !important; transition: background .15s, color .15s, border-color .15s; }
.btn:hover { filter: brightness(1.08); }
.btn.outline { background: #fff; color: var(--brand-ink); border-color: var(--brand-ink); }
.btn.outline:hover { background: var(--brand-soft); filter: none; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); filter: none; }
.btn.danger:hover, .btn.ghost.danger:hover { background: color-mix(in srgb, #dc2626 10%, transparent); color: #dc2626; }
.btn.red { background: #dc2626; border-color: #dc2626; color: #fff; }
.btn.green { background: var(--brand); border-color: var(--brand); color: var(--on-brand); } /* confirmar/receber/concluir: cor do tema */
.btn.accent { background: var(--accent); border-color: var(--accent); color: var(--on-brand); }
.btn.edit:hover { background: color-mix(in srgb, #2563eb 10%, transparent); color: #2563eb; }
.btn.sm { height: 32px; padding: 0 11px; font-size: 13px; border-radius: 8px; }
.btn.pill { border-radius: 999px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ------------------------------------------------ formulários */
.form { padding: 20px; }
.grid12 { display: grid; grid-template-columns: repeat(12, 1fr); gap: 14px 16px; margin: 0; }
.c2 { grid-column: span 2; } .c3 { grid-column: span 3; } .c4 { grid-column: span 4; } .c5 { grid-column: span 5; }
.c6 { grid-column: span 6; } .c7 { grid-column: span 7; } .c8 { grid-column: span 8; } .c9 { grid-column: span 9; } .c12 { grid-column: span 12; }
.sec { font-size: 14px; font-weight: 600; margin: 22px 0 10px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--text); }
.grid12:first-child + .sec, .form > .grid12:first-of-type:empty + .sec { margin-top: 0; padding-top: 0; border: 0; }
.fld { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.fld > label, .fld > .lbl, label.fld > span:first-child { font-weight: 600; font-size: 13px; color: #374151; }
.req { color: #dc2626; font-weight: 600; }
.help { color: var(--muted); font-size: 12px; }
input, select, textarea { font: inherit; color: var(--text); background: #fff; border: 1.5px solid var(--line-2); border-radius: var(--radius-sm); padding: 0 12px; height: 40px; width: 100%; min-width: 0; }
textarea { height: auto; padding: 9px 12px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: var(--focus); }
input[disabled], select[disabled], textarea[disabled] { background: var(--surface-2); color: var(--muted); }
input[type=checkbox], input[type=radio] { width: 17px; height: 17px; padding: 0; accent-color: var(--brand); }
input[type=color] { padding: 3px; width: 64px; }
input[type=file] { padding: 7px; height: auto; }
.has-err input, .has-err select, .has-err textarea, [aria-invalid=true] { border-color: #dc2626; }
.pre-in { display: flex; align-items: stretch; }
.pre-in > span { display: grid; place-items: center; padding: 0 10px; background: var(--surface-2); border: 1.5px solid var(--line-2); border-right: 0; border-radius: var(--radius-sm) 0 0 var(--radius-sm); color: var(--muted); font-size: 13px; }
.pre-in input { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.sel-row { display: flex; gap: 6px; align-items: center; }
.sel-row select, .sel-row .cbx { flex: 1; min-width: 0; }
.sel-row .qa { height: 40px; width: 40px; padding: 0; border: 1.5px solid var(--line-2); flex: none; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); }
.chk { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 400 !important; }
.chk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 8px 16px; }
.file-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* Não / Sim */
.seg { display: inline-flex; gap: 4px; padding: 4px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; width: max-content; }
.seg label { cursor: pointer; }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg span { display: inline-flex; align-items: center; gap: 5px; padding: 6px 16px; border-radius: 9px; font-weight: 600; color: #374151; border: 1.5px solid transparent; }
.seg span .ic { display: none; }
.seg input:checked + span { background: #fff; border-color: var(--brand); color: var(--brand-ink); box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.seg input:checked + span .ic { display: inline; }
.seg input:focus-visible + span { box-shadow: var(--focus); }

/* chave liga/desliga */
.switch-l { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; color: #374151; }
.switch-l input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch { width: 38px; height: 22px; border-radius: 999px; background: #cbd5e1; position: relative; transition: background .15s; flex: none; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: left .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch-l input:checked + .switch { background: var(--brand); }
.switch-l input:checked + .switch::after { left: 19px; }
.switch-l input:focus-visible + .switch { box-shadow: var(--focus); }

/* chips (Todos / 30+ dias …) */
.chips { display: flex; gap: 6px; flex-wrap: wrap; padding: 6px; background: var(--surface-2); border-radius: 999px; width: max-content; max-width: 100%; }
.chip { display: inline-flex; align-items: center; height: 30px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-2); background: #fff; color: #374151; font-size: 12.5px; font-weight: 600; }
.chip:hover { text-decoration: none; border-color: var(--brand); }
.chip.on { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }

/* combo filtrável (select com busca) */
.cbx { position: relative; }
.cbx-btn { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; height: 40px; padding: 0 12px; background: #fff; border: 1.5px solid var(--line-2); border-radius: var(--radius-sm); font: inherit; color: var(--text); cursor: pointer; text-align: left; }
.cbx-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cbx-btn.ph span { color: var(--muted); }
.cbx.open .cbx-btn, .cbx-btn:focus-visible { border-color: var(--brand); box-shadow: var(--focus); }
.cbx-pop { display: none; position: absolute; left: 0; right: 0; top: calc(100% + 4px); background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgba(15,23,42,.16); z-index: 60; padding: 6px; min-width: 220px; }
.cbx.open .cbx-pop { display: block; }
.cbx-search { display: flex; align-items: center; gap: 6px; background: var(--surface-2); border-radius: 8px; padding: 0 8px; margin-bottom: 4px; color: var(--muted); }
.cbx-search input { border: 0; background: none; height: 34px; padding: 0; box-shadow: none !important; }
.cbx-list { max-height: 260px; overflow: auto; list-style: none; margin: 0; padding: 0; }
.cbx-list li { padding: 7px 10px; border-radius: 8px; cursor: pointer; }
.cbx-list li.act, .cbx-list li:hover { background: var(--brand-soft); }
.cbx-list li.sel { color: var(--brand-ink); font-weight: 600; }
.cbx-list li.none { color: var(--muted); cursor: default; background: none; }
.cbx[aria-disabled=true] .cbx-btn { background: var(--surface-2); color: var(--muted); pointer-events: none; }

/* ------------------------------------------------ listas */
.toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 14px; padding: 14px 16px; }
.search-in { display: flex; align-items: center; gap: 6px; border: 1.5px solid var(--line-2); border-radius: 999px; padding: 0 12px; background: #fff; flex: 1 1 260px; max-width: 420px; color: var(--muted); }
.search-in:focus-within { border-color: var(--brand); box-shadow: var(--focus); }
.search-in input { border: 0; height: 38px; padding: 0; box-shadow: none !important; }
.flt { display: grid; gap: 3px; font-size: 12px; color: var(--muted); font-weight: 600; min-width: 150px; }
.flt select, .flt input { height: 38px; }
.tb-act { display: flex; gap: 8px; align-items: center; margin-left: auto; flex-wrap: wrap; }
.tbl-wrap { overflow-x: auto; position: relative; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th, .tbl td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl thead th { font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; background: var(--surface-2); }
.tbl thead th a { color: inherit; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr[data-href] { cursor: pointer; }
.tbl tbody tr:hover td { background: #fafbff; }
.tbl tr.is-off td { color: var(--muted); }
.tbl .num { text-align: right; white-space: nowrap; }
.tbl tfoot td { font-weight: 700; background: var(--surface-2); }
.tbl-1l th, .tbl-1l td { padding: 5px 14px; white-space: nowrap; }
.tbl-1l .row-actions .btn.sm { height: 28px; padding: 0 9px; }
.tbl-1l td .badge { vertical-align: middle; }
.tbl-1l .row-actions { margin-top: 0; }
.tbl td.act { width: 1%; }
.row-actions { display: flex; gap: 4px; justify-content: flex-end; }
.row-actions .btn span { display: none; }
@media (min-width: 1100px) { .row-actions .btn span { display: inline; } }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 4px 4px 16px; flex-wrap: wrap; }
.pager nav { display: flex; gap: 4px; }
.pager a { display: grid; place-items: center; min-width: 34px; height: 34px; padding: 0 8px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--text); }
.pager a.on { background: var(--brand); color: var(--on-brand); border-color: var(--brand); }
.mini { border-collapse: collapse; font-size: 13px; margin-top: 6px; width: 100%; }
.mini th, .mini td { padding: 3px 8px; border-bottom: 1px dashed var(--line); text-align: left; vertical-align: top; word-break: break-word; }
.mini th { color: var(--muted); font-weight: 500; width: 28%; }
.mini td.old { color: #b91c1c; text-decoration: line-through; }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 18px; white-space: nowrap; background: #f1f5f9; color: #475569; }
.badge.green { background: #dcfce7; color: #166534; }
.badge.blue { background: #dbeafe; color: #1e40af; }
.badge.amber { background: #ffedd5; color: #9a3412; }
.badge.red { background: #fee2e2; color: #991b1b; }
.badge.purple { background: #ede9fe; color: #5b21b6; }
.badge.teal { background: #ccfbf1; color: #115e59; }
.badge.gray { background: #f1f5f9; color: #475569; }
.badge.dark { background: #334155; color: #fff; }
.swatch { display: inline-block; width: 14px; height: 14px; border-radius: 4px; vertical-align: -2px; border: 1px solid rgba(0,0,0,.1); }

/* detalhes */
.details { padding: 18px 20px; }
.details dl { margin: 0; }
.details dt { font-size: 12px; color: var(--muted); font-weight: 500; }
.details dd { margin: 2px 0 0; font-weight: 500; word-break: break-word; }
.details .sec:first-child { margin-top: 0; border: 0; padding-top: 0; }
.danger-zone { display: flex; justify-content: flex-end; padding: 8px 0; }

/* histórico */
.hist summary { list-style: none; cursor: pointer; padding: 16px 20px; }
.hist summary::-webkit-details-marker { display: none; }
.hist summary h2 { display: flex; align-items: center; gap: 8px; }
.timeline { list-style: none; margin: 0; padding: 0 20px 16px 36px; position: relative; }
.timeline::before { content: ""; position: absolute; left: 25px; top: 0; bottom: 16px; width: 2px; background: var(--line); }
.timeline li { position: relative; padding: 6px 0 12px; }
.timeline li::before { content: ""; position: absolute; left: -15px; top: 11px; width: 10px; height: 10px; border-radius: 50%; background: #fff; border: 2px solid var(--brand); }
.tl-m { font-size: 13px; color: #92400e; }

/* anexos */
.files { list-style: none; margin: 0; padding: 0 20px; display: grid; gap: 8px; }
.files li { display: flex; align-items: center; gap: 12px; padding: 8px; border: 1px solid var(--line); border-radius: 12px; }
.files li > div:not(.modal) { flex: 1; min-width: 0; display: grid; }
.files li > div:not(.modal) a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.files small { color: var(--muted); }
.thumb { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 10px; background: var(--surface-2); overflow: hidden; flex: none; color: var(--muted); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.upload-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; padding: 14px 20px 18px; }
.upload-row .fld { flex: 1 1 160px; }

/* alertas */
.flash { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: 12px; margin-bottom: 14px; border: 1px solid; }
.flash ul { margin: 4px 0 0; padding-left: 18px; }
.flash.ok { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }
.flash.err { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.flash.warn, .flash.info { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.flash > span, .flash > div { flex: 1; }
.flash-x { background: none; border: 0; color: inherit; cursor: pointer; padding: 0; opacity: .7; }
.note { background: var(--brand-soft); border-radius: 12px; padding: 10px 14px; font-size: 13px; }

/* ------------------------------------------------ modais */
.modal { display: none; position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 80; align-items: center; justify-content: center; padding: 16px; }
.modal.open { display: flex; }
.modal-box { background: #fff; border-radius: 22px; padding: 26px; width: min(420px, 100%); text-align: center; box-shadow: 0 24px 60px rgba(0,0,0,.25); max-height: 92vh; overflow: auto; }
.modal-box h2 { margin: 6px 0 8px; }
.modal-box p { color: var(--muted); }
.modal-box .fld { text-align: left; margin: 10px 0; }
.modal-ic { display: grid; place-items: center; width: 52px; height: 52px; margin: 0 auto 6px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-ink); }
.modal-ic.info { background: var(--brand-soft); color: var(--brand-ink); }
.modal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.modal-actions.one { grid-template-columns: 1fr; }
.modal-box.wide { width: min(640px, 100%); text-align: left; }
.demo-box { width: min(500px, 100%); }
.demo-box p { margin-bottom: 12px; line-height: 1.55; }
.demo-box .demo-obs { font-size: 13px; background: var(--brand-soft); border-radius: 12px; padding: 10px 12px; margin-bottom: 20px; color: var(--text); }
.qa-box { background: #fff; border-radius: 22px; width: min(640px, 100%); box-shadow: 0 24px 60px rgba(0,0,0,.25); overflow: hidden; display: flex; flex-direction: column; }
.qa-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.qa-head button { background: none; border: 0; cursor: pointer; color: var(--muted); padding: 4px; }
.qa-box iframe { border: 0; width: 100%; height: 300px; display: block; }

/* ------------------------------------------------ painel */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.stat { border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; background: #fff; display: flex; flex-direction: column; gap: 4px; color: var(--text); }
a.stat:hover { text-decoration: none; border-color: var(--brand); }
.stat .st-h { display: flex; justify-content: space-between; align-items: center; font-weight: 500; }
.stat .st-h .ic { color: var(--muted); }
.stat .st-v { font-size: 26px; font-weight: 600; letter-spacing: -.01em; }
.stat .st-s { color: var(--muted); font-size: 12px; }
.stat .bar { height: 14px; border-radius: 4px; margin: 10px 0 4px; background: repeating-linear-gradient(-45deg, var(--c) 0 8px, color-mix(in srgb, var(--c) 45%, #fff) 8px 14px); opacity: .7; }
.stat.green { --c: #22c55e; } .stat.green .st-v { color: #15803d; }
.stat.blue { --c: #3b82f6; } .stat.blue .st-v { color: #1d4ed8; }
.stat.amber { --c: #f59e0b; } .stat.amber .st-v { color: #c2410c; }
.stat.red { --c: #f87171; } .stat.red .st-v { color: #dc2626; }
.stat.purple { --c: #8b5cf6; } .stat.purple .st-v { color: #6d28d9; }
.stat.gray { --c: #94a3b8; }
.stat .st-l { display: flex; justify-content: space-between; color: var(--muted); font-size: 12.5px; padding-top: 4px; border-top: 1px dashed var(--line); margin-top: 4px; }
.tasks { display: grid; gap: 10px; padding: 0 20px 18px; }
.task { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 14px; background: var(--surface-2); }
.task .t-ic { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: #fff; color: var(--brand-ink); flex: none; }
.task > div { flex: 1; min-width: 0; }
.task strong { display: block; }
.task small { color: var(--muted); }
.occ { display: flex; height: 18px; border-radius: 6px; overflow: hidden; background: var(--line); margin: 8px 0; }
.occ span { display: block; height: 100%; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.hbar { display: grid; grid-template-columns: 160px 1fr 60px; gap: 8px; align-items: center; font-size: 13px; margin: 6px 0; }
.hbar .b { height: 10px; border-radius: 999px; background: var(--brand-soft); overflow: hidden; }
.hbar .b span { display: block; height: 100%; background: var(--brand); border-radius: 999px; }

/* ------------------------------------------------ mapa */
.map-wrap { overflow: auto; padding: 16px; }
.map-quadras { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.quadra { border: 1.5px solid var(--line-2); border-radius: 14px; padding: 10px; background: var(--surface-2); }
.quadra h3 { font-size: 13px; margin-bottom: 8px; display: flex; justify-content: space-between; }
.lotes { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 5px; }
.lote { display: grid; place-items: center; height: 40px; border-radius: 7px; font-size: 11px; font-weight: 600; color: #fff; border: 2px solid transparent; position: relative; }
.lote:hover { text-decoration: none; border-color: #111827; transform: scale(1.06); }
.lote small { position: absolute; right: 3px; top: 1px; font-size: 9px; opacity: .9; }
.s-DISPONIVEL { background: #22c55e; } .s-RESERVADO { background: #f59e0b; } .s-VENDIDO { background: #3b82f6; }
.s-OCUPADO { background: #6366f1; } .s-CHEIO { background: #334155; } .s-BLOQUEADO { background: #ef4444; } .s-EM_OBRA { background: #a16207; }
.s-ENCERRADO { background: #94a3b8; } .s-EMPRESTADO { background: #14b8a6; } .s-CEDIDO { background: #0ea5e9; }
.lote.hl { outline: 3px solid #f43f5e; outline-offset: 2px; }

/* ------------------------------------------------ agenda */
.cal-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 14px 16px; }
.cal-head h2 { margin: 0 8px; }
.week { display: grid; grid-template-columns: 56px repeat(7, minmax(120px, 1fr)); min-width: 900px; }
.week .wh { position: sticky; top: 0; background: var(--surface-2); border-bottom: 1px solid var(--line); padding: 8px 6px; font-size: 12px; font-weight: 600; text-align: center; }
.week .wh.today { color: var(--brand-ink); }
.week .hr { font-size: 11px; color: var(--muted); text-align: right; padding-right: 6px; border-right: 1px solid var(--line); height: 44px; transform: translateY(-7px); }
.week .day { position: relative; border-right: 1px solid var(--line); background: repeating-linear-gradient(to bottom, transparent 0 43px, var(--line) 43px 44px); }
.ev { position: absolute; left: 3px; right: 3px; border-radius: 8px; padding: 3px 6px; font-size: 11.5px; color: #fff; overflow: hidden; line-height: 1.3; box-shadow: 0 1px 3px rgba(0,0,0,.15); }
.ev:hover { text-decoration: none; z-index: 2; filter: brightness(1.1); }
.ev .prep { position: absolute; left: 0; right: 0; background: repeating-linear-gradient(45deg, rgba(255,255,255,.35) 0 4px, transparent 4px 8px); }
.ev.prov { opacity: .75; border: 2px dashed #fff; }
.ev.canc { background: #94a3b8 !important; text-decoration: line-through; }

/* checklist */
.checklist { list-style: none; margin: 0; padding: 0 20px 14px; display: grid; gap: 6px; }
.checklist li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; }
.checklist li.done { background: #f0fdf4; border-color: #bbf7d0; }
.checklist li > span { flex: 1; }
.steps { display: flex; gap: 0; margin: 0 0 16px; padding: 0; list-style: none; overflow-x: auto; }
.steps li { flex: 1; min-width: 110px; text-align: center; font-size: 12px; color: var(--muted); position: relative; padding-top: 26px; }
.steps li::before { content: ""; position: absolute; top: 8px; left: 50%; width: 14px; height: 14px; margin-left: -7px; border-radius: 50%; background: #fff; border: 2px solid var(--line-2); z-index: 1; }
.steps li::after { content: ""; position: absolute; top: 14px; left: -50%; right: 50%; height: 2px; background: var(--line-2); }
.steps li:first-child::after { display: none; }
.steps li.done { color: var(--text); }
.steps li.done::before { background: var(--brand); border-color: var(--brand); }
.steps li.done::after { background: var(--brand); }
.steps li.cur { color: var(--brand-ink); font-weight: 700; }
.steps li.cur::before { box-shadow: var(--focus); }

/* abas */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs a { padding: 10px 14px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.on { color: var(--brand-ink); border-bottom-color: var(--brand); }
.tabs a:hover { text-decoration: none; color: var(--text); }
.cor-pick { display: flex; align-items: center; gap: 18px 24px; flex-wrap: wrap; margin-top: 14px; }
.cor-atual { display: flex; align-items: center; gap: 12px; padding: 8px 14px 8px 8px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); }
.cor-amostra { width: 44px; height: 44px; border-radius: 10px; border: 1px solid rgba(0,0,0,.08); flex: none; }
.cor-atual small { display: block; font-size: 12px; color: var(--muted); }
.cor-atual code { font-size: 14px; font-weight: 600; letter-spacing: .02em; }
.cor-opcoes { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.cor-op { position: relative; display: block; cursor: pointer; }
.cor-op input[type=radio] { position: absolute; opacity: 0; width: 1px; height: 1px; }
.cor-op span { display: block; width: 34px; height: 34px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 1px var(--line-2); transition: transform .12s; }
.cor-op:hover span { transform: scale(1.08); }
.cor-op input[type=radio]:checked + span { box-shadow: 0 0 0 3px #111827; }
.cor-op input[type=radio]:focus-visible + span { box-shadow: var(--focus); }
.cor-custom span { background: radial-gradient(circle, var(--c, #fff) 0 42%, transparent 44%), conic-gradient(red, yellow, lime, cyan, blue, magenta, red); }
.cor-custom input[type=color] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; padding: 0; border: 0; }

/* busca */
.res-group h3 { padding: 14px 20px 6px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.res { display: flex; gap: 12px; align-items: center; padding: 10px 20px; border-top: 1px solid var(--line); color: var(--text); }
.res:hover { background: var(--surface-2); text-decoration: none; }
.res small { color: var(--muted); display: block; }

/* login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: linear-gradient(135deg, var(--brand) 0%, color-mix(in srgb, var(--brand) 60%, #000) 100%); }
.login-box { width: min(400px, 100%); background: #fff; border-radius: 22px; padding: 30px; box-shadow: 0 24px 60px rgba(0,0,0,.25); }
.login-box h1 { text-align: center; margin: 10px 0 4px; }
.login-box .logo { display: grid; place-items: center; }
.login-box .logo img { max-height: 70px; max-width: 200px; }
.login-box .logo .brand-ic { width: 56px; height: 56px; border-radius: 16px; background: var(--brand); color: #fff; }
.login-box form { display: grid; gap: 14px; margin-top: 18px; }
.login-box .btn { width: 100%; height: 44px; }
.login-box .links { text-align: center; font-size: 13px; }

/* documentos impressos */
.print-doc { background: #fff; padding: 24px; color: #111; }
.doc { max-width: 800px; margin: 0 auto; background: #fff; padding: 36px 40px; border: 1px solid var(--line); border-radius: 8px; }
.doc-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; border-bottom: 2px solid #111; padding-bottom: 10px; margin-bottom: 18px; }
.doc-head img { max-height: 60px; }
.doc h1 { text-align: center; font-size: 20px; margin: 10px 0 18px; }
.doc .sig { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-top: 60px; text-align: center; font-size: 13px; }
.doc .sig div { border-top: 1px solid #111; padding-top: 6px; }
.tbl.print th, .tbl.print td { border: 1px solid #ccc; padding: 4px 8px; font-size: 12px; }
.no-print { margin: 0 auto 16px; max-width: 800px; display: flex; gap: 8px; }
@media print {
  .no-print, .topbar, .page-actions, .toolbar, .pager, .danger-zone, .row-actions, form.upload-row { display: none !important; }
  body { background: #fff; }
  .doc { border: 0; padding: 0; }
  .card { box-shadow: none; break-inside: avoid; }
}

/* ------------------------------------------------ responsivo */
.search-btn { display: none; }
@media (max-width: 1700px) {
  .top-search { display: none; }
  .search-btn { display: grid; margin-left: auto; }
  .nav-a { padding: 0 8px; gap: 5px; }
  .brand span { max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
  .nav li.cfg .nav-a span { display: none; }
}
@media (max-width: 1360px) {
  .nav-toggle { display: block; order: 3; margin-left: 0; }
  .search-btn { margin-left: auto; }
  .nav { display: none; position: absolute; top: 60px; left: 0; right: 0; background: var(--brand); padding: 8px 12px 16px; max-height: calc(100vh - 60px); overflow: auto; box-shadow: 0 10px 20px rgba(0,0,0,.15); }
  .nav.open { display: block; }
  .nav ul { flex-direction: column; }
  .nav-a { width: 100%; height: 44px; padding: 0 11px; }
  .nav-a span, .nav li.cfg .nav-a span { display: inline !important; }
  .nav-a .ic:last-child { margin-left: auto; }
  .dd-menu { position: static; box-shadow: none; margin: 4px 0 8px; }
  .user-dd .dd-menu { position: absolute; }
}
@media (max-width: 760px) {
  .main { padding: 16px 16px 50px; }
  .grid12 { grid-template-columns: 1fr; }
  .grid12 > * { grid-column: auto !important; }
  .tbl-wrap .tbl thead { display: none; }
  .tbl-wrap .tbl, .tbl-wrap .tbl tbody, .tbl-wrap .tbl tr, .tbl-wrap .tbl td { display: block; width: 100%; }
  .tbl-wrap .tbl tr { padding: 8px 4px; border-bottom: 1px solid var(--line); }
  .tbl-wrap .tbl td { border: 0; padding: 3px 12px; white-space: normal; display: flex; gap: 10px; justify-content: space-between; text-align: right; }
  .tbl-wrap .tbl td::before { content: attr(data-label); color: var(--muted); font-size: 12px; text-align: left; }
  .tbl-wrap .tbl td:first-child { font-weight: 600; }
  .tbl-wrap .tbl td.act { width: auto; }
  .tbl-wrap .tbl td.act::before { content: none; }
  .tbl-wrap .tbl.tbl-1l td { padding: 5px 12px; }
  .row-actions { margin-top: 4px; }
  .toolbar { align-items: stretch; }
  .search-in { max-width: none; }
  .flt { flex: 1 1 140px; }
  .tb-act { margin-left: 0; }
  .page-head h1 { font-size: 19px; }
  .hbar { grid-template-columns: 110px 1fr 50px; }
  .doc { padding: 18px; }
  .brand span { max-width: 140px; overflow: hidden; text-overflow: ellipsis; }
  .form-actions { position: sticky; bottom: 0; background: #fff; margin: 16px -20px -20px; padding: 12px 20px; border-radius: 0 0 var(--radius) var(--radius); }
  .form-actions .btn { flex: 1; }
}
