:root {
  --bg: #f4f7fb;
  --panel: #ffffff;
  --ink: #172033;
  --muted: #667085;
  --line: #d8e0eb;
  --brand: #176b5b;
  --brand-dark: #0f2a3f;
  --accent: #2d5f8a;
  --ok: #067647;
  --warn: #b54708;
  --danger: #b42318;
  --shadow: 0 14px 34px rgba(23, 32, 51, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input, select {
  font: inherit;
}

button, select {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.48fr);
  background: #fff;
}

.login-hero {
  min-height: 460px;
  padding: 52px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  color: white;
  background:
    linear-gradient(rgba(15, 42, 63, 0.74), rgba(15, 42, 63, 0.74)),
    url("https://images.unsplash.com/photo-1551288049-bebda4e38f71?auto=format&fit=crop&w=1800&q=80");
  background-size: cover;
  background-position: center;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 780;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: white;
  background: linear-gradient(135deg, #25a07f, #2d5f8a);
}

.login-hero h1 {
  max-width: 720px;
  margin: 26px 0 12px;
  font-size: 44px;
  line-height: 1.08;
  letter-spacing: 0;
}

.login-hero p {
  max-width: 620px;
  margin: 0;
  color: #dde7f1;
  line-height: 1.7;
}

.login-panel {
  display: grid;
  align-content: center;
  gap: 16px;
  padding: 44px;
}

.login-panel h2 {
  margin: 0 0 6px;
  font-size: 28px;
}

.login-panel p, .topbar p {
  margin: 0;
  color: var(--muted);
}

label {
  display: grid;
  gap: 7px;
}

label span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 680;
}

input, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  min-height: 44px;
  background: white;
  color: var(--ink);
}

button {
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 42px;
  padding: 10px 12px;
  background: white;
  color: var(--ink);
  font-weight: 700;
}

button.primary, .primary {
  color: white;
  background: var(--brand);
  border-color: var(--brand);
}

button:disabled {
  cursor: wait;
  opacity: 0.62;
}

.hint, .message, .error {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  color: var(--muted);
  background: #f7f9fc;
  line-height: 1.6;
  font-size: 13px;
}

.error {
  color: var(--danger);
  background: #fff0ee;
  border-color: #ffd1cc;
}

.update-status {
  margin: -8px 0 16px;
  border: 1px solid #b7e6c6;
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--ok);
  background: #ecfdf3;
  font-size: 13px;
}

.update-status.error {
  color: var(--danger);
  background: #fff0ee;
  border-color: #ffd1cc;
}

.message {
  color: var(--ok);
  background: #ecfdf3;
  border-color: #b7e6c6;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
}

.sidebar {
  padding: 22px;
  color: white;
  background: var(--brand-dark);
  display: flex;
  flex-direction: column;
  gap: 22px;
}

nav {
  display: grid;
  gap: 8px;
}

nav button {
  text-align: left;
  color: #d7e1ec;
  background: transparent;
  border: 0;
}

nav button.active, nav button:hover {
  color: white;
  background: rgba(255, 255, 255, 0.12);
}

.session-card {
  margin-top: auto;
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  color: #d7e1ec;
  font-size: 13px;
}

.session-card button {
  color: white;
  background: transparent;
  border-color: rgba(255, 255, 255, 0.28);
}

main {
  min-width: 0;
  padding: 26px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 20px;
}

.topbar h1 {
  margin: 0 0 6px;
  font-size: 26px;
  letter-spacing: 0;
}

.controls {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.controls select,
.date-filter > button,
#refreshHetaoButton,
#updateDataButton {
  height: 48px;
  min-height: 48px;
  border-radius: 8px;
  padding: 0 16px;
  font-size: 15px;
  line-height: 1;
  white-space: nowrap;
}

.controls select {
  width: 220px;
  max-width: 100%;
  appearance: auto;
}

.date-filter {
  position: relative;
}

.date-filter > button {
  min-width: 190px;
}

#updateDataButton {
  min-width: 132px;
}

.hetao-date-filter {
  display: grid;
  grid-template-columns: 42px 152px 42px;
  gap: 6px;
  align-items: center;
}

