body { background: #efebe3; }
.gate { min-height: calc(100vh - 40px); display: grid; place-items: center; padding: 16px; }
.gate-card { width: min(360px, 100%); display: grid; gap: 14px; justify-items: center; padding: 28px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); text-align: center; }
.gate-card h1 { margin: 0; font: 700 22px var(--display); }
.gate-card label { width: 100%; text-align: left; }
.gate-card input { font-size: 20px; letter-spacing: .3em; text-align: center; }

.dash { max-width: 1240px; margin: 0 auto; padding: 0 16px 60px; }
.dash-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 0; }
.dash-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.live { display: inline-flex; align-items: center; gap: 6px; margin-right: 6px; color: var(--ok); font-size: 13px; font-weight: 700; }
.live .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 rgb(36 114 74 / .5); animation: pulse 2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px rgb(36 114 74 / 0); } 100% { box-shadow: 0 0 0 0 rgb(36 114 74 / 0); } }

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 860px) { .kpis { grid-template-columns: repeat(2, 1fr); } }
.kpi { position: relative; display: grid; gap: 2px; padding: 16px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.kpi span { color: var(--muted); font-size: 13px; }
.kpi strong { font: 700 30px/1.15 var(--display); font-variant-numeric: tabular-nums; }
.kpi small { color: var(--muted); font-size: 12px; }
.spark { display: flex; align-items: flex-end; gap: 4px; height: 34px; margin-top: 6px; }
.spark i { flex: 1; min-height: 2px; background: var(--accent); border-radius: 3px 3px 0 0; opacity: .85; }
.spark i:last-child { opacity: 1; }

.day-panel { margin-top: 16px; padding: 16px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.day-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.day-nav h2 { margin: 0 0 0 8px; font: 700 20px var(--display); }
.day-count { color: var(--muted); font-size: 14px; }

.board-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
.board { --row: 22px; display: grid; grid-template-columns: 56px repeat(var(--cols), minmax(170px, 1fr)); min-width: calc(56px + var(--cols) * 170px); position: relative; }
.col-head { position: sticky; top: 0; z-index: 3; display: flex; align-items: center; gap: 8px; padding: 10px; background: #faf8f4; border-bottom: 1px solid var(--line); border-left: 1px solid var(--line); font-weight: 700; }
.col-head .avatar { width: 30px; height: 30px; margin: 0; font-size: 13px; }
.col-head small { display: block; color: var(--muted); font-weight: 400; font-size: 12px; }
.corner { background: #faf8f4; border-bottom: 1px solid var(--line); }
.times-col { position: relative; }
.times-col .tl:first-child { translate: 0 2px; }
.times-col .tl:last-child { translate: 0 -100%; }
.tl { position: absolute; left: 0; right: 0; padding-right: 8px; text-align: right; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; translate: 0 -50%; }
.col { position: relative; border-left: 1px solid var(--line); background:
  repeating-linear-gradient(to bottom, transparent 0 calc(var(--row) * 4 - 1px), var(--line) calc(var(--row) * 4 - 1px) calc(var(--row) * 4)); }
.col.off { background-color: #f3f0ea; background-image: repeating-linear-gradient(45deg, transparent 0 8px, rgb(0 0 0 / .03) 8px 16px); }
.lunch { position: absolute; left: 0; right: 0; background: repeating-linear-gradient(45deg, #f4efe6 0 6px, #ece6da 6px 12px); color: var(--muted); font-size: 11px; display: grid; place-items: center; }
.ev { position: absolute; left: 4px; right: 4px; padding: 4px 8px; border-radius: 8px; border-left: 4px solid; text-align: left; overflow: hidden; cursor: pointer; font-size: 12.5px; line-height: 1.25; border-top: 0; border-right: 0; border-bottom: 0; transition: transform .1s, box-shadow .1s; }
.ev:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgb(0 0 0 / .1); z-index: 2; }
.ev b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev span { color: inherit; opacity: .8; }
.ev.confirmed { background: #fbe9e6; border-color: var(--accent); color: #5a1a15; }
.ev.walkin { background: #fdf1d9; border-color: #c98a00; color: #573b00; }
.ev.done { background: #e6eefb; border-color: #3b64ad; color: #1d3561; }
.ev.no_show { background: #f1f1f1; border-color: #888; color: #444; text-decoration: line-through; }
.ev.cancelled { display: none; }
.ev.block { background: repeating-linear-gradient(45deg, #ece9e3 0 6px, #e2ded6 6px 12px); border-color: #777; color: #333; }
.ev.is-new { animation: flash 2.4s ease-out; }
@keyframes flash { 0%, 30% { box-shadow: 0 0 0 3px var(--ok); } 100% { box-shadow: 0 0 0 0 transparent; } }
.now-line { position: absolute; left: 56px; right: 0; height: 2px; background: var(--ok); z-index: 2; pointer-events: none; }
.now-line::before { content: ""; position: absolute; left: -5px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--ok); }
.closed { padding: 40px; text-align: center; color: var(--muted); }

.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; margin: 12px 0 0; color: var(--muted); font-size: 13px; }
.lg { display: inline-block; width: 14px; height: 14px; border-radius: 4px; border-left: 4px solid; margin-right: -8px; }
.lg.confirmed { background: #fbe9e6; border-color: var(--accent); }
.lg.walkin { background: #fdf1d9; border-color: #c98a00; }
.lg.done { background: #e6eefb; border-color: #3b64ad; }
.lg.no_show { background: #f1f1f1; border-color: #888; }
.lg.block { background: #e5e1d9; border-color: #777; }

.drawer-backdrop { position: fixed; inset: 0; z-index: 40; background: rgb(22 19 15 / .35); }
.drawer { position: fixed; z-index: 41; top: 0; right: 0; bottom: 0; width: min(420px, 100%); padding: 24px; overflow-y: auto; background: var(--card); box-shadow: -10px 0 40px rgb(0 0 0 / .15); }
.drawer h3 { margin: 0 0 4px; font: 700 24px var(--display); }
.drawer-close { position: absolute; top: 12px; right: 12px; width: 40px; height: 40px; border: 0; border-radius: 50%; background: #f1ede6; font-size: 24px; cursor: pointer; }
.drawer .actions { justify-content: flex-start; }
.drawer form { display: grid; gap: 12px; margin-top: 14px; }
.drawer select { width: 100%; padding: 12px 14px; font: inherit; border: 1.5px solid var(--line); border-radius: 10px; background: #fff; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
