* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

:root {
  color-scheme: light;
  --bg: #f7f5ef;
  --bg-soft: #ebe7dc;
  --surface: #fffdf8;
  --surface-strong: #ffffff;
  --text: #18211f;
  --muted: #66716d;
  --muted-strong: #47534f;
  --border: rgba(24, 33, 31, 0.13);
  --border-strong: rgba(24, 33, 31, 0.2);
  --glass: rgba(255, 253, 248, 0.78);
  --shadow: 0 16px 36px rgba(30, 42, 38, 0.12);
  --shadow-soft: 0 8px 20px rgba(30, 42, 38, 0.08);
  --primary: #0f766e;
  --primary-strong: #115e59;
  --primary-soft: rgba(15, 118, 110, 0.12);
  --accent: #b45309;
  --accent-soft: rgba(180, 83, 9, 0.12);
  --ok: #047857;
  --warn: #b45309;
  --bad: #b91c1c;
  --radius: 8px;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #141612;
    --bg-soft: #1d201a;
    --surface: #20231d;
    --surface-strong: #252920;
    --text: #f4f1e8;
    --muted: #b4b0a4;
    --muted-strong: #d2cec1;
    --border: rgba(244, 241, 232, 0.13);
    --border-strong: rgba(244, 241, 232, 0.22);
    --glass: rgba(32, 35, 29, 0.78);
    --shadow: 0 16px 36px rgba(0, 0, 0, 0.28);
    --shadow-soft: 0 8px 20px rgba(0, 0, 0, 0.2);
    --primary: #2dd4bf;
    --primary-strong: #5eead4;
    --primary-soft: rgba(45, 212, 191, 0.12);
    --accent: #f59e0b;
    --accent-soft: rgba(245, 158, 11, 0.14);
    --ok: #34d399;
    --warn: #f59e0b;
    --bad: #f87171;
  }
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(15, 118, 110, 0.08), transparent 220px),
    linear-gradient(90deg, rgba(24, 33, 31, 0.035) 1px, transparent 1px),
    linear-gradient(180deg, rgba(24, 33, 31, 0.035) 1px, transparent 1px),
    var(--bg);
  background-size: auto, 48px 48px, 48px 48px, auto;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

a {
  color: inherit;
}

.container,
.wrap {
  width: min(100%, 1060px);
  margin: 0 auto;
  padding: 18px 14px 24px;
}

.container {
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 18px;
}

.adminContainer {
  display: block;
  min-height: auto;
}

.adminContainer .nav {
  margin-bottom: 18px;
}

