:root {
  --ink: oklch(22% 0.02 260);
  --muted: oklch(52% 0.025 260);
  --soft: oklch(68% 0.018 260);
  --line: oklch(89% 0.015 260);
  --surface: oklch(99% 0.005 260);
  --canvas: oklch(96% 0.012 260);
  --brand: #0f28c0;
  --brand-soft: oklch(95% 0.035 265);
  --success: oklch(46% 0.16 265);
  --warning: oklch(58% 0.08 260);
  --radius: 20px;
  --shadow: 0 16px 40px oklch(30% 0.03 260 / 0.07);
  font-family: "Poppins", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: var(--canvas); }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }

.app-shell { display: flex; min-height: 100svh; }
.sidebar { width: 248px; padding: 24px 18px 20px; display: flex; flex-direction: column; flex-shrink: 0; background: oklch(98% 0.008 260); border-right: 1px solid var(--line); }
.brand { display: flex; align-items: center; justify-content: flex-start; padding: 0 12px; margin-bottom: 42px; }
.brand img { display: block; width: 148px; height: auto; max-height: 36px; object-fit: contain; object-position: left center; }
.brand strong, .brand small { display: block; letter-spacing: -0.02em; }
.brand strong { font-size: 16px; }
.brand small { margin-top: 2px; color: var(--muted); font-size: 11px; }
.sidebar-label, .eyebrow { color: var(--soft); font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }
.sidebar-label { padding: 0 13px 12px; }
.side-nav { display: grid; gap: 5px; }
.nav-item { display: flex; align-items: center; gap: 12px; min-height: 42px; padding: 0 13px; border-radius: 11px; color: var(--muted); font-size: 12px; font-weight: 600; transition: background 180ms ease, color 180ms ease; }
.nav-item:hover { background: oklch(95% 0.01 260); color: var(--ink); }
.nav-item.is-active { color: var(--brand); background: var(--brand-soft); }
.nav-icon { width: 19px; color: currentColor; font-size: 18px; line-height: 1; text-align: center; }
.sidebar-spacer { flex: 1; min-height: 48px; }
.sidebar-note { display: flex; gap: 10px; align-items: flex-start; padding: 13px; margin-bottom: 14px; border-radius: 14px; background: var(--brand-soft); color: var(--brand); }
.sidebar-note strong, .sidebar-note small, .profile-mini strong, .profile-mini small { display: block; }
.sidebar-note strong { font-size: 12px; }
.sidebar-note small, .profile-mini small { margin-top: 4px; font-size: 10px; color: var(--muted); }
.pulse-dot { width: 7px; height: 7px; flex: 0 0 auto; margin-top: 4px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 4px oklch(67% 0.12 265 / 0.18); }
.profile-mini { display: flex; align-items: center; gap: 10px; padding: 12px 10px 0; border-top: 1px solid var(--line); }
.profile-mini strong { max-width: 142px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.profile-mini .chevron { margin-left: auto; color: var(--soft); font-size: 20px; }

.avatar { display: grid; place-items: center; width: 34px; height: 34px; flex: 0 0 auto; border: 0; border-radius: 50%; font-size: 11px; font-weight: 800; }
.avatar-blue { color: var(--brand); background: oklch(90% 0.065 260); }
.avatar-blue-soft { color: oklch(38% 0.12 265); background: oklch(91% 0.035 265); }
.avatar-gray-blue { color: oklch(42% 0.06 260); background: oklch(91% 0.015 260); }
.avatar-gray { color: oklch(32% 0.05 260); background: oklch(94% 0.01 260); }
.main-content { width: min(100%, 1440px); min-width: 0; padding: 0 40px 52px; margin: 0 auto; }
.topbar { display: flex; align-items: center; justify-content: space-between; height: 72px; border-bottom: 1px solid oklch(90% 0.012 260 / .75); }
.breadcrumb { display: flex; gap: 10px; color: var(--muted); font-size: 12px; }
.breadcrumb strong { color: var(--ink); font-weight: 700; }
.breadcrumb-separator { color: var(--soft); }
.topbar-actions { display: flex; align-items: center; gap: 15px; }
.icon-button, .mobile-menu { position: relative; border: 0; color: var(--muted); background: transparent; cursor: pointer; font-size: 20px; }
.notification-dot { position: absolute; top: -1px; right: -1px; width: 6px; height: 6px; border-radius: 50%; background: var(--brand); }
.mobile-menu { display: none; }

.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; padding: 38px 0 26px; }
.page-heading h1, .live-screen h1 { margin: 7px 0 7px; font-size: clamp(26px, 2.4vw, 34px); letter-spacing: -0.045em; line-height: 1.14; }
.page-heading h1 { font-weight: 600; }
.heading-subtitle { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.primary-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px; border: 0; border-radius: 10px; color: oklch(99% 0.005 260); background: var(--brand); box-shadow: 0 6px 14px oklch(35% 0.16 265 / .14); font-size: 11px; font-weight: 600; transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease; }
.primary-button:hover { transform: translateY(-1px); background: oklch(39% 0.22 265); box-shadow: 0 12px 22px oklch(35% 0.16 265 / .25); }
.primary-button span { font-size: 18px; font-weight: 400; line-height: 1; }
.full-width { width: 100%; }

