/* Restaurant table surfaces, shared by API and local registers. Occupancy is
   read from the surface; kitchen stages and requests retain semantic text. */
:is(.tables-workspace, .local-tables-panel) .table-toolbar {
  min-width: 0;
  flex-wrap: wrap;
  gap: var(--space-3);
}
:is(.tables-workspace, .local-tables-panel) .table-toolbar h1 { font-weight: var(--weight-medium); }
:is(.tables-workspace, .local-tables-panel) .area-tabs {
  min-width: 0;
  flex: 0 1 auto;
  max-width: 420px;
  gap: var(--space-2);
  overflow-x: auto;
  scrollbar-width: none;
}
:is(.tables-workspace, .local-tables-panel) .area-tabs button {
  flex: 0 0 auto;
  min-width: 72px;
  padding-inline: var(--space-4);
}
:is(.tables-workspace, .local-tables-panel) .table-toolbar .search-box {
  flex: 1 1 220px;
  width: auto;
  max-width: 340px;
  min-width: 0;
}
:is(.tables-workspace, .local-tables-panel) .table-status-filter { flex: 0 0 168px; }
:is(.tables-workspace, .local-tables-panel) .tables-grid { grid-auto-rows: 120px; }
:is(.tables-workspace, .local-tables-panel) .table-card {
  padding: var(--space-3) var(--space-4);
  gap: 6px;
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--color-surface) 65%, var(--color-bg));
  box-shadow: none;
}
:is(.tables-workspace, .local-tables-panel) .table-card.is-occupied {
  border-color: var(--color-border-strong);
  background: var(--color-surface);
}
:is(.tables-workspace, .local-tables-panel) .table-card .table-name {
  color: var(--color-text-secondary);
  font-size: var(--text-md);
  line-height: 20px;
  font-weight: var(--weight-medium);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  white-space: normal;
  overflow-wrap: anywhere;
}
:is(.tables-workspace, .local-tables-panel) .table-card.is-occupied .table-name { color: var(--color-primary); }
:is(.tables-workspace, .local-tables-panel) .table-card-head { gap: var(--space-1); }
:is(.tables-workspace, .local-tables-panel) .table-card-total {
  color: var(--color-primary);
  font-size: var(--text-lg);
  line-height: 24px;
  font-weight: var(--weight-medium);
  font-variant-numeric: tabular-nums;
}
:is(.tables-workspace, .local-tables-panel) .table-card-state {
  min-height: 20px;
  font-weight: var(--weight-regular);
}
:is(.tables-workspace, .local-tables-panel) .table-card.is-tone-info .table-card-state { color: var(--color-info); }
:is(.tables-workspace, .local-tables-panel) .table-card.has-customer-request { border-color: var(--color-warning-border); }
:is(.tables-workspace, .local-tables-panel) .table-card.has-customer-request .table-card-state {
  align-self: flex-start;
  max-width: 100%;
  padding: 1px 7px;
  border-radius: var(--radius-sm);
  background: var(--color-warning-subtle);
  color: var(--color-warning);
}
:is(.tables-workspace, .local-tables-panel) .table-card.is-tone-warning .table-state-dot { box-shadow: none; }
:is(.tables-workspace, .local-tables-panel) .table-card:hover:not(:disabled) { border-color: var(--color-primary); }
:is(.tables-workspace, .local-tables-panel) .table-card.is-selected {
  border-color: var(--color-selected-border);
  background: var(--color-selected-bg);
  box-shadow: none;
}
:is(.tables-workspace, .local-tables-panel) .table-card.is-selected .table-name { color: var(--color-primary); }
:is(.tables-workspace, .local-tables-panel) .table-card:active:not(:disabled) {
  background: var(--color-primary-subtle);
  filter: none;
  transform: scale(.99);
}
:is(.tables-workspace, .local-tables-panel) .table-card:disabled {
  background: var(--color-surface-subtle);
  border-color: var(--color-border);
  color: var(--color-text-disabled);
  cursor: progress;
  transform: none;
}

/* A quiet header, readable order lines, and a stable total/action region. */
.tables-workspace .table-details h2 { font-weight: var(--weight-medium); }
.tables-workspace .table-status {
  background: transparent;
  padding-inline: 0;
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  font-weight: var(--weight-regular);
}
.tables-workspace .table-status.occupied { color: var(--color-primary); }
.tables-workspace .table-preview-heading strong,
.tables-workspace .table-preview-row strong { font-weight: var(--weight-medium); }
.tables-workspace .table-preview-row > div { overflow-wrap: anywhere; }
.tables-workspace .table-preview-row strong { color: var(--color-primary); }
.tables-workspace .table-order-note {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
}
.tables-workspace .table-detail-footer {
  margin: 0 calc(-1 * var(--space-4)) calc(-1 * var(--space-4));
  padding: var(--space-3) var(--space-4) var(--space-4);
  border-top: 1px solid var(--color-border);
  background: color-mix(in srgb, var(--color-primary-subtle) 45%, var(--color-surface));
}
.tables-workspace .table-detail-footer .total-box {
  min-height: var(--control-md);
  align-items: center;
  padding: 0;
}
.tables-workspace .table-detail-footer .total-box > span { font-size: var(--text-sm); font-weight: var(--weight-regular); }
.tables-workspace .table-detail-footer .total-box > strong { color: var(--color-primary); font-weight: var(--weight-medium); }
.tables-workspace .table-operation-buttons button { font-size: var(--text-sm); }
.tables-workspace .table-open-button:disabled {
  background: var(--color-surface-sunken);
  color: var(--color-text-disabled);
}

@media (min-width: 900px) {
  .tables-workspace:not(.is-full-width) .table-toolbar .search-box { flex-basis: 240px; }
}
@media (max-width: 899px) {
  .pos-shell.is-compact :is(.tables-workspace, .local-tables-panel) .table-toolbar { gap: var(--space-2); margin-bottom: 0; }
  .pos-shell.is-compact :is(.tables-workspace, .local-tables-panel) .area-tabs { max-width: calc(100% - 90px); }
  .pos-shell.is-compact :is(.tables-workspace, .local-tables-panel) .area-tabs button { min-width: 60px; padding-inline: var(--space-3); }
  .pos-shell.is-compact :is(.tables-workspace, .local-tables-panel) .table-toolbar .search-box {
    flex: 1 1 160px;
    max-width: none;
    margin-left: 0;
  }
  .pos-shell.is-compact :is(.tables-workspace, .local-tables-panel) .table-status-filter { flex-basis: 140px; }
  .pos-shell.is-compact :is(.tables-workspace, .local-tables-panel) .tables-grid { grid-auto-rows: 120px; }
  .pos-shell.is-compact .tables-workspace .table-detail-footer {
    margin-bottom: calc(-16px - env(safe-area-inset-bottom));
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
  }
}
@media (prefers-reduced-motion: reduce) {
  :is(.tables-workspace, .local-tables-panel) .table-card { transition: none; }
}
