@import url('https://fonts.googleapis.com/css2?family=Mitr:wght@200;400;500;600;700&display=swap');

/* ===== CSS Variables ===== */
:root {
  --green: #92D050;
  --orange: #FFC000;
  --yellow: #FFFF00;
  --blue: #00B0F0;
  --red: #ef4444;
  --bg: #0f172a;
  --card: #1e293b;
  --card2: #334155;
  --text: #f1f5f9;
  --text2: #94a3b8;
  --border: #475569;
  --sidebar-w: 260px;
  --detail-w: 420px;
  --header-h: 56px;
  --radius: 8px;
  --radius-sm: 6px;
  --transition: 0.25s ease;
}

/* ===== Reset & Base ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 14px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Mitr', 'Segoe UI', sans-serif;
  font-weight: 200;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text2); }

/* ===== Toast ===== */
.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  color: var(--text);
  background: var(--card2);
  border-left: 4px solid var(--green);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  transform: translateX(120%);
  transition: transform 0.3s ease;
  max-width: 360px;
}
.toast.show { transform: translateX(0); }
.toast.error { border-left-color: var(--red); }

/* ===== Header ===== */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-h);
  background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 100;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

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

.logo-icon {
  width: 32px;
  height: 32px;
  background: var(--green);
  color: var(--bg);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.2rem;
}

.logo-text {
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 1px;
  color: var(--green);
}

.header-title {
  color: var(--text2);
  font-size: 0.9rem;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

#headerUser {
  font-size: 0.82rem;
  color: var(--text2);
  display: flex;
  align-items: center;
  gap: 4px;
  padding-right: 8px;
  border-right: 1px solid var(--border);
  margin-right: 2px;
}

.header-date {
  color: var(--text2);
  font-size: 0.85rem;
  margin-right: 8px;
}

/* Nav links between services */
.nav-link-hk,
.nav-link-back {
  text-decoration: none;
}

/* ===== Responsive Nav Items ===== */
.nav-items {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  transition: background .15s, color .15s;
}
.nav-toggle:hover { background: var(--border); }
.nav-toggle .nav-icon-close { display: none; }
.nav-toggle.open .nav-icon-menu { display: none; }
.nav-toggle.open .nav-icon-close { display: block; }

.nav-divider {
  display: none;          /* visible only inside open dropdown */
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background: var(--green);
  color: var(--bg);
  font-weight: 600;
}
.btn-primary:hover { background: #a3e05f; transform: translateY(-1px); }

.btn-outline {
  background: transparent;
  color: var(--text2);
  border: 1px solid var(--border);
}
.btn-outline:hover { border-color: var(--text); color: var(--text); }

.btn-sm {
  padding: 4px 10px;
  font-size: 0.78rem;
}

.btn-danger {
  background: transparent;
  color: var(--red);
  border: 1px solid var(--red);
}
.btn-danger:hover { background: var(--red); color: #fff; }

/* ===== Layout ===== */
.layout {
  display: flex;
  margin-top: var(--header-h);
  min-height: calc(100vh - var(--header-h));
}

/* ===== Sidebar ===== */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--card);
  border-right: 1px solid var(--border);
  padding: 16px;
  overflow-y: auto;
  height: calc(100vh - var(--header-h));
  position: sticky;
  top: var(--header-h);
}

.sidebar-section {
  margin-bottom: 24px;
}

.sidebar-heading {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text2);
  margin-bottom: 12px;
}

/* Progress */
.progress-item {
  margin-bottom: 12px;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.progress-label-text {
  font-size: 0.82rem;
  color: var(--text);
}

.progress-pct {
  font-size: 0.78rem;
  color: var(--text2);
  font-weight: 600;
}

.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--card2);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.5s ease;
}

.progress-ee { background: var(--blue); }
.progress-san { background: var(--orange); }
.progress-ac { background: var(--green); }

/* Floor list */
.floor-list {
  list-style: none;
}

.floor-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition);
  font-size: 0.88rem;
}

.floor-item:hover { background: var(--card2); }
.floor-item.active { background: var(--card2); color: var(--green); font-weight: 600; }

.floor-item-name {
  display: flex;
  align-items: center;
  gap: 8px;
}

.floor-badge {
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 12px;
  background: rgba(146, 208, 80, 0.15);
  color: var(--green);
  font-weight: 600;
}

/* ===== Main Content ===== */
.main {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  height: calc(100vh - var(--header-h));
}

/* Stats bar */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  transition: transform var(--transition);
}
.stat-card:hover { transform: translateY(-2px); }

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.1;
}

