/* MenuBoard admin panel.
 * Hand-written CSS on purpose: no build step means deploying is a file copy,
 * and a restaurant is never blocked by a broken npm install. */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #fbfbfc;
  --border: #e2e5ea;
  --border-strong: #cdd2da;
  --text: #14171c;
  --text-dim: #666e7a;
  --text-faint: #9aa1ac;
  --accent: #1f6feb;
  --accent-dark: #1a5fcc;
  --accent-soft: #e8f0fe;
  --good: #16794a;
  --good-soft: #e4f4ec;
  --warn: #a15c00;
  --warn-soft: #fdf3e2;
  --bad: #b42318;
  --bad-soft: #fdeceb;
  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.1);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, 0.14);
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 22px; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }
p { margin: 0 0 12px; }

/* ------------------------------------------------------------------ layout */

.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 216px;
  flex: 0 0 216px;
  background: #101319;
  color: #c9ced8;
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 10px 18px;
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.01em;
}
.sidebar-brand:hover { text-decoration: none; }
.sidebar-mark {
  width: 24px; height: 24px; border-radius: 6px; flex: none;
  background: linear-gradient(140deg, #f5c451, #e07a3c);
}
.sidebar nav { display: flex; flex-direction: column; gap: 1px; }
.sidebar nav a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: #c9ced8;
  font-weight: 500;
}
.sidebar nav a:hover { background: #1a1f28; color: #fff; text-decoration: none; }
.sidebar nav a.active { background: #232a35; color: #fff; }
.sidebar-section {
  padding: 16px 10px 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #6b7482;
  font-weight: 600;
}
.sidebar-foot { margin-top: auto; padding-top: 16px; border-top: 1px solid #232a35; }
.sidebar-user { padding: 6px 10px; font-size: 12px; color: #8b93a1; }
.sidebar-user strong { display: block; color: #e7eaef; font-size: 13px; font-weight: 600; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 30;
}
.topbar-actions { display: flex; gap: 8px; align-items: center; }
.page { padding: 24px 28px 64px; max-width: 1360px; width: 100%; }
.page-lede { color: var(--text-dim); margin: 4px 0 0; font-size: 13px; }

/* ------------------------------------------------------------------- cards */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 18px;
  overflow: hidden;
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.card-body { padding: 18px; }
.card-body.tight { padding: 0; }
.card-foot {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  display: flex;
  gap: 8px;
  align-items: center;
}

.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

.stat { padding: 16px 18px; }
.stat-value { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; }
.stat-label { color: var(--text-dim); font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; }

/* ------------------------------------------------------------------ tables */

table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 18px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  font-weight: 600;
  background: var(--surface-2);
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fafbfc; }
td.right, th.right { text-align: right; }
td.actions { white-space: nowrap; text-align: right; }
.table-wrap { overflow-x: auto; }

/* ------------------------------------------------------------------ badges */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  background: #eef0f3;
  color: var(--text-dim);
  white-space: nowrap;
}
.badge-good { background: var(--good-soft); color: var(--good); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-bad { background: var(--bad-soft); color: var(--bad); }
.badge-info { background: var(--accent-soft); color: var(--accent-dark); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }

/* ----------------------------------------------------------------- buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s, border-color 0.12s;
}
.btn:hover { background: #f2f4f7; text-decoration: none; }
.btn:active { background: #e9ecf1; }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn-danger { color: var(--bad); border-color: #f0c4c0; background: #fff; }
.btn-danger:hover { background: var(--bad-soft); }
.btn-sm { padding: 4px 9px; font-size: 12px; }
.btn-lg { padding: 10px 18px; font-size: 14px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: #eef0f3; }

/* ------------------------------------------------------------------- forms */

label, .label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 5px;
  color: #2c313a;
}
.hint { font-size: 12px; color: var(--text-dim); font-weight: 400; margin-top: 4px; }

input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="date"], input[type="time"], input[type="search"], input[type="url"],
select, textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13.5px;
  color: var(--text);
  background: #fff;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(31, 111, 235, 0.14);
}
textarea { resize: vertical; min-height: 70px; }
input[type="color"] {
  width: 40px; height: 32px; padding: 2px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: #fff; cursor: pointer;
}
input[type="range"] { width: 100%; }

.field { margin-bottom: 14px; }
.field-row { display: flex; gap: 12px; }
.field-row > * { flex: 1; min-width: 0; }
.check { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 10px; }
.check input { margin-top: 2px; flex: none; }
.check label { margin: 0; font-weight: 500; }
.inline-form { display: inline; }

.error { color: var(--bad); font-size: 12.5px; margin-top: 4px; }
.errors {
  background: var(--bad-soft);
  border: 1px solid #f3cdc9;
  color: #7a1c14;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
}
.errors ul { margin: 0; padding-left: 18px; }

/* ------------------------------------------------------------------ alerts */

.alert {
  padding: 11px 15px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  border: 1px solid transparent;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.alert-good { background: var(--good-soft); border-color: #bfe3d0; color: #0f5133; }
.alert-warn { background: var(--warn-soft); border-color: #f0dcb8; color: #7a4600; }
.alert-info { background: var(--accent-soft); border-color: #c6dbfb; color: #16447f; }

/* ------------------------------------------------------------------ tokens */

.token-box {
  font-family: var(--mono);
  font-size: 13px;
  background: #101319;
  color: #7ee2b8;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  word-break: break-all;
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}
.token-box button { flex: none; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
code {
  background: #eef0f3;
  padding: 1px 5px;
  border-radius: 4px;
}
pre {
  background: #101319;
  color: #d7dce4;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.6;
  margin: 0 0 12px;
}

/* --------------------------------------------------------------- guest page */

.guest {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: #101319;
}
.guest-card {
  width: 100%;
  max-width: 384px;
  background: var(--surface);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  padding: 30px;
}
.guest-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
  font-size: 17px;
  font-weight: 600;
}
.guest-foot { margin-top: 18px; font-size: 12.5px; color: var(--text-dim); text-align: center; }

/* ------------------------------------------------------------------- misc */

.muted { color: var(--text-dim); }
.faint { color: var(--text-faint); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.row { display: flex; gap: 10px; align-items: center; }
.row-between { display: flex; gap: 10px; align-items: center; justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 4px; }
.mt { margin-top: 16px; }
.mb { margin-bottom: 16px; }
.empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-dim);
}
.empty h3 { margin-bottom: 6px; color: var(--text); }

.thumb {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  background: #eef0f3;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  display: block;
}
.media-tile { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.media-meta { padding: 9px 11px; font-size: 12px; }

.qr { background: #fff; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); display: inline-block; }
.qr svg { display: block; width: 200px; height: 200px; }

.codes {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  font-family: var(--mono);
  font-size: 14px;
}
.codes span { background: #eef0f3; padding: 8px 12px; border-radius: 6px; text-align: center; letter-spacing: 0.06em; }

.timeline { display: flex; height: 30px; border-radius: 6px; overflow: hidden; border: 1px solid var(--border); }
.timeline-seg { flex: none; font-size: 10px; color: #fff; display: flex; align-items: center; padding: 0 6px; overflow: hidden; white-space: nowrap; }

.preview-frame {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #000;
  display: block;
}

@media (max-width: 820px) {
  .app { flex-direction: column; }
  .sidebar { width: 100%; flex: none; height: auto; position: static; flex-direction: column; }
  .sidebar nav { flex-direction: row; flex-wrap: wrap; }
  .page { padding: 16px; }
  .topbar { padding: 12px 16px; }
}