.hetao-date-filter button,
.hetao-date-filter input,
#refreshHetaoButton {
  height: 48px;
  min-height: 48px;
}

.hetao-date-filter button {
  padding: 0;
  font-size: 22px;
}

.hetao-date-filter input {
  padding: 0 10px;
}

.calendar-popover {
  position: absolute;
  z-index: 10;
  top: calc(100% + 8px);
  right: 0;
  width: 328px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: var(--shadow);
  padding: 12px;
}

.calendar-head,
.calendar-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.calendar-head button {
  width: 34px;
  min-height: 34px;
  padding: 0;
}

.calendar-weekdays,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-top: 10px;
}

.calendar-weekdays span {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}

.calendar-grid button {
  min-height: 34px;
  padding: 0;
  border-radius: 8px;
  border-color: transparent;
}

.calendar-grid button.in-range {
  background: #dcefed;
  color: var(--brand);
}

.calendar-grid button.selected {
  background: var(--brand);
  color: white;
}

.calendar-grid button:disabled {
  cursor: not-allowed;
  color: #b8c0cc;
  background: #f5f7fa;
}

.calendar-actions {
  margin-top: 12px;
}

.calendar-actions span {
  color: var(--muted);
  font-size: 13px;
}

.panel {
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.panel-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-title h2 {
  margin: 0;
  font-size: 17px;
}

.panel-title span {
  display: inline-flex;
  border-radius: 999px;
  background: #edf3f9;
  color: var(--accent);
  padding: 4px 8px;
  font-size: 12px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.kpi-grid.hetao-period-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.meal-period-card {
  padding: 20px;
}

.meal-period-card.lunch {
  border-top: 4px solid #9ccc39;
}

.meal-period-card.dinner {
  border-top: 4px solid #2d5f8a;
}

.meal-period-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.meal-period-card-head > div {
  display: grid;
  grid-template-columns: auto auto;
  align-items: baseline;
  gap: 2px 9px;
}

.meal-period-card-head > div > span {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 13px;
  font-weight: 720;
}

.meal-period-card-head > div > strong {
  font-size: 32px;
  line-height: 1.15;
}

.meal-period-card-head > div > small {
  color: var(--muted);
  font-size: 12px;
}

.meal-period-badge {
  display: inline-flex;
  min-width: 46px;
  justify-content: center;
  border-radius: 999px;
  padding: 6px 10px;
  color: #587d00;
  background: #eff7d9;
  font-size: 12px;
  font-weight: 780;
}

.meal-period-card.dinner .meal-period-badge {
  color: #2d5f8a;
  background: #edf3f9;
}

.meal-period-status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(88px, 1fr));
  gap: 8px;
  margin-top: 16px;
}

.period-status {
  display: grid;
  gap: 3px;
  border-radius: 8px;
  padding: 10px 12px;
  background: #f5f7fa;
}

.period-status small {
  color: var(--muted);
  font-size: 11px;
}

.period-status strong {
  font-size: 20px;
}

.period-status.unaccepted {
  color: #9a430b;
  background: #fff0df;
}

.period-status.accepted {
  color: #587d00;
  background: #eff7d9;
}

.period-status.partial {
  color: #7a4e00;
  background: #fff6cc;
}

.period-status.delivered {
  color: #067647;
  background: #e8f7ed;
}

.kpi-label {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 10px;
}

.kpi-value {
  font-size: 28px;
  line-height: 1.15;
  font-weight: 790;
  letter-spacing: 0;
}

.delta {
  display: inline-flex;
  margin-top: 9px;
  border-radius: 999px;
  padding: 4px 8px;
  background: #ecfdf3;
  color: var(--ok);
  font-size: 12px;
}

.today-panel {
  margin-top: 16px;
  display: grid;
  gap: 14px;
}

.today-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.today-head h2 {
  margin: 0 0 6px;
  font-size: 17px;
}

.today-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.today-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.today-actions span {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.today-actions button {
  height: 42px;
  min-height: 42px;
  white-space: nowrap;
}

.today-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.today-kpi {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfd;
}

.today-kpi span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
}

