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

:root {
  --primary: #4F7CFF;
  --primary-dark: #3A5FD9;
  --primary-light: #E8EEFF;
  --bg: #F5F7FA;
  --bg-white: #FFFFFF;
  --bg-hover: #F0F2F5;
  --text: #1F2937;
  --text-secondary: #6B7280;
  --text-muted: #9CA3AF;
  --border: #E5E7EB;
  --border-light: #F3F4F6;
  --available: #10B981;
  --nearly-full: #F59E0B;
  --full: #EF4444;
  --waitlist: #8B5CF6;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
  --radius: 8px;
  --radius-lg: 12px;
  --sidebar-width: 220px;
  --right-panel-width: 300px;
  --topbar-height: 52px;
  --font-scale: 1;
}

[data-theme="dark"] {
  --primary: #6B8FFF;
  --primary-dark: #5878E6;
  --primary-light: #1E2A4A;
  --bg: #0F172A;
  --bg-white: #1E293B;
  --bg-hover: #334155;
  --text: #F1F5F9;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;
  --border: #334155;
  --border-light: #1E293B;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.4);
}

[data-font="small"] { --font-scale: 0.875; }
[data-font="medium"] { --font-scale: 1; }
[data-font="large"] { --font-scale: 1.125; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: calc(14px * var(--font-scale));
  line-height: 1.5;
  overflow: hidden;
}

/* ============================================ */
/* App Layout                                   */
/* ============================================ */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr var(--right-panel-width);
  height: 100vh;
  overflow: hidden;
}

/* ============================================ */
/* Sidebar                                      */
/* ============================================ */
.sidebar {
  background: var(--bg-white);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 14px 10px;
  overflow: visible;
}

.logo {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 10px 14px;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 12px;
}
.logo-icon {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--primary) 0%, #6C5CE7 100%);
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  color: white; flex-shrink: 0;
}
.logo-icon svg { width: 18px; height: 18px; }
.logo-text { font-size: calc(15px * var(--font-scale)); font-weight: 700; color: var(--text); }

.nav { flex: 1; overflow-y: auto; }
.nav-list { list-style: none; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--radius);
  cursor: pointer; color: var(--text-secondary);
  transition: all 0.15s ease; position: relative;
  user-select: none; font-size: calc(13px * var(--font-scale));
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item:hover { background: var(--bg-hover); color: var(--text); }
.nav-item.active { background: var(--primary); color: white; }
.nav-item .badge {
  position: absolute; right: 10px;
  background: #EF4444; color: white; font-size: 10px;
  padding: 1px 5px; border-radius: 10px; min-width: 16px; text-align: center;
}

.sidebar-bottom { border-top: 1px solid var(--border-light); padding-top: 12px; position: relative; }
.user-profile {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--radius);
  cursor: pointer; transition: background 0.15s;
}
.user-profile:hover { background: var(--bg-hover); }
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white; display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: calc(13px * var(--font-scale)); flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-name { font-weight: 600; font-size: calc(12px * var(--font-scale)); color: var(--text); }
.user-role { font-size: calc(11px * var(--font-scale)); color: var(--text-muted); }

/* 用户下拉菜单 */
.chevron-icon {
  width: 14px; height: 14px; color: var(--text-muted);
  transition: transform 0.15s; flex-shrink: 0;
}
.user-profile.active .chevron-icon { transform: rotate(180deg); }

.user-dropdown {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 8px;
  right: 8px;
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 4px;
  z-index: 100;
}
.user-dropdown.show { display: block; }

.dropdown-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: calc(var(--radius) - 2px);
  cursor: pointer; transition: background 0.1s;
  font-size: 13px; color: var(--text);
}
.dropdown-item:hover { background: var(--bg-hover); }
.dropdown-item svg { width: 16px; height: 16px; color: var(--text-secondary); flex-shrink: 0; }
.dropdown-item:hover svg { color: var(--primary); }
.dropdown-item[data-action="logout"] { color: var(--full); }
.dropdown-item[data-action="logout"] svg { color: var(--full); }
.dropdown-item[data-action="logout"]:hover { background: rgba(239,68,68,0.1); }
.dropdown-divider {
  height: 1px; background: var(--border-light); margin: 4px 8px;
}

