/* ---------------------------------------------------------------
   Torenia - staff back office (desktop first: front-desk monitors)
   --------------------------------------------------------------- */

:root {
  --bg: #f4f5f8;
  --panel: #ffffff;
  --border: #e2e5ea;
  --text: #171a1f;
  --text-muted: #5c6472;
  --text-faint: #8b93a1;
  --accent: #2f5fd6;
  --accent-hover: #2750bb;
  --accent-soft: #e8effc;
  --ok: #17845a;
  --ok-soft: #e6f5ee;
  --warn: #b26a00;
  --warn-soft: #fdf1dd;
  --danger: #c93b3b;
  --danger-soft: #fbeaea;
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: "Cascadia Mono", "SF Mono", Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --panel: #161920;
    --border: #262a33;
    --text: #e8eaef;
    --text-muted: #9aa1ae;
    --text-faint: #6b7280;
    --accent: #6d92f0;
    --accent-hover: #7fa0f4;
    --accent-soft: #1a2440;
    --ok: #4cc38a;
    --ok-soft: #14261f;
    --warn: #e0a340;
    --warn-soft: #2b2314;
    --danger: #f26d6d;
    --danger-soft: #2c1919;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button, input, select { font-family: inherit; font-size: 14px; }
button { cursor: pointer; }
h1 { font-size: 17px; margin: 0; letter-spacing: -0.01em; }
.mono { font-family: var(--mono); }
.muted { color: var(--text-muted); font-size: 13px; }
.sub { color: var(--text-faint); font-size: 12.5px; }
.right { text-align: right; }
.empty { color: var(--text-faint); font-size: 13.5px; padding: 18px 2px; margin: 0; }

/* ---------------------------------------------------------- nav --- */

.nav {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 11px 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.nav-brand { display: flex; align-items: center; gap: 10px; }
.nav-mark { font-size: 22px; }
.nav-brand strong { display: block; font-size: 14.5px; letter-spacing: -0.01em; }
.nav-brand span { font-size: 12px; color: var(--text-muted); }

.nav-links { display: flex; gap: 4px; flex: 1; }
.nav-links a {
  padding: 7px 13px;
  border-radius: 8px;
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 550;
}
.nav-links a:hover { background: var(--bg); color: var(--text); }
.nav-links a.on { background: var(--accent-soft); color: var(--accent); }

.nav-user { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--text-muted); }

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

.page { max-width: 1180px; margin: 0 auto; padding: 20px; display: flex; flex-direction: column; gap: 18px; }

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 20px 20px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

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

button:not(.ghost):not(.danger), .primary {
  border: 0;
  border-radius: 9px;
  padding: 9px 16px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}
button:not(.ghost):not(.danger):hover:not(:disabled) { background: var(--accent-hover); }
button:disabled { opacity: 0.55; cursor: default; }

.ghost, .ghost-link {
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 8px 14px;
  background: transparent;
  color: var(--text-muted);
  font-weight: 550;
  text-decoration: none;
  display: inline-block;
}
.ghost:hover, .ghost-link:hover { background: var(--bg); color: var(--text); }

.danger {
  border: 1px solid var(--danger);
  border-radius: 9px;
  padding: 7px 13px;
  background: transparent;
  color: var(--danger);
  font-weight: 600;
}
.danger:hover { background: var(--danger-soft); }

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

.checkin-form, .upload-form {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  align-items: end;
}

.upload-form { grid-template-columns: repeat(3, 1fr); }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field.short { max-width: 140px; }
.field.wide { grid-column: span 2; }
.field.actions { flex-direction: row; gap: 10px; align-items: center; }

.field label { font-size: 12.5px; font-weight: 600; color: var(--text-muted); }

.field input, .filters input, .filters select {
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--bg);
  color: var(--text);
  outline: none;
}