.today-kpi strong {
  color: var(--ink);
  font-size: 22px;
  line-height: 1.15;
}

.today-table td:nth-child(3),
.today-table td:nth-child(4),
.today-table td:nth-child(5) {
  white-space: nowrap;
}

.attendance-panel {
  margin-top: 16px;
  display: grid;
  gap: 14px;
}

.attendance-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.attendance-head h2 {
  margin: 0 0 6px;
  font-size: 17px;
}

.attendance-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.attendance-actions {
  display: grid;
  gap: 10px;
  justify-items: end;
}

.attendance-actions span {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.attendance-refresh-row,
.attendance-export-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.attendance-actions button,
#refreshAttendanceCouponButton {
  height: 42px;
  min-height: 42px;
  padding: 0 14px;
  white-space: nowrap;
}

#refreshAttendanceCouponButton {
  min-width: 132px;
}

.attendance-export-row button {
  min-width: 126px;
}

.attendance-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.attendance-kpi {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfd;
}

.attendance-kpi span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
}

.attendance-kpi strong {
  color: var(--ink);
  font-size: 22px;
  line-height: 1.15;
}

.attendance-table td:nth-child(3),
.attendance-table td:nth-child(4),
.attendance-table td:nth-child(5),
.attendance-table td:nth-child(6) {
  white-space: nowrap;
}

.snapshot-block {
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.panel-title.compact {
  margin-bottom: 10px;
}

.snapshot-list {
  display: grid;
  gap: 8px;
}

.snapshot-line {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) 140px 100px;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}

.snapshot-line span {
  text-align: right;
  color: var(--muted);
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 12px;
  color: var(--muted);
  background: #fbfcfd;
}

.content-grid {
  margin-top: 16px;
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.8fr);
  gap: 16px;
}

.trend-panel,
.insight-panel {
  margin-top: 16px;
}

.bar-chart {
  height: 280px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(28px, 1fr));
  align-items: end;
  gap: 10px;
  border-left: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 12px 8px 0 12px;
}

.bar-chart.combo-chart-shell {
  display: block;
}

.bar-chart.trend-table-shell {
  height: auto;
  display: block;
  border: 0;
  padding: 0;
}

.bar-wrap {
  height: 100%;
  display: grid;
  align-items: end;
  gap: 8px;
}

.bar {
  min-height: 10px;
  border-radius: 6px 6px 0 0;
  background: linear-gradient(180deg, #2c927a, #2d5f8a);
}

.bar-label {
  min-height: 24px;
  text-align: center;
  font-size: 11px;
  color: var(--muted);
}

.combo-shell {
  height: 100%;
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) 78px;
  gap: 10px;
}

.axis {
  height: calc(100% - 34px);
  display: grid;
  grid-template-rows: auto 1fr 1fr 1fr;
  color: var(--muted);
  font-size: 12px;
}

.axis strong {
  color: var(--ink);
  font-size: 12px;
  font-weight: 760;
  white-space: nowrap;
}

.axis span {
  align-self: start;
}

.axis-left span {
  text-align: right;
}

.axis-right span {
  text-align: left;
}

.combo-chart {
  position: relative;
  height: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(28px, 1fr));
  gap: 7px;
}

.combo-chart svg {
  position: absolute;
  inset: 0 0 24px 0;
  width: 100%;
  height: calc(100% - 24px);
  pointer-events: none;
}

.grid-line {
  stroke: var(--line);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.grid-line.strong {
  stroke-dasharray: 4 4;
}

.combo-day {
  min-width: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) 24px;
  align-items: end;
  text-align: center;
}

.combo-plot {
  position: relative;
  height: 100%;
}

.rate-bar {
  position: absolute;
  left: 28%;
  right: 28%;
  border-radius: 5px 5px 0 0;
  background: #2c927a;
}

.rate-bar.negative {
  border-radius: 0 0 5px 5px;
  background: #b54708;
}

.combo-day span {
  color: var(--muted);
  font-size: 11px;
}

.chart-legend {
  display: flex;
  gap: 16px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}

.chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

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

.trend-table-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fbfcfd;
}