.stat-label {
  font-size: 0.78rem;
  color: var(--text2);
  margin-top: 4px;
}

.stat-total .stat-value { color: var(--text); }
.stat-green .stat-value { color: var(--green); }
.stat-orange .stat-value { color: var(--orange); }
.stat-notstarted .stat-value { color: var(--text2); }

/* Tab bar */
.tab-bar {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
}

.tab {
  background: none;
  border: none;
  color: var(--text2);
  padding: 8px 20px;
  font-size: 0.9rem;
  font-family: inherit;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all var(--transition);
  margin-bottom: -1px;
}

.tab:hover { color: var(--text); }
.tab.active { color: var(--green); border-bottom-color: var(--green); font-weight: 600; }

/* Filter chips */
.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.chip {
  padding: 5px 14px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text2);
  font-size: 0.82rem;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
}

.chip:hover { border-color: var(--text); color: var(--text); }
.chip.active { background: var(--green); color: var(--bg); border-color: var(--green); font-weight: 600; }

/* ===== Content Area ===== */
.content-area {
  /* Grid or table view */
}

/* Floor section */
.floor-section {
  margin-bottom: 28px;
}

.floor-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.floor-section-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text2);
  white-space: nowrap;
}

.floor-room-count {
  font-weight: 400;
  font-size: 0.78rem;
  color: var(--text2);
  opacity: 0.7;
}

/* Per-floor system progress bars */
.floor-system-bars {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-shrink: 0;
}

.floor-sys-bar {
  display: flex;
  align-items: center;
  gap: 4px;
}

.floor-sys-label {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text2);
  width: 24px;
  text-align: right;
}

.floor-sys-track {
  width: 60px;
  height: 6px;
  background: var(--card2);
  border-radius: 3px;
  overflow: hidden;
}

.floor-sys-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.5s ease;
}

.floor-sys-ee { background: #60a5fa; }
.floor-sys-san { background: #34d399; }
.floor-sys-ac { background: #fbbf24; }

.floor-sys-pct {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text2);
  width: 28px;
}

@media (max-width: 768px) {
  .floor-section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
  .floor-system-bars {
    gap: 8px;
    flex-wrap: wrap;
  }
  .floor-sys-track { width: 40px; }
}

/* Sample toggle button */
.sample-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px 4px 6px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: var(--card2);
  color: var(--text2);
  cursor: pointer;
  font-size: 0.8rem;
  transition: all var(--transition);
}

.sample-toggle-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: transparent;
  transition: all var(--transition);
}

.sample-toggle.active {
  border-color: var(--blue);
  background: rgba(0,176,240,0.1);
  color: var(--blue);
}

.sample-toggle.active .sample-toggle-dot {
  background: var(--blue);
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(0,176,240,0.25);
}

.sample-toggle:hover {
  border-color: var(--blue);
  background: rgba(0,176,240,0.06);
}

/* Room grid */
.room-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 8px;
}

/* Room cell */
.room-cell {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 6px 8px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
}

.room-cell:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.3);
  border-color: var(--text2);
}

.room-cell.status-green {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}
.room-cell.status-green .room-type { color: rgba(255,255,255,0.75); }

.room-cell.status-orange {
  background: var(--orange);
  border-color: var(--orange);
  color: #fff;
}
.room-cell.status-orange .room-type { color: rgba(255,255,255,0.75); }

.room-cell.status-yellow {
  background: var(--yellow);
  border-color: var(--yellow);
  color: #1a1a2e;
}
.room-cell.status-yellow .room-type { color: rgba(0,0,0,0.55); }

.room-cell.status-not_started {
  background: var(--card);
  border-color: var(--border);
  opacity: 0.7;
}

.room-cell.is-sample {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}
.room-cell.is-sample .room-type { color: rgba(255,255,255,0.75); }

.room-number {
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 2px;
}

.room-type {
  font-size: 0.68rem;
  color: var(--text2);
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.room-dots {
  display: flex;
  justify-content: center;
  gap: 4px;
}

.room-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--card2);
  box-shadow: 0 0 0 1.5px rgba(0,0,0,0.3);
}

.room-dot.green { background: var(--green); }
.room-dot.orange { background: var(--orange); }
.room-dot.yellow { background: var(--yellow); }
.room-dot.not_started { background: var(--text2); opacity: 0.4; }

.room-comment-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--red);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text2);
}

.empty-state svg {
  margin-bottom: 16px;
  opacity: 0.4;
}

.empty-state p {
  font-size: 0.95rem;
}

