* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: Inter, system-ui, sans-serif; color: #1C1B18; background: #FFF3E6; -webkit-text-size-adjust: 100%; }
button, input, select { font-family: inherit; }
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }

/* ---------- piezas reutilizables ---------- */
.card { background: #FFFFFF; border: 1px solid #F1D8C0; border-radius: 14px; padding: 20px; }
.card.tint { background: #FDE3CF; border-color: #F5C49C; }
.card.ink { background: #1C1B18; border-color: #1C1B18; color: #FFFFFF; }
.col { display: flex; flex-direction: column; gap: 8px; }
.row-flex { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.h2 { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 20px; }
.h2.sm { font-size: 17px; }
.num { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 28px; }
.mut { font-size: 13px; color: #5F574D; }
.lbl { font-size: 13px; font-weight: 600; color: #5F574D; }
.blue { color: #1E5BB8; }
.red { color: #B3440B; }
.orange-t { color: #F9A15F; }
.strong { font-weight: 600; }
.right { text-align: right; }
.grid { display: grid; gap: 16px; }
.g-kpi { grid-template-columns: repeat(auto-fit, minmax(min(190px, 100%), 1fr)); }
.g-2 { grid-template-columns: repeat(auto-fit, minmax(min(360px, 100%), 1fr)); }
.g-3 { grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); }
.g-inv { grid-template-columns: repeat(auto-fit, minmax(min(230px, 100%), 1fr)); }
.g-form { grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: 12px; }

.btn, .btn-ink, .btn-o { min-height: 44px; padding: 0 18px; border-radius: 10px; font-size: 15px; font-weight: 600; cursor: pointer; }
.btn { border: 0; background: #F26A1B; color: #1C1B18; }
.btn-ink { border: 0; background: #1C1B18; color: #FFFFFF; }
.btn-o { border: 1px solid #1C1B18; background: #FFFFFF; color: #1C1B18; }
.btn-s, .btn-so { min-height: 40px; padding: 0 12px; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; }
.btn-s { border: 0; background: #F26A1B; color: #1C1B18; }
.btn-so { border: 1px solid #1C1B18; background: #FFFFFF; color: #1C1B18; }
.btn-danger { min-height: 40px; padding: 0 12px; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; border: 1px solid #B3440B; background: #FFFFFF; color: #8A3208; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible { outline: 3px solid #1E5BB8; outline-offset: 2px; }

.inp { width: 100%; min-height: 48px; padding: 0 12px; border: 1px solid #CDB9A5; border-radius: 10px; background: #FFFFFF; font-size: 16px; color: #1C1B18; }
.field { display: flex; flex-direction: column; gap: 6px; }
.pill { display: inline-block; padding: 5px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.pill.blue-bg { background: #DCE8F8; color: #153F80; }
.pill.grey-bg { background: #E8E5DD; color: #3F3C35; }
.pill.warn-bg { background: #FBE3D3; color: #8A3208; }
.pill.ink-bg { background: #1C1B18; color: #FFFFFF; }
.pill.tint-bg { background: #FDE3CF; color: #5A2B0A; }
.chip { min-height: 40px; padding: 0 16px; border-radius: 999px; font-size: 14px; cursor: pointer; border: 1px solid #E8C4A2; background: #FFFFFF; color: #1C1B18; }
.chip.on { background: #1C1B18; color: #FFFFFF; font-weight: 600; }
.track { height: 16px; background: #F7E6D6; border-radius: 6px; }
.track.big { height: 22px; }
.fill { height: 100%; border-radius: 6px; background: #F26A1B; }
.fill.blue-bg { background: #1E5BB8; }
.fill.ink-bg { background: #1C1B18; }
.err { padding: 10px 14px; border-radius: 10px; background: #FBE3D3; color: #8A3208; font-size: 14px; font-weight: 600; }

/* filas tipo tabla */
.scroll-x { overflow-x: auto; }
.rows { min-width: var(--min, 640px); }
.row { display: grid; grid-template-columns: var(--cols); gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid #F1D8C0; font-size: 14px; }
.row.head { border-top: 0; font-size: 13px; color: #5F574D; }
.row .acts { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }

/* ---------- estructura ---------- */
.app { display: flex; flex-wrap: wrap; min-height: 100vh; }
.nav { flex: 0 0 248px; background: #1C1B18; color: #F5F3EE; padding: 24px 14px; display: flex; flex-direction: column; gap: 18px; }
.nav-scroll { display: flex; flex-direction: column; gap: 2px; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px; }
.brand b { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 24px; letter-spacing: 0.04em; line-height: 1; display: block; }
.brand small { font-size: 11px; color: #F9B27C; }
.nav-head { padding: 14px 12px 4px; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: #F9B27C; }
.nav-btn { display: flex; align-items: center; min-height: 42px; padding: 0 12px; border: 0; border-radius: 8px; background: transparent; color: #F5F3EE; font-size: 15px; text-align: left; cursor: pointer; }
.nav-btn.on { background: #F26A1B; color: #1C1B18; font-weight: 600; }
.nav-user { margin-top: auto; padding: 14px 12px; border-radius: 10px; background: #2B2A26; display: flex; flex-direction: column; gap: 8px; font-size: 13px; color: #D9D4C9; }
.nav-user button { min-height: 40px; border: 1px solid #F9B27C; border-radius: 8px; background: transparent; color: #F5F3EE; font-size: 14px; cursor: pointer; }
.topbar { display: none; }
.main { flex: 999 1 560px; min-width: 0; padding: 28px 36px; display: flex; flex-direction: column; gap: 22px; }
.banner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; padding: 22px 26px; border-radius: 18px; background: #F26A1B; color: #1C1B18; }
.banner h1 { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 32px; }
.banner .btn-o { background: #FFFFFF; }

#toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 80; max-width: min(520px, calc(100vw - 32px)); padding: 12px 18px; border-radius: 10px; background: #1C1B18; color: #FFFFFF; font-size: 15px; font-weight: 600; box-shadow: 0 6px 24px rgba(0, 0, 0, 0.3); display: none; }
#toast.show { display: block; }
#toast.bad { background: #8A3208; }

/* ventanas */
.bg { position: fixed; inset: 0; z-index: 50; overflow-y: auto; background: rgba(28, 27, 24, 0.6); display: flex; padding: 16px; }
.dlg { margin: auto; width: 100%; max-width: 640px; background: #FFF3E6; border-radius: 16px; padding: 24px; display: flex; flex-direction: column; gap: 14px; }
.dlg.sm { max-width: 480px; }
.dlg h2 { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 24px; }
.dlg .item { background: #FFFFFF; border: 1px solid #F1D8C0; border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.btns { display: flex; gap: 10px; }
.btns .btn-o { flex: 1; min-height: 52px; }
.btns .btn { flex: 2; min-height: 52px; font-size: 16px; }

/* entrada */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: #FFF3E6; }
.login form { width: 100%; max-width: 400px; background: #FFFFFF; border: 1px solid #F1D8C0; border-radius: 18px; padding: 28px; display: flex; flex-direction: column; gap: 14px; }
.login .brandrow { display: flex; align-items: center; gap: 14px; }

/* barras por día */
.days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.daybars { align-items: end; height: 150px; }
.daybar { display: flex; align-items: flex-end; justify-content: center; gap: 3px; height: 100%; }
.daybar span { width: 40%; border-radius: 4px 4px 0 0; }
.daylab { display: flex; flex-direction: column; gap: 2px; font-size: 12px; padding: 4px 0; border-radius: 6px; text-align: center; }

/* ---------- celular ---------- */
@media (max-width: 860px) {
  .app { display: block; }
  .topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; background: #1C1B18; color: #F5F3EE; position: sticky; top: 0; z-index: 40; }
  .topbar button { min-height: 44px; min-width: 44px; border: 1px solid #F9B27C; border-radius: 10px; background: transparent; color: #F5F3EE; font-size: 20px; cursor: pointer; }
  .topbar .brand b { font-size: 20px; }
  .nav { position: fixed; top: 0; left: 0; bottom: 0; width: 270px; z-index: 60; transform: translateX(-100%); transition: transform 0.2s; overflow-y: auto; }
  .nav.open { transform: none; }
  .navshade { position: fixed; inset: 0; z-index: 55; background: rgba(0, 0, 0, 0.5); }
  .main { padding: 16px 14px 90px; gap: 16px; }
  .banner { padding: 16px 18px; }
  .banner h1 { font-size: 26px; }
  .num { font-size: 24px; }
  .dlg { padding: 18px; }
}
@media (prefers-reduced-motion: reduce) { .nav { transition: none; } }
