/* ============================================================
   RASATA Floor Grid — restaurant-reservations.html
   Landscape-first "spreadsheet" of tables × time.
   Uses the existing RASATA design tokens from variables.css.
   ============================================================ */

/* ── Page states ── */
.fg-state {
  text-align: center;
  padding: 48px 24px;
}

.fg-state-title {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--charcoal);
}

.fg-state p {
  color: var(--muted);
  margin-top: 6px;
}

/* ── Toolbar ── */
.fg-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}

.fg-toolbar label {
  font-size: .78rem;
  color: var(--muted);
  display: block;
  margin-bottom: 2px;
}

.fg-field {
  display: flex;
  flex-direction: column;
}

.fg-toolbar select,
.fg-toolbar input[type="date"],
.fg-toolbar input[type="search"] {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  font: inherit;
  background: var(--white);
  color: var(--charcoal);
  min-height: 38px;
}

.fg-datenav {
  display: flex;
  align-items: end;
  gap: 6px;
}

.fg-datenav .btn {
  padding: 8px 12px;
  min-height: 38px;
}

.fg-spacer {
  flex: 1 1 auto;
}

.fg-live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .78rem;
  color: var(--muted);
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--soft);
}

.fg-live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
}

.fg-live.is-on .fg-live-dot {
  background: var(--success);
}

.fg-live.is-poll .fg-live-dot {
  background: var(--yellow);
}

.fg-viewtoggle {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  align-self: end;
}

.fg-viewtoggle button {
  border: 0;
  background: var(--white);
  color: var(--charcoal);
  padding: 8px 14px;
  font: inherit;
  cursor: pointer;
  min-height: 38px;
}

.fg-viewtoggle button[aria-pressed="true"] {
  background: var(--charcoal);
  color: var(--white);
}

/* ── Counters ── */
.fg-counters {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.fg-counters .card.stat strong {
  font-size: 1.3rem;
}

@media (max-width: 860px) {
  .fg-counters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ── The grid shell ── */
.fg-wrap {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: auto;
  max-height: 72vh;
  position: relative;
}

.fg-grid {
  position: relative;
  display: inline-block;
  min-width: 100%;
}

/* header row of times — sticky on scroll */
.fg-timehead {
  display: flex;
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--warm);
  border-bottom: 2px solid var(--line);
}

.fg-corner {
  position: sticky;
  left: 0;
  z-index: 31;
  background: var(--warm);
  border-right: 2px solid var(--line);
  display: flex;
  align-items: center;
  padding: 8px 10px;
  font-weight: 700;
  font-size: .8rem;
  color: var(--charcoal);
  flex: 0 0 auto;
}

.fg-timecell {
  flex: 0 0 auto;
  text-align: left;
  font-size: .72rem;
  color: var(--muted);
  padding: 8px 4px;
  border-right: 1px dashed var(--line);
  font-variant-numeric: tabular-nums;
}

.fg-timecell.fg-hour {
  color: var(--charcoal);
  font-weight: 700;
  border-right-style: solid;
}

/* covers-per-slot row */
.fg-covers-row {
  display: flex;
  border-bottom: 1px solid var(--line);
  background: var(--soft);
}

.fg-covers-label {
  position: sticky;
  left: 0;
  z-index: 20;
  background: var(--soft);
  border-right: 2px solid var(--line);
  padding: 4px 10px;
  font-size: .72rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  flex: 0 0 auto;
}

.fg-covers-cell {
  flex: 0 0 auto;
  text-align: center;
  font-size: .72rem;
  padding: 4px 0;
  color: var(--charcoal);
  border-right: 1px dashed var(--line);
  font-variant-numeric: tabular-nums;
}

.fg-covers-cell.is-busy {
  background: #fdebe3;
  font-weight: 700;
}

/* area group heading rows */
.fg-arearow {
  position: sticky;
  left: 0;
  z-index: 20;
  background: var(--charcoal);
  color: var(--white);
  font-size: .72rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 4px 10px;
}

/* table rows */
.fg-row {
  display: flex;
  border-bottom: 1px solid var(--line);
  position: relative;
}

.fg-row:nth-child(even) {
  background: var(--soft);
}

.fg-rowhead {
  position: sticky;
  left: 0;
  z-index: 20;
  background: var(--white);
  border-right: 2px solid var(--line);
  padding: 6px 10px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  flex: 0 0 auto;
  min-height: 44px;
}

.fg-row:nth-child(even) .fg-rowhead {
  background: var(--soft);
}

.fg-rowhead strong {
  font-size: .84rem;
  color: var(--charcoal);
  line-height: 1.2;
}

.fg-rowhead span {
  font-size: .7rem;
  color: var(--muted);
}

.fg-rowhead .fg-inactive {
  color: var(--danger);
}

.fg-lane {
  position: relative;
  flex: 0 0 auto;
  min-height: 44px;
}

.fg-cell {
  position: absolute;
  top: 0;
  bottom: 0;
  border-right: 1px dashed var(--line);
  cursor: pointer;
}

.fg-cell.fg-hourline {
  border-right-style: solid;
}

.fg-cell:hover {
  background: rgba(255, 107, 53, .08);
}

.fg-cell:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: -2px;
}