/* 个人中心模态框 */
.profile-modal {
  max-width: 500px; width: 90%;
}
.profile-body { padding: 0; }
.profile-tabs {
  display: flex; border-bottom: 1px solid var(--border);
  padding: 0 16px;
}
.profile-tab {
  padding: 12px 16px;
  background: none; border: none;
  font-size: 14px; font-weight: 500;
  color: var(--text-secondary); cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
  font-family: inherit;
}
.profile-tab:hover { color: var(--text); }
.profile-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.profile-panel { display: none; padding: 20px; }
.profile-panel.active { display: block; }

.profile-avatar-section {
  display: flex; justify-content: center; margin-bottom: 20px;
}
.profile-avatar {
  width: 72px; height: 72px; border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white; display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 28px;
}

.profile-form { display: flex; flex-direction: column; gap: 14px; }
.profile-form .form-group { display: flex; flex-direction: column; gap: 4px; }
.profile-form .form-label { font-size: 13px; font-weight: 500; color: var(--text); }
.profile-form .form-input,
.profile-form .form-select {
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  background: var(--bg-white);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
  font-family: inherit;
}
.profile-form .form-input:focus,
.profile-form .form-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,124,255,0.1);
}
.profile-form .btn-primary {
  margin-top: 8px;
  padding: 11px 20px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.profile-form .btn-primary:hover { background: var(--primary-dark); }

/* ============================================ */
/* Main                                         */
/* ============================================ */
.main { display: flex; flex-direction: column; overflow: hidden; }

.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 0 20px; height: var(--topbar-height);
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-white); flex-shrink: 0;
}
.search-bar {
  flex: 1; max-width: 460px;
  display: flex; align-items: center; gap: 8px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 7px 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.search-bar:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,124,255,0.1); }
.search-bar svg { width: 16px; height: 16px; color: var(--text-muted); flex-shrink: 0; }
.search-bar input { flex: 1; border: none; outline: none; font-size: calc(13px * var(--font-scale)); background: transparent; color: var(--text); }
.search-bar input::placeholder { color: var(--text-muted); }

.topbar-actions { display: flex; gap: 6px; }
.icon-btn {
  width: 36px; height: 36px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--bg-white);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary); transition: all 0.15s; position: relative;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; }
.notif-dot {
  position: absolute; top: 6px; right: 6px;
  width: 8px; height: 8px; background: #EF4444;
  border-radius: 50%; border: 2px solid var(--bg-white);
}

.view-container { flex: 1; overflow: hidden; display: flex; flex-direction: column; }

/* View system */
.view { display: none; flex: 1; flex-direction: column; overflow: hidden; }
.view.active { display: flex; }

/* ============================================ */
/* Home View                                    */
/* ============================================ */
.view-home { padding: 12px 16px 8px; gap: 8px; }

.section-card {
  background: var(--bg-white); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm); display: flex; flex-direction: column;
  overflow: hidden;
}

