/*
 * KOrder styles · public/css/04-hub.css
 * Counter hub: local hub panel, remote sync panel, floor map, table cards and table bill modal, totals. Also the .button variants (secondary/danger/compact) that sit here in the original order.
 *
 * public/css/*.css used to be one public/styles.css. The files are cut from it in order
 * and index.html loads them in that same order, which is the CSS cascade order: do not
 * reorder the <link> tags, and add a rule to the file that owns its screen.
 * Map: public/css/README.md
 */
.local-hub-screen {
  align-items: start;
}

.local-hub-addresses {
  display: grid;
  gap: 10px;
}

.local-hub-shortcuts {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
}

.local-hub-addresses div {
  display: grid;
  gap: 5px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.9);
}

.local-hub-addresses span {
  color: var(--muted);
  font-weight: 800;
}

.local-hub-addresses strong {
  color: var(--ink);
  word-break: break-all;
}

.remote-sync-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
  border: 1px solid rgba(15, 118, 110, 0.24);
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(15, 118, 110, 0.08), rgba(255, 255, 255, 0.9));
}

.remote-sync-panel div {
  display: grid;
  gap: 4px;
}

.remote-sync-panel strong {
  font-size: 16px;
}

.remote-sync-panel span,
.remote-sync-panel em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

.remote-sync-panel em {
  color: var(--coral);
}

.floor-map-panel {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, #242a31, #191d22);
  box-shadow: var(--soft-shadow);
}

.floor-map-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.floor-map-head h2 {
  margin: 0;
  color: #fff;
}

.floor-map-head p {
  margin: 5px 0 0;
  color: rgba(255, 255, 255, 0.66);
}

.floor-map-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  font-weight: 850;
}

.floor-map-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #d4d8d3;
}

.dot.cooking {
  background: var(--amber);
}

.dot.pay {
  background: var(--coral);
}

.floor-map-board {
  position: relative;
  min-height: 360px;
  aspect-ratio: 100 / 64;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.055) 1px, transparent 1px),
    rgba(255, 255, 255, 0.04);
  background-size: 10% 12.5%;
}

.floor-map-board > .empty-state,
.table-layout-board > .empty-state {
  position: absolute;
  inset: 18px;
  display: grid;
  place-items: center;
}

/* The card size comes from the floor map (many tables = small cards), so the
   text must fit inside it: centred, one line each, cut with "…", never spilling. */
.floor-table {
  display: grid;
  position: absolute;
  align-content: center;
  gap: 4px;
  min-width: 86px;
  min-height: 70px;
  overflow: hidden;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius);
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  text-align: left;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.floor-table.round {
  border-radius: 999px;
  place-items: center;
  text-align: center;
}

.floor-table.wide {
  align-content: center;
}

.floor-table.done {
  border-color: rgba(100, 187, 146, 0.32);
  background: rgba(47, 125, 72, 0.22);
}

.floor-table.warn {
  border-color: rgba(216, 138, 22, 0.42);
  background: rgba(194, 122, 24, 0.24);
}

.floor-table strong {
  font-size: 30px;
  line-height: 1.1;
  font-weight: 950;
}

