:root {
  --bg: #faf6f1;           /* blanco roto */
  --card: #ffffff;
  --ink: #3d3a3a;
  --muted: #8a8383;
  --line: #ece4dc;
  --rose: #f3e3e1;  --rose-d: #b47472;  --rose-t: #9a5755;
  --sage: #e1ebe0;  --sage-d: #8fae8c;  --sage-t: #4d6e4a;
  --lav: #e9e4f3;   --lav-d: #a99bd1;   --lav-t: #5f4e92;
  --beige: #f1e8da; --beige-d: #cdb892; --beige-t: #7d6840;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(80,60,50,.04), 0 6px 20px rgba(80,60,50,.05);
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-size: 15px; -webkit-text-size-adjust: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--lav-t); text-decoration: none; }
h1 { font-size: 1.5rem; margin: 0; font-weight: 600; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; margin: 0 0 .75rem; font-weight: 600; }
h3 { font-size: .95rem; margin: 0 0 .5rem; font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.right { text-align: right; }
.hidden { display: none !important; }

/* layout */
.shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.side { background: #fff; border-right: 1px solid var(--line); padding: 20px 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; font-weight: 600; font-size: 1.05rem; }
.brand i { width: 34px; height: 34px; border-radius: 11px; background: var(--rose); color: var(--rose-t); display: grid; place-items: center; }
.side a.nav { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; color: var(--ink); font-size: .93rem; }
.side a.nav svg { width: 18px; height: 18px; flex: none; color: var(--muted); }
.side a.nav:hover { background: var(--bg); }
.side a.nav.on { background: var(--rose); color: var(--rose-t); font-weight: 600; }
.side a.nav.on svg { color: var(--rose-t); }
.main { min-width: 0; }
.top { display: flex; align-items: center; gap: 12px; padding: 14px 28px; position: sticky; top: 0; background: rgba(250,246,241,.92); backdrop-filter: blur(8px); z-index: 20; border-bottom: 1px solid transparent; }
.top .grow { flex: 1; }
.searchbox { position: relative; max-width: 420px; flex: 1; }
.searchbox input { width: 100%; padding: 10px 14px 10px 38px; border-radius: 999px; border: 1px solid var(--line); background: #fff; }
.searchbox svg { position: absolute; left: 13px; top: 10px; width: 17px; height: 17px; color: var(--muted); }
.results { position: absolute; top: 46px; left: 0; right: 0; background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); max-height: 60vh; overflow: auto; z-index: 30; }
.results a { display: flex; gap: 10px; padding: 10px 14px; color: var(--ink); border-bottom: 1px solid var(--line); }
.results a:hover { background: var(--bg); }
.results b { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--lav-t); min-width: 74px; }
.content { padding: 8px 28px 60px; max-width: 1400px; }
.page-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin: 10px 0 18px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.btn.burger { display: none; }

/* cards */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; border: 1px solid var(--line); }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpis { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); margin-bottom: 18px; }
.kpi { padding: 16px 18px; border-radius: var(--radius); border: 1px solid var(--line); background: #fff; display: block; color: inherit; }
.kpi .v { font-size: 1.7rem; font-weight: 600; margin-top: 4px; }
.kpi .l { font-size: .8rem; color: var(--muted); }
.kpi.rose { background: var(--rose); } .kpi.sage { background: var(--sage); } .kpi.lav { background: var(--lav); } .kpi.beige { background: var(--beige); }
.list > div { display: flex; gap: 10px; justify-content: space-between; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); }
.list > div:last-child { border-bottom: 0; }
.empty { color: var(--muted); padding: 14px 0; text-align: center; }