.field input:focus, .filters input:focus, .filters select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.filters { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.filters input[type="search"] { flex: 1; min-width: 200px; }

.tabs { display: flex; gap: 4px; }
.tabs button {
  border: 1px solid var(--border) !important;
  background: transparent !important;
  color: var(--text-muted) !important;
  border-radius: 8px;
  padding: 7px 14px !important;
  font-weight: 550;
}
.tabs button.on {
  background: var(--accent-soft) !important;
  color: var(--accent) !important;
  border-color: var(--accent) !important;
}

.note { margin: -4px 0 16px; max-width: 78ch; }

.json-sample {
  margin: 18px 0 0;
  padding: 13px 15px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-family: var(--mono);
  font-size: 12.4px;
  color: var(--text-muted);
  overflow-x: auto;
}

/* -------------------------------------------------------- table --- */

.table-wrap { overflow-x: auto; }

.grid { width: 100%; border-collapse: collapse; }
.grid th {
  text-align: left;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  padding: 0 12px 9px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.grid td { padding: 11px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.grid tr:last-child td { border-bottom: 0; }
.grid tr:hover td { background: var(--bg); }
.grid td strong { display: block; font-weight: 600; }

.room {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 7px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  font-family: var(--mono);
  font-size: 12.5px;
}

.pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 650;
  text-transform: capitalize;
}

.pill-ok, .pill-OPEN { background: var(--ok-soft); color: var(--ok); }
.pill-muted, .pill-CANCELLED { background: var(--bg); color: var(--text-faint); }
.pill-ACKNOWLEDGED { background: var(--warn-soft); color: var(--warn); }
.pill-DONE { background: var(--accent-soft); color: var(--accent); }

.urg-low { background: var(--bg); color: var(--text-faint); }
.urg-normal { background: var(--bg); color: var(--text-muted); }
.urg-high { background: var(--danger-soft); color: var(--danger); }

/* ------------------------------------------------------ tickets --- */

.stats { display: flex; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }

.stat {
  flex: 1;
  min-width: 130px;
  padding: 13px 16px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}

.stat-n { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; }
.stat-l { font-size: 12px; color: var(--text-muted); }
.stat-open .stat-n { color: var(--ok); }
.stat-ack .stat-n { color: var(--warn); }
.stat-done .stat-n { color: var(--accent); }

.tickets { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 13px; }

.ticket {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 15px;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ticket.st-OPEN { border-left: 3px solid var(--ok); }
.ticket.st-ACKNOWLEDGED { border-left: 3px solid var(--warn); }
.ticket.st-DONE, .ticket.st-CANCELLED { opacity: 0.75; }

.ticket-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.t-icon { font-size: 16px; }
.t-code { font-weight: 700; font-size: 13px; letter-spacing: 0.02em; }
.t-when { margin-left: auto; font-size: 12px; color: var(--text-faint); }

.t-summary { margin: 0; font-weight: 600; font-size: 14.5px; }
.t-who { margin: 0; font-size: 12.5px; color: var(--text-muted); }

.t-details {
  margin: 2px 0 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 3px 12px;
  font-size: 13px;
}
.t-details dt { color: var(--text-faint); text-transform: capitalize; }
.t-details dd { margin: 0; }

.t-note {
  margin: 0;
  padding: 7px 10px;
  border-radius: 8px;
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 12.5px;
}

.t-actions { display: flex; gap: 8px; align-items: center; margin-top: 2px; }
.t-actions button { padding: 7px 13px !important; font-size: 13px; }

/* ---------------------------------------------- escalation colours --- */

/* The guest has chased this: yellow, then orange, then red. */
.ticket.esc-1 { border-left: 4px solid #e0a340; background: var(--warn-soft); }
.ticket.esc-2 { border-left: 4px solid #e2711d; background: var(--warn-soft); }
.ticket.esc-3 { border-left: 4px solid var(--danger); background: var(--danger-soft); }

.esc-pill.esc-1 { background: #fdf1dd; color: #a86a12; }
.esc-pill.esc-2 { background: #fde3cc; color: #b4541a; }
.esc-pill.esc-3 { background: var(--danger-soft); color: var(--danger); }

@media (prefers-color-scheme: dark) {
  .esc-pill.esc-1 { background: #2b2314; color: #e0a340; }
  .esc-pill.esc-2 { background: #33210f; color: #f0913f; }
}

.pill-review { background: var(--warn-soft); color: var(--warn); }

.t-due { margin: 0; font-size: 12.5px; color: var(--text-faint); }
.t-due.overdue { color: var(--danger); font-weight: 600; }

/* free-text reply to the guest */
.t-compose {
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.t-compose textarea {
  width: 100%;
  resize: vertical;
  min-height: 56px;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--panel);
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  line-height: 1.45;
  outline: none;
}

.t-compose textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.t-compose-actions { display: flex; align-items: center; gap: 8px; }
.t-compose-actions .sub { flex: 1; }
.t-compose-actions button { padding: 6px 13px !important; font-size: 12.5px; }

.check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--text-muted);
  padding: 0 4px;
  white-space: nowrap;
}

/* -------------------------------------------------------- charts --- */

.two-up { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.chart { width: 100%; margin-bottom: 6px; }
.sub-head { margin-top: 18px; }

.grid-line { stroke: var(--border); stroke-width: 1; }
.axis-label { fill: var(--text-faint); font-size: 10px; font-family: var(--font); }
.bar { fill: var(--accent); }
.bar.warn { fill: #e0a340; }
.bar.orange { fill: #e2711d; }
.bar.bad { fill: var(--danger); }
.bar:hover { opacity: 0.82; }
.trend { fill: none; stroke: var(--ok); stroke-width: 2; stroke-linejoin: round; }

.stat-plain .stat-n { color: var(--text); }
.stat-esc .stat-n { color: var(--danger); }

.short-input { max-width: 110px; }

/* ------------------------------------------------- staff / account --- */

.panel.narrow { max-width: 520px; }
.panel.denied { text-align: center; padding: 40px 20px; }

.stack-form { display: flex; flex-direction: column; gap: 14px; max-width: 380px; }
.stack-form .field.actions { margin-top: 4px; }
.small { font-size: 12px; }
.forgot { margin: 18px 0 0; }

.with-button { display: flex; gap: 8px; }
.with-button input { flex: 1; min-width: 0; }

.row-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.row-actions button { padding: 6px 11px !important; font-size: 12.5px; }
.muted-row td { opacity: 0.6; }
.grid td select { padding: 6px 9px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text); }

.role-help { margin: 14px 0 0; }

.nav-who { display: flex; flex-direction: column; line-height: 1.2; text-align: right; }
.nav-who strong { font-size: 13px; color: var(--text); }
.nav-who span { font-size: 11.5px; color: var(--text-faint); }

@media (max-width: 1000px) {
  .two-up { grid-template-columns: 1fr; }
}

/* --------------------------------------------------------- menu --- */

.menu-section { margin-bottom: 18px; }
.menu-section h3 { margin: 0 0 7px; font-size: 13.5px; color: var(--text-muted); }
.menu-section ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 4px; }
.menu-section li { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); }
.menu-section li em { margin-left: auto; font-style: normal; color: var(--text-muted); font-size: 13px; }

.dot { width: 9px; height: 9px; border-radius: 2px; flex: 0 0 9px; }
.dot.veg { background: var(--ok); }
.dot.nonveg { background: var(--danger); }

/* -------------------------------------------------------- login --- */

.login-body { display: grid; place-items: center; min-height: 100vh; padding: 22px; }

.login-card {
  width: 100%;
  max-width: 370px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px 26px 24px;
  box-shadow: 0 16px 40px rgba(15, 17, 21, 0.10);
}

.login-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
  margin-bottom: 10px;
}

.login-logo { width: 132px; height: auto; display: block; margin-bottom: 6px; }
.login-hero h1 { font-size: 18px; margin: 0; }
.login-hero span { font-size: 12.5px; color: var(--text-muted); }

.nav-logo { display: block; width: 34px; height: 34px; }

.login-card label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-muted); margin: 14px 0 6px; }
.login-card input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--bg);
  color: var(--text);
  outline: none;
}
.login-card input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.login-card button { width: 100%; margin-top: 20px; padding: 11px !important; }
.error { color: var(--danger); font-size: 13px; margin: 12px 0 0; }

/* -------------------------------------------------------- toast --- */

.toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  padding: 11px 18px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 550;
  z-index: 50;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
}

.toast.ok { background: var(--ok); color: #fff; }
.toast.err { background: var(--danger); color: #fff; }

@media (max-width: 900px) {
  .checkin-form, .upload-form { grid-template-columns: repeat(2, 1fr); }
  .field.wide { grid-column: span 2; }
  .nav { flex-wrap: wrap; gap: 12px; }
}