.trend-table-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.trend-table-head strong {
  color: var(--ink);
  font-size: 14px;
}

.trend-table-head span {
  color: var(--muted);
  font-size: 12px;
}

.trend-table {
  min-width: 520px;
  background: var(--panel);
}

.trend-table th,
.trend-table td {
  white-space: nowrap;
  text-align: right;
}

.trend-table th:first-child,
.trend-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  text-align: left;
  background: var(--panel);
}

.trend-table th.metric-strong,
.trend-table td.metric-strong {
  color: var(--ink);
  font-weight: 760;
  background: #f5f7fa;
}

.legend-bar,
.legend-line {
  width: 18px;
  height: 8px;
  display: inline-block;
  background: #2c927a;
  border-radius: 4px;
}

.legend-line {
  height: 2px;
  background: var(--accent);
}

.insights {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}

.insights li {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.insights strong {
  font-size: 14px;
}

.insights span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.table-panel {
  margin-top: 16px;
}

.hetao-detail-panel {
  overflow: hidden;
  padding: 0;
}

.hetao-detail-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px;
  cursor: pointer;
  list-style: none;
  transition: background 160ms ease;
}

.hetao-detail-summary::-webkit-details-marker {
  display: none;
}

.hetao-detail-summary::marker {
  content: "";
}

.hetao-detail-summary:hover {
  background: #f8fafc;
}

.hetao-detail-summary:focus-visible {
  outline: 3px solid rgba(45, 95, 138, 0.28);
  outline-offset: -3px;
}

.hetao-detail-identity {
  display: grid;
  gap: 5px;
}

.hetao-detail-identity h2 {
  margin: 0;
  font-size: 17px;
}

.hetao-detail-identity span {
  color: var(--muted);
  font-size: 12px;
}

.hetao-detail-toggle {
  display: grid;
  justify-items: end;
  gap: 4px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 720;
  white-space: nowrap;
}

.hetao-detail-toggle::after {
  content: "⌄";
  font-size: 22px;
  line-height: 12px;
  transition: transform 160ms ease;
}

.hetao-detail-panel[open] .toggle-closed {
  display: none;
}

.hetao-detail-panel[open] .toggle-open {
  display: inline;
}

.hetao-detail-panel[open] .hetao-detail-toggle::after {
  transform: rotate(180deg);
}

.hetao-detail-panel .table-scroll {
  border-top: 1px solid var(--line);
  padding: 0 18px 18px;
}

