/* Dashboard layout. Shared tokens and components are in base.css. */
.overview {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 3fr);
  grid-template-rows: auto 380px;
  gap: 32px 48px;
}
.welcome { grid-column: 1; grid-row: 1; align-self: end; }
.demand { grid-column: 1; grid-row: 2; }
.by-dish { grid-column: 2; grid-row: 1 / 3; }

.graph {
  display: flex;
  flex-direction: column;
  min-width: 0; /* lets the chart canvas shrink with the grid column on narrow screens */
  min-height: 0;
}
.graph .chart { position: relative; flex: 1; min-height: 0; margin-top: 16px; }

/* The weekly summary: a few sentences with Play buttons in English and Chinese. */
.week-summary { margin-top: 32px; }
.week-summary-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }
.week-summary-buttons { display: flex; gap: 8px; }
.week-summary-buttons[hidden] { display: none; }
.week-summary-text { margin-top: 12px; max-width: 70ch; font-size: var(--text-lg); line-height: 1.5; }
.week-summary .note { margin-top: 8px; color: var(--muted); font-size: var(--text-sm); }

.money { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 3fr); gap: 32px 48px; margin-top: 32px; }
.money .note { color: var(--muted); font-size: var(--text-sm); }
.money-warning { margin-top: 12px; color: var(--warning); font-size: var(--text-sm); }
.money-warning a { color: var(--teal-strong); }
.top-dishes { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; font-size: var(--text-sm); }
.top-dishes li { display: flex; justify-content: space-between; gap: 16px; padding-bottom: 8px; border-bottom: 1px solid var(--divider); }
.top-dishes li span:last-child { color: var(--muted); text-align: right; }

/* Revenue by day: 53 weeks of columns, Monday to Sunday down each column, like GitHub. */
.heatmap-card { position: relative; margin-top: 32px; }
.heatmap-heading { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; }
.heatmap-heading .note { color: var(--muted); font-size: var(--text-sm); }
.heatmap-scroll { overflow-x: auto; margin-top: 16px; padding-bottom: 4px; }
/* Squares grow to fill the card, down to 12px; below that (phones) the grid scrolls sideways. */
.heatmap {
  display: grid;
  grid-template-columns: 32px repeat(var(--weeks, 53), minmax(12px, 1fr));
  grid-template-rows: 16px;
  grid-auto-rows: auto;
  gap: 3px;
  min-width: calc(32px + var(--weeks, 53) * 15px);
  font-size: var(--text-xs);
  color: var(--muted);
}
.heatmap-month { grid-row: 1; white-space: nowrap; }
/* Zero height, so the labels never make their row taller than a square (which would leave
   gaps around the Mon, Wed and Fri rows when the squares are small); the text still shows. */
.heatmap-weekday { grid-column: 1; align-self: center; height: 0; line-height: 0; overflow: visible; }
.heat-cell { aspect-ratio: 1; border-radius: 3px; background: var(--neutral-soft); }
.heat-cell.level-1 { background: var(--heat-1); }
.heat-cell.level-2 { background: var(--heat-2); }
.heat-cell.level-3 { background: var(--heat-3); }
.heat-cell.level-4 { background: var(--heat-4); }
.heat-cell.is-closed { background: var(--surface); box-shadow: inset 0 0 0 1px var(--border); }
.heatmap .heat-cell { transition: transform var(--duration-fast) var(--ease-out); }
.heatmap .heat-cell:hover { outline: 2px solid var(--ink); outline-offset: 1px; transform: scale(1.25); }
.heatmap-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: 12px; color: var(--muted); font-size: var(--text-xs); }
.heatmap-legend .heat-cell { width: 12px; }
.heatmap-legend .legend-gap { margin-left: 12px; }
.heatmap-table { margin-top: 12px; font-size: var(--text-sm); }
.heatmap-table summary { width: fit-content; color: var(--teal-strong); cursor: pointer; }
.heatmap-table table { width: 100%; max-width: 480px; margin-top: 8px; border-collapse: collapse; }
.heatmap-table th, .heatmap-table td { padding: 6px 4px; border-bottom: 1px solid var(--divider); text-align: left; }
.heatmap-table th { color: var(--muted); font-size: var(--text-xs); font-weight: 400; letter-spacing: 0.08em; text-transform: uppercase; }
.heatmap-tooltip {
  position: absolute;
  z-index: 2;
  padding: 6px 10px;
  border-radius: var(--radius-md);
  background: var(--ink);
  color: var(--surface);
  font-size: var(--text-xs);
  white-space: nowrap;
  pointer-events: none;
}
.heatmap-tooltip strong { font-weight: 600; }

