/* The Shipyard design system — mobile-first, touch-first.
   Breakpoints: ≥640px tablet, ≥1024px desktop. */

:root {
  --navy: #0f2c3f;
  --navy-2: #16405c;
  --teal: #0e7c86;
  --teal-dark: #0a5d65;
  --sand: #f7f3ea;
  --paper: #ffffff;
  --ink: #17303f;
  --ink-2: #51677a;
  --line: #dde5ea;
  --coral: #e4572e;
  --gold: #d9a441;
  --ok: #1f8a4c;
  --warn: #b7791f;
  --bad: #c0392b;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(15, 44, 63, .10), 0 4px 16px rgba(15, 44, 63, .06);
  --tap: 46px;                 /* minimum touch target */
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  color: var(--ink);
  background: var(--sand);
  line-height: 1.45;
  font-size: 16px;
}
img { max-width: 100%; }
a { color: var(--teal); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; color: var(--navy); }
h1 { font-size: 1.4rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; }
p { margin: .4rem 0; }
.muted { color: var(--ink-2); font-size: .9rem; }
.lead { font-size: 1.05rem; color: var(--ink-2); }
.display { font-size: 2.6rem; letter-spacing: .02em; }
.nowrap { white-space: nowrap; }
[hidden] { display: none !important; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  min-height: var(--tap); padding: .55rem 1.05rem;
  border: 1.5px solid var(--line); border-radius: var(--radius);
  background: var(--paper); color: var(--navy);
  font-size: 1rem; font-weight: 600; cursor: pointer; text-decoration: none;
  transition: background .12s, border-color .12s, transform .05s;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.985); }
