/* ------------------------------------------------------------------
   New Horizons Check-In — staff & admin interface
   Calm, clinical, quiet chrome; the data is the loud part.
   ------------------------------------------------------------------ */

:root {
  --bg: #f6f8f7;
  --surface: #ffffff;
  --surface-2: #fbfcfb;
  --ink: #16211f;
  --ink-2: #56605d;
  --ink-3: #8b938f;
  --hairline: #e3e8e6;
  --hairline-2: #eef1f0;

  --brand: #0e7268;          /* deep teal */
  --brand-strong: #0a5c54;
  --brand-soft: #e4f2f0;
  --brand-softer: #f1f8f7;

  --good: #0c7c34;
  --good-soft: #e7f5ec;
  --warn: #9a6700;
  --warn-soft: #fdf3dd;
  --bad: #b3383d;
  --bad-soft: #fbeaea;
  --info-soft: #e8f0fa;
  --info: #2a5da8;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(22, 33, 31, .05), 0 4px 16px rgba(22, 33, 31, .05);
  --shadow-lg: 0 2px 4px rgba(22, 33, 31, .06), 0 12px 32px rgba(22, 33, 31, .10);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html { height: 100%; }
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  font-size: 14.5px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

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

/* ---------------- shell ---------------- */

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

.sidebar {
  width: 232px;
  flex-shrink: 0;
  background: linear-gradient(180deg, #0d3d3c 0%, #0e4f49 60%, #0e5c50 100%);
  color: #e9f3f1;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px 16px;
  color: #fff;
}
.sidebar .brand svg { width: 30px; height: 30px; flex-shrink: 0; }
.sidebar .brand .brand-name { font-weight: 650; font-size: 15px; letter-spacing: .01em; line-height: 1.2; }
.sidebar .brand .brand-sub { font-size: 11px; color: #a9ccc5; font-weight: 500; letter-spacing: .04em; text-transform: uppercase; }

.nav-section { padding: 10px 10px; }
.nav-label {
  font-size: 10.5px;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: #8fb8b0;
  padding: 12px 10px 6px;
  font-weight: 600;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 9px;
  color: #d3e6e2;
  font-weight: 500;
  margin-bottom: 2px;
}
.nav-item svg { width: 17px; height: 17px; opacity: .85; }
.nav-item:hover { background: rgba(255, 255, 255, .08); color: #fff; text-decoration: none; }
.nav-item.active { background: rgba(255, 255, 255, .14); color: #fff; }

.sidebar .foot { margin-top: auto; padding: 14px; font-size: 12px; color: #9dc3bc; }

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

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 28px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(6px);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar h1 { font-size: 18px; margin: 0; font-weight: 650; letter-spacing: -0.01em; }
.topbar .who { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--ink-2); }
.topbar .avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--brand-soft); color: var(--brand-strong);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 650; font-size: 12.5px;
}

.content { padding: 10px 28px 48px; max-width: 1240px; width: 100%; }

/* ---------------- cards & tiles ---------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 18px; }
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 20px 0;
}
.card-head h2 { font-size: 15px; margin: 0; font-weight: 650; }
.card-head .sub { color: var(--ink-3); font-size: 12.5px; margin-top: 2px; }
.card-body { padding: 16px 20px 20px; }

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
  margin: 16px 0 20px;
}
.tile {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px 13px;
  position: relative;
  overflow: hidden;
}
.tile .t-label { font-size: 12.5px; color: var(--ink-2); font-weight: 550; display: flex; align-items: center; gap: 7px; }
.tile .t-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.tile .t-value { font-size: 30px; font-weight: 650; letter-spacing: -0.02em; margin-top: 4px; line-height: 1.1; }
.tile .t-sub { font-size: 12px; color: var(--ink-3); margin-top: 3px; }

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

.table-wrap { overflow-x: auto; }
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
table.data th {
  text-align: left;
  font-size: 11px;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 600;
  padding: 10px 12px;
  border-bottom: 1px solid var(--hairline);
  white-space: nowrap;
}
table.data td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--hairline-2);
  vertical-align: middle;
}
table.data tr:last-child td { border-bottom: none; }
table.data tr:hover td { background: var(--surface-2); }
td.num, th.num { font-variant-numeric: tabular-nums; }
.t-strong { font-weight: 600; }
.t-dim { color: var(--ink-3); font-size: 12.5px; }

.empty {
  text-align: center;
  color: var(--ink-3);
  padding: 42px 20px;
  font-size: 14px;
}
.empty .big { font-size: 34px; margin-bottom: 8px; }

/* ---------------- chips & badges ---------------- */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  padding: 3.5px 10px;
  white-space: nowrap;
}
.chip svg { width: 12px; height: 12px; }
.chip.checked { background: var(--good-soft); color: var(--good); }
.chip.waiting { background: var(--warn-soft); color: var(--warn); }
.chip.neutral { background: var(--hairline-2); color: var(--ink-2); }
.chip.brand { background: var(--brand-soft); color: var(--brand-strong); }
.chip.off { background: var(--bad-soft); color: var(--bad); }

.progress-pips { display: inline-flex; gap: 4px; align-items: center; }
.pip { width: 9px; height: 9px; border-radius: 50%; background: var(--hairline); }
.pip.done { background: var(--good); }
.pip.skip { background: var(--warn); }

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

label.f-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-2);
  margin: 0 0 5px;
}
.f-help { font-size: 12px; color: var(--ink-3); margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input[type=url],
input[type=number], select, textarea {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid #cdd6d3;
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  outline: none;
  transition: border-color .12s, box-shadow .12s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(14, 114, 104, .14);
}
.f-row { margin-bottom: 16px; }
.f-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 720px) { .f-grid { grid-template-columns: 1fr; } }