/* Actions needed: one row per card from GET /api/actions. */
.action-list { display: grid; margin: 20px 0 0; padding: 0; list-style: none; border-top: 1px solid var(--divider); }
.action-item {
  transition: background-color var(--duration-fast);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 4px;
  border-bottom: 1px solid var(--divider);
}
.action-item:hover { background-color: rgb(235 246 245 / 55%); }
.action-text { flex: 1; min-width: 0; }
.action-text strong { display: block; font-weight: 400; }
.action-text span { display: block; margin-top: 4px; color: var(--muted); font-size: var(--text-sm); }
.action-buttons { display: flex; flex: none; align-items: center; gap: 8px; }

.record-dialog {
  width: min(440px, calc(100% - 32px));
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow-float);
  color: var(--ink);
}
.record-dialog::backdrop { background: rgb(0 0 0 / 0.3); }
.record-dialog h2 { font-size: var(--text-lg); }
.record-dialog .lede { margin-top: 4px; color: var(--muted); font-size: var(--text-sm); }
.record-date { margin-top: 16px; }
.record-list { display: grid; gap: 12px; max-height: 50vh; overflow: auto; margin-top: 16px; }
/* Each dish: its name, then portions sold, sold-out time and leftovers side by side. */
.record-row { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 5fr) minmax(0, 3fr); gap: 8px; padding-bottom: 12px; border-bottom: 1px solid var(--divider); font-size: var(--text-sm); }
.record-row legend { float: left; grid-column: 1 / -1; width: 100%; margin-bottom: 4px; font-weight: 500; }
.record-field { display: grid; gap: 4px; color: var(--muted); font-size: var(--text-xs); }
.actions .section-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.record-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

/* The assistant's large input box: an assistant surface, so it uses the UI font (see DESIGN.md). */
.chat-box {
  width: min(480px, 100%);
  margin: 48px auto 0;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--surface);
  font-family: var(--font-ui);
}
.chat-box { transition: border-color var(--duration-fast), box-shadow var(--duration-base) var(--ease-out); }
.chat-box:hover { box-shadow: 0 6px 20px rgb(66 86 100 / 8%); }
.chat-box:focus-within { border-color: var(--teal); box-shadow: 0 0 0 3px var(--teal-tint), 0 10px 28px rgb(15 125 119 / 12%); }
.chat-box textarea {
  display: block;
  width: 100%;
  height: 34px;
  padding: 0;
  border: 0;
  outline: none;
  resize: none;
  background: transparent;
  font: var(--text-md)/22px var(--font-ui);
}
.chat-box textarea::placeholder { color: var(--muted); opacity: 1; }
.chat-toolbar { display: flex; gap: 8px; align-items: center; margin-top: 12px; }
.icon-button {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}
.icon-button { transition: background-color var(--duration-fast), transform var(--duration-fast) var(--ease-out); }
.icon-button:hover:not(:disabled) { background: var(--neutral-soft); }
.icon-button:active:not(:disabled) { transform: scale(0.92); }
.send:not(:disabled) { animation: send-ready 300ms var(--ease-spring); }
@keyframes send-ready { from { transform: scale(0.8); } }
.icon-button:disabled { cursor: not-allowed; }
.icon-button img { display: block; }
.attachment { position: relative; overflow: hidden; }
.attachment input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.attachment:focus-within { outline: 2px solid var(--teal); outline-offset: 2px; }
.send { margin-left: auto; background: var(--teal-strong); }
.send:hover:not(:disabled) { background: var(--teal-hover); }
.send img { filter: brightness(0) invert(1); }
.send:disabled { background: var(--neutral-soft); }
.send:disabled img { filter: none; opacity: 0.5; }

@media (pointer: coarse) {
  .icon-button { width: 44px; height: 44px; }
  .chat-box textarea { height: 44px; }
  .heatmap-table summary { display: flex; align-items: center; min-height: 44px; }
}

@media (max-width: 800px) {
  .overview { grid-template-columns: 1fr; grid-template-rows: auto 300px 300px; gap: 24px; }
  .welcome, .demand, .by-dish { grid-column: 1; }
  .demand { grid-row: 2; }
  .by-dish { grid-row: 3; }
  .money { grid-template-columns: 1fr; gap: 24px; }
  .week-summary { margin-top: 24px; }
  .week-summary-text { font-size: var(--text-md); }
  .action-item { flex-wrap: wrap; }
  .action-buttons { width: 100%; justify-content: flex-end; }
}