.btn-primary { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn-primary:hover { background: var(--teal-dark); }
.btn-navy { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn-danger { background: #fff; border-color: var(--bad); color: var(--bad); }
.btn-danger-solid { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--teal); }
.btn-lg { min-height: 54px; font-size: 1.06rem; padding: .7rem 1.3rem; }
.btn-sm { min-height: 38px; font-size: .9rem; padding: .3rem .7rem; border-radius: 9px; }
.btn-block { display: flex; width: 100%; }
.btn[disabled], .btn.disabled { opacity: .45; pointer-events: none; }
.btn-row { display: flex; flex-wrap: wrap; gap: .5rem; }

/* ---------- forms ---------- */
.field { margin-bottom: .95rem; }
.field label, .label {
  display: block; font-size: .82rem; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; color: var(--ink-2); margin-bottom: .3rem;
}
input[type=text], input[type=tel], input[type=email], input[type=password],
input[type=date], input[type=time], input[type=number], input[type=search],
select, textarea {
  width: 100%; min-height: var(--tap); padding: .55rem .75rem;
  font-size: 1rem; font-family: inherit; color: var(--ink);
  border: 1.5px solid var(--line); border-radius: var(--radius); background: var(--paper);
  appearance: none; -webkit-appearance: none;
}
input:focus, select, textarea:focus, select:focus {
  outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(14, 124, 134, .15);
}
textarea { min-height: 84px; resize: vertical; }
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2351677a' stroke-width='2' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .8rem center; padding-right: 2.2rem;
}
.checkbox { display: flex; gap: .6rem; align-items: flex-start; font-size: .95rem; }
.checkbox input { width: 22px; height: 22px; margin-top: .1rem; accent-color: var(--teal); flex: none; }
.field-error { color: var(--bad); font-size: .85rem; margin-top: .25rem; }
.form-grid { display: grid; gap: 0 1rem; }
@media (min-width: 640px) { .form-grid { grid-template-columns: 1fr 1fr; } .form-grid .full { grid-column: 1 / -1; } }

/* segmented control */
.segmented { display: flex; border: 1.5px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--paper); }
.segmented button {
  flex: 1; min-height: var(--tap); border: 0; background: transparent;
  font-size: 1rem; font-weight: 600; color: var(--ink-2); cursor: pointer;
}
.segmented button.active { background: var(--navy); color: #fff; }

/* choice chips (party size etc.) */
.chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip {
  min-width: var(--tap); min-height: var(--tap); padding: .4rem .8rem;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--line); border-radius: 999px; background: var(--paper);
  font-size: 1rem; font-weight: 600; cursor: pointer;
}
.chip.active { background: var(--teal); border-color: var(--teal); color: #fff; }

/* time grid */
.time-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .55rem; }
@media (min-width: 480px) { .time-grid { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 1024px) { .time-grid { grid-template-columns: repeat(5, 1fr); } }
.time-btn {
  min-height: 50px; border: 1.5px solid var(--line); border-radius: var(--radius);
  background: var(--paper); font-size: 1rem; font-weight: 700; color: var(--navy);
  cursor: pointer;
}
.time-btn.suggested { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(217,164,65,.25); }
.time-btn.active { background: var(--teal); border-color: var(--teal); color: #fff; }
.time-btn[disabled] { color: #b6c2cb; background: #f1f4f6; cursor: default; text-decoration: line-through; }

/* ---------- cards & layout ---------- */
.card { background: var(--paper); border-radius: 16px; box-shadow: var(--shadow); padding: 1.1rem; }
.card + .card { margin-top: 1rem; }
.card-title { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .6rem; }
.center-card { max-width: 560px; margin: 2rem auto; text-align: center; }
.stack > * + * { margin-top: 1rem; }

/* ---------- badges & statuses ---------- */
.badge {
  display: inline-flex; align-items: center; gap: .3rem; padding: .18rem .6rem;
  border-radius: 999px; font-size: .78rem; font-weight: 700; letter-spacing: .02em;
  background: #e8edf1; color: var(--ink-2); white-space: nowrap;
}
.badge-muted { background: #e8edf1; color: var(--ink-2); }
.badge-pending   { background: #fdf3d7; color: #8a6116; }
.badge-confirmed { background: #ddf0e3; color: #17693a; }
.badge-arrived   { background: #d9ecf7; color: #155e8a; }
.badge-seated    { background: #d9e2f7; color: #2a4494; }
.badge-dining    { background: #e4dcf5; color: #5b3ba0; }
.badge-finished  { background: #e8edf1; color: #51677a; }
.badge-cancelled { background: #fbe0da; color: #a03016; }
.badge-no_show   { background: #f7d9d9; color: #8f1f1f; }
.badge-waitlisted{ background: #fdeacc; color: #8a5b16; }
.warn-icon { font-size: .95rem; }

/* ---------- staff shell ---------- */
.staff { background: #eef2f5; }
.s-shell { display: flex; min-height: 100vh; }
.s-sidebar {
  display: none; flex-direction: column; width: 216px; flex: none;
  background: var(--navy); color: #fff; padding: 1rem .8rem calc(1rem + var(--safe-b));
  position: sticky; top: 0; height: 100vh;
}
.s-brand { display: flex; align-items: center; gap: .6rem; color: #fff; text-decoration: none; font-weight: 700; padding: .3rem .5rem 1rem; }
.s-nav { display: flex; flex-direction: column; gap: .15rem; flex: 1; }
.s-nav a {
  color: #cfdbe4; text-decoration: none; padding: .6rem .75rem; border-radius: 10px;
  font-weight: 600; font-size: .95rem;
}
.s-nav a:hover { background: var(--navy-2); color: #fff; }
.s-nav a.active { background: var(--teal); color: #fff; }
.s-user { border-top: 1px solid rgba(255,255,255,.15); padding-top: .7rem; display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.s-user-name { font-size: .9rem; font-weight: 600; }
.s-user .btn-ghost { color: #9fc3cf; }
.s-content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.s-topbar {
  display: flex; align-items: center; gap: .7rem; padding: .65rem .9rem;
  background: var(--paper); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 30;
}
.s-title { font-size: 1.15rem; margin: 0; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.s-topbar-actions { display: flex; gap: .5rem; align-items: center; }
.s-menu-btn { font-size: 1.3rem; background: none; border: 0; min-width: var(--tap); min-height: var(--tap); cursor: pointer; color: var(--navy); }
.s-main { padding: 1rem .9rem calc(84px + var(--safe-b)); max-width: 1280px; width: 100%; margin: 0 auto; }
.s-bottomnav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
  display: flex; background: var(--navy); padding-bottom: var(--safe-b);
  box-shadow: 0 -2px 12px rgba(15,44,63,.25);
}
.s-bottomnav a, .s-bottomnav button {
  flex: 1; text-align: center; color: #cfdbe4; text-decoration: none; font-size: .78rem;
  font-weight: 700; padding: .8rem .2rem; background: none; border: 0; cursor: pointer;
}
.s-bottomnav a.active { color: #fff; box-shadow: inset 0 3px 0 var(--teal); }
@media (min-width: 1024px) {
  .s-sidebar { display: flex; }
  .s-bottomnav { display: none; }
  .s-menu-btn { display: none; }
  .s-main { padding: 1.4rem 1.6rem 2rem; }
}

/* stat strip */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: .6rem; }
@media (min-width: 640px) { .stats { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 1024px) { .stats { grid-template-columns: repeat(6, 1fr); } }
.stat { background: var(--paper); border-radius: 14px; box-shadow: var(--shadow); padding: .7rem .9rem; }
.stat b { display: block; font-size: 1.5rem; color: var(--navy); line-height: 1.1; }
.stat span { font-size: .8rem; color: var(--ink-2); font-weight: 600; }
.stat.alert b { color: var(--coral); }

/* list rows */
.rows { display: flex; flex-direction: column; gap: .55rem; }
.row-card {
  background: var(--paper); border-radius: 14px; box-shadow: var(--shadow);
  padding: .75rem .9rem; display: flex; flex-wrap: wrap; gap: .5rem .9rem; align-items: center;
}
.row-card .grow { flex: 1; min-width: 140px; }
.row-time { font-weight: 800; font-size: 1.05rem; color: var(--navy); min-width: 74px; }
.row-name { font-weight: 700; }
.row-sub { font-size: .85rem; color: var(--ink-2); }
.row-card.late { box-shadow: var(--shadow), inset 3px 0 0 var(--coral); }
.row-card.vip { box-shadow: var(--shadow), inset 3px 0 0 var(--gold); }

/* data tables */
.table-wrap { overflow-x: auto; background: var(--paper); border-radius: 14px; box-shadow: var(--shadow); }
table.data { border-collapse: collapse; width: 100%; font-size: .92rem; }
table.data th {
  text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em;
  color: var(--ink-2); padding: .65rem .8rem; border-bottom: 1.5px solid var(--line);
  white-space: nowrap;
}
table.data td { padding: .6rem .8rem; border-bottom: 1px solid #edf1f4; vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data tr.clickable { cursor: pointer; }
table.data tr.clickable:hover { background: #f4f7f9; }

/* filter bar */
.filters { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: .9rem; }
.filters input[type=search], .filters input[type=date], .filters select { width: auto; min-width: 130px; flex: 1; max-width: 240px; }

/* ---------- customer shell ---------- */
.c-header {
  display: flex; align-items: center; justify-content: space-between; gap: .8rem;
  padding: .7rem 1rem; background: var(--navy); color: #fff;
}
.c-brand { display: flex; align-items: center; gap: .65rem; color: #fff; text-decoration: none; }
.c-brand strong { display: block; font-size: 1.05rem; }
.c-brand small { display: block; font-size: .75rem; color: #a8c3d2; }
.c-phone { color: #fff; font-weight: 700; text-decoration: none; font-size: .95rem; padding: .5rem .2rem; }
.c-main { max-width: 640px; margin: 0 auto; padding: 1rem 1rem 2.5rem; }
@media (min-width: 1024px) { .c-main { max-width: 720px; padding-top: 1.6rem; } }
.c-footer { text-align: center; color: var(--ink-2); font-size: .85rem; padding: 1.4rem 1rem calc(1.6rem + var(--safe-b)); }
.c-footer a { color: var(--teal); }
.c-footer-links { margin-top: .5rem; }

/* wizard */
.steps { display: flex; gap: .4rem; margin-bottom: 1rem; }
.steps span { flex: 1; height: 5px; border-radius: 4px; background: var(--line); }
.steps span.done { background: var(--teal); }
.hold-bar {
  display: flex; align-items: center; gap: .6rem; background: #fdf3d7; color: #8a6116;
  border-radius: var(--radius); padding: .6rem .9rem; font-weight: 600; font-size: .95rem;
  margin: .8rem 0;
}
.confirm-ref { font-size: 2rem; letter-spacing: .12em; color: var(--navy); font-weight: 800; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: .35rem .9rem; text-align: left; font-size: .98rem; }
.kv dt { color: var(--ink-2); font-weight: 600; }
.kv dd { margin: 0; font-weight: 600; color: var(--navy); }

/* ---------- overlays ---------- */
.sheet-backdrop, .modal-backdrop {
  position: fixed; inset: 0; background: rgba(15, 44, 63, .5); z-index: 90;
  display: flex; align-items: flex-end; justify-content: center;
}
.modal-backdrop { align-items: center; padding: 1rem; }
.sheet {
  background: var(--paper); border-radius: 18px 18px 0 0; width: 100%; max-width: 560px;
  padding: .5rem .9rem calc(1rem + var(--safe-b)); max-height: 85vh; overflow-y: auto;
}
.sheet-handle { width: 42px; height: 5px; border-radius: 4px; background: var(--line); margin: .35rem auto .6rem; }
.sheet-item {
  display: block; width: 100%; text-align: left; padding: .8rem .6rem; font-size: 1rem;
  font-weight: 600; color: var(--navy); background: none; border: 0; border-bottom: 1px solid #eef1f4;
  text-decoration: none; cursor: pointer;
}
.sheet-item.danger { color: var(--bad); }
.modal { background: var(--paper); border-radius: 16px; width: 100%; max-width: 480px; padding: 1.1rem; max-height: 90vh; overflow-y: auto; }
@media (min-width: 640px) { .sheet-backdrop { align-items: center; padding: 1rem; } .sheet { border-radius: 16px; } }

/* toast */
#toast-root { position: fixed; left: 0; right: 0; bottom: calc(70px + var(--safe-b)); display: flex; flex-direction: column; align-items: center; gap: .5rem; z-index: 120; pointer-events: none; }
.toast {
  background: var(--navy); color: #fff; padding: .65rem 1.1rem; border-radius: 999px;
  font-weight: 600; font-size: .95rem; box-shadow: var(--shadow); max-width: 92vw;
  animation: toast-in .18s ease-out;
}
.toast.error { background: var(--bad); }
.toast.success { background: var(--ok); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* offline banner */
.offline-banner {
  background: var(--coral); color: #fff; text-align: center; font-weight: 600;
  font-size: .9rem; padding: .5rem .9rem;
}

/* ---------- floor plan ---------- */
.floor-canvas { background: var(--paper); border-radius: 14px; box-shadow: var(--shadow); touch-action: none; }
.floor-table { cursor: pointer; }
.floor-table rect, .floor-table circle { fill: #e8f4f2; stroke: var(--teal); stroke-width: 1.5; }
.floor-table.available rect, .floor-table.available circle { fill: #eef7ef; stroke: var(--ok); }
.floor-table.reserved rect, .floor-table.reserved circle { fill: #fdf3d7; stroke: var(--warn); }
.floor-table.occupied rect, .floor-table.occupied circle { fill: #fbe4de; stroke: var(--coral); }
.floor-table.cleaning rect, .floor-table.cleaning circle { fill: #e6ecf7; stroke: #5577c0; }
.floor-table.blocked rect, .floor-table.blocked circle { fill: #edeef0; stroke: #9aa7b1; stroke-dasharray: 4 3; }
.floor-table.selected rect, .floor-table.selected circle { stroke-width: 3; }
.floor-table text { fill: var(--navy); font-weight: 700; font-size: 13px; pointer-events: none; }
.floor-table .sub { font-size: 10px; fill: var(--ink-2); font-weight: 600; }

/* timeline */
.timeline-wrap { overflow-x: auto; background: var(--paper); border-radius: 14px; box-shadow: var(--shadow); }

/* utility */
.split { display: grid; gap: 1rem; }
@media (min-width: 900px) { .split { grid-template-columns: 5fr 4fr; align-items: start; } }
.right { text-align: right; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: .6rem; flex-wrap: wrap; }
.mt { margin-top: 1rem; } .mb { margin-bottom: 1rem; }
.empty {
  text-align: center; color: var(--ink-2); padding: 2.2rem 1rem; background: var(--paper);
  border-radius: 14px; border: 1.5px dashed var(--line);
}
.notice { background: #ddf0e3; color: #17693a; border-radius: var(--radius); padding: .6rem .9rem; font-weight: 600; }
.notice.error { background: #fbe0da; color: #a03016; }
.spinner {
  width: 26px; height: 26px; border: 3px solid var(--line); border-top-color: var(--teal);
  border-radius: 50%; animation: spin .8s linear infinite; margin: 1rem auto;
}
@keyframes spin { to { transform: rotate(360deg); } }
