:root {
  --bg: #eef3f4;
  --ink: #172026;
  --muted: #64717a;
  --line: #dde5e9;
  --brand: #0a7d76;
  --brand-dark: #064b49;
  --panel: #ffffff;
  --warn: #8a5600;
  --good: #0f7a45;
  --busy: #9b3d1c;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
a { color: inherit; text-decoration: none; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 18px;
  color: #fff;
  background: var(--brand-dark);
}
.topbar h1 { margin: 0; font-size: 20px; letter-spacing: 0; }
.topbar span { color: #cbe2e0; font-size: 13px; }
.topbar nav { display: flex; gap: 10px; align-items: center; }
.topbar a {
  min-width: 58px;
  padding: 9px 10px;
  text-align: center;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 6px;
}

.wrap { max-width: 1220px; margin: 0 auto; padding: 16px; }
.sync-status {
  margin-bottom: 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--muted);
}
.sync-status.warn { color: var(--warn); background: #fff8e8; }

.stats {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.stats article, .panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}
.stats article { padding: 14px; }
.stats span { display: block; color: var(--muted); font-size: 13px; }
.stats strong { display: block; margin-top: 8px; font-size: clamp(18px, 2vw, 23px); }

.quick-tabs {
  position: sticky;
  top: 68px;
  z-index: 4;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 8px 0 14px;
  margin-bottom: 4px;
  background: var(--bg);
}
.quick-tabs a {
  flex: 0 0 auto;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--brand-dark);
  font-weight: 700;
  font-size: 13px;
}

.grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}
.panel { overflow: hidden; margin-bottom: 16px; }
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.panel h2 { margin: 0; font-size: 18px; }
.panel-head input {
  width: min(260px, 100%);
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
}
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 680px; }
.compact table { min-width: 420px; }
th, td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
  font-size: 14px;
}
th { color: var(--muted); background: #fbfcfc; font-weight: 700; }
tr:last-child td { border-bottom: 0; }

.room-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  padding: 14px;
}
.room-card {
  display: grid;
  gap: 5px;
  min-height: 104px;
  padding: 12px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--muted);
  border-radius: 8px;
  background: #fbfcfc;
}
.room-card strong { font-size: 18px; }
.room-card span, .room-card small { color: var(--muted); }
.room-card em {
  align-self: end;
  font-style: normal;
  font-weight: 700;
}
.room-card.ok { border-left-color: var(--good); }
.room-card.ok em { color: var(--good); }
.room-card.busy { border-left-color: var(--busy); }
.room-card.busy em { color: var(--busy); }

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  background: linear-gradient(135deg, #e8f3f2, #f6f0df);
}
.login-box {
  width: min(390px, 100%);
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 50px rgba(20, 32, 38, .12);
}
.login-box h1 { margin: 0 0 6px; font-size: 24px; }
.login-box p { margin: 0 0 18px; color: var(--muted); }
.login-box label { display: block; margin: 13px 0; font-weight: 700; }
.login-box input {
  width: 100%;
  margin-top: 6px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
}
button {
  width: 100%;
  margin-top: 10px;
  padding: 12px;
  border: 0;
  border-radius: 6px;
  color: #fff;
  background: var(--brand);
  font-weight: 700;
}
.alert {
  padding: 10px 12px;
  border-radius: 6px;
  color: #8a1f11;
  background: #ffeceb;
}

@media (max-width: 900px) {
  .topbar { align-items: flex-start; flex-direction: column; gap: 10px; }
  .topbar nav { width: 100%; overflow-x: auto; }
  .topbar a { min-width: auto; white-space: nowrap; }
  .quick-tabs { top: 110px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid { grid-template-columns: 1fr; }
  .panel-head { align-items: flex-start; flex-direction: column; }
  .panel-head input { width: 100%; }
  th, td { padding: 10px; font-size: 13px; }
}

@media (max-width: 520px) {
  .wrap { padding: 10px; }
  .topbar { padding: 12px; }
  .topbar h1 { font-size: 18px; }
  .stats { gap: 8px; }
  .stats article { padding: 11px; }
  .stats span { font-size: 12px; }
  .stats strong { font-size: 18px; }
  .room-grid { grid-template-columns: 1fr; padding: 10px; }
}