.section-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; border-bottom: 1px solid var(--border-light); flex-shrink: 0;
}
.section-title { display: flex; align-items: center; gap: 12px; }
.section-title h2 { font-size: calc(15px * var(--font-scale)); font-weight: 600; color: var(--text); }
.date-nav {
  display: flex; align-items: center; gap: 6px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 2px;
}
.date-arrow {
  width: 24px; height: 24px; border: none; background: transparent;
  border-radius: 5px; cursor: pointer; color: var(--text-secondary);
  font-size: 16px; display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.date-arrow:hover { background: var(--bg-hover); color: var(--text); }
.date-range { font-size: calc(12px * var(--font-scale)); font-weight: 500; color: var(--text); padding: 0 6px; }
.section-actions { display: flex; align-items: center; gap: 6px; }

/* Week View */
.week-view-section { flex: 1 1 70%; min-height: 360px; display: flex; flex-direction: column; }
.week-grid-wrapper { overflow: auto; padding: 0 14px 8px; flex: 1; min-height: 320px; }
.week-header {
  display: grid; grid-template-columns: 90px repeat(7, minmax(70px, 1fr));
  border-bottom: 1px solid var(--border); position: sticky; top: 0;
  background: var(--bg-white); z-index: 2; min-width: 600px;
}
.time-corner { border-right: 1px solid var(--border); min-height: 44px; }
.day-column {
  display: flex; flex-direction: column; align-items: center;
  padding: 4px; border-right: 1px solid var(--border-light); min-height: 44px;
}
.day-column:last-child { border-right: none; }
.day-name { font-size: calc(11px * var(--font-scale)); color: var(--text-muted); }
.day-date { font-size: calc(13px * var(--font-scale)); font-weight: 600; color: var(--text); }

.space-row {
  display: grid; grid-template-columns: 90px repeat(7, minmax(70px, 1fr));
  min-height: 280px; border-bottom: 1px solid var(--border-light); min-width: 600px;
}
.space-label {
  border-right: 1px solid var(--border); padding: 6px 4px;
  display: flex; flex-direction: column; justify-content: center;
  align-items: center; text-align: center; gap: 1px; overflow: visible;
}
.space-name { font-size: calc(12px * var(--font-scale)); font-weight: 600; color: var(--text); }
.space-desc { font-size: 10px; color: var(--text-muted); }
.space-capacity { font-size: 10px; color: var(--text-secondary); }
.space-info-top { text-align: center; width: 100%; }
.time-axis {
  position: relative; width: 100%; flex: 1; min-height: 360px;
  border-top: 1px solid var(--border-light); margin-top: 4px;
}
.time-label {
  position: absolute; right: 2px;
  font-size: 10px; color: var(--text-secondary);
  transform: translateY(-50%); font-weight: 500;
}

.fav-star {
  cursor: pointer; font-size: 18px; color: var(--text-muted);
  transition: all 0.15s; user-select: none;
}
.fav-star.active { color: var(--nearly-full); }
.fav-star:hover { transform: scale(1.15); }

.add-card {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-width: 120px; min-height: 110px;
  border: 2px dashed var(--border); border-radius: var(--radius);
  color: var(--text-muted); cursor: pointer; transition: all 0.2s;
  background: var(--bg);
}
.add-card:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.add-card span { font-size: 32px; line-height: 1; }
.add-card .add-text { font-size: 13px; margin-top: 6px; font-weight: 500; }

.today-label {
  position: absolute; bottom: 2px; right: 2px;
  font-size: 8px; background: var(--primary); color: white;
  padding: 1px 3px; border-radius: 2px;
}

/* Toast notifications */
.toast-container {
  position: fixed; top: 70px; right: 20px; z-index: 2000;
  display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
.toast {
  background: var(--bg-white); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 12px 16px;
  box-shadow: var(--shadow-md); display: flex; align-items: center; gap: 10px;
  min-width: 240px; max-width: 360px; pointer-events: auto;
  animation: toastSlideIn 0.3s ease;
}
.toast.success { border-left: 4px solid var(--available); }
.toast.error { border-left: 4px solid var(--full); }
.toast.info { border-left: 4px solid var(--primary); }
.toast.warning { border-left: 4px solid var(--nearly-full); }
.toast-icon { font-size: 18px; }
.toast.success .toast-icon { color: var(--available); }
.toast.error .toast-icon { color: var(--full); }
.toast.info .toast-icon { color: var(--primary); }
.toast.warning .toast-icon { color: var(--nearly-full); }
.toast-message { flex: 1; font-size: calc(13px * var(--font-scale)); color: var(--text); }
.toast-close {
  cursor: pointer; color: var(--text-muted); background: none; border: none;
  font-size: 16px; padding: 0 4px;
}
.toast-close:hover { color: var(--text); }
@keyframes toastSlideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
@keyframes toastSlideOut {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(100%); opacity: 0; }
}
.toast.leaving { animation: toastSlideOut 0.3s ease forwards; }

.space-row {
  display: grid; grid-template-columns: 90px repeat(7, minmax(70px, 1fr));
  min-height: 360px; border-bottom: 1px solid var(--border-light); min-width: 600px;
}

.week-cell {
  position: relative; border-right: 1px solid var(--border-light);
  min-height: 360px; padding: 2px; overflow: visible;
}
.week-cell:last-child { border-right: none; }

.week-cell .time-grid {
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none; z-index: 0;
}
.time-grid-line {
  position: absolute; left: 0; right: 0; height: 1px;
  background: var(--border-light);
}

.booking-block {
  position: absolute; left: 2px; right: 2px; border-radius: 5px;
  padding: 4px 5px; cursor: pointer; transition: all 0.15s;
  z-index: 1; line-height: 1.15; min-height: 0; overflow: visible;
  display: flex; flex-direction: column; justify-content: flex-start;
  word-break: break-word;
}
.booking-block:hover { transform: scale(1.02); box-shadow: var(--shadow-md); z-index: 10; }
.booking-block .b-time { font-weight: 600; font-size: 9px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.booking-block .b-name { font-size: 10px; font-weight: 600; white-space: normal; word-break: break-word; margin: 2px 0; line-height: 1.2; }
.booking-block .b-count { font-size: 9px; opacity: 0.9; margin-top: auto; }
.booking-block .b-status-dot {
  position: absolute; top: 4px; right: 4px;
  width: 7px; height: 7px; border-radius: 50%;
}
.booking-block .b-status-dot.nearly-full { background: var(--nearly-full); }
.booking-block .b-status-dot.full { background: var(--full); }

.booking-block.available { background: rgba(16,185,129,0.15); border: 1px solid rgba(16,185,129,0.4); color: #065F46; }
.booking-block.nearly-full { background: rgba(245,158,11,0.15); border: 1px solid rgba(245,158,11,0.4); color: #92400E; }
.booking-block.full { background: rgba(239,68,68,0.15); border: 1px solid rgba(239,68,68,0.4); color: #991B1B; }
.booking-block.waitlist { background: rgba(139,92,246,0.15); border: 1px solid rgba(139,92,246,0.4); color: #5B21B6; }
.booking-block.conflict { background: rgba(239,68,68,0.15); border: 1px solid rgba(239,68,68,0.6); color: #991B1B; }

[data-theme="dark"] .booking-block.available { color: #6EE7B7; }
[data-theme="dark"] .booking-block.nearly-full { color: #FCD34D; }
[data-theme="dark"] .booking-block.full { color: #FCA5A5; }
[data-theme="dark"] .booking-block.waitlist { color: #C4B5FD; }
[data-theme="dark"] .booking-block.conflict { color: #FCA5A5; }

.legend {
  display: flex; align-items: center; gap: 14px; padding: 6px 14px;
  border-top: 1px solid var(--border-light); flex-shrink: 0; flex-wrap: wrap;
}
.legend-item { display: flex; align-items: center; gap: 5px; font-size: calc(11px * var(--font-scale)); color: var(--text-secondary); }
.legend-color { width: 14px; height: 10px; border-radius: 3px; }
.legend-color.available { background: rgba(16,185,129,0.3); border: 1px solid rgba(16,185,129,0.5); }
.legend-color.nearly-full { background: rgba(245,158,11,0.3); border: 1px solid rgba(245,158,11,0.5); }
.legend-color.full { background: rgba(239,68,68,0.3); border: 1px solid rgba(239,68,68,0.5); }
.legend-color.waitlist { background: rgba(139,92,246,0.3); border: 1px solid rgba(139,92,246,0.5); }
.legend-color.conflict { background: rgba(239,68,68,0.3); border: 1px solid rgba(239,68,68,0.6); }

/* Space selector dropdown */
.space-selector {
  display: flex; align-items: center; gap: 6px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 4px 8px;
  font-size: calc(12px * var(--font-scale)); color: var(--text);
}
.space-selector select {
  border: none; background: transparent; outline: none;
  font-size: calc(12px * var(--font-scale)); color: var(--text);
  cursor: pointer; font-family: inherit;
}
.space-selector select option { background: var(--bg-white); color: var(--text); }

/* My Schedule */
.my-schedule-section { flex-shrink: 0; flex: 0 0 auto; }
.schedule-tabs { display: flex; gap: 6px; padding: 8px 14px 0; flex-wrap: wrap; }
.tab-btn {
  padding: 5px 12px; border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--bg-white); color: var(--text-secondary);
  font-size: calc(12px * var(--font-scale)); cursor: pointer; transition: all 0.15s;
}
.tab-btn:hover { background: var(--bg-hover); }
.tab-btn.active { background: var(--primary); color: white; border-color: var(--primary); }
.schedule-cards {
  display: flex; gap: 8px; padding: 8px 14px 10px;
  overflow-x: auto; flex-wrap: nowrap;
}
.schedule-card {
  background: var(--bg-white); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 8px 10px; cursor: pointer;
  transition: all 0.15s; position: relative; overflow: hidden;
  min-width: 150px; max-width: 180px; flex-shrink: 0;
}
.schedule-card:hover { border-color: var(--primary); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.schedule-card::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; }
.schedule-card.ongoing::before { background: var(--primary); }
.schedule-card.upcoming::before { background: var(--available); }
.schedule-card.soon::before { background: var(--nearly-full); }
.schedule-card.conflict::before { background: var(--full); }
.card-badge {
  display: inline-block; padding: 1px 6px; border-radius: 4px;
  font-size: 10px; font-weight: 500; margin-bottom: 4px;
}
.card-badge.ongoing { background: var(--primary-light); color: var(--primary); }
.card-badge.upcoming { background: rgba(16,185,129,0.15); color: var(--available); }
.card-badge.soon { background: rgba(245,158,11,0.15); color: var(--nearly-full); }
.card-badge.conflict { background: rgba(239,68,68,0.15); color: var(--full); }
.schedule-time { font-size: calc(12px * var(--font-scale)); font-weight: 600; color: var(--text); margin-bottom: 2px; }
.schedule-name { font-size: calc(12px * var(--font-scale)); color: var(--text); margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.schedule-meta { display: flex; align-items: center; justify-content: space-between; font-size: 10px; color: var(--text-muted); }
.schedule-card .cancel-sched {
  margin-top: 6px; font-size: 11px; color: var(--full);
  padding: 2px 6px; border: 1px solid var(--border); border-radius: 4px;
  background: transparent; cursor: pointer; align-self: flex-end;
}
.schedule-card .cancel-sched:hover { background: rgba(239,68,68,0.1); }
.booking-card .card-footer .cancel-booking {
  color: var(--full); font-size: 11px; padding: 2px 8px;
}
.booking-card .card-footer .cancel-booking:hover { background: rgba(239,68,68,0.1); }

/* ============================================ */
/* List Views (Activities, Spaces, etc.)        */
/* ============================================ */
.view-list { padding: 12px 16px; overflow-y: auto; }
.view-list-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.view-list-header h2 { font-size: calc(18px * var(--font-scale)); font-weight: 600; }
.view-list-header .filters { display: flex; gap: 6px; }

.card-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

.info-card {
  background: var(--bg-white); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 14px; cursor: pointer;
  transition: all 0.15s; display: flex; flex-direction: column; gap: 6px;
}
.info-card:hover { border-color: var(--primary); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.info-card .card-top { display: flex; align-items: start; justify-content: space-between; gap: 8px; }
.info-card .card-title { font-size: calc(14px * var(--font-scale)); font-weight: 600; color: var(--text); }
.info-card .card-subtitle { font-size: calc(12px * var(--font-scale)); color: var(--text-secondary); }
.info-card .card-meta { display: flex; flex-wrap: wrap; gap: 8px; font-size: calc(11px * var(--font-scale)); color: var(--text-muted); }
.info-card .card-meta-item { display: flex; align-items: center; gap: 3px; }
.info-card .card-desc { font-size: calc(12px * var(--font-scale)); color: var(--text-secondary); line-height: 1.4; }
.info-card .card-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 4px; }

.status-tag {
  font-size: 10px; padding: 2px 8px; border-radius: 4px; font-weight: 500; white-space: nowrap;
}
.status-tag.available, .status-tag.open { background: rgba(16,185,129,0.15); color: var(--available); }
.status-tag.nearly-full { background: rgba(245,158,11,0.15); color: var(--nearly-full); }
.status-tag.full, .status-tag.closed { background: rgba(239,68,68,0.15); color: var(--full); }
.status-tag.waitlist { background: rgba(139,92,246,0.15); color: var(--waitlist); }
.status-tag.ended { background: var(--border-light); color: var(--text-muted); }
.status-tag.using { background: var(--primary-light); color: var(--primary); }

.progress-bar { width: 100%; height: 6px; background: var(--border-light); border-radius: 3px; overflow: hidden; margin-top: 4px; }
.progress-fill { height: 100%; border-radius: 3px; transition: width 0.3s ease; }
.progress-fill.available { background: var(--available); }
.progress-fill.nearly-full { background: var(--nearly-full); }
.progress-fill.full { background: var(--full); }
.progress-fill.waitlist { background: var(--waitlist); }

/* Team cards */
.team-card { grid-column: span 2; }
.team-members { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.team-member {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 8px; background: var(--bg); border-radius: var(--radius);
  font-size: calc(11px * var(--font-scale));
}
.team-member-avatar {
  width: 24px; height: 24px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary) 0%, #6C5CE7 100%);
  color: white; display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 600;
}
.team-member-role { color: var(--text-muted); font-size: 10px; }

/* Messages */
.message-item {
  display: flex; align-items: start; gap: 12px; padding: 12px 14px;
  border-bottom: 1px solid var(--border-light); cursor: pointer; transition: background 0.15s;
}
.message-item:hover { background: var(--bg-hover); }
.message-item.unread { background: var(--primary-light); }
.message-icon {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 16px;
}
.message-icon.reminder { background: rgba(79,124,255,0.15); }
.message-icon.warning { background: rgba(245,158,11,0.15); }
.message-icon.info { background: rgba(16,185,129,0.15); }
.message-content { flex: 1; }
.message-title { font-size: calc(13px * var(--font-scale)); font-weight: 600; color: var(--text); margin-bottom: 2px; }
.message-text { font-size: calc(12px * var(--font-scale)); color: var(--text-secondary); }
.message-time { font-size: 11px; color: var(--text-muted); white-space: nowrap; }

/* Settings */
.settings-group { margin-bottom: 16px; }
.settings-group-title { font-size: calc(13px * var(--font-scale)); font-weight: 600; color: var(--text-secondary); margin-bottom: 8px; }
.settings-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; background: var(--bg-white); border: 1px solid var(--border);
  border-radius: var(--radius); margin-bottom: 6px;
}
.settings-label { font-size: calc(13px * var(--font-scale)); color: var(--text); }
.settings-desc { font-size: calc(11px * var(--font-scale)); color: var(--text-muted); margin-top: 2px; }

/* Toggle switch */
.toggle {
  position: relative; width: 44px; height: 24px;
  background: var(--border); border-radius: 12px; cursor: pointer;
  transition: background 0.2s;
}
.toggle.active { background: var(--primary); }
.toggle::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 20px; height: 20px; background: white; border-radius: 50%;
  transition: transform 0.2s;
}
.toggle.active::after { transform: translateX(20px); }

/* Font size buttons */
.font-size-btns { display: flex; gap: 4px; }
.font-size-btn {
  padding: 4px 12px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg-white); cursor: pointer; color: var(--text-secondary);
  transition: all 0.15s;
}
.font-size-btn.active { background: var(--primary); color: white; border-color: var(--primary); }
.font-size-btn small { font-size: 11px; }
.font-size-btn medium { font-size: 13px; }
.font-size-btn large { font-size: 15px; }

/* ============================================ */
/* Right Sidebar                                */
/* ============================================ */
.right-sidebar {
  background: var(--bg-white); border-left: 1px solid var(--border);
  padding: 12px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px;
}
.panel { background: var(--bg-white); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; display: flex; flex-direction: column; flex: 1; min-height: 0; }
.panel-header { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border-bottom: 1px solid var(--border-light); flex-shrink: 0; }
.panel-header h3 { font-size: calc(13px * var(--font-scale)); font-weight: 600; }
.panel-body { padding: 8px 12px 10px; overflow-y: auto; flex: 1; }

.space-status-list { display: flex; flex-direction: column; gap: 4px; }
.space-status-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 8px; border-radius: var(--radius); transition: background 0.15s; cursor: pointer; gap: 8px;
}
.space-status-item:hover { background: var(--bg-hover); }
.space-status-info { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; }
.space-status-name { font-size: calc(12px * var(--font-scale)); font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.space-status-seats { font-size: 10px; color: var(--text-muted); }
.space-status-progress { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; min-width: 50px; }
.space-status-progress .progress-bar { width: 50px; margin-top: 0; }

.upcoming-list { display: flex; flex-direction: column; gap: 6px; }
.upcoming-item {
  display: flex; align-items: flex-start; gap: 8px; padding: 6px 8px;
  border-radius: var(--radius); cursor: pointer; transition: background 0.15s;
  border: 1px solid transparent;
}
.upcoming-item:hover { background: var(--bg-hover); border-color: var(--border-light); }
.upcoming-time { display: flex; flex-direction: column; align-items: center; min-width: 42px; padding: 3px 6px; background: var(--primary-light); border-radius: var(--radius); }
.upcoming-time-date { font-size: 9px; color: var(--primary); }
.upcoming-time-time { font-size: calc(11px * var(--font-scale)); font-weight: 600; color: var(--primary); }
.upcoming-info { flex: 1; min-width: 0; }
.upcoming-name { font-size: calc(12px * var(--font-scale)); font-weight: 500; color: var(--text); margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.upcoming-meta { display: flex; align-items: center; gap: 6px; font-size: 10px; color: var(--text-muted); }

.view-all-link {
  display: block; text-align: center; padding: 8px;
  font-size: calc(12px * var(--font-scale)); color: var(--primary);
  text-decoration: none; border-top: 1px solid var(--border-light);
  cursor: pointer; transition: background 0.15s;
}
.view-all-link:hover { background: var(--bg-hover); }

/* ============================================ */
/* Buttons                                      */
/* ============================================ */
.btn {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 6px 12px; border-radius: var(--radius);
  font-size: calc(12px * var(--font-scale)); font-weight: 500;
  cursor: pointer; border: none; transition: all 0.15s;
  background: transparent; white-space: nowrap; font-family: inherit;
}
.btn svg { width: 14px; height: 14px; }
.btn-sm { padding: 4px 10px; font-size: calc(11px * var(--font-scale)); }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { border: 1px solid var(--border); background: var(--bg-white); color: var(--text); }
.btn-outline:hover { background: var(--bg-hover); }
.btn-text { color: var(--text-secondary); background: transparent; }
.btn-text:hover { color: var(--primary); background: var(--primary-light); }

/* ============================================ */
/* Modal                                        */
/* ============================================ */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(15,23,42,0.5);
  backdrop-filter: blur(4px); display: none;
  align-items: center; justify-content: center; z-index: 1000; padding: 20px;
}
.modal-overlay.active { display: flex; animation: fadeIn 0.2s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--bg-white); border-radius: var(--radius-lg);
  width: 100%; max-width: 480px; max-height: 90vh; overflow: hidden;
  box-shadow: 0 25px 50px rgba(0,0,0,0.25); animation: slideUp 0.25s ease;
  display: flex; flex-direction: column;
}
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border-light); flex-shrink: 0; }
.modal-header h3 { font-size: calc(16px * var(--font-scale)); font-weight: 600; }
.modal-close {
  width: 28px; height: 28px; border: none; background: var(--bg);
  border-radius: 6px; cursor: pointer; font-size: 18px; color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center; transition: all 0.15s;
}
.modal-close:hover { background: var(--border); color: var(--text); }
.modal-body { padding: 16px 20px; overflow-y: auto; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--border-light); flex-shrink: 0; }

/* Form */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: calc(12px * var(--font-scale)); font-weight: 500; color: var(--text); margin-bottom: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border);
  border-radius: var(--radius); font-size: calc(13px * var(--font-scale));
  font-family: inherit; color: var(--text); background: var(--bg-white); transition: all 0.15s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,124,255,0.1);
}
.form-group textarea { resize: vertical; }

/* Booking type tabs */
.booking-type-tabs { display: flex; gap: 4px; margin-bottom: 14px; }
.booking-type-tab {
  flex: 1; padding: 8px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg-white); cursor: pointer; text-align: center;
  font-size: calc(12px * var(--font-scale)); color: var(--text-secondary); transition: all 0.15s;
}
.booking-type-tab.active { background: var(--primary); color: white; border-color: var(--primary); }

/* Detail modal */
.detail-info { display: flex; flex-direction: column; gap: 10px; }
.detail-row { display: flex; gap: 10px; font-size: calc(13px * var(--font-scale)); }
.detail-label { color: var(--text-muted); min-width: 70px; }
.detail-value { color: var(--text); font-weight: 500; }
.conflict-badge {
  display: inline-flex; align-items: center; gap: 4px;
  background: rgba(239,68,68,0.15); color: var(--full);
  font-size: 11px; padding: 3px 8px; border-radius: 4px; margin-top: 6px;
}

/* Profile modal */
.profile-header { display: flex; align-items: center; gap: 16px; padding: 20px; border-bottom: 1px solid var(--border-light); }
.profile-avatar {
  width: 64px; height: 64px; border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white; display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 600;
}
.profile-name { font-size: calc(18px * var(--font-scale)); font-weight: 700; }
.profile-role { font-size: calc(13px * var(--font-scale)); color: var(--text-secondary); }
.profile-info { padding: 16px 20px; }
.profile-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border-light); }
.profile-row:last-child { border-bottom: none; }
.profile-row-label { color: var(--text-muted); font-size: calc(13px * var(--font-scale)); }
.profile-row-value { color: var(--text); font-weight: 500; font-size: calc(13px * var(--font-scale)); }