.metric-strip { display: grid; grid-template-columns: 1.35fr 1fr 1fr; gap: 12px; padding-bottom: 22px; }
.metric-item { min-height: 118px; padding: 18px 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.metric-highlight { color: var(--ink); background: var(--brand-soft); border-color: oklch(84% 0.07 265); box-shadow: none; }
.metric-label { display: flex; align-items: center; gap: 8px; margin-bottom: 17px; font-size: 12px; font-weight: 650; color: var(--muted); }
.metric-highlight .metric-label { color: var(--brand); }
.metric-symbol { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 7px; color: var(--brand); background: oklch(99% 0.005 260); font-size: 12px; }
.metric-symbol.muted { color: var(--muted); background: oklch(95% 0.008 260); }
.metric-item > strong { display: block; font-size: 24px; font-weight: 600; letter-spacing: -0.04em; }
.metric-change { display: block; margin-top: 12px; font-size: 11px; font-weight: 700; }
.metric-change small { margin-left: 5px; color: var(--muted); font-size: 10px; font-weight: 500; }
.metric-highlight .metric-change small { color: var(--muted); }
.positive { color: var(--brand); }
.metric-highlight .positive { color: oklch(88% 0.06 265); }
.neutral { color: var(--soft); font-weight: 550; }

.content-grid { display: grid; grid-template-columns: 1fr 1.618fr; gap: 18px; align-items: start; }
.panel { min-width: 0; padding: 22px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.panel-head, .section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.panel h2, .section-head h2 { margin: 5px 0 0; font-size: 16px; font-weight: 600; letter-spacing: -0.03em; }
.select-wrap select, .sale-form select, .sale-form input { width: 100%; height: 42px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; outline: 0; color: var(--ink); background: oklch(99% 0.005 260); font-size: 12px; }
.select-wrap select { width: auto; min-width: 142px; color: var(--muted); }
select:focus, input:focus { border-color: oklch(57% 0.16 265); box-shadow: 0 0 0 3px oklch(60% 0.17 265 / .13); }
.period-tabs { display: flex; gap: 4px; padding: 4px; border-radius: 11px; background: oklch(96% 0.008 260); }
.period-tabs.compact { width: max-content; margin: 24px 0 16px; }
.period-tabs button { min-height: 31px; padding: 0 11px; border: 0; border-radius: 8px; color: var(--soft); background: transparent; cursor: pointer; font-size: 10px; font-weight: 700; }
.period-tabs button.is-active { color: var(--ink); background: var(--surface); box-shadow: 0 2px 6px oklch(30% 0.03 260 / .08); }
.leaderboard { display: grid; gap: 4px; }
.leader-row { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto auto; align-items: center; gap: 10px; min-height: 56px; padding: 0 8px; border-bottom: 1px solid oklch(91% 0.01 260 / .7); }
.leader-row:last-child { border-bottom: 0; }
.leader-row.is-current { margin: 2px -8px; padding: 0 16px; border-radius: 12px; background: oklch(96% 0.025 265); border-bottom-color: transparent; }
.leader-rank { color: var(--soft); font-size: 12px; font-weight: 800; }
.leader-row:first-child .leader-rank { color: var(--brand); }
.leader-person { display: flex; align-items: center; gap: 9px; min-width: 0; }
.leader-person strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.leader-person small { display: block; margin-top: 3px; color: var(--soft); font-size: 10px; }
.leader-value { text-align: right; font-size: 12px; font-weight: 800; }
.leader-count { color: var(--soft); font-size: 10px; }
.text-link { display: inline-flex; align-items: center; gap: 8px; margin-top: 17px; color: var(--brand); font-size: 11px; font-weight: 750; }
.text-link span { font-size: 17px; transition: transform 180ms ease; }
.text-link:hover span { transform: translateX(3px); }
.round-plus { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; color: var(--brand); background: var(--brand-soft); font-size: 20px; }
.sale-form { display: grid; gap: 13px; margin-top: 25px; }
.sale-form label { display: grid; gap: 7px; color: var(--muted); font-size: 11px; font-weight: 650; }
.form-row { display: grid; grid-template-columns: 1.2fr .8fr; gap: 10px; }
.amount-input { position: relative; }
.amount-input span { position: absolute; left: 12px; top: 13px; color: var(--brand); font-weight: 800; font-size: 13px; }
.amount-input input { padding-left: 29px; }
.calculation-preview { display: grid; grid-template-columns: 1fr auto; gap: 5px 12px; align-items: center; padding: 13px; margin-top: 3px; border-radius: 11px; background: oklch(97% 0.012 260); }
.calculation-preview span { color: var(--muted); font-size: 10px; }
.calculation-preview strong { color: var(--ink); font-size: 15px; }
.calculation-preview span:last-child { grid-column: 1 / -1; color: var(--soft); }
.form-feedback { min-height: 15px; margin: -3px 0 0; color: var(--success); font-size: 11px; font-weight: 650; }

.activity-section { padding-top: 36px; }
.section-head { align-items: end; padding-bottom: 14px; }
.section-head .text-link { margin: 0; }
.activity-list { border-top: 1px solid var(--line); }
.activity-row { display: grid; grid-template-columns: 36px 1fr auto auto; gap: 12px; align-items: center; min-height: 70px; border-bottom: 1px solid oklch(91% 0.01 260 / .7); }
.activity-icon { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; color: var(--brand); background: var(--brand-soft); font-size: 14px; }
.activity-row strong, .activity-row small { display: block; }
.activity-row strong { font-size: 12px; }
.activity-row small { margin-top: 4px; color: var(--soft); font-size: 10px; }
.activity-value { text-align: right; font-size: 12px; font-weight: 800; }
.activity-ape { min-width: 100px; text-align: right; color: var(--muted); font-size: 10px; }

.live-screen { max-width: 1320px; padding: 58px 0 30px; margin: 0 auto; }
.live-screen-head { display: flex; justify-content: space-between; align-items: end; gap: 20px; }
.live-screen h1 { font-size: clamp(38px, 6vw, 84px); font-weight: 700; }
.live-screen h1 em { color: var(--brand); font-style: normal; }
.live-clock { text-align: right; }
.live-clock strong, .live-clock span { display: block; }
.live-clock strong { font-size: clamp(28px, 4vw, 48px); letter-spacing: -0.06em; }
.live-clock span { margin-top: 4px; color: var(--muted); font-size: 12px; }
.live-controls { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 34px 0 24px; }
.sound-button { min-height: 34px; padding: 0 13px; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); background: var(--surface); cursor: pointer; font-size: 11px; font-weight: 700; }
.live-board { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.live-card { position: relative; min-height: 300px; padding: 26px 22px; overflow: hidden; border: 1px solid var(--line); border-radius: 22px; background: var(--surface); transition: transform 220ms ease, border-color 220ms ease; }
.live-card.is-first { min-height: 340px; border-color: oklch(62% 0.15 265 / .35); box-shadow: var(--shadow); }
.live-card.is-current { transform: translateY(-6px); border-color: var(--brand); }
.live-card-top { display: flex; justify-content: space-between; align-items: center; }
.live-place { color: var(--soft); font-size: 12px; font-weight: 800; }
.live-place.is-first { color: var(--brand); }
.live-card .avatar { width: 44px; height: 44px; margin: 30px 0 18px; font-size: 13px; }
.live-card strong { display: block; font-size: clamp(15px, 2vw, 20px); letter-spacing: -0.03em; }
.live-card small { display: block; margin-top: 7px; color: var(--muted); font-size: 11px; }
.live-total { display: block; margin-top: 46px; font-size: clamp(20px, 3vw, 30px); letter-spacing: -0.05em; }
.live-card.is-first .live-total { color: var(--brand); }
.live-card-footer { position: absolute; right: 22px; bottom: 22px; left: 22px; display: flex; justify-content: space-between; color: var(--soft); font-size: 10px; }
.live-footer { display: flex; justify-content: space-between; padding: 18px 2px 0; color: var(--soft); font-size: 10px; }
.live-footer span:first-child { display: flex; align-items: center; gap: 9px; }
.confetti-layer { position: fixed; inset: 0; z-index: 20; pointer-events: none; opacity: 0; transition: opacity 180ms ease; }
.confetti-layer.is-visible { opacity: 1; }

.bottom-nav { display: none; }
.menu-scrim { display: none; }
.bottom-nav-employee { grid-template-columns: repeat(3, 1fr); }
.bottom-nav-admin { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1000px) { .sidebar { width: 220px; } .main-content { padding: 0 28px 64px; } .content-grid { grid-template-columns: 1fr; } .quick-entry-panel { max-width: none; } .live-board { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 700px) {
  .app-shell { display: block; }
  .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 30; width: min(280px, 85vw); transform: translateX(-105%); transition: transform 220ms ease; box-shadow: 12px 0 40px oklch(30% .03 260 / .12); }
  body.menu-open .sidebar { transform: translateX(0); }
  .menu-scrim { position: fixed; inset: 0 0 0 min(280px, 85vw); z-index: 29; display: block; width: auto; height: auto; padding: 0; border: 0; background: oklch(20% .02 260 / .06); opacity: 0; pointer-events: none; transition: opacity 180ms ease; }
  body.menu-open .menu-scrim { opacity: 1; pointer-events: auto; }
  .main-content { padding: 0 16px calc(88px + env(safe-area-inset-bottom)); }
  .topbar { height: 60px; }
  .mobile-menu { display: block; }
  .breadcrumb { margin-right: auto; margin-left: 14px; }
  .breadcrumb span:first-child, .breadcrumb-separator { display: none; }
  .topbar-actions .avatar { display: none; }
  .page-heading { align-items: flex-start; flex-direction: column; padding: 28px 0 20px; gap: 16px; }
  .page-heading h1 { font-size: 26px; }
  .heading-subtitle { max-width: 300px; line-height: 1.45; font-size: 12px; }
  .page-heading .primary-button { width: 100%; }
  .metric-strip { grid-template-columns: 1fr 1fr; gap: 8px; }
  .metric-item { min-height: 104px; padding: 14px; border-radius: 14px; }
  .metric-highlight { grid-column: 1 / -1; min-height: 108px; }
  .metric-item > strong { font-size: 20px; }
  .metric-change small { display: none; }
  .panel { padding: 16px; border-radius: 14px; }
  .panel-head { align-items: center; }
  /* iOS Safari zooms focused controls below 16px. Keep form focus at a stable scale. */
  .sale-form input, .sale-form select { font-size: 16px; line-height: 1.25; }
  .select-wrap select { min-width: 118px; }
  .period-tabs.compact { width: 100%; }
  .period-tabs.compact button { flex: 1; padding: 0 5px; }
  .activity-row { grid-template-columns: 32px 1fr auto; gap: 9px; }
  .activity-ape { display: none; }
  .bottom-nav { position: fixed; right: 12px; bottom: calc(8px + env(safe-area-inset-bottom)); left: 12px; z-index: 25; display: grid; min-height: 56px; padding: 4px; overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: 0 10px 24px oklch(30% .03 260 / .14); }
  .bottom-nav-employee { grid-template-columns: repeat(3, 1fr); }
  .bottom-nav-admin { grid-template-columns: repeat(4, 1fr); }
  .bottom-nav-item { display: grid; place-items: center; gap: 2px; min-height: 46px; border-radius: 12px; color: var(--soft); }
  .bottom-nav-item span { font-size: 16px; line-height: 1; }
  .bottom-nav-item small { font-size: 8px; font-weight: 700; }
  .bottom-nav-item.is-active { color: var(--brand); background: var(--brand-soft); }
  .live-screen { padding: 28px 0 20px; }
  .live-screen-head { align-items: flex-start; flex-direction: column; }
  .live-clock { text-align: left; }
  .live-controls { align-items: flex-start; flex-direction: column; padding: 25px 0 18px; }
  .live-controls .period-tabs { width: 100%; }
  .live-controls .period-tabs button { flex: 1; }
  .live-board { grid-template-columns: 1fr; }
  .live-card, .live-card.is-first { min-height: 220px; }
  .live-total { margin-top: 30px; }
  .live-footer { gap: 12px; flex-direction: column; }
  .leader-row { grid-template-columns: 24px minmax(0, 1fr) auto; gap: 8px; min-height: 55px; padding: 0 4px; }
  .leader-row.is-current { margin: 2px -4px; padding: 0 10px; }
  .leader-count { display: none; }
  .leader-person strong { font-size: 11px; font-weight: 600; }
  .leader-person small { font-size: 9px; }
  .leader-value { font-size: 11px; white-space: nowrap; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; } }