.siteFooter {
  width: min(100%, 1060px);
  margin: 16px auto 24px;
  padding: 0 14px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.nav {
  min-height: 52px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.brandMark {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border-radius: var(--radius);
  color: #ffffff;
  background: var(--primary);
  font-weight: 950;
  box-shadow: var(--shadow-soft);
}

.brandName,
.navPrimary {
  display: block;
  color: var(--text);
  font-size: 15px;
  font-weight: 900;
  line-height: 1.15;
}

.brandSub,
.navSecondary {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
}

.navTitle {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.navRight {
  margin-left: auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.navRight form {
  margin: 0;
}

.navLink,
.linkbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 8px 11px;
  color: var(--text);
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  font-size: 13px;
  font-weight: 850;
  text-decoration: none;
  white-space: nowrap;
  backdrop-filter: blur(10px);
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  max-width: min(52vw, 420px);
  padding: 6px 10px;
  overflow: hidden;
  color: var(--muted-strong);
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
  backdrop-filter: blur(10px);
}

.pill.strong {
  color: var(--primary-strong);
  background: var(--primary-soft);
  border-color: rgba(15, 118, 110, 0.18);
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  max-width: 760px;
  font-size: clamp(30px, 5vw, 56px);
  line-height: 1.02;
  font-weight: 950;
}

h2 {
  font-size: 15px;
  font-weight: 900;
}

.desc {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.eyebrow {
  margin-bottom: 8px;
  color: var(--primary-strong);
  font-size: 12px;
  font-weight: 950;
}

.hero,
.roomIntro {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin: 24px 0 18px;
}

.compactHero h1 {
  font-size: clamp(28px, 4vw, 44px);
}

.summaryTile {
  width: 128px;
  min-height: 96px;
  display: grid;
  align-content: center;
  gap: 2px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

.summaryNum {
  font-size: 34px;
  font-weight: 950;
  line-height: 1;
}

.summaryLabel {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.panel,
.card,
.statusCard {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.panel {
  padding: 16px;
}

.panelNarrow {
  width: min(100%, 520px);
  margin: 0 auto;
}

.searchPanel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.searchHint {
  grid-column: 1 / -1;
}

.field {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.field.grow {
  flex: 1;
}

.label,
.sectionTitle {
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 900;
}

.input {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  padding: 10px 12px;
  color: var(--text);
  background: var(--surface-strong);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  outline: none;
  font-size: 14px;
  transition: border-color 150ms ease, box-shadow 150ms ease, background-color 150ms ease;
}

.input::placeholder {
  color: rgba(102, 113, 109, 0.72);
}

.input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-soft);
}

.select {
  min-width: 160px;
}

.btnPrimary,
.btnSecondary,
.btn,
.toastBtn {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  font-weight: 900;
  line-height: 1.1;
  white-space: nowrap;
  transition: transform 150ms ease, border-color 150ms ease, background-color 150ms ease, opacity 150ms ease;
}

.btnPrimary,
.btn {
  color: #ffffff;
  background: var(--primary);
  box-shadow: 0 12px 22px rgba(15, 118, 110, 0.22);
}

.btnSecondary,
.btn.subtle,
.toastBtn {
  color: var(--text);
  background: var(--surface-strong);
  border-color: var(--border-strong);
}

.btnPrimary:hover,
.btnSecondary:hover,
.btn:hover,
.toastBtn:hover,
.navLink:hover,
.card:hover {
  transform: translateY(-1px);
}

.btn:disabled,
.btnPrimary:disabled,
.btnSecondary:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

.hint {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.45;
}

.inlineLink {
  color: var(--primary-strong);
  text-decoration: none;
  border-bottom: 1px solid rgba(15, 118, 110, 0.3);
}

.sectionHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 22px 0 10px;
}

.grid,
.grid2 {
  display: grid;
  gap: 12px;
}

.grid {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.grid2 {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.card {
  min-height: 96px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px;
  transition: transform 150ms ease, box-shadow 150ms ease;
}

.link {
  color: inherit;
  text-decoration: none;
}

.name {
  margin-bottom: 6px;
  font-size: 18px;
  font-weight: 950;
}

.meta {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.roomArrow {
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  color: var(--primary-strong);
  background: var(--primary-soft);
  border-radius: 999px;
  font-weight: 950;
}

.emptyState {
  padding: 18px;
  color: var(--muted);
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  font-weight: 800;
}

.row {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.formRow {
  align-items: end;
}

.spacer {
  flex: 1;
}

.roomMain {
  display: grid;
  align-content: start;
  gap: 14px;
}

.statusCard {
  overflow: hidden;
}

.statusHeader {
  display: grid;
  gap: 12px;
  padding: 20px;
  background: linear-gradient(180deg, rgba(15, 118, 110, 0.08), transparent);
  border-bottom: 1px solid var(--border);
}

.statusBadge {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 7px 11px;
  color: var(--primary-strong);
  background: var(--primary-soft);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 950;
  transition: background-color 180ms ease, color 180ms ease;
}

.statusValue {
  min-height: 64px;
  display: flex;
  align-items: center;
  color: var(--primary-strong);
  font-size: clamp(52px, 12vw, 86px);
  font-weight: 950;
  line-height: 0.96;
  overflow-wrap: anywhere;
  transition: color 180ms ease;
}

.statusHint {
  min-height: 24px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 800;
  line-height: 1.45;
}

.statusMeta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  background: var(--border);
}

.metaRow {
  min-height: 62px;
  display: grid;
  align-content: center;
  gap: 5px;
  padding: 13px 16px;
  background: var(--surface);
}

.statusMeta .metaRow:last-child:nth-child(odd) {
  grid-column: 1 / -1;
}

.metaKey {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.metaVal {
  min-width: 0;
  color: var(--text);
  font-size: 13px;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.statusCard[data-state="idle"] .statusBadge {
  color: var(--ok);
  background: rgba(4, 120, 87, 0.12);
}

.statusCard[data-state="idle"] .statusValue {
  color: var(--ok);
}

.statusCard[data-state="busy"] .statusBadge {
  color: var(--warn);
  background: var(--accent-soft);
}

.statusCard[data-state="busy"] .statusValue {
  color: var(--warn);
}

.statusCard[data-state="error"] .statusBadge {
  color: var(--bad);
  background: rgba(185, 28, 28, 0.1);
}

.statusCard[data-state="error"] .statusValue {
  color: var(--bad);
  font-size: clamp(38px, 9vw, 66px);
}

.statusCard[data-state="loading"] .statusBadge {
  color: var(--primary-strong);
  background: var(--primary-soft);
}

.actionBar {
  position: sticky;
  bottom: 10px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 10px;
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.actionBar[data-mode="tracking"] {
  grid-template-columns: 1fr;
}

.toast,
.globalToast {
  position: fixed;
  z-index: 60;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.toast {
  left: 12px;
  right: 12px;
  bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
}

.toastText,
.globalToastText {
  color: var(--text);
  font-size: 13px;
  font-weight: 900;
}

.toastActions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toastBtn {
  min-height: 38px;
}

.toastBtnPrimary {
  color: #ffffff;
  background: var(--primary);
  border-color: transparent;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: currentColor;
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.13);
}

.skeletonLine {
  display: inline-block;
  width: 140px;
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(148, 140, 122, 0.24) 0%, rgba(148, 140, 122, 0.12) 35%, rgba(148, 140, 122, 0.24) 70%);
  background-size: 300% 100%;
  animation: shimmer 1.2s ease-in-out infinite;
}

.skeletonSmall {
  width: 120px;
  height: 12px;
}

.skeletonBig {
  width: min(100%, 220px);
  height: 54px;
  border-radius: var(--radius);
}

@keyframes shimmer {
  0% { background-position: 0% 0%; }
  100% { background-position: 100% 0%; }
}

.statusCard[data-state="loading"] .dot {
  animation: pulse 1.2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 0.72; }
  50% { transform: scale(1.25); opacity: 1; }
}

.textDanger {
  color: var(--bad);
  font-weight: 900;
}

.sectionTitle {
  margin-bottom: 12px;
}

.kv {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
}

.kv .k {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.kv .v {
  min-width: 0;
  color: var(--text);
  font-size: 12px;
  font-weight: 900;
  overflow-wrap: anywhere;
  text-align: right;
}

.auditList {
  margin-top: 10px;
  display: grid;
  gap: 8px;
}

.auditItem {
  padding: 10px;
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.auditTop {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.auditAction {
  color: var(--text);
  font-size: 13px;
  font-weight: 900;
}

.auditMeta {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  overflow-wrap: anywhere;
}

.badgeOk,
.badgeNo {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 950;
}

.badgeOk {
  color: var(--ok);
  background: rgba(4, 120, 87, 0.11);
  border: 1px solid rgba(4, 120, 87, 0.2);
}

.badgeNo {
  color: var(--bad);
  background: rgba(185, 28, 28, 0.1);
  border: 1px solid rgba(185, 28, 28, 0.2);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 70;
  padding: 16px;
}

.modalMask {
  position: absolute;
  inset: 0;
  background: rgba(11, 18, 16, 0.56);
  backdrop-filter: blur(3px);
}

.modalPanel {
  position: relative;
  z-index: 1;
  width: min(100%, 420px);
  margin: 14vh auto 0;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  animation: popIn 0.16s ease-out;
}

@keyframes popIn {
  from { transform: translateY(10px) scale(0.98); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

.modalTitle {
  margin-bottom: 5px;
  color: var(--text);
  font-size: 17px;
  font-weight: 950;
}

.modalDesc {
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
  line-height: 1.5;
}

.modalInput {
  width: 100%;
}

.modalActions {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.globalToast {
  top: 14px;
  left: 50%;
  padding: 10px 12px;
  opacity: 0;
  transform: translateX(-50%) translateY(-6px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.globalToast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.globalToast[data-type="error"] {
  border-color: rgba(185, 28, 28, 0.28);
}

.globalToast[data-type="ok"] {
  border-color: rgba(4, 120, 87, 0.28);
}

@media (max-width: 720px) {
  .container,
  .wrap {
    padding: 14px 12px 20px;
  }

  .nav {
    align-items: flex-start;
  }

  .navRight {
    flex-wrap: wrap;
  }

  .pill {
    max-width: 100%;
  }

  .hero,
  .roomIntro {
    display: grid;
    align-items: start;
    margin-top: 18px;
  }

  .summaryTile {
    width: 100%;
    min-height: 76px;
    grid-template-columns: auto 1fr;
    align-items: end;
    align-content: center;
    column-gap: 10px;
  }

  .searchPanel {
    grid-template-columns: 1fr;
  }

  .btnPrimary,
  .btnSecondary,
  .btn,
  .toastBtn {
    width: 100%;
  }

  .statusHeader {
    padding: 18px 16px;
  }

  .statusMeta {
    grid-template-columns: 1fr;
  }

  .actionBar {
    grid-template-columns: 1fr 1fr;
  }

  .actionBar > :nth-child(3) {
    grid-column: 1 / -1;
  }

  .toast {
    bottom: 94px;
  }
}

@media (min-width: 900px) {
  .container {
    padding-top: 22px;
    padding-bottom: 34px;
  }

  .roomMain {
    align-content: center;
  }

  .statusCard {
    max-width: 780px;
    width: 100%;
    justify-self: center;
  }

  .actionBar {
    position: static;
    width: min(100%, 560px);
    justify-self: end;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