/* ===== Table View ===== */
.table-wrapper {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.data-table th {
  text-align: left;
  padding: 10px 12px;
  background: var(--card);
  color: var(--text2);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 8px 12px;
  border-bottom: 1px solid rgba(71, 85, 105, 0.3);
  vertical-align: middle;
}

.data-table tr:hover td {
  background: rgba(30, 41, 59, 0.5);
}

.data-table tr {
  cursor: pointer;
}

.status-pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  text-align: center;
}

.status-pill.green { background: rgba(146,208,80,0.15); color: var(--green); }
.status-pill.orange { background: rgba(255,192,0,0.15); color: var(--orange); }
.status-pill.yellow { background: rgba(255,255,0,0.15); color: var(--yellow); }
.status-pill.not_started { background: rgba(148,163,184,0.15); color: var(--text2); }

/* ===== Detail Panel ===== */
.detail-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 199;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.detail-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.detail-panel {
  position: fixed;
  top: var(--header-h);
  right: 0;
  width: var(--detail-w);
  height: calc(100vh - var(--header-h));
  background: var(--card);
  border-left: 1px solid var(--border);
  z-index: 200;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.detail-panel.open {
  transform: translateX(0);
}

.detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.detail-title {
  font-size: 1.1rem;
  font-weight: 700;
}

.detail-close {
  background: none;
  border: none;
  color: var(--text2);
  font-size: 1.6rem;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all var(--transition);
}

.detail-close:hover { background: var(--card2); color: var(--text); }

.detail-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

/* Detail info section */
.detail-info {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 24px;
}

.detail-info-item {
  font-size: 0.82rem;
}

.detail-info-label {
  color: var(--text2);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.detail-info-value {
  font-weight: 600;
  margin-top: 2px;
}

/* System status rows */
.detail-section-title {
  font-size: 0.78rem;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.system-row {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 10px;
}

.system-row-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.system-name {
  font-weight: 600;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 6px;
}

.system-icon {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.system-icon.green { background: var(--green); }
.system-icon.orange { background: var(--orange); }
.system-icon.yellow { background: var(--yellow); }
.system-icon.not_started { background: var(--text2); opacity: 0.4; }

.system-status-text {
  font-size: 0.78rem;
  color: var(--text2);
}

.system-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.system-btn {
  padding: 4px 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text2);
  font-size: 0.75rem;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
}

.system-btn:hover { border-color: var(--text); color: var(--text); }
.system-btn.active-status { background: var(--green); color: var(--bg); border-color: var(--green); font-weight: 600; }
.system-btn.active-orange { background: var(--orange); color: var(--bg); border-color: var(--orange); font-weight: 600; }
.system-btn.active-yellow { background: var(--yellow); color: var(--bg); border-color: var(--yellow); font-weight: 600; }
.system-btn.active-not_started { background: var(--text2); color: var(--bg); border-color: var(--text2); font-weight: 600; }

/* Comments section */
.comments-section {
  margin-top: 24px;
}

.comment-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-bottom: 8px;
}

.comment-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.comment-system {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--blue);
}

.comment-date {
  font-size: 0.72rem;
  color: var(--text2);
}

.comment-text {
  font-size: 0.85rem;
  color: var(--text);
  line-height: 1.4;
  margin-bottom: 6px;
}

.comment-by {
  font-size: 0.72rem;
  color: var(--text2);
}

.comment-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
}

.comment-resolved {
  font-size: 0.72rem;
  color: var(--green);
  font-weight: 600;
}

/* Add comment form */
.add-comment-form {
  margin-top: 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
}

.add-comment-form h4 {
  font-size: 0.82rem;
  color: var(--text2);
  margin-bottom: 10px;
}

.form-group {
  margin-bottom: 10px;
}

.form-group label {
  display: block;
  font-size: 0.75rem;
  color: var(--text2);
  margin-bottom: 4px;
}

.form-group select,
.form-group textarea,
.form-group input {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 0.85rem;
  padding: 8px 10px;
  transition: border-color var(--transition);
}

.form-group select:focus,
.form-group textarea:focus,
.form-group input:focus {
  outline: none;
  border-color: var(--green);
}

.form-group textarea {
  resize: vertical;
  min-height: 60px;
}