.fg-cell.fg-past {
  cursor: default;
}

.fg-cell.fg-past:hover {
  background: rgba(31, 41, 55, .04);
}

/* reservation blocks */
.fg-block {
  position: absolute;
  top: 4px;
  bottom: 4px;
  z-index: 10;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 3px 8px;
  font-size: .74rem;
  line-height: 1.25;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(31, 41, 55, .14);
}

.fg-block:focus-visible {
  outline: 2px solid var(--dark);
  outline-offset: 1px;
}

.fg-block strong {
  font-weight: 700;
}

.fg-block .fg-block-sub {
  font-size: .68rem;
  opacity: .92;
}

.fg-block .fg-buffer {
  position: absolute;
  top: 0;
  bottom: 0;
  right: 0;
  background: repeating-linear-gradient(135deg, rgba(255, 255, 255, .55) 0 4px, transparent 4px 8px);
  pointer-events: none;
}

/* status colours — each also carries a text marker in the block, never colour alone */
.fg-block.st-confirmed {
  background: #e7f0fb;
  border-color: #a8c6ea;
  color: #17395e;
}

.fg-block.st-arrived {
  background: #fff3d6;
  border-color: #ecd28a;
  color: #6a4d05;
}

.fg-block.st-seated {
  background: #e2f4ec;
  border-color: #9dd6bd;
  color: #114d34;
}

.fg-block.st-completed {
  background: #eceff3;
  border-color: #cbd2da;
  color: #4b5563;
}

.fg-block.st-no_show {
  background: #fbe6e6;
  border-color: #e8b0b0;
  color: #7a1f1f;
  text-decoration: line-through;
}

.fg-block.st-cancelled {
  background: transparent;
  border: 1px dashed var(--line);
  color: var(--muted);
  text-decoration: line-through;
  box-shadow: none;
}

.fg-block.src-walk_in {
  border-left: 4px solid var(--orange);
}

.fg-block.src-phone {
  border-left: 4px solid var(--yellow);
}

/* unassigned lane */
.fg-unassigned-head {
  position: sticky;
  left: 0;
  z-index: 20;
  background: #fdf3ec;
  border-right: 2px solid var(--line);
  color: var(--orange-dark);
}

/* current time line */
.fg-nowline {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  z-index: 25;
  background: var(--danger);
  pointer-events: none;
}

.fg-nowline::before {
  content: "";
  position: sticky;
  top: 0;
  display: block;
  width: 8px;
  height: 8px;
  margin-left: -3px;
  border-radius: 50%;
  background: var(--danger);
}

/* legend */
.fg-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
  font-size: .76rem;
  color: var(--muted);
}

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

.fg-legend .fg-swatch {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  border: 1px solid var(--line);
  display: inline-block;
}

/* ── List view ── */
.fg-list .data-table td {
  vertical-align: middle;
}

.fg-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 700;
  border: 1px solid transparent;
}