.table-scroll {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th, td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.overlap-diner {
  display: grid;
  gap: 2px;
  min-width: 140px;
}

.overlap-diner small,
.overlap-meal small {
  color: var(--muted);
}

.overlap-meal {
  display: grid;
  gap: 4px;
  min-width: 220px;
  line-height: 1.45;
}

.tree-row td {
  padding: 0;
}

.tree-row details {
  border-bottom: 1px solid var(--line);
}

.tree-row details:last-child {
  border-bottom: 0;
}

.tree-row summary {
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 10px;
  list-style: none;
}

.tree-row summary::-webkit-details-marker {
  display: none;
}

.tree-row summary::before {
  content: "›";
  color: var(--muted);
  font-weight: 900;
  transform: rotate(0deg);
}

.tree-row details[open] > summary::before {
  transform: rotate(90deg);
}

.tree-row summary strong {
  margin-right: auto;
}

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

.tree-level {
  margin: 0 0 8px 28px;
  border-left: 2px solid #edf3f9;
}

.merchant-list,
.overlap-day-list {
  display: grid;
  gap: 6px;
  padding: 0 10px 12px 16px;
}

.merchant-line {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 80px 90px 110px 110px;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}

.merchant-line span:not(:first-child) {
  color: var(--muted);
  text-align: right;
}

.overlap-day-line {
  display: grid;
  grid-template-columns: 110px minmax(220px, 1fr) minmax(220px, 1fr);
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}

.overlap-day-line span {
  display: grid;
  gap: 4px;
  line-height: 1.45;
}

.overlap-day-line small {
  color: var(--muted);
}

.status {
  display: inline-flex;
  border-radius: 999px;
  padding: 4px 8px;
  color: var(--ok);
  background: #ecfdf3;
  font-size: 12px;
}

.status.watch, .status.paused {
  color: var(--warn);
  background: #fff4e5;
}

.hetao-section {
  margin-top: 16px;
}

.hetao-overview {
  border-top: 4px solid #9ccc39;
}

.hetao-note {
  margin: -2px 0 16px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.hetao-groups,
.meal-plan-list,
.merchant-status-list {
  display: grid;
  gap: 12px;
}

.workplace-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fafc;
}

.meal-plan-head,
.merchant-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.workplace-head {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(510px, auto) 78px;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  color: #fff;
  background: linear-gradient(135deg, #203449, #176b5b);
  cursor: pointer;
  list-style: none;
  transition: filter 160ms ease;
}

.workplace-head::-webkit-details-marker {
  display: none;
}

.workplace-head::marker {
  content: "";
}

.workplace-head:hover {
  filter: brightness(1.06);
}

.workplace-head:focus-visible {
  outline: 3px solid rgba(156, 204, 57, 0.7);
  outline-offset: -3px;
}

.workplace-identity,
.meal-plan-head > div,
.merchant-status-row > div {
  display: grid;
  gap: 4px;
}

.workplace-identity > span,
.meal-plan-head > div > span {
  font-size: 11px;
  opacity: 0.74;
}

.workplace-identity strong {
  font-size: 16px;
  line-height: 1.35;
}

.workplace-status-summary {
  display: flex;
  align-items: stretch;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.workplace-period-summary {
  display: grid;
  min-width: 510px;
  gap: 6px;
}

.workplace-period-row {
  display: flex;
  align-items: center;
  gap: 6px;
  border-radius: 8px;
  padding: 5px 7px;
  background: rgba(255, 255, 255, 0.1);
}

.workplace-period-row > strong {
  min-width: 36px;
  font-size: 12px;
}

.workplace-period-row > span {
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
  min-width: 72px;
  gap: 4px;
  border-radius: 6px;
  padding: 5px 7px;
  color: #fff;
  background: rgba(255, 255, 255, 0.13);
  font-size: 14px;
  font-weight: 780;
  white-space: nowrap;
}

.workplace-period-row small {
  font-size: 9px;
  font-weight: 650;
  opacity: 0.82;
}

.workplace-period-row > span.unaccepted {
  color: #9a430b;
  background: #fff0df;
}

.workplace-period-row > span.accepted {
  color: #587d00;
  background: #eff7d9;
}

.workplace-period-row > span.partial {
  color: #7a4e00;
  background: #fff6cc;
}

.workplace-period-row > span.delivered {
  color: #067647;
  background: #e8f7ed;
}

.workplace-summary-item {
  display: grid;
  min-width: 68px;
  gap: 3px;
  border-radius: 8px;
  padding: 7px 10px;
  color: #fff;
  background: rgba(255, 255, 255, 0.13);
  text-align: center;
}

.workplace-summary-item small {
  font-size: 10px;
  opacity: 0.82;
}

.workplace-summary-item strong {
  font-size: 18px;
  line-height: 1.1;
}

.workplace-summary-item.unaccepted {
  color: #9a430b;
  background: #fff0df;
}

.workplace-summary-item.accepted {
  color: #587d00;
  background: #eff7d9;
}

.workplace-summary-item.partial {
  color: #7a4e00;
  background: #fff6cc;
}

.workplace-summary-item.delivered {
  color: #067647;
  background: #e8f7ed;
}

.workplace-toggle {
  display: grid;
  justify-items: end;
  gap: 4px;
  font-size: 11px;
  white-space: nowrap;
  opacity: 0.88;
}

.workplace-toggle::after {
  content: "⌄";
  font-size: 22px;
  line-height: 12px;
  transition: transform 160ms ease;
}

.toggle-open {
  display: none;
}

.workplace-card[open] .toggle-closed {
  display: none;
}

.workplace-card[open] .toggle-open {
  display: inline;
}

.workplace-card[open] .workplace-toggle::after {
  transform: rotate(180deg);
}

.meal-plan-list {
  padding: 12px;
}

.workplace-detail {
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.meal-plan-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.meal-plan-head {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.meal-plan-head time {
  color: var(--accent);
  font-size: 13px;
  font-weight: 750;
  white-space: nowrap;
}

.meal-period-chip {
  display: inline-flex;
  border-radius: 999px;
  margin-right: 4px;
  padding: 2px 7px;
  color: #587d00;
  background: #eff7d9;
  font-size: 10px;
  font-weight: 780;
  opacity: 1;
}

.meal-period-chip.dinner {
  color: #2d5f8a;
  background: #edf3f9;
}

.merchant-status-list {
  gap: 0;
  padding: 0 14px;
}

.merchant-status-row {
  min-height: 58px;
  padding: 10px 0;
  border-bottom: 1px solid #edf1f5;
}

.merchant-status-row:last-child {
  border-bottom: 0;
}

.merchant-status-row > div > span {
  color: var(--muted);
  font-size: 12px;
}

.delivery-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 760;
  white-space: nowrap;
}

.delivery-status.delivered {
  color: #067647;
  background: #e8f7ed;
}

.delivery-status.accepted {
  color: #587d00;
  background: #eff7d9;
}

.delivery-status.unaccepted {
  color: #c55a11;
  background: #fff0df;
}

.delivery-status.partial {
  color: #7a4e00;
  background: #fff6cc;
}

.delivery-status.unknown {
  color: var(--muted);
  background: #eef1f5;
}

.hetao-kpi.unaccepted {
  border-top: 4px solid #f59e0b;
}

.hetao-kpi.accepted {
  border-top: 4px solid #9ccc39;
}

.hetao-kpi.delivered {
  border-top: 4px solid #16a368;
}

.hetao-table td:nth-child(3),
.hetao-table td:nth-child(5),
.hetao-table td:nth-child(6),
.hetao-table td:nth-child(7) {
  white-space: nowrap;
}

.empty-cell {
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

.admin-grid {
  display: grid;
  grid-template-columns: 0.85fr 1.15fr;
  gap: 16px;
  align-items: start;
}

.form-panel {
  display: grid;
  gap: 12px;
}

@media (max-width: 980px) {
  .login-screen, .app-shell, .kpi-grid, .content-grid, .admin-grid {
    grid-template-columns: 1fr;
  }

  .login-hero {
    padding: 34px;
  }

  .login-hero h1 {
    font-size: 34px;
  }

  .topbar {
    flex-direction: column;
  }

  .controls {
    width: 100%;
    min-width: 0;
    justify-content: flex-start;
  }

  .today-head {
    flex-direction: column;
  }

  .attendance-head {
    flex-direction: column;
  }

  .hetao-date-filter {
    grid-template-columns: 40px minmax(150px, 1fr) 40px;
  }

  .workplace-head,
  .meal-plan-head {
    align-items: flex-start;
  }

  .workplace-head {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .workplace-status-summary {
    justify-content: flex-start;
  }

  .workplace-period-summary {
    width: 100%;
    min-width: 0;
  }

  .workplace-period-row {
    flex-wrap: wrap;
  }

  .workplace-summary-item {
    flex: 1 1 72px;
  }

  .workplace-toggle {
    justify-items: start;
  }

  .today-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .attendance-actions {
    width: 100%;
    justify-items: stretch;
  }

  .attendance-refresh-row,
  .attendance-export-row {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .attendance-export-row button {
    flex: 1 1 160px;
  }

  .today-kpis {
    grid-template-columns: 1fr;
  }

  .attendance-kpis {
    grid-template-columns: 1fr;
  }

  .snapshot-line {
    grid-template-columns: 1fr;
  }

  .snapshot-line span {
    text-align: left;
  }

  .controls select,
  .date-filter,
  .date-filter > button,
  #updateDataButton {
    flex: 1 1 180px;
  }

  .combo-shell {
    grid-template-columns: 54px minmax(420px, 1fr) 62px;
    overflow-x: auto;
  }

  .trend-table-grid {
    grid-template-columns: 1fr;
  }
}