/* ===== Import Modal ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 90%;
  max-width: 440px;
  max-height: calc(100dvh - 80px);
  display: flex;
  flex-direction: column;
  box-shadow: 0 16px 64px rgba(0,0,0,0.5);
  transform: scale(0.95);
  transition: transform 0.3s ease;
}

.modal-overlay.show .modal {
  transform: scale(1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.modal-header h3 {
  font-size: 1rem;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text2);
  font-size: 1.4rem;
  cursor: pointer;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all var(--transition);
}

.modal-close:hover { background: var(--card2); color: var(--text); }

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 40px 20px;
  text-align: center;
  transition: all var(--transition);
}

.drop-zone.drag-over {
  border-color: var(--green);
  background: rgba(146,208,80,0.05);
}

.drop-text {
  color: var(--text);
  margin-top: 12px;
  font-size: 0.95rem;
}

.drop-subtext {
  color: var(--text2);
  font-size: 0.82rem;
  margin: 8px 0;
}

.import-status {
  margin-top: 16px;
  font-size: 0.85rem;
  text-align: center;
  min-height: 24px;
}

.import-status.loading {
  color: var(--blue);
}

.import-status.success {
  color: var(--green);
}

.import-status.error {
  color: var(--red);
}

/* ===== Report Modal ===== */
.modal.modal-wide {
  max-width: 640px;
}

.report-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 600px) {
  .report-grid { grid-template-columns: 1fr; }
}

.report-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.report-card:hover {
  border-color: var(--green);
  background: rgba(146,208,80,0.06);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.report-card:active {
  transform: scale(0.98);
}

.report-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.report-icon-blue { background: rgba(0,176,240,0.15); color: var(--blue); }
.report-icon-green { background: rgba(146,208,80,0.15); color: var(--green); }
.report-icon-red { background: rgba(239,68,68,0.15); color: var(--red); }
.report-icon-purple { background: rgba(168,85,247,0.15); color: #a855f7; }

.report-info {
  flex: 1;
  min-width: 0;
}

.report-name {
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 4px;
}

.report-desc {
  font-size: 0.75rem;
  color: var(--text2);
  line-height: 1.4;
}

.report-option {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.report-option label {
  font-size: 0.78rem;
  color: var(--text2);
}

.report-option select {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-size: 0.78rem;
  cursor: pointer;
}

.report-status {
  margin-top: 16px;
  font-size: 0.85rem;
  text-align: center;
  min-height: 24px;
}

.report-status.loading { color: var(--blue); }
.report-status.success { color: var(--green); }
.report-status.error { color: var(--red); }

/* ===== Sidebar Toggle (Mobile) ===== */
.sidebar-toggle {
  display: none;
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 150;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--green);
  color: var(--bg);
  border: none;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

/* ===== Loading Spinner ===== */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .header-title { display: none; }

  /* ── Dropdown nav on mobile ── */
  .nav-items {
    display: none;
    position: absolute;
    top: var(--header-h);
    right: 0;
    width: 240px;
    background: var(--card);
    border: 1px solid var(--border);
    border-top: 2px solid var(--green);
    border-radius: 0 0 0 12px;
    box-shadow: -2px 8px 24px rgba(0,0,0,.16);
    padding: 8px;
    flex-direction: column;
    align-items: stretch;
    gap: 3px;
    z-index: 200;
    max-height: calc(100vh - var(--header-h));
    overflow-y: auto;
  }
  .nav-items.open { display: flex; }

  /* Full-width buttons with labels inside the dropdown */
  .nav-items .btn {
    justify-content: flex-start;
    width: 100%;
    padding: 10px 14px;
    gap: 10px;
    border-radius: 8px;
  }
  .nav-items .nav-label { display: inline !important; }
  .nav-items .header-date {
    display: block !important;
    padding: 4px 14px;
    font-size: 0.82rem;
    color: var(--text2);
  }
  .nav-divider { display: block; }

  .nav-toggle { display: flex; }
  .header-right { gap: 8px; }
  #headerUser {
    font-size: 0.78rem;
    max-width: 90px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding-right: 6px;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: var(--header-h);
    z-index: 150;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-toggle {
    display: flex;
  }

  .main {
    padding: 12px;
  }

  .stats-bar {
    grid-template-columns: repeat(2, 1fr);
  }

  .detail-panel {
    width: 100%;
  }

  .detail-overlay.show + .detail-panel.open {
    width: 100%;
  }

  .room-grid {
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  }

  .filter-chips {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 4px;
  }

  .chip {
    flex-shrink: 0;
  }
}

@media (max-width: 480px) {
  .stats-bar {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .stat-card {
    padding: 10px;
  }

  .stat-value {
    font-size: 1.5rem;
  }

  .btn span.btn-text {
    display: none;
  }

  /* ≤480px: ซ่อน username และ VOYAGE text */
  #headerUser { display: none; }
  .logo-text { display: none; }
  .header-right { gap: 6px; }
  .nav-items { width: 100%; border-radius: 0; }
}