.floor-table span,
.floor-table em {
  overflow: hidden;
  color: rgba(255, 255, 255, 0.72);
  font-style: normal;
  font-size: 12px;
  line-height: 1.2;
  font-weight: 850;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.floor-table strong {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* Small cards (about 30+ tables on the map): tighter box, smaller table name. */
.floor-table.compact {
  gap: 1px;
  padding: 6px 8px;
}

.floor-table.compact strong {
  font-size: 20px;
}

.floor-table.compact span,
.floor-table.compact em {
  font-size: 11px;
}

.table-layout-editor {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 320px);
  gap: 16px;
  align-items: stretch;
}

.table-layout-board {
  position: relative;
  min-height: 420px;
  aspect-ratio: 100 / 64;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(rgba(24, 28, 34, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(24, 28, 34, 0.055) 1px, transparent 1px),
    #f8faf7;
  background-size: 10% 12.5%;
}

.layout-table {
  position: absolute;
  display: grid;
  place-items: center;
  min-width: 84px;
  min-height: 62px;
  padding: 8px;
  border: 2px solid rgba(31, 36, 42, 0.2);
  border-radius: 8px;
  color: var(--text);
  background: #fff;
  box-shadow: 0 12px 26px rgba(23, 27, 33, 0.12);
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.layout-table.round {
  border-radius: 999px;
}

.layout-table.wide {
  border-radius: 10px;
}

.layout-table.is-dragging {
  z-index: 5;
  border-color: var(--coral);
  box-shadow: 0 18px 34px rgba(23, 27, 33, 0.22);
  cursor: grabbing;
}

.layout-table strong {
  overflow-wrap: anywhere;
  text-align: center;
  font-size: 18px;
  font-weight: 950;
}

.table-layout-side {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 14px;
  min-height: 0;
}

.table-layout-control-list {
  display: grid;
  align-content: start;
  gap: 8px;
  max-height: 420px;
  overflow: auto;
  padding-right: 2px;
}

.table-layout-control-row {
  display: grid;
  grid-template-columns: minmax(60px, 0.8fr) minmax(86px, 1fr) minmax(92px, 1fr);
  gap: 8px;
  align-items: center;
}

.table-layout-control-row strong {
  overflow-wrap: anywhere;
  font-size: 14px;
  font-weight: 950;
}

.table-layout-control-row .select {
  min-width: 0;
  height: 38px;
  padding: 0 30px 0 10px;
  font-size: 13px;
}

.table-layout-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.local-printer-card {
  gap: 14px;
}

.printer-role-field {
  display: grid;
  gap: 6px;
}

.printer-role-field span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.local-diagnostics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.diagnostic-card {
  display: grid;
  gap: 5px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.94);
}

.diagnostic-card span,
.diagnostic-card em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

.diagnostic-card strong {
  color: var(--ink);
  font-size: 24px;
}

.local-print-log {
  margin-top: 2px;
}

.pos-bridge-card {
  display: grid;
  grid-template-columns: minmax(150px, 0.8fr) minmax(150px, 1fr) minmax(150px, 1fr) minmax(190px, 1fr) auto;
  gap: 10px;
  align-items: end;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.94);
}

.pos-bridge-card > label:not(.check-row) {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.pos-outbox-note {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  background: #f8f4ed;
}

.pos-outbox-note span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.pos-outbox-note strong {
  word-break: break-all;
}

.local-table-head {
  margin-top: 6px;
}

.local-table-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
}

.local-table-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--soft-shadow);
}

.local-table-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.local-table-top strong {
  color: var(--ink);
  font-size: 34px;
  line-height: 1.1;
  font-weight: 900;
}

.local-table-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.local-table-stats div {
  display: grid;
  gap: 4px;
  padding: 10px;
  border-radius: 8px;
  background: #eef1ed;
}

.local-table-stats span,
.local-table-latest span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.local-table-stats strong,
.local-table-latest strong {
  color: var(--ink);
  font-weight: 900;
}

.local-table-latest {
  display: grid;
  gap: 4px;
  min-height: 48px;
}

.local-table-latest.empty {
  align-content: center;
  color: var(--muted);
  font-weight: 800;
}

.local-table-actions,
.hub-table-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.hub-table-modal {
  max-width: 920px;
}

.hub-table-order-list {
  display: grid;
  gap: 10px;
  max-height: min(58vh, 620px);
  overflow: auto;
  padding-right: 4px;
}

.hub-table-order {
  display: grid;
  gap: 10px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fffdf8;
}

.hub-table-items {
  display: grid;
  gap: 6px;
}

.hub-table-items div,
.hub-table-print-log {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.hub-table-items strong {
  color: var(--ink);
}

.hub-table-print-log {
  flex-wrap: wrap;
  justify-content: flex-start;
  padding-top: 2px;
}

.hub-table-print-log span {
  padding: 4px 7px;
  border-radius: 999px;
  background: #f4efe6;
}

.total-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  font-weight: 900;
}

.total-row.discount {
  color: var(--coral);
}

.total-row strong {
  font-size: 26px;
}

.button {
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  font-weight: 800;
}

.button.secondary {
  background: #fff;
}

.button.danger {
  border-color: var(--coral);
  color: var(--coral);
  background: #fff;
}

.button.compact {
  width: auto;
  min-height: 38px;
}

