:root {
  --bg: #f5f7f3;
  --panel: #ffffff;
  --text: #1f2520;
  --muted: #697068;
  --line: #dfe6dc;
  --green: #62c653;
  --yellow: #e5c84d;
  --red: #d94b42;
  --gold: #be8d12;
  --shadow: 0 10px 28px rgba(32, 44, 30, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  letter-spacing: 0;
}

.app-shell {
  width: min(100%, 760px);
  margin: 0 auto;
  padding: 14px 12px 28px;
}

.topbar {
  display: grid;
  gap: 8px;
  padding: 6px 2px 12px;
}

.brand-logo {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
}

.header-people {
  display: grid;
  gap: 7px;
}

.attendance-launch-row {
  display: flex;
  justify-content: flex-end;
}

.attendance-launch {
  grid-column: 3;
  grid-row: 1;
  width: 44px;
  min-height: 44px;
  height: 100%;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: #fff;
  color: var(--text);
  font-size: 36px;
  line-height: 1;
  cursor: pointer;
}

.shop-attendance-people {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)) 44px;
  gap: 4px;
  align-items: stretch;
}

.shop-attendance-people .shift-employee {
  min-height: 44px;
  padding: 6px;
  text-align: left;
  font-family: inherit;
  color: var(--text);
  border-radius: 2px;
  cursor: pointer;
}

.attendance-invitation {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  min-height: 44px;
  padding: 4px 6px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: #fff;
  color: var(--text);
  font: 13px Arial, sans-serif;
  cursor: pointer;
}

