:root {
  --bg: #f4f0ea;
  --bg-accent: #f7f4ef;
  --ink: #1c1b1a;
  --muted: #5e5a55;
  --card: #fbfaf8;
  --stroke: #ded8cf;
  --available: #128a43;
  --in-use: #d11f1f;
  --blocked: #6e6a65;
  --shadow: rgba(36, 30, 18, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Avenir Next", "Avenir", "Gill Sans", "Helvetica Neue", "Segoe UI", sans-serif;
  color: var(--ink);
  background: #ffffff;
  padding: 32px clamp(20px, 4vw, 48px) 64px;
}

h1, h2 {
  margin: 0;
  font-weight: 700;
}

h1 {
  font-size: clamp(2rem, 3.6vw, 3.4rem);
}

h2 {
  font-size: 1.35rem;
}

p {
  margin: 0;
}

.hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 32px;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.7rem;
  color: var(--muted);
  margin-bottom: 12px;
}

.hero-logo {
  display: block;
  width: 160px;
  height: auto;
  margin: 0 0 16px;
}

.subtitle {
  margin-top: 12px;
  font-size: 1rem;
  color: var(--muted);
}

.hero-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
  margin-top: 12px;
}

.user-control {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--stroke);
  background: white;
  padding: 8px 12px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 8px 16px -14px var(--shadow);
  font-size: 0.85rem;
}

.user-icon {
  display: inline-flex;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #1c1b1a;
  color: white;
  align-items: center;
  justify-content: center;
}

.user-icon svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.user-name {
  font-weight: 600;
  color: var(--ink);
}

.status-counts {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.count-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  border: 1px solid currentColor;
  background: white;
}

.count-available {
  color: var(--available);
}

.count-in-use {
  color: var(--in-use);
}

.count-blocked {
  color: var(--blocked);
}

.refresh-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  color: var(--muted);
}

.refresh-spinner {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid rgba(28, 27, 26, 0.2);
  border-top-color: rgba(28, 27, 26, 0.7);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.refresh-indicator.is-refreshing .refresh-spinner {
  opacity: 1;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.legend-item {
  font-size: 0.75rem;
  padding: 6px 10px;
}

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

.card {
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 12px 24px -20px var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.card.status-card-available {
  background: #e6f7ee;
  border-color: rgba(18, 138, 67, 0.35);
}

.card.status-card-in-use {
  background: #ffe5e5;
  border-color: rgba(209, 31, 31, 0.35);
}

.card.status-card-blocked {
  background: #f2f1ef;
  border-color: rgba(110, 106, 101, 0.35);
}

.card.status-card-unknown {
  background: var(--card);
}

.card-header {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.card-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.card-title-row h2 {
  margin: 0;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.muted {
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 6px;
}

.last-update {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  width: 100%;
  justify-content: space-between;
}

.last-update .muted {
  white-space: nowrap;
  margin-top: 0;
}

.text-button {
  border: 1px solid var(--stroke);
  background: white;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: none;
  letter-spacing: 0;
  box-shadow: 0 6px 12px -10px var(--shadow);
  transition: transform 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}

.text-button:hover {
  transform: translateY(-1px);
  color: var(--ink);
  border-color: rgba(28, 27, 26, 0.4);
}

.status {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  border: 1px solid currentColor;
  background: var(--bg-accent);
  white-space: nowrap;
}

.status-available {
  color: var(--available);
}

.status-in-use {
  color: var(--in-use);
}

.status-blocked {
  color: var(--blocked);
}

.status-unknown {
  color: var(--muted);
}

.card-body {
  display: grid;
  gap: 10px;
  font-size: 0.95rem;
  flex: 1;
}

.card-actions {
  margin-top: auto;
  display: flex;
  justify-content: stretch;
}

.message {
  line-height: 1.45;
}

.message.is-hidden,
.eta.is-hidden {
  display: none;
}

.eta span {
  font-weight: 600;
}

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

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

.user.is-hidden {
  display: none;
}

.update-form {
  display: grid;
  gap: 10px;
  margin-top: auto;
}

.update-form label {
  display: grid;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--muted);
}

.update-form input,
.update-form select,
.update-form textarea {
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--stroke);
  background: white;
  font-size: 0.9rem;
}

.update-form textarea {
  resize: vertical;
  min-height: 84px;
  font-family: inherit;
}

.update-form input:disabled,
.update-form textarea:disabled {
  background: #f1ede7;
  color: var(--muted);
}

.update-form button {
  padding: 10px 12px;
  border-radius: 10px;
  border: none;
  background: #3b3836;
  color: white;
  font-weight: 400;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.update-form button:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 12px -8px var(--shadow);
}

.update-button {
  width: 100%;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--stroke);
  background: white;
  color: var(--muted);
  font-weight: 500;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, color 0.12s ease;
}

.update-button:hover {
  transform: translateY(-1px);
  color: var(--ink);
  box-shadow: 0 6px 12px -10px var(--shadow);
}

.history-button {
  border: 1px solid var(--stroke);
  background: white;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
}

.history-panel {
  display: none;
}

.modal-body ul {
  list-style: none;
  padding: 12px 0 0;
  margin: 0;
  display: grid;
  gap: 10px;
}

.modal-body li {
  display: grid;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--muted);
  border: 1px solid var(--stroke);
  border-radius: 12px;
  padding: 10px;
  background: var(--bg-accent);
}

.history-empty {
  text-align: center;
  font-style: italic;
}

.history-text {
  color: var(--ink);
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 20;
}

.modal.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 18, 16, 0.45);
}

.modal-card {
  position: relative;
  background: var(--card);
  border-radius: 18px;
  padding: 20px;
  width: min(560px, 92vw);
  border: 1px solid var(--stroke);
  box-shadow: 0 20px 50px -30px rgba(16, 12, 8, 0.7);
  max-height: 80vh;
  overflow: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.modal-header h3 {
  margin: 0;
  font-size: 1.1rem;
}

.modal-close {
  border: 1px solid var(--stroke);
  background: white;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: pointer;
}

.modal-body h3 {
  display: none;
}

.modal-note {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.9rem;
}

.update-warning {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #fff5e6;
  color: #7a4b00;
  border: 1px solid rgba(122, 75, 0, 0.2);
  font-size: 0.85rem;
}

.update-warning.is-hidden {
  display: none;
}

.user-field input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--stroke);
  background: white;
  font-size: 1rem;
}

.user-save {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  border: none;
  background: #1c1b1a;
  color: white;
  font-weight: 600;
  cursor: pointer;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.history-eta,
.history-time {
  font-size: 0.75rem;
}

@media (max-width: 720px) {
  .hero {
    flex-direction: column;
    align-items: stretch;
  }
}