.fg-badge.st-confirmed {
  background: #e7f0fb;
  color: #17395e;
  border-color: #a8c6ea;
}

.fg-badge.st-arrived {
  background: #fff3d6;
  color: #6a4d05;
  border-color: #ecd28a;
}

.fg-badge.st-seated {
  background: #e2f4ec;
  color: #114d34;
  border-color: #9dd6bd;
}

.fg-badge.st-completed {
  background: #eceff3;
  color: #4b5563;
  border-color: #cbd2da;
}

.fg-badge.st-no_show {
  background: #fbe6e6;
  color: #7a1f1f;
  border-color: #e8b0b0;
}

.fg-badge.st-cancelled {
  background: var(--soft);
  color: var(--muted);
  border-color: var(--line);
}

/* ── Drawer / modal ── */
.fg-overlay {
  position: fixed;
  inset: 0;
  background: rgba(11, 15, 20, .45);
  z-index: 90;
}

.fg-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(440px, 100%);
  background: var(--white);
  z-index: 95;
  box-shadow: -14px 0 40px rgba(31, 41, 55, .22);
  display: flex;
  flex-direction: column;
}

.fg-drawer-head {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
}

.fg-drawer-head h2 {
  font-size: 1.05rem;
  margin: 0;
}

.fg-drawer-head .muted {
  font-size: .78rem;
}

.fg-drawer-body {
  padding: 16px 18px;
  overflow: auto;
  flex: 1;
}

.fg-drawer-body h3 {
  font-size: .82rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  margin: 18px 0 8px;
}

.fg-drawer-body h3:first-child {
  margin-top: 0;
}

.fg-kv {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 4px 10px;
  font-size: .86rem;
}

.fg-kv dt {
  color: var(--muted);
}

.fg-kv dd {
  margin: 0;
  color: var(--charcoal);
  overflow-wrap: anywhere;
}

.fg-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.fg-actions .btn {
  padding: 8px 12px;
  font-size: .82rem;
}

.fg-history {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: .78rem;
}

.fg-history li {
  padding: 6px 0;
  border-bottom: 1px dashed var(--line);
  color: var(--muted);
}

.fg-history li strong {
  color: var(--charcoal);
}

.fg-form .field {
  margin-bottom: 12px;
}

.fg-form label {
  display: block;
  font-size: .78rem;
  color: var(--muted);
  margin-bottom: 4px;
}

.fg-form input,
.fg-form select,
.fg-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 10px;
  font: inherit;
  background: var(--white);
  color: var(--charcoal);
}

.fg-form textarea {
  min-height: 70px;
  resize: vertical;
}

.fg-form .fg-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.fg-form-status {
  font-size: .8rem;
  margin-top: 8px;
  min-height: 1.2em;
}

.fg-status-ok {
  color: var(--success);
}

.fg-status-bad {
  color: var(--danger);
}

.fg-status-busy {
  color: var(--muted);
}

.fg-modal {
  position: fixed;
  z-index: 95;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.fg-modal-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  width: min(520px, 100%);
  max-height: 92vh;
  overflow: auto;
  padding: 20px;
}

.fg-modal-card h2 {
  margin: 0 0 12px;
  font-size: 1.1rem;
}

/* portrait hint — grid works best in landscape on tablets */
.fg-rotate-hint {
  display: none;
}

@media (max-width: 720px) and (orientation: portrait) {
  .fg-rotate-hint {
    display: block;
    background: #fff3d6;
    border: 1px solid #ecd28a;
    color: #6a4d05;
    border-radius: 12px;
    padding: 10px 14px;
    font-size: .82rem;
    margin-bottom: 12px;
  }
}

@media print {

  .site-header,
  .footer,
  .fg-toolbar,
  .sidebar,
  .fg-drawer,
  .fg-overlay,
  .fg-modal {
    display: none !important;
  }

  .fg-wrap {
    max-height: none;
    overflow: visible;
    box-shadow: none;
  }
}

.fg-drawer[hidden],
.fg-modal[hidden] {
  display: none !important;
}