:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --text: #1a2332;
  --muted: #5c6b7a;
  --line: #d8dee6;
  --accent: #1e4d78;
  --accent-hover: #163a5c;
  --success: #2e7d4f;
  --warning: #b45309;
  --danger: #b42318;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  line-height: 1.5;
}

.app-header {
  align-items: center;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  padding: 0.875rem 2rem;
}

.brand {
  color: var(--accent);
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.app-main {
  margin: 0 auto;
  max-width: 1200px;
  padding: 2rem;
}

.page-title {
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 0.35rem;
}

.page-subtitle {
  color: var(--muted);
  font-size: 0.95rem;
  margin: 0 0 1.5rem;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 1rem;
  padding: 1.25rem;
}

.nav-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin-top: 1.5rem;
}

.nav-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  display: block;
  font-weight: 600;
  padding: 1.25rem 1.5rem;
  text-align: center;
  text-decoration: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.nav-card:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(30, 77, 120, 0.1);
}

.metrics-row {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin-bottom: 1.5rem;
}

.metric-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1.25rem;
}

.metric-card h3 {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  margin: 0 0 0.5rem;
  text-transform: uppercase;
}

.metric-value {
  font-size: 1.75rem;
  font-weight: 700;
  margin: 0;
}

.alert-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.alert-item {
  border-left: 3px solid var(--accent);
  margin-bottom: 0.5rem;
  padding: 0.5rem 0.75rem;
}

.alert-item.warning {
  background: #fffbeb;
  border-left-color: var(--warning);
}

.alert-item.info {
  background: #eff6ff;
  border-left-color: var(--accent);
}

.facility-layout {
  align-items: start;
  display: grid;
  gap: 1.5rem;
  grid-template-columns: 220px minmax(0, 1fr);
}

.facility-layout > aside {
  justify-self: start;
  max-width: 220px;
  width: 100%;
}

.facility-layout > section {
  min-width: 0;
}

@media (max-width: 768px) {
  .facility-layout {
    grid-template-columns: 1fr;
  }

  .facility-layout > aside {
    max-width: none;
  }
}

.text-link {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

.text-link-btn {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  margin-top: 0.5rem;
  padding: 0;
  width: auto;
}

.muted {
  color: var(--muted);
  font-size: 0.9rem;
}

.field-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin: 1rem 0 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.booking-panel {
  max-width: 560px;
}

.slot-grid {
  display: grid;
  gap: 0.4rem;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
}

.slot-btn {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  cursor: pointer;
  font-size: 0.8rem;
  padding: 0.45rem 0.35rem;
  width: auto;
}

.slot-btn:hover {
  border-color: var(--accent);
}

.slot-btn.is-selected {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.duration-row {
  align-items: center;
  display: flex;
  gap: 1rem;
}

.duration-row input[type="range"] {
  flex: 1;
  width: auto;
}

.duration-display {
  font-size: 0.95rem;
  font-weight: 600;
  min-width: 5rem;
}

.select-input,
.date-input {
  max-width: 100%;
  width: 100%;
}

.booking-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.booking-list-header {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: space-between;
}

.booking-time {
  font-size: 0.95rem;
  margin: 0.5rem 0 0;
}

.cancel-form {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.cancel-form .select-input {
  flex: 1;
  min-width: 200px;
  width: auto;
}

.lookup-section {
  border-top: 2px solid var(--line);
  margin-top: 2rem;
  padding-top: 1.5rem;
}

.lookup-grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  margin-top: 1rem;
}

.filter-panel h3 {
  font-size: 0.85rem;
  font-weight: 600;
  margin: 1rem 0 0.5rem;
  text-transform: uppercase;
}

.filter-panel h3:first-child {
  margin-top: 0;
}

.filter-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
  cursor: pointer;
}

.filter-option input[type="checkbox"] {
  flex-shrink: 0;
  width: auto;
  margin: 0;
  padding: 0;
  cursor: pointer;
}

.facility-grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.facility-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.facility-card-image {
  align-items: center;
  background: #e8edf2;
  color: var(--muted);
  display: flex;
  font-size: 0.85rem;
  height: 140px;
  justify-content: center;
}

.facility-card-image img {
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.facility-card-body {
  padding: 1rem;
}

.facility-card-body h3 {
  font-size: 1.1rem;
  margin: 0 0 0.35rem;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.5rem;
}

.tag {
  background: #eef2f6;
  border-radius: 4px;
  color: var(--muted);
  font-size: 0.75rem;
  padding: 0.15rem 0.45rem;
}

.auth-panel {
  max-width: 420px;
}

.grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

label {
  display: block;
  margin-bottom: 1rem;
}

input,
textarea,
select,
button,
.button {
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
  padding: 0.65rem 0.75rem;
  width: 100%;
}

button,
.button {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
  cursor: pointer;
  display: inline-block;
  text-decoration: none;
  width: auto;
}

button:hover,
.button:hover {
  background: var(--accent-hover);
}

.button-secondary {
  background: var(--surface);
  border-color: var(--line);
  color: var(--text);
}

.button-danger {
  background: var(--danger);
  border-color: var(--danger);
}

table {
  background: var(--surface);
  border-collapse: collapse;
  width: 100%;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 0.75rem;
  text-align: left;
}

.flash {
  border-radius: 6px;
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
}

.flash-success {
  background: #ecfdf3;
  border: 1px solid #bbf7d0;
}

.flash-error {
  background: #fff1f0;
  border: 1px solid #ffccc7;
}

.flash-info {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
}

.status-active {
  color: var(--success);
  font-weight: 600;
}

.status-cancelled {
  color: var(--muted);
  font-weight: 600;
}

.badge {
  border-radius: 4px;
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  text-transform: uppercase;
}

.badge-active {
  background: #ecfdf3;
  color: var(--success);
}

.badge-inactive {
  background: #fef2f2;
  color: var(--danger);
}