:root {
  --bg: #f6f7fb; --card: #fff; --ink: #1e293b; --muted: #64748b; --line: #e2e8f0;
  --brand: #1d4ed8; --brand-soft: #dbeafe; --ok: #16a34a; --bad: #dc2626; --warn: #d97706; --pref: #16a34a;
}
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.45 system-ui, "Segoe UI", sans-serif; background: var(--bg); color: var(--ink); }
header { background: #0f172a; color: #fff; padding: 0 20px; display: flex; align-items: center; gap: 24px; height: 52px; position: sticky; top: 0; z-index: 10; }
header h1 { font-size: 16px; margin: 0; font-weight: 600; white-space: nowrap; }
@media (max-width: 1450px) { header h1 span, header .usr-nome { display: none; } header { gap: 12px; } nav button { padding: 8px 9px; } }
nav { display: flex; gap: 4px; overflow-x: auto; }
nav button { background: none; border: 0; color: #cbd5e1; padding: 8px 12px; border-radius: 6px; cursor: pointer; font: inherit; white-space: nowrap; }
nav button.on, nav button:hover { background: #1e293b; color: #fff; }
main { padding: 20px; max-width: 1500px; margin: 0 auto; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin-bottom: 16px; }
.card h2 { margin: 0 0 12px; font-size: 16px; }
.card h3 { margin: 16px 0 8px; font-size: 14px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.grow { flex: 1; }
.cols { display: grid; grid-template-columns: 1fr 340px; gap: 16px; align-items: start; }
.cols2 { display: grid; grid-template-columns: 300px 1fr; gap: 16px; align-items: start; }
@media (max-width: 1000px) { .cols, .cols2 { grid-template-columns: 1fr; } }
button.btn { background: var(--brand); color: #fff; border: 0; padding: 7px 14px; border-radius: 6px; cursor: pointer; font: inherit; }
button.btn.sec { background: #fff; color: var(--ink); border: 1px solid var(--line); }
button.btn.danger { background: var(--bad); }
button.btn:disabled { opacity: .5; cursor: wait; }
button.link { background: none; border: 0; color: var(--brand); cursor: pointer; padding: 0 4px; font: inherit; }
input, select, textarea { font: inherit; padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink); }
input[type=number] { width: 80px; }
label.f { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); }
table { border-collapse: collapse; width: 100%; }
th, td { border-bottom: 1px solid var(--line); padding: 6px 8px; text-align: left; vertical-align: middle; }
th { font-size: 12px; color: var(--muted); font-weight: 600; background: #f8fafc; }
td select { max-width: 170px; }
.badge { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 99px; background: #e2e8f0; color: #334155; }
.badge.ead { background: #fef3c7; color: #92400e; }
.badge.ori { background: #ede9fe; color: #5b21b6; }
.badge.ok { background: #dcfce7; color: #166534; }
.badge.bad { background: #fee2e2; color: #991b1b; }
.muted { color: var(--muted); font-size: 12px; }
.list { max-height: 70vh; overflow: auto; }
.list div.item { padding: 6px 10px; border-radius: 6px; cursor: pointer; display: flex; justify-content: space-between; }
.list div.item:hover { background: #f1f5f9; }
.list div.item.on { background: var(--brand-soft); }
/* matriz de disponibilidade */
.mx { border-collapse: separate; border-spacing: 3px; width: auto; }
.mx th, .mx td { border: 0; text-align: center; padding: 0; }
.mx th { background: none; padding: 2px 6px; }
.mx td div { width: 74px; height: 34px; border-radius: 6px; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 11px; user-select: none; }
.v1 { background: #e2e8f0; color: #475569; } .v0 { background: #fecaca; color: #991b1b; } .v2 { background: #bbf7d0; color: #166534; }
/* grade de horário */
.grade { border-collapse: separate; border-spacing: 4px; table-layout: fixed; }
.grade th, .grade td { border: 0; padding: 0; }
.grade th { background: none; text-align: center; padding: 4px; }
.grade td.h { width: 92px; font-size: 11px; color: var(--muted); text-align: center; }
.slot { min-height: 74px; border-radius: 8px; padding: 6px 8px; font-size: 12px; border: 2px solid transparent; cursor: pointer; position: relative; }
.slot.cheio { background: #eef2ff; border-left: 5px solid var(--c, #4f46e5); }
.slot.vago { background: #f8fafc; color: #94a3b8; display: flex; align-items: center; justify-content: center; border: 2px dashed #e2e8f0; }
.slot.bloq { background: repeating-linear-gradient(45deg, #fee2e2, #fee2e2 6px, #fff 6px, #fff 12px); }
.slot.sel { border-color: var(--warn); box-shadow: 0 0 0 3px #fde68a; }
.slot.alvo-ok { outline: 3px solid #4ade80; outline-offset: -1px; }
.slot.alvo-bad { opacity: .55; }
.slot .d { font-weight: 600; line-height: 1.25; }
.slot .p { color: #1e3a8a; margin-top: 3px; }
.slot .t { color: var(--muted); font-size: 11px; }
.slot .pin { position: absolute; top: 3px; right: 6px; font-size: 11px; }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(560px, 1fr)); gap: 16px; }
.toast { position: fixed; bottom: 20px; right: 20px; background: #0f172a; color: #fff; padding: 10px 16px; border-radius: 8px; z-index: 50; max-width: 480px; }
.modal-bg { position: fixed; inset: 0; background: rgba(15,23,42,.45); display: flex; align-items: center; justify-content: center; z-index: 40; }
.modal { background: #fff; border-radius: 12px; padding: 20px; width: min(560px, 94vw); max-height: 90vh; overflow: auto; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); border-radius: 99px; padding: 3px 10px; cursor: pointer; font-size: 12px; background: #fff; }
.chip.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.bar { height: 8px; background: #e2e8f0; border-radius: 4px; overflow: hidden; width: 90px; display: inline-block; vertical-align: middle; }
.bar i { display: block; height: 100%; background: var(--brand); }
.bar i.over { background: var(--bad); }
table.ocup { font-size: 11px; }
table.ocup td, table.ocup th { border: 1px solid var(--line); padding: 3px 5px; min-width: 70px; text-align: center; vertical-align: top; }
table.ocup td.ocupada { background: #eef2ff; }
.errs li { color: var(--bad); }
@media print { header, .noprint { display: none !important; } main { padding: 0; } .card { border: 0; break-inside: avoid; } }