/* Calendar modal */
.calendar-modal { max-width: 400px; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; padding: 12px 16px; }
.calendar-day-header { text-align: center; font-size: 11px; color: var(--text-muted); padding: 4px 0; font-weight: 600; }
.calendar-day {
  aspect-ratio: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; border-radius: var(--radius); cursor: pointer;
  font-size: calc(12px * var(--font-scale)); transition: all 0.15s; position: relative;
}
.calendar-day:hover { background: var(--bg-hover); }
.calendar-day.today { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.calendar-day.has-event::after { content: ''; position: absolute; bottom: 4px; width: 5px; height: 5px; background: var(--primary); border-radius: 50%; }
.calendar-day.other-month { color: var(--text-muted); opacity: 0.4; }
.calendar-nav { display: flex; align-items: center; justify-content: space-between; padding: 0 16px 8px; }
.calendar-month { font-size: calc(15px * var(--font-scale)); font-weight: 600; }
.calendar-events { padding: 0 16px 12px; max-height: 150px; overflow-y: auto; }
.calendar-event-item { padding: 6px 10px; background: var(--bg); border-radius: var(--radius); margin-bottom: 4px; font-size: calc(12px * var(--font-scale)); }
.calendar-event-time { font-weight: 600; color: var(--primary); font-size: 11px; }

/* Empty state */
.empty-state { text-align: center; padding: 30px 20px; color: var(--text-muted); }
.empty-state-icon { font-size: 40px; margin-bottom: 8px; opacity: 0.5; }

/* Live indicator */
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }
.live-indicator { display: inline-block; width: 6px; height: 6px; background: var(--available); border-radius: 50%; animation: pulse 2s infinite; margin-right: 4px; }

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

/* Responsive */
@media (max-width: 1200px) {
  .app { grid-template-columns: var(--sidebar-width) 1fr; }
  .right-sidebar { display: none; }
}
@media (max-width: 768px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .form-row { grid-template-columns: 1fr; }
  .team-card { grid-column: span 1; }
}