.switch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; }
.switch .track {
  width: 36px; height: 21px; border-radius: 999px; background: #ccd5d2;
  position: relative; transition: background .15s; flex-shrink: 0;
}
.switch .track::after {
  content: ""; position: absolute; top: 2.5px; left: 2.5px;
  width: 16px; height: 16px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .15s;
}
.switch input:checked + .track { background: var(--brand); }
.switch input:checked + .track::after { transform: translateX(15px); }
.switch input:focus-visible + .track { box-shadow: 0 0 0 3px rgba(14,114,104,.25); }

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font: inherit;
  font-weight: 600;
  font-size: 13.5px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  padding: 8.5px 15px;
  cursor: pointer;
  transition: background .12s, border-color .12s, color .12s;
  white-space: nowrap;
}
.btn svg { width: 15px; height: 15px; }
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-strong); }
.btn-ghost { background: transparent; color: var(--ink-2); border-color: #cdd6d3; }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn-soft { background: var(--brand-soft); color: var(--brand-strong); }
.btn-soft:hover { background: #d5eae7; }
.btn-danger-soft { background: var(--bad-soft); color: var(--bad); }
.btn-danger-soft:hover { background: #f5d9d9; }
.btn-sm { padding: 5.5px 11px; font-size: 12.5px; border-radius: 8px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

.row-actions { display: flex; gap: 8px; justify-content: flex-end; }

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

.alert {
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-size: 13.5px;
  margin: 0 0 16px;
  display: flex;
  gap: 9px;
  align-items: flex-start;
}
.alert svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px; }
.alert.ok { background: var(--good-soft); color: var(--good); }
.alert.err { background: var(--bad-soft); color: var(--bad); }
.alert.info { background: var(--info-soft); color: var(--info); }
.alert.warn { background: var(--warn-soft); color: var(--warn); }
.alert ul { margin: 0; padding-left: 18px; }

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

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(1100px 500px at 85% -10%, rgba(14, 114, 104, .16), transparent 60%),
    radial-gradient(900px 480px at -10% 110%, rgba(42, 93, 168, .10), transparent 55%),
    var(--bg);
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  padding: 34px 34px 30px;
}
.login-card .mark { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.login-card .mark svg { width: 40px; height: 40px; }
.login-card h1 { font-size: 19px; margin: 0; letter-spacing: -0.01em; }
.login-card .sub { color: var(--ink-3); font-size: 13px; margin-top: 2px; }

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

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 14px 0 18px; flex-wrap: wrap; }
.page-head h1 { font-size: 21px; font-weight: 650; margin: 0; letter-spacing: -0.015em; }
.page-head .sub { color: var(--ink-2); font-size: 13.5px; margin-top: 3px; }

.seg {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
  box-shadow: var(--shadow);
  flex-wrap: wrap;
}
.seg a {
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
}
.seg a:hover { text-decoration: none; color: var(--ink); }
.seg a.active { background: var(--brand); color: #fff; }

.kv { display: grid; grid-template-columns: 190px 1fr; gap: 7px 16px; font-size: 13.5px; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; font-weight: 550; word-break: break-all; }

.code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  border-radius: 7px;
  padding: 2px 7px;
}
.bigcode {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: .22em;
  background: var(--brand-softer);
  border: 1px dashed #b5d4cf;
  color: var(--brand-strong);
  border-radius: 10px;
  padding: 10px 16px;
  display: inline-block;
}

.search-input { max-width: 260px; }

.muted-block {
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 13px;
  color: var(--ink-2);
}

.pulse-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); display: inline-block; }
.pulse-dot.live { animation: pulse 2s infinite; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(12, 124, 52, .35); }
  70% { box-shadow: 0 0 0 7px rgba(12, 124, 52, 0); }
  100% { box-shadow: 0 0 0 0 rgba(12, 124, 52, 0); }
}

.survey-assign { border: 1px solid var(--hairline); border-radius: var(--radius-sm); overflow: hidden; }
.survey-assign .sa-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--hairline-2);
  background: var(--surface);
}
.survey-assign .sa-row:last-child { border-bottom: none; }
.survey-assign .sa-row.unassigned { background: var(--surface-2); color: var(--ink-2); }
.sa-order { display: flex; flex-direction: column; gap: 2px; }
.sa-order button {
  border: 1px solid var(--hairline); background: var(--surface); border-radius: 5px;
  width: 22px; height: 18px; line-height: 1; font-size: 10px; color: var(--ink-2); cursor: pointer;
}
.sa-order button:hover { background: var(--brand-soft); color: var(--brand-strong); }

@media (max-width: 900px) {
  .sidebar { position: fixed; z-index: 50; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; }
  .content, .topbar { padding-left: 18px; padding-right: 18px; }
  .menu-toggle { display: inline-flex !important; }
}
.menu-toggle { display: none; background: none; border: none; cursor: pointer; padding: 6px; color: var(--ink); }