/* buttons & forms */
.btn { border: 1px solid var(--line); background: #fff; padding: 9px 16px; border-radius: 12px; cursor: pointer; font-weight: 500; display: inline-flex; gap: 8px; align-items: center; }
.btn:hover { background: var(--bg); }
.btn.primary { background: var(--rose-d); border-color: var(--rose-d); color: #fff; }
.btn.primary:hover { filter: brightness(.96); }
.btn.sage { background: var(--sage-d); border-color: var(--sage-d); color: #fff; }
.btn.danger { color: var(--rose-t); border-color: var(--rose); background: var(--rose); }
.btn.sm { padding: 5px 11px; font-size: .85rem; border-radius: 10px; }
.btn svg { width: 16px; height: 16px; }
.btn[disabled] { opacity: .5; cursor: default; }
input, select, textarea { border: 1px solid var(--line); border-radius: 11px; padding: 9px 12px; background: #fff; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--lav); border-color: var(--lav-d); }
input[type=checkbox] { width: auto; }
label.f { display: block; font-size: .82rem; color: var(--muted); }
label.f > :not(span) { margin-top: 4px; color: var(--ink); }
label.f .err { color: var(--rose-t); font-size: .78rem; margin-top: 3px; display: block; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.form-grid .full { grid-column: 1 / -1; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; align-items: end; }
.filters label.f { min-width: 130px; flex: 0 1 180px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.tabs button { background: none; border: 0; padding: 10px 14px; cursor: pointer; border-bottom: 2px solid transparent; color: var(--muted); font-weight: 500; }
.tabs button.on { color: var(--rose-t); border-color: var(--rose-d); }

/* tables */
.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th { text-align: left; font-weight: 600; font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 12px 14px; background: #fdfaf7; white-space: nowrap; }
td { padding: 11px 14px; border-top: 1px solid var(--line); vertical-align: middle; }
tr.click { cursor: pointer; } tr.click:hover td { background: #fdfaf7; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* badges */
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .76rem; font-weight: 600; white-space: nowrap; }
.b-programada, .b-pendiente, .b-esperando, .b-media { background: var(--lav); color: var(--lav-t); }
.b-realizada, .b-activo, .b-apto, .b-confirmada, .b-disponible, .b-asignado, .b-baja_ { background: var(--sage); color: var(--sage-t); }
.b-cancelada, .b-no_apto, .b-bloqueado, .b-alta, .b-baja, .b-no_presentado, .b-descartado { background: var(--rose); color: var(--rose-t); }
.b-terminado, .b-en_espera, .b-modificada, .b-completo { background: var(--beige); color: var(--beige-t); }
.b-pendiente { background: var(--beige); color: var(--beige-t); }
.b-baja.sev { background: var(--beige); color: var(--beige-t); }
.pos { color: var(--sage-t); } .neg { color: var(--rose-t); font-weight: 600; }
.bar { height: 8px; border-radius: 8px; background: var(--beige); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--sage-d); }
.bar.full > i { background: var(--rose-d); }

/* weekly calendar */
.cal-nav { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.cal-nav .title { font-weight: 600; min-width: 190px; text-align: center; }
.weekgrid { display: grid; grid-template-columns: 54px repeat(6, minmax(120px, 1fr)); background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow-x: auto; }
.weekgrid .dh { padding: 10px 6px; text-align: center; font-size: .82rem; border-bottom: 1px solid var(--line); background: #fdfaf7; position: sticky; top: 0; }
.weekgrid .dh b { display: block; font-size: 1.05rem; }
.weekgrid .dh.today { background: var(--rose); color: var(--rose-t); }
.weekgrid .hours { position: relative; border-right: 1px solid var(--line); }
.weekgrid .hours span { position: absolute; right: 6px; font-size: .68rem; color: var(--muted); transform: translateY(-50%); }
.weekgrid .day { position: relative; border-left: 1px solid var(--line); cursor: cell; }
.weekgrid .line { position: absolute; left: 0; right: 0; border-top: 1px dashed #f1ebe4; pointer-events: none; }
.weekgrid .gap { position: absolute; left: 0; right: 0; background: repeating-linear-gradient(45deg, #faf6f1, #faf6f1 6px, #f4eee7 6px, #f4eee7 12px); pointer-events: none; }
.p { position: absolute; border-radius: 9px; padding: 4px 7px; font-size: .74rem; line-height: 1.25; overflow: hidden; cursor: pointer; border-left: 4px solid; }
.p b { display: block; font-size: .78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p.programada { background: var(--lav); border-color: var(--lav-d); color: var(--lav-t); }
.p.realizada { background: var(--sage); border-color: var(--sage-d); color: var(--sage-t); }
.p.cancelada { background: var(--rose); border-color: var(--rose-d); color: var(--rose-t); opacity: .75; text-decoration: line-through; }
.p.pendiente { background: var(--beige); border-color: var(--beige-d); color: var(--beige-t); }
.p.no_presentado { background: #f6d4d2; border-color: #c97d7a; color: #8a3b38; }
.free { position: absolute; left: 3px; right: 3px; border: 1.5px dashed var(--sage-d); border-radius: 9px; background: rgba(225,235,224,.55); color: var(--sage-t); font-size: .72rem; padding: 3px 6px; cursor: pointer; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; margin: 10px 0 0; font-size: .78rem; color: var(--muted); }
.legend i { display: inline-block; width: 11px; height: 11px; border-radius: 4px; margin-right: 5px; vertical-align: -1px; }

/* motos */
.moto-week { display: grid; grid-template-columns: repeat(7, minmax(130px, 1fr)); gap: 10px; overflow-x: auto; }
.moto-col { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; min-height: 120px; }
.moto-col h4 { margin: 0 0 8px; font-size: .82rem; text-align: center; }
.moto-col.today { border-color: var(--rose-d); }
.shift { border-radius: 12px; padding: 8px 10px; margin-bottom: 8px; cursor: pointer; font-size: .8rem; border: 1px solid var(--line); background: var(--sage); }
.shift.completo { background: var(--beige); } .shift.bloqueado { background: var(--rose); } .shift.pocas { background: var(--lav); }
.month { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.month .dn { text-align: center; font-size: .75rem; color: var(--muted); }
.month .d { min-height: 78px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 6px 8px; font-size: .78rem; cursor: pointer; }
.month .d.out { opacity: .4; } .month .d.today { border-color: var(--rose-d); }
.month .d .pill { display: block; margin-top: 3px; border-radius: 8px; padding: 1px 6px; font-size: .7rem; }

/* misc */
.photo { width: 76px; height: 76px; border-radius: 22px; background: var(--lav); color: var(--lav-t); display: grid; place-items: center; font-size: 1.6rem; font-weight: 600; object-fit: cover; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 6px 12px; font-size: .9rem; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; }
.modal-bg { position: fixed; inset: 0; background: rgba(61,58,58,.35); display: grid; place-items: center; z-index: 100; padding: 16px; overflow-y: auto; }
.modal { background: #fff; border-radius: 20px; padding: 22px; width: min(680px, 100%); max-height: 92vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,.2); }
.modal .foot { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }
.modal .foot .left { margin-right: auto; }
#toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; z-index: 200; }
.toast { background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 12px; box-shadow: var(--shadow); max-width: 90vw; }
.toast.err { background: #a2514e; }
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: linear-gradient(160deg, var(--rose), var(--lav) 55%, var(--sage)); }
.login .card { width: min(400px, 100%); padding: 30px; }
.login h1 { margin-bottom: 4px; }
.alert-row { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--line); color: inherit; }
.dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 6px; flex: none; }
.dot.alta { background: var(--rose-d); } .dot.media { background: var(--beige-d); } .dot.baja { background: var(--lav-d); }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 50; left: 0; top: 0; width: 270px; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow); }
  .side.open { transform: none; }
  .btn.burger { display: inline-flex; }
  .top, .content { padding-left: 14px; padding-right: 14px; }
  .g2, .g3 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .weekgrid { grid-template-columns: 44px repeat(6, minmax(104px, 1fr)); }
  .kv { grid-template-columns: 120px 1fr; }
}
@media print {
  .side, .top, .no-print, .page-head .actions, .filters, .tabs, #toasts { display: none !important; }
  .shell { display: block; } body { background: #fff; } .content { padding: 0; max-width: none; }
  .card, .table-wrap { box-shadow: none; }
}