.attendance-invitation img { width: 30px; height: 36px; object-fit: contain; }
.shop-attendance-people button:disabled { cursor: default; }
.attendance-launch:disabled { background: #f0f2ef; color: #a3aaa0; }
.shop-attendance-people button:focus-visible { outline: 2px solid #287d20; outline-offset: 2px; }
.presence-notice { margin: 0; color: var(--muted); font-size: 12px; }

.supervisor-summary {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  border: 1px solid var(--line);
  background: #fff;
  padding: 8px 10px;
  font-size: 13px;
}

.supervisor-summary > span:last-child {
  margin-left: auto;
  color: var(--muted);
  white-space: nowrap;
}

.shift-employee {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px;
  min-width: 0;
  border: 1px solid var(--line);
  background: #fff;
  padding: 8px 10px;
  font-size: 13px;
}

.employee-rating {
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  align-self: center;
  font-size: 14px;
  font-weight: 700;
}

.rating-star {
  color: #b27a00;
  margin-left: 1px;
}

.employee-role-icon {
  display: inline-block;
  width: 22px;
  height: 27px;
  align-self: end;
  flex: 0 0 22px;
  background-image: url("./employee-role-icons.png?v=20260910-1");
  background-repeat: no-repeat;
  background-size: 104px 104px;
}

.employee-role-icon.role-supervisor {
  background-position: -4px -39px;
}

.employee-role-icon.role-senior_shift {
  background-position: -54px -39px;
}

.employee-role-icon.role-merchandiser {
  background-position: -30px -38px;
}

.employee-role-icon.role-seller {
  background-position: -79px -40px;
}

.shift-employees {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2px;
}

.employee-name {
  display: grid;
  grid-template-rows: repeat(2, minmax(0, 1fr));
  align-items: center;
  height: 27px;
  font-size: 12px;
  line-height: 1.08;
  min-width: 0;
}

.employee-name > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attendance-kiosk {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: max(4px, env(safe-area-inset-top)) 6px max(4px, env(safe-area-inset-bottom));
  background: rgba(15, 22, 15, 0.72);
}

body[data-mode="attendance"] #dashboardApp {
  display: none !important;
}

body[data-mode="attendance"] .attendance-kiosk {
  background: radial-gradient(ellipse at top, #e5efdf, #f5f7f3 70%);
}

.attendance-terminal {
  display: grid;
  min-height: 100vh;
  min-height: 100dvh;
  place-items: center;
  padding: 24px 16px;
}

.attendance-terminal-card {
  width: min(100%, 440px);
  padding: 28px 22px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: var(--shadow);
  text-align: center;
}

.attendance-terminal-logo {
  display: block;
  width: min(100%, 240px);
  height: auto;
  margin: 0 auto 24px;
}

.attendance-terminal-card h1 { margin: 0; font-size: 24px; }
.attendance-terminal-shop { margin: 8px 0 18px; color: var(--muted); }
.attendance-terminal-message {
  margin: 0 0 18px;
  padding: 12px;
  border-radius: 8px;
  background: #f1f5ee;
  font-size: 15px;
  line-height: 1.45;
}

.attendance-terminal-open {
  width: 100%;
  min-height: 48px;
  border: 0;
  border-radius: 8px;
  background: #287d20;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}

.attendance-terminal-open:focus-visible { outline: 3px solid #e5c84d; outline-offset: 3px; }

.attendance-kiosk-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: 44px 48px 48px 100px 80px minmax(0, 1fr);
  width: min(100%, 520px);
  height: 100%;
  max-height: 760px;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 10px clamp(12px, 3vw, 20px);
  border: 1px solid #e2e9de;
  border-radius: 24px;
  background: var(--panel);
  box-shadow: 0 16px 60px rgba(32, 60, 28, 0.12);
}

.attendance-kiosk-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.attendance-kiosk-brand { min-width: 0; flex: 1; }
.attendance-kiosk-brand p { margin: 0 0 2px; color: #48733f; font-size: 16px; line-height: 20px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.attendance-kiosk-brand h2 { margin: 0; font-size: 20px; line-height: 22px; letter-spacing: -0.5px; }
.attendance-navigation { display: grid; align-items: end; padding: 16px 0 6px; }
.attendance-steps { display: flex; justify-content: space-between; padding: 0; margin: 0; list-style: none; }
.attendance-steps li { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 13px; }
.attendance-steps span { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: #f0f3ee; font-weight: 700; }
.attendance-kiosk[data-stage="select"] [data-step="select"],
.attendance-kiosk[data-stage="pin"] [data-step="pin"],
.attendance-kiosk[data-stage="pin_setup"] [data-step="pin"],
.attendance-kiosk[data-stage="camera"] [data-step="camera"],
.attendance-kiosk[data-stage="success"] [data-step="success"] { color: #287d20; font-weight: 700; }
.attendance-kiosk[data-stage="select"] [data-step="select"] span,
.attendance-kiosk[data-stage="pin"] [data-step="pin"] span,
.attendance-kiosk[data-stage="pin_setup"] [data-step="pin"] span,
.attendance-kiosk[data-stage="camera"] [data-step="camera"] span,
.attendance-kiosk[data-stage="success"] [data-step="success"] span { background: #287d20; color: #fff; }

.attendance-close {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  color: var(--text);
  font-size: 25px;
  cursor: pointer;
}

.attendance-kiosk[data-stage="pin"] #attendanceClose,
.attendance-kiosk[data-stage="pin_setup"] #attendanceClose,
.attendance-kiosk[data-stage="camera"] #attendanceClose { display: none; }

.attendance-status {
  display: flex;
  align-items: center;
  gap: 8px;
  align-self: center;
  height: 36px;
  min-height: 0;
  margin: 4px 0;
  padding: 2px 8px;
  border-radius: 8px;
  background: #edf8eb;
  color: #246a1c;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
}

.attendance-status[data-error="true"] { background: #fff0ef; color: #8d221d; }
.attendance-status::before { content: none; display: grid; place-items: center; flex: 0 0 24px; width: 24px; height: 24px; border-radius: 50%; background: #dcefd6; }
.attendance-status[data-tone="success"]::before { content: "✓"; background: #287d20; color: #fff; font-size: 18px; }
.attendance-status[data-tone="loading"]::before { content: "…"; }
.attendance-status[data-error="true"]::before { content: "!"; background: #f5d8d4; }
.attendance-hint { grid-row: 5; display: grid; grid-template-columns: 32px minmax(0, 1fr); align-items: center; gap: 8px; margin-bottom: 6px; padding: 6px 8px; border-radius: 14px; background: #edf8eb; }
.attendance-hint-icon { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: #dcefd6; color: #287d20; }
.attendance-hint-icon svg { width: 22px; height: 22px; }
.attendance-hint h3 { margin: 0; font-size: 18px; line-height: 1.15; }
.attendance-hint p { margin: 4px 0 0; color: #66715f; font-size: 12px; line-height: 1.2; }
.attendance-change-pin { display: block; margin-top: 4px; border: 0; padding: 0; background: none; color: #287d20; font: inherit; font-size: 12px; line-height: 16px; text-align: left; text-decoration: underline; cursor: pointer; }
.attendance-change-pin:focus-visible { outline: 2px solid #287d20; outline-offset: 2px; }
.attendance-kiosk:not([data-stage="select"]) .attendance-form,
.attendance-kiosk:not([data-stage="select"]) .attendance-camera-stage,
.attendance-kiosk:not([data-stage="select"]) .attendance-success { grid-row: 6; }
.attendance-recent { grid-row: 4 / 6; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(2, minmax(0, 1fr)); gap: 6px; margin: 0 0 8px; padding: 0; min-height: 0; }

.attendance-employee-card {
  min-width: 0;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 7px 9px;
  text-align: left;
  cursor: pointer;
  display: grid;
  grid-template-columns: 33px minmax(0, 1fr);
  grid-template-rows: auto 18px;
  align-content: center;
  align-items: center;
  column-gap: 6px;
  row-gap: 4px;
}
.attendance-person-symbol { display: contents; }
.attendance-employee-card .employee-role-icon { grid-column: 1; grid-row: 1; justify-self: center; align-self: center; width: 33px; height: 40.5px; background-size: 156px 156px; }
.attendance-employee-card .role-supervisor { background-position: -6px -58.5px; }
.attendance-employee-card .role-senior_shift { background-position: -81px -58.5px; }
.attendance-employee-card .role-merchandiser { background-position: -45px -57px; }
.attendance-employee-card .role-seller { background-position: -118.5px -60px; }
.attendance-person-code { grid-column: 1; grid-row: 2; justify-self: center; font-size: 12px; line-height: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.attendance-person-name { grid-column: 2; grid-row: 1; min-width: 0; font-size: 16px; line-height: 1.15em; overflow-wrap: anywhere; }
.attendance-person-name b { display: block; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.attendance-person-role { grid-column: 2; grid-row: 2; min-width: 0; color: var(--muted); font-size: 11px; font-weight: 400; line-height: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.attendance-employee-empty { display: flex; color: var(--muted); background: #f8faf6; cursor: default; justify-content: center; font-size: 12px; }
.attendance-identity { grid-row: 4; display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); align-items: center; min-height: 0; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.attendance-identity .attendance-employee-card { --name-size: clamp(20px, 5vw, 26px); --portrait-height: calc(var(--name-size) * 2.3); width: 100%; min-height: 82px; padding: 8px; border: 0; grid-template-columns: 44px minmax(0, 1fr); column-gap: 8px; }
.attendance-identity .attendance-employee-card .attendance-person-name { font-size: var(--name-size); }
.attendance-identity .attendance-person-code { font-size: 16px; }
.attendance-identity .employee-role-icon { width: calc(var(--portrait-height) * 44 / 54); height: var(--portrait-height); background-size: calc(var(--portrait-height) * 208 / 54) calc(var(--portrait-height) * 208 / 54); }
.attendance-identity .role-supervisor { background-position: calc(var(--portrait-height) * -8 / 54) calc(var(--portrait-height) * -78 / 54); }
.attendance-identity .role-senior_shift { background-position: calc(var(--portrait-height) * -108 / 54) calc(var(--portrait-height) * -78 / 54); }
.attendance-identity .role-merchandiser { background-position: calc(var(--portrait-height) * -60 / 54) calc(var(--portrait-height) * -76 / 54); }
.attendance-identity .role-seller { background-position: calc(var(--portrait-height) * -158 / 54) calc(var(--portrait-height) * -80 / 54); }
.attendance-employee-card-large { cursor: default; padding: 12px; }
.attendance-employee-card-large .attendance-person-name { font-size: clamp(20px, 5vw, 26px); }

.attendance-form { grid-row: 6; display: grid; min-height: 0; }
.attendance-form label { margin-top: 4px; font-size: 13px; font-weight: 700; }
.attendance-form input { width: 100%; min-height: 46px; margin: 0; border: 1px solid #bfcbbb; border-radius: 8px; padding: 10px 12px; font-size: 18px; }
#attendanceEmployeeNumber { display: none; }
.attendance-form .primary-button { position: static; width: 100%; margin: 8px 0 0; }
.attendance-form .primary-button, .attendance-camera-actions .primary-button { min-height: 52px; border: 0; border-radius: 12px; padding: 12px; background: #287d20; color: #fff; font-size: 16px; font-weight: 700; cursor: pointer; }
.attendance-form .primary-button:disabled, .attendance-camera-actions .primary-button:disabled { opacity: 0.55; cursor: default; }
.attendance-pin-pad { display: grid; grid-template-rows: 16px 80px minmax(0, 1fr); gap: 6px; min-height: 0; }
.attendance-pin-pad > span { font-size: 13px; font-weight: 700; }
.attendance-pin-display { display: grid; grid-template-columns: repeat(4, minmax(0, 56px)); justify-content: center; align-items: center; gap: 8px; padding: 4px; border: 1px solid #d9e3d4; border-radius: 12px; background: #f8faf6; text-align: center; font-size: 56px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; color: #287d20; cursor: text; user-select: none; }
.attendance-pin-slot { min-width: 0; }
.attendance-pin-pad[data-mode="open"] .attendance-pin-slot { font-family: "Arial Black", "Segoe UI Black", sans-serif; font-weight: 900; }
.attendance-pin-keys { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: repeat(4, minmax(44px, 1fr)); gap: 6px; }
.attendance-pin-keys button { min-height: 44px; padding: 0; border: 1px solid #e0e7dc; border-radius: 12px; background: #fff; color: var(--text); font: 700 40px/1 Arial, sans-serif; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.attendance-pin-keys [data-pin-key="clear"] { font-size: 12px; color: var(--muted); }
.attendance-pin-keys [data-pin-key="backspace"] { color: var(--muted); }
@media (hover: hover) and (pointer: fine) {
  .attendance-pin-keys button:hover { background: #f0f7ec; }
}
.attendance-pin-keys button:active { background: #e2efd9; transform: translateY(1px); }
.attendance-pin-keys button:disabled { opacity: 0.5; cursor: default; }
.attendance-pin-display:focus { outline: none; }
.attendance-pin-keys button:focus-visible { outline: 3px solid #8dc981; outline-offset: 2px; }
.attendance-kiosk[data-stage="unavailable"] .attendance-navigation { visibility: hidden; }
.attendance-link { display: block; margin: 12px auto 0; border: 0; background: none; color: #287d20; text-decoration: underline; cursor: pointer; }

.attendance-video-wrap {
  min-height: 0;
  overflow: hidden;
  width: 100%;
  height: 100%;
  border-radius: 12px;
  background: #172017;
}

.attendance-video-wrap video { display: block; width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.attendance-camera-stage { grid-row: 6; display: grid; grid-template-rows: minmax(0, 1fr) 42px 52px; gap: 6px; min-height: 0; }
.attendance-camera-identity { align-self: center; min-width: 0; padding: 10px 6px; border-left: 1px solid var(--line); }
.attendance-camera-identity > span { display: flex; justify-content: center; align-items: center; gap: 8px; font-size: 20px; font-weight: 700; }
.attendance-kind-copy { display: grid; gap: 4px; min-width: 0; }
.attendance-kind-copy small { color: var(--muted); font-size: 11px; font-weight: 400; }
.attendance-kind-icon { display: inline-grid; place-items: center; flex: 0 0 32px; width: 32px; height: 32px; border-radius: 50%; background: #eaf5e6; color: #287d20; }
.attendance-kind-icon::before { content: "↘"; font-size: 25px; line-height: 1; }
.attendance-camera-identity [data-kind="out"] .attendance-kind-icon::before { content: "↗"; }
.attendance-camera-identity [data-kind="pending"] .attendance-kind-icon { display: none; }
.attendance-camera-identity [data-kind="pending"] .attendance-kind-label { font-size: 11px; }
.attendance-face-status { align-self: center; margin: 0; text-align: center; font-size: 13px; font-weight: 700; }
.attendance-camera-actions { position: relative; display: grid; }
.attendance-camera-actions .primary-button { position: static; width: 100%; margin: 0; }
.attendance-camera-actions .secondary-button { position: absolute; bottom: calc(100% + 6px); width: 100%; min-height: 44px; }
.attendance-success { grid-row: 6; align-self: start; display: flex; justify-content: center; align-items: center; gap: 14px; margin-top: 12px; padding: 18px 10px; border: 1px solid #9fd197; border-radius: 10px; background: #f2fff0; text-align: center; }
.attendance-success-check { color: #287d20; font-size: 64px; font-weight: 800; line-height: 1; }
.attendance-success-details { display: grid; gap: 8px; min-width: 0; }
.attendance-success-time { font-size: clamp(44px, 10vw, 56px); line-height: 1.1; font-weight: 800; font-variant-numeric: tabular-nums; }
.attendance-success-date { font-size: clamp(20px, 5vw, 26px); font-weight: 700; }
.attendance-kiosk-card > .attendance-terminal-open { margin-top: 16px; min-height: 52px; border-radius: 12px; }

@media (max-width: 420px) {
  .attendance-steps li { gap: 3px; font-size: 11px; }
  .attendance-steps span { width: 23px; height: 23px; }
  .attendance-kiosk-card { padding: 8px 10px; }
}

@media (max-width: 520px) {
  .shift-employee {
    grid-template-columns: 22px minmax(0, 1fr) auto;
    gap: 3px;
    padding-inline: 7px;
    font-size: 11px;
  }

  .employee-rating {
    font-size: 13px;
  }

  .employee-name {
    font-size: 11px;
    line-height: 1.15;
  }
}

.top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
}

.header-back {
  margin-right: auto;
}

.rating-heading {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  align-items: center;
  gap: 2px;
  margin-inline: -12px;
}

.rating-heading .hero-title {
  min-width: 0;
  font-size: clamp(14px, 4.5vw, 20px);
  line-height: 1.3;
}

.rating-heading-label,
.rating-heading-date {
  display: block;
}

.rating-heading .rating-heading-date {
  white-space: nowrap;
  font-size: clamp(13px, 4vw, 20px);
}

.rating-day-button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #ecfae8;
  color: var(--text);
  cursor: pointer;
}

.rating-day-button svg {
  width: 24px;
  height: 24px;
}

.rating-day-button:disabled {
  background: #f3f4f3;
  color: #c6c9c5;
  cursor: default;
}

.rating-day-button:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

.rating-history-error {
  color: var(--red);
  font-size: 13px;
}

.rating-history-error:not(:empty) {
  margin-bottom: 12px;
}

h2,
p {
  margin: 0;
}

h2 {
  font-size: 20px;
  line-height: 1.15;
}

.status-pill {
  min-width: 88px;
  max-width: 150px;
  padding: 7px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
  white-space: nowrap;
}

.status-pill.stale {
  border-color: #d94b42;
  color: #b42318;
  background: #fff1f0;
  font-weight: 800;
}

.refresh-button {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--text);
  padding: 8px 8px;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.refresh-button:disabled {
  color: var(--muted);
  background: #f4f6f3;
}

.hero {
  min-height: 204px;
  border: 3px solid #9ad67a;
  background: linear-gradient(180deg, #ffffff 0%, #f6fbf6 100%);
  box-shadow: var(--shadow);
  padding: 16px;
}

.hero-title {
  text-align: center;
  font-size: 20px;
  font-weight: 800;
}

.hero-shop {
  margin-top: 16px;
  font-size: 24px;
  line-height: 1.08;
  font-weight: 800;
}

.stars {
  color: var(--gold);
  white-space: nowrap;
}

.hero-stars {
  margin-top: 8px;
  overflow: hidden;
  font-size: clamp(22px, 7vw, 34px);
}

.hero-kpis {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 14px;
}

.kpi {
  min-width: 0;
  border: 1px solid #c8dcc8;
  background: #fbfefb;
  padding: 9px 10px;
}

.kpi-label {
  color: var(--muted);
  font-size: 12px;
}

.kpi-value {
  margin-top: 3px;
  font-size: 19px;
  font-weight: 800;
}

.tabs {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 10px 0;
  background: rgba(245, 247, 243, 0.94);
  backdrop-filter: blur(8px);
}

.tabs a {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  padding: 8px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.section {
  margin-top: 12px;
  padding: 14px 0 4px;
}

.shop-hero + .section {
  margin-top: 6px;
  padding-top: 8px;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.section-head span {
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}

.hidden {
  display: none !important;
}

.rating-list,
.chart-list,
.user-activity-list {
  display: grid;
  gap: 9px;
}

.rating-row,
.chart-row,
.user-activity-row {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 4px 14px rgba(32, 44, 30, 0.05);
  padding: 11px;
}

button.rating-row,
button.chart-row {
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

button.rating-row:active,
button.chart-row:active {
  transform: translateY(1px);
}

.rating-main,
.chart-main,
.user-activity-main {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
}

.user-activity-main {
  grid-template-columns: 1fr auto;
}

.user-activity-row .rating-details {
  margin-top: 2px;
}

.rank {
  position: relative;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 2px solid var(--gold);
  border-radius: 50%;
  font-weight: 800;
  line-height: 1;
}

.rank-number {
  color: var(--text);
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
  padding-top: 1px;
}

.shop-cell {
  min-width: 0;
}

.shop-name {
  min-width: 0;
  font-weight: 800;
  line-height: 1.15;
}

.activity-strip {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 3px;
  height: 6px;
  margin-top: 6px;
  overflow: hidden;
}

.activity-segment {
  height: 100%;
  background: #edf1eb;
}

.activity-segment-filled {
  background: var(--green);
}

.metric-value {
  font-weight: 800;
  text-align: right;
  white-space: nowrap;
}

.rating-stars {
  margin-top: 8px;
  overflow: hidden;
  font-size: clamp(18px, 5.6vw, 30px);
}

.rating-details {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.bar-track {
  position: relative;
  height: 18px;
  margin-top: 9px;
  overflow: hidden;
  background: #edf1eb;
}

.bar-fill {
  height: 100%;
  min-width: 2px;
}

.average-marker {
  position: absolute;
  top: -3px;
  bottom: -3px;
  width: 2px;
  background: rgba(0, 0, 0, 0.4);
}

.chart-meta {
  margin-top: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.chart-stars {
  overflow: hidden;
  font-size: clamp(18px, 5.6vw, 30px);
  line-height: 1;
}

.error {
  border-color: #e3aaa5;
  background: #fff7f6;
}

.back-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--text);
  padding: 8px 8px;
  font: inherit;
  font-weight: 800;
  white-space: nowrap;
}

.shop-hero {
  border: 2px solid #9ad67a;
  background: #fff;
  box-shadow: var(--shadow);
  padding: 9px 15px;
}

.shop-hero-top {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: stretch;
  margin-top: 8px;
}

.shop-title {
  min-width: 0;
  display: flex;
  align-items: center;
  font-size: 25px;
  line-height: 1.08;
  font-weight: 800;
}

.shop-rank {
  min-width: 58px;
  border: 1px solid var(--line);
  background: #f6fbf6;
  padding: 7px 9px;
  text-align: center;
}

.shop-rank strong {
  display: block;
  font-size: 24px;
  line-height: 1;
}

.shop-rank span {
  color: var(--muted);
  font-size: 12px;
}

.shop-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 8px;
  margin-top: 8px;
}

.shop-rating-wide {
  margin-top: 8px;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 12px;
}

.shop-rating-value {
  min-width: 0;
  justify-self: stretch;
  text-align: center;
  font-size: clamp(24px, 7.2vw, 34px);
  line-height: 1;
  font-weight: 900;
  color: var(--text);
}

.shop-metric {
  border: 1px solid var(--line);
  background: #fbfefb;
  padding: 7px 10px;
}

.shop-hero .hero-stars {
  margin-top: 4px;
}

.goal-list {
  display: grid;
  gap: 9px;
}

.goal-card {
  border: 1px solid var(--line);
  background: #fff;
  padding: 12px;
}

.goal-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
}

.goal-title {
  font-weight: 800;
}

.goal-value {
  font-weight: 800;
  white-space: nowrap;
}

.goal-note {
  margin-top: 7px;
  color: var(--muted);
  font-size: 15px;
}

.goal-note .stars {
  display: inline-block;
  margin-bottom: 3px;
  font-size: 24px;
}

.goal-up {
  color: var(--green);
  font-size: 1.45em;
  font-weight: 900;
  white-space: nowrap;
}

.goal-card .bar-track {
  height: 16px;
}

.level-tick {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: rgba(31, 37, 32, 0.38);
  transform: translateX(-1px);
}

.workflow-notice {
  width: 100%;
  min-height: 62px;
  margin-bottom: 12px;
  border: 3px solid;
  background: #fff;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--text);
  font: inherit;
  font-size: 19px;
  font-weight: 900;
  text-align: left;
  box-shadow: var(--shadow);
}

.workflow-notice-supervisor {
  border-color: #df7a2e;
  background: #fff4eb;
}

.workflow-notice-supervisor-empty {
  border-color: var(--green);
  background: var(--bg);
}

.workflow-notice strong {
  flex: 0 0 auto;
  min-width: 40px;
  text-align: right;
}

/* Отдельный блок пунктов экрана магазина: заявки на списание и проверка остатков. Второй пункт без
   активной проверки остаётся на месте, но бледнеет и не нажимается. */
.shop-menu {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 8px 0 6px;
}

.shop-menu + .section {
  margin-top: 0;
  padding-top: 6px;
}

.shop-menu-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  min-height: 66px;
  padding: 9px 11px;
  border: 2px solid #9ad67a;
  border-radius: 16px;
  background: #fff;
  color: var(--text);
  font: inherit;
  text-align: left;
  text-decoration: none;
}

.shop-menu-icon {
  width: 38px;
  height: 38px;
  object-fit: contain;
}

.shop-menu-label {
  min-width: 0;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.1;
}

.shop-menu-tail {
  display: flex;
  align-items: center;
  gap: 7px;
}

.shop-menu-chevron {
  color: var(--muted);
  font-size: 24px;
  line-height: 1;
}

/* Бейдж нотификации стоит рядом со стрелкой и не выходит за обводку пункта. Цвета пунктов меню
   переставлены: списания — оранжевые, проверка остатков — красные. */
.shop-menu-badge {
  flex: 0 0 auto;
  min-width: 22px;
  height: 22px;
  padding: 0 5px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: #fff;
  font-size: 13px;
  font-weight: 900;
}

.shop-menu-badge-writeoff {
  background: #df7a2e;
}

.shop-menu-badge-check {
  background: var(--red);
}

/* Активные состояния: оранжевая рамка и кремовый фон у заявок, красная рамка и розовый фон у
   проверки остатков с заданием. */
.shop-menu-item-alert {
  border-color: #df7a2e;
  background: #fdf4e7;
}

.shop-menu-item-attention {
  border-color: var(--red);
  background: #fdf1f0;
}

.shop-menu-item-muted {
  border-color: #e8ece6;
  background: #fafbf9;
  color: #b4bcb2;
}

.shop-menu-item-muted .shop-menu-icon {
  opacity: 0.45;
}

.shop-menu-item-muted .shop-menu-chevron {
  color: #ccd3ca;
}

.workflow-page-head {
  border: 2px solid #9ad67a;
  background: #fff;
  box-shadow: var(--shadow);
  padding: 15px;
  text-align: center;
}

.workflow-page-head h1 {
  margin: 9px 0 6px;
  font-size: 26px;
  line-height: 1.08;
}

.stock-check-page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  text-align: left;
}

.stock-check-page-head h1 {
  margin: 0;
  font-size: 22px;
}

.stock-check-title p {
  margin: 5px 0 0;
  font-size: 13px;
}

.stock-check-shop-name {
  max-width: 46%;
  text-align: right;
  font-size: 17px;
  line-height: 1.15;
}

.stock-approval-page-head {
  text-align: left;
}

.stock-approval-page-head h1 {
  margin: 0;
}

.workflow-page-head p {
  color: var(--muted);
}

.workflow-submitted {
  min-height: 320px;
  border: 3px solid var(--green);
  background: #f4fff2;
  display: grid;
  place-content: center;
  gap: 10px;
  padding: 24px;
  text-align: center;
  box-shadow: var(--shadow);
}

.workflow-submitted-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--green);
  color: #fff;
  font-size: 42px;
  font-weight: 900;
}

.workflow-submitted h1 {
  margin: 8px 0 0;
  font-size: 28px;
}

.workflow-submitted p {
  color: var(--muted);
  font-size: 17px;
}

.stock-item-list,
.approval-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.stock-check-table {
  gap: 0;
  border: 2px solid var(--line);
  background: #fff;
  /* Leave room for the confirmation controls below the table. */
  max-height: calc(100dvh - 380px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.stock-check-scroll-hint {
  min-height: 26px;
  margin: 10px 0 -2px;
  color: #4d7044;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}

.stock-check-scroll-hint.is-hidden {
  visibility: hidden;
}

.stock-item-table-head,
.stock-check-table .stock-item-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 86px 116px;
  gap: 6px;
  align-items: center;
}

.stock-item-table-head {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f3f5f1;
  border-bottom: 2px solid var(--line);
  padding: 9px 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  line-height: 1.1;
}

.stock-item-table-head span:nth-child(2),
.stock-item-table-head span:nth-child(3) {
  text-align: center;
}

.stock-check-table .stock-item-card {
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 10px;
  box-shadow: none;
}

.stock-check-table .stock-item-card:last-child {
  border-bottom: 0;
}

.stock-check-table .stock-item-name {
  font-size: 14px;
}

.stock-check-table .stock-item-meta {
  display: block;
  margin: 0;
  text-align: center;
}

.stock-check-table .stock-item-meta strong {
  display: block;
  font-size: 18px;
}

.stock-check-table .stock-item-meta span {
  font-size: 11px;
}

.stock-check-table .stock-toggle {
  min-height: 54px;
  margin: 0;
  border-width: 2px;
  padding: 4px;
  gap: 7px;
  font-size: 14px;
}

.stock-check-table .stock-toggle-track {
  width: 76px;
  height: 36px;
}

.stock-check-table .stock-toggle-thumb {
  top: 3px;
  left: 3px;
  width: 30px;
  height: 30px;
}

.stock-check-table .stock-toggle-yes .stock-toggle-thumb {
  transform: translateX(40px);
}

@media (min-width: 430px) {
  .stock-item-table-head,
  .stock-check-table .stock-item-card {
    grid-template-columns: minmax(0, 1fr) 104px 140px;
  }
}

.stock-item-card {
  min-width: 0;
  border: 2px solid var(--line);
  background: #fff;
  padding: 13px;
  box-shadow: 0 4px 14px rgba(32, 44, 30, 0.05);
}

.stock-item-name {
  font-size: 17px;
  line-height: 1.22;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.stock-item-meta {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-top: 10px;
}

.stock-item-meta strong {
  font-size: 25px;
}

.stock-item-meta span {
  color: var(--muted);
  font-weight: 700;
}

.stock-toggle {
  width: 100%;
  min-height: 52px;
  margin-top: 12px;
  border: 3px solid;
  background: #fff;
  padding: 7px 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--text);
  font: inherit;
  font-size: 18px;
}

.stock-toggle-yes {
  border-color: var(--green);
  background: #f4fff2;
}

.stock-toggle-no {
  border-color: var(--red);
  background: #fff3f2;
}

.stock-toggle-track {
  position: relative;
  width: 58px;
  height: 30px;
  border-radius: 999px;
  background: var(--red);
  transition: background 0.15s ease;
}

.stock-toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.25);
  transition: transform 0.15s ease;
}

.stock-toggle-yes .stock-toggle-track {
  background: var(--green);
}

.stock-toggle-yes .stock-toggle-thumb {
  transform: translateX(28px);
}

.stock-toggle:disabled {
  opacity: 0.7;
}

.workflow-primary-button {
  position: sticky;
  bottom: 12px;
  z-index: 4;
  width: 100%;
  min-height: 56px;
  margin-top: 14px;
  border: 0;
  background: #287d20;
  color: #fff;
  padding: 12px 16px;
  font: inherit;
  font-size: 19px;
  font-weight: 900;
  box-shadow: 0 8px 20px rgba(40, 125, 32, 0.24);
}

.workflow-primary-button:disabled {
  background: #aeb5ad;
  box-shadow: none;
}

#stockCheckPage {
  padding-bottom: 28px;
}

.stock-check-finish-action {
  margin-top: 12px;
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.stock-check-finish-action .workflow-primary-button {
  position: static;
  flex: 1 1 auto;
  width: auto;
  margin: 0;
}

.stock-check-confirm {
  flex: 0 0 56px;
}

.workflow-hint {
  margin-top: 8px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}

.workflow-error,
.workflow-success,
.saby-document-link {
  display: block;
  margin-top: 12px;
  border: 2px solid;
  background: #fff;
  padding: 12px;
  line-height: 1.3;
  font-weight: 800;
}

.workflow-error {
  border-color: var(--red);
  color: #a52f28;
  background: #fff3f2;
}

.workflow-success {
  border-color: var(--green);
  background: #f4fff2;
}

.saby-document-link {
  border-color: #4387d0;
  color: #165fae;
  background: #f1f7ff;
  text-align: center;
  text-decoration: none;
}

.approval-document {
  border: 2px solid var(--line);
  background: #fff;
  box-shadow: var(--shadow);
}

.approval-document summary {
  min-height: 64px;
  padding: 12px 38px 12px 13px;
  display: grid;
  gap: 4px;
  position: relative;
  cursor: pointer;
  list-style: none;
}

.approval-document summary::-webkit-details-marker {
  display: none;
}

.approval-document summary::after {
  content: "⌄";
  position: absolute;
  right: 14px;
  top: 19px;
  font-size: 24px;
  font-weight: 900;
}

.approval-document[open] summary::after {
  transform: rotate(180deg);
}

.approval-document summary span {
  color: var(--muted);
  font-size: 13px;
}

.approval-document summary strong {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
}

.approval-status-icon {
  width: 25px;
  height: 25px;
  flex: 0 0 auto;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  color: #fff;
  font-size: 17px;
  font-weight: 900;
  line-height: 1;
}

.approval-status-pending {
  background: var(--red);
}

.approval-status-approved {
  background: var(--green);
}

.approval-document-body {
  border-top: 1px solid var(--line);
  padding: 10px;
}

.approval-item-table {
  border: 1px solid var(--line);
}

.approval-item-table-head,
.approval-item-table .stock-item-card.compact {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 86px 116px;
  gap: 6px;
  align-items: center;
}

.approval-item-table-head {
  border-bottom: 1px solid var(--line);
  background: #f3f5f1;
  padding: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.approval-item-table-head span:nth-child(2),
.approval-item-table-head span:nth-child(3) {
  text-align: center;
}

.approval-item-table .stock-item-card.compact {
  border: 0;
  border-bottom: 1px solid var(--line);
  margin: 0;
  padding: 8px;
}

.approval-item-table .stock-item-card.compact:last-child {
  border-bottom: 0;
}

.approval-item-table .stock-item-name {
  font-size: 13px;
}

.approval-item-table .stock-item-meta {
  display: block;
  margin: 0;
  text-align: center;
}

.approval-item-table .stock-item-meta strong {
  display: block;
  font-size: 17px;
}

.approval-item-table .stock-item-meta span {
  font-size: 11px;
}

.approval-item-table .stock-toggle {
  min-height: 46px;
  margin: 0;
  padding: 4px;
  gap: 5px;
  font-size: 13px;
}

.approval-action {
  display: flex;
  align-items: stretch;
  gap: 8px;
  margin-top: 12px;
}

.approval-action .workflow-primary-button {
  position: static;
  flex: 1 1 auto;
  width: auto;
  margin: 0;
}

.approval-confirm {
  width: 56px;
  min-width: 56px;
  border: 2px solid var(--line);
  background: #fff;
  padding: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
}

.approval-confirm input {
  width: 30px;
  height: 30px;
  margin: 0;
  accent-color: #287d20;
}

.approval-confirm:has(input:checked) {
  border-color: var(--green);
  background: #f4fff2;
}

.stock-item-card.compact {
  box-shadow: none;
  margin-bottom: 8px;
}

@media (min-width: 680px) {
  .app-shell {
    padding-top: 22px;
  }

  .hero-kpis,
  .shop-summary {
    grid-template-columns: repeat(4, 1fr);
  }

  .stock-item-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 110px 190px;
    gap: 14px;
    align-items: center;
  }

  .stock-item-table-head,
  .stock-check-table .stock-item-card {
    grid-template-columns: minmax(0, 1fr) 130px 180px;
  }

  .stock-item-meta,
  .stock-toggle {
    margin-top: 0;
  }
}
/* Device pairing shares the dashboard's mobile layout. */
.access-panel { max-width: 520px; margin: 8vh auto; padding: 24px; }
.access-panel .brand-logo { width: 100%; max-width: none; height: auto; }
.access-panel #accessMessage { white-space: pre-line; }
.access-panel h1 { font-size: 26px; }

/* Production portraits use the supplied assets, independent of the shop sprite. */
.employee-role-icon.role-production_manager { background-image: url("./production-manager.png"); }
.employee-role-icon.role-cook-female { background-image: url("./cook-female.png"); }
.employee-role-icon.role-cook-male { background-image: url("./cook-male.png"); }
.employee-role-icon:is(.role-production_manager, .role-cook-female, .role-cook-male) {
  background-size: 190% 145%; background-position: 50% 50%; background-repeat: no-repeat;
}
/* The manager artwork occupies more of its source canvas than the cooks. */
.employee-role-icon.role-production_manager,
.workshop-portrait.workshop-portrait-manager { background-size: 162% 134%; }
.workshop-attendance .attendance-recent { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2px; }
.workshop-attendance .attendance-recent .attendance-employee-card { padding: 5px; column-gap: 5px; row-gap: 2px; grid-template-columns: 33px minmax(0, 1fr); grid-template-rows: auto auto; }
.workshop-attendance .attendance-recent .attendance-person-role { font-size: 10px; }
.workshop-attendance .attendance-person-role { white-space: normal; overflow: visible; line-height: 1.15; }
.workshop-attendance .attendance-person-role > span { display: block; white-space: nowrap; }
.workshop-attendance .attendance-identity .attendance-employee-card { grid-template-rows: auto auto; }
