:root {
  --bg: #f5f7fa;
  --panel: #ffffff;
  --border: #e1e4e8;
  --text: #2d3748;
  --text-muted: #718096;
  --accent: #3182ce;
  --accent-hover: #2b6cb0;
  --danger: #e53e3e;
  --success: #38a169;
  --warning: #d69e2e;
  --shadow: 0 1px 3px rgba(0,0,0,0.1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  overflow: hidden;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* Toolbar */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
  height: 56px;
  flex-shrink: 0;
  gap: 12px;
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand h1 {
  font-size: 18px;
  font-weight: 600;
  color: var(--accent);
  line-height: 1.2;
}

.brand .sync-status {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: 0;
}

/* Account menu dropdown */
.account-menu {
  position: relative;
}

.account-menu-trigger {
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  transition: background .15s;
  white-space: nowrap;
}

.account-menu-trigger:hover {
  background: #edf2f7;
}

.account-menu-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 140px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  z-index: 100;
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.account-menu-dropdown.hidden {
  display: none;
}

.account-menu-item,
.account-menu-dropdown button {
  padding: 8px 12px;
  border: none;
  border-radius: 6px;
  background: transparent;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: background .1s;
}

.account-menu-item:hover,
.account-menu-dropdown button:hover {
  background: #f5f7fa;
}

.warning-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border: none;
  border-radius: 12px;
  background: var(--warning);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, transform .1s;
}

.warning-badge:hover {
  background: #b7791f;
  transform: translateY(-1px);
}

.warning-badge.hidden {
  display: none;
}

.warning-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: rgba(255,255,255,0.25);
  font-size: 10px;
  font-weight: 700;
}

.toolbar-center {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
  justify-content: center;
}

.control-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.control-group label {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

.control-group select {
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  background: var(--panel);
  color: var(--text);
}

.view-toggle {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.view-toggle button {
  border: none;
  background: var(--panel);
  padding: 4px 12px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text-muted);
  transition: background .15s;
}

.view-toggle button:not(:last-child) {
  border-right: 1px solid var(--border);
}

.view-toggle button.active {
  background: var(--accent);
  color: #fff;
}

.multi-select {
  position: relative;
  display: inline-block;
}

.multi-select-trigger {
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  min-width: 100px;
  text-align: left;
}

.multi-select-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 160px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  z-index: 100;
  padding: 8px 0;
}

.multi-select-dropdown.hidden {
  display: none;
}

.multi-select-actions {
  display: flex;
  justify-content: space-between;
  padding: 0 12px 8px;
  border-bottom: 1px solid var(--border);
}

.multi-select-actions button {
  background: none;
  border: none;
  font-size: 12px;
  color: var(--accent);
  cursor: pointer;
  padding: 2px 4px;
}

.multi-select-actions button:hover {
  text-decoration: underline;
}

.multi-select-options {
  max-height: 220px;
  overflow-y: auto;
}

.multi-select-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
  transition: background .1s;
}

.multi-select-option:hover {
  background: #f5f7fa;
}

.multi-select-option input[type="checkbox"] {
  margin: 0;
  cursor: pointer;
}

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

.toolbar-right button {
  padding: 5px 10px;
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text);
  transition: background .15s;
}

.toolbar-right button:hover {
  background: #edf2f7;
}

#current-range-label {
  font-size: 14px;
  font-weight: 500;
  min-width: 120px;
  text-align: center;
}

/* Main view */
#main-view {
  flex: 1;
  overflow: auto;
  padding: 12px;
}

.error {
  padding: 40px;
  text-align: center;
  color: var(--text-muted);
}

.error code {
  background: #edf2f7;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
}

/* Week View */
.week-view {
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-radius: 8px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  min-width: max-content;
}

.week-header {
  display: flex;
  border-bottom: 1px solid var(--border);
  background: #fafbfc;
  min-width: max-content;
  position: sticky;
  top: 0;
  z-index: 20;
}

.time-column-header {
  width: 60px;
  min-width: 60px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  position: sticky;
  left: 0;
  z-index: 30;
  background: #fafbfc;
}

.day-header {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 8px 12px;
  border-right: 1px solid var(--border);
  font-size: 13px;
}

.day-header:last-child { border-right: none; }

.day-header.today {
  background: #ebf8ff;
}

.day-header-main {
  text-align: left;
}

.day-header .day-name {
  font-weight: 500;
  color: var(--text-muted);
}

.day-header .day-date {
  font-size: 16px;
  font-weight: 600;
  margin-top: 2px;
}

.cancelled-btn {
  padding: 2px 8px;
  border: none;
  border-radius: 12px;
  background: #e2e8f0;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, color .15s;
  white-space: nowrap;
}

.cancelled-btn:hover {
  background: #cbd5e0;
  color: var(--text);
}

.week-body {
  display: flex;
  position: relative;
  min-height: 660px;
  min-width: max-content;
}

.time-labels {
  width: 60px;
  min-width: 60px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  background: #fafbfc;
  position: sticky;
  left: 0;
  z-index: 10;
}

.time-label {
  position: relative;
  border-bottom: 1px solid var(--border);
}

.time-label span {
  position: absolute;
  top: -8px;
  right: 6px;
  font-size: 11px;
  color: var(--text-muted);
}

.day-column {
  flex: 1;
  min-width: 280px;
  position: relative;
  border-right: 1px solid var(--border);
  min-height: 100%;
}

.day-column:last-child { border-right: none; }

.hour-cell {
  border-bottom: 1px dashed #e1e4e8;
}

.coach-separator {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(0,0,0,0.06);
  pointer-events: none;
  z-index: 1;
}

/* Month View */
.month-view {
  background: var(--panel);
  border-radius: 8px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  max-width: 1200px;
  margin: 0 auto;
}

.month-header, .month-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.month-header {
  border-bottom: 1px solid var(--border);
  background: #fafbfc;
}

.month-day-name {
  text-align: center;
  padding: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}

.month-cell {
  min-height: 110px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 6px;
  display: flex;
  flex-direction: column;
}

.month-cell:nth-child(7n) { border-right: none; }

.month-cell.other-month {
  background: #f8f9fa;
}

.month-cell.today {
  background: #ebf8ff;
}

.cell-date {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
}

.cell-classes {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
}

/* Quarter View */
.quarter-view {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  max-width: 1400px;
  margin: 0 auto;
}

@media (max-width: 1100px) {
  .quarter-view { grid-template-columns: 1fr; }
}

.quarter-month {
  background: var(--panel);
  border-radius: 8px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.quarter-month-title {
  text-align: center;
  padding: 10px;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  background: #fafbfc;
}

.quarter-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.q-day-name {
  text-align: center;
  padding: 6px;
  font-size: 12px;
  color: var(--text-muted);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.q-cell {
  min-height: 70px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 4px;
  display: flex;
  flex-direction: column;
}

.quarter-grid > *:nth-child(7n) { border-right: none; }

.q-cell.other-month { background: #f8f9fa; }
.q-cell.today { background: #ebf8ff; }

.q-date {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 2px;
}

.q-classes {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* Class Cards */
.class-card {
  border-radius: 4px;
  padding: 3px 5px;
  font-size: 11px;
  color: #fff;
  cursor: pointer;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0,0,0,0.15);
  transition: transform .1s, box-shadow .1s;
  text-shadow: 0 1px 1px rgba(0,0,0,0.2);
}

.class-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 6px rgba(0,0,0,0.2);
  z-index: 10;
}

.week-card {
  position: absolute;
  padding: 4px 6px;
  font-size: 12px;
  border-left: 3px solid rgba(255,255,255,0.4);
}

.card-time {
  font-weight: 600;
  font-size: 11px;
  opacity: 0.95;
}

.card-coach {
  font-weight: 500;
  margin-top: 1px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.nature-tag {
  font-size: 9px;
  padding: 0 3px;
  border-radius: 3px;
  background: rgba(255,255,255,0.25);
  font-weight: 700;
}

.card-guest {
  margin-top: 2px;
  opacity: 0.95;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-level {
  margin-top: 1px;
  font-size: 10px;
  opacity: 0.85;
}

.card-header-row {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 1px;
}

.loc-badge {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  font-size: 9px;
  font-weight: 600;
  color: #fff;
  padding: 1px 4px;
  border-radius: 3px;
  line-height: 1;
  text-shadow: none;
  flex-shrink: 0;
}

.month-card {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 4px;
  font-size: 11px;
  white-space: nowrap;
}

.mini-time { font-weight: 600; }
.mini-coach { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.mini-nature {
  font-size: 9px;
  padding: 0 2px;
  border-radius: 2px;
  background: rgba(255,255,255,0.25);
}
.mini-guest {
  display: none;
}

.mini-loc {
  font-size: 10px;
  line-height: 1;
  margin-right: 2px;
}

.quarter-card {
  padding: 2px 4px;
  font-size: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.q-mini-loc {
  font-size: 9px;
  line-height: 1;
  margin-right: 2px;
}

.more-label {
  font-size: 10px;
  color: var(--accent);
  text-align: center;
  padding: 3px 6px;
  margin-top: 2px;
  border-radius: 4px;
  cursor: pointer;
  background: rgba(49, 130, 206, 0.08);
  transition: background .15s, color .15s;
  font-weight: 500;
  user-select: none;
}

.more-label:hover {
  background: var(--accent);
  color: #fff;
}

/* Status styles */
.status-cancelled {
  opacity: 0.5;
  text-decoration: line-through;
  filter: grayscale(0.8);
}

.status-booked {
  box-shadow: 0 0 0 2px var(--warning) inset;
}

.status-done {
  opacity: 0.85;
}

/* Detail Panel */
.detail-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 380px;
  max-width: 90vw;
  height: 100vh;
  background: var(--panel);
  box-shadow: -4px 0 20px rgba(0,0,0,0.15);
  z-index: 1000;
  transform: translateX(0);
  transition: transform .25s ease;
  display: flex;
  flex-direction: column;
}

.detail-panel.hidden {
  transform: translateX(100%);
}

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

.detail-header h2 {
  font-size: 16px;
  font-weight: 600;
}

.close-btn {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
}

.close-btn:hover { color: var(--text); }

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

.detail-badge {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 20px;
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.detail-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.detail-table th,
.detail-table td {
  text-align: left;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.detail-table th {
  color: var(--text-muted);
  font-weight: 500;
  width: 110px;
  padding-right: 12px;
}

.detail-table td {
  color: var(--text);
  word-break: break-word;
}

.detail-separator {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}

.detail-subtitle {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 12px;
}

.detail-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
}

.detail-nav-btn {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 12px;
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
  transition: background .15s;
}

.detail-nav-btn:hover:not(:disabled) {
  background: #edf2f7;
}

.detail-nav-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.detail-dots {
  display: flex;
  align-items: center;
  gap: 6px;
}

.detail-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
  cursor: pointer;
  transition: background .15s, transform .15s;
}

.detail-dot:hover {
  background: #a0aec0;
}

.detail-dot.active {
  background: var(--accent);
  transform: scale(1.2);
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 999;
  opacity: 1;
  transition: opacity .25s;
}

.overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

/* Tooltip */
.custom-tooltip {
  background: rgba(35, 41, 50, 0.95);
  color: #fff;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.5;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  backdrop-filter: blur(4px);
  max-width: 220px;
}

.custom-tooltip .tt-time {
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 2px;
}

.custom-tooltip .tt-meta {
  opacity: 0.9;
}

.custom-tooltip .tt-level {
  opacity: 0.75;
  font-size: 11px;
  margin-top: 2px;
}

/* Warning Panel */
.warning-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.warning-item {
  background: #fffaf0;
  border: 1px solid #fbd38d;
  border-radius: 8px;
  padding: 12px;
}

.warning-item-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.warning-item-no {
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  background: var(--warning);
  padding: 2px 6px;
  border-radius: 4px;
}

.warning-item-row {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.warning-item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  font-size: 12px;
  color: var(--text);
  margin-bottom: 8px;
}

.warning-item-meta span {
  background: rgba(255,255,255,0.6);
  padding: 2px 6px;
  border-radius: 4px;
}

.warning-item-issues {
  margin: 0 0 8px 16px;
  font-size: 13px;
  color: #c05621;
}

.warning-item-issues li {
  margin-bottom: 4px;
}

.warning-raw {
  font-size: 12px;
}

.warning-raw summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 500;
}

.warning-raw pre {
  margin-top: 8px;
  padding: 10px;
  background: #f7fafc;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow-x: auto;
  font-size: 11px;
  color: var(--text);
}

.empty-warnings {
  text-align: center;
  color: var(--text-muted);
  padding: 40px 0;
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-thumb {
  background: #cbd5e0;
  border-radius: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

.sync-status {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: 6px;
  white-space: nowrap;
}

/* Loading overlay */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.loading-text {
  margin-top: 16px;
  font-size: 14px;
  color: var(--text-muted);
}

.loading-overlay.hidden {
  display: none;
}

/* Login panel */
#login-panel {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
}

#login-panel.hidden {
  display: none;
}

.login-box {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 40px 36px;
  width: 320px;
  box-shadow: var(--shadow);
  text-align: center;
}

.login-box h2 {
  font-size: 22px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 4px;
}

.login-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.login-box input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 12px;
  background: var(--panel);
  color: var(--text);
}

.login-box input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.1);
}

#login-btn {
  width: 100%;
  padding: 10px;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s;
}

#login-btn:hover {
  background: var(--accent-hover);
}

.login-error {
  margin-top: 12px;
  font-size: 13px;
  color: var(--danger);
  min-height: 18px;
}

/* Admin config panel */
.admin-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.admin-form-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.admin-form-row input,
.admin-form-row select {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  flex: 1;
}

.admin-form-row button {
  padding: 6px 14px;
  border: none;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}

.admin-form-row button:hover {
  background: var(--accent-hover);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.admin-table th,
.admin-table td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
}

.admin-table th {
  font-weight: 600;
  color: var(--text-muted);
  background: #fafbfc;
}

.admin-table .admin-action-btn {
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--panel);
  font-size: 12px;
  cursor: pointer;
  color: var(--text);
}

.admin-table .admin-action-btn:hover {
  background: #edf2f7;
}

.admin-table .admin-action-btn.danger {
  color: var(--danger);
  border-color: #feb2b2;
}

.admin-table .admin-action-btn.danger:hover {
  background: #fff5f5;
}

/* ================= Mobile Responsive ================= */
@media (max-width: 768px) {
  /* iOS height fix */
  body, #app {
    height: 100vh;
    height: -webkit-fill-available;
  }

  /* Smooth scroll */
  #main-view {
    -webkit-overflow-scrolling: touch;
    padding: 8px;
  }

  /* Toolbar */
  .toolbar {
    height: auto;
    min-height: 52px;
    flex-wrap: wrap;
    padding: 8px 10px;
    gap: 6px;
    position: relative;
  }
  .toolbar-left {
    flex: 1;
    gap: 6px;
  }
  .brand h1 {
    font-size: 15px;
  }
  .brand .sync-status {
    display: none;
  }
  /* Range label floats at top center so month/quarter title stays visible */
  #current-range-label {
    display: block;
    position: absolute;
    top: 6px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 11px;
    min-width: auto;
    padding: 1px 6px;
    background: var(--bg);
    border-radius: 4px;
    color: var(--text-muted);
    z-index: 5;
    white-space: nowrap;
  }
  .toolbar-center {
    flex: 1 1 100%;
    justify-content: flex-start;
    gap: 8px;
    order: 3;
    margin-top: 2px;
  }
  .control-group {
    gap: 4px;
  }
  .control-group label {
    display: none;
  }
  .control-group select,
  .multi-select-trigger,
  .view-toggle button {
    font-size: 12px;
    padding: 3px 6px;
    min-width: auto;
  }
  .toolbar-right {
    gap: 4px;
  }
  .toolbar-right button {
    padding: 4px 7px;
    font-size: 12px;
  }
  .account-menu-trigger {
    font-size: 12px;
    padding: 4px 8px;
  }
  .warning-badge {
    padding: 2px 6px;
    font-size: 11px;
  }

  /* Month view */
  .month-view {
    max-width: 100%;
    width: 100%;
    border-radius: 6px;
  }
  .month-header {
    font-size: 12px;
  }
  .month-day-name {
    padding: 5px 2px;
    font-size: 11px;
  }
  .cell-date {
    font-size: 11px;
    margin-bottom: 2px;
  }
  .month-card {
    font-size: 9px;
    padding: 1px 2px;
    gap: 2px;
  }
  .mini-time { font-size: 9px; }
  .mini-coach { display: none; }
  .mini-nature { font-size: 8px; }
  .more-label {
    font-size: 9px;
    padding: 2px 4px;
  }

  /* Quarter view */
  .quarter-view { gap: 10px; }
  .quarter-month-title { font-size: 13px; padding: 8px; }
  .q-day-name { padding: 4px; font-size: 11px; }
  .q-date { font-size: 11px; }
  .quarter-card { font-size: 9px; padding: 1px 2px; }

  /* Detail panels -> bottom sheet */
  .detail-panel {
    width: 100%;
    max-width: 100%;
    height: 88vh;
    top: auto;
    bottom: 0;
    right: 0;
    left: 0;
    transform: translateY(0);
    border-radius: 12px 12px 0 0;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
  }
  .detail-panel.hidden { transform: translateY(100%); }
  .detail-header { padding: 12px 16px; }
  .detail-header h2 { font-size: 15px; }
  .detail-content { padding: 16px; }
  .detail-badge { font-size: 13px; padding: 5px 12px; }
  .detail-table { font-size: 12px; }
  .detail-table th, .detail-table td { padding: 8px 0; }
  .detail-table th { width: 90px; }

  /* Login */
  .login-box { width: 90%; max-width: 360px; padding: 24px 20px; }
  .login-box h2 { font-size: 18px; }
  .login-subtitle { font-size: 13px; }

  /* Loading overlay */
  .loading-text { font-size: 14px; }

  /* Multi-select dropdown */
  .multi-select-dropdown { min-width: 180px; }

  /* Default portrait values */
  .month-cell { min-height: 52px; padding: 2px; }
  .q-cell { min-height: 48px; padding: 2px; }

  /* Week view portrait */
  .day-column { min-width: 140px; }
  .day-header { padding: 6px 8px; font-size: 11px; gap: 6px; }
  .day-header .day-date { font-size: 13px; }
  .week-card { font-size: 10px; padding: 2px 4px; border-left-width: 2px; }
  .card-time { font-size: 9px; }
  .card-coach { font-size: 10px; gap: 2px; }
  .card-guest { font-size: 9px; }
  .card-level { font-size: 9px; }
  .nature-tag { font-size: 8px; padding: 0 2px; }
  .loc-badge { font-size: 8px; padding: 1px 3px; }
  .cancelled-btn { font-size: 9px; padding: 1px 5px; }
  .time-column-header, .time-labels { width: 44px; min-width: 44px; }
  .time-label span { font-size: 10px; right: 4px; }
}

/* Landscape phones */
@media (max-width: 768px) and (orientation: landscape) {
  .toolbar {
    min-height: 38px;
    padding: 4px 8px;
    gap: 4px;
  }
  #current-range-label {
    top: 4px;
    font-size: 10px;
  }
  .toolbar-center {
    margin-top: 0;
    gap: 6px;
    flex: 0 1 auto;
    order: 0;
  }
  .toolbar-left {
    flex: 0 0 auto;
  }
  .control-group select,
  .multi-select-trigger,
  .view-toggle button {
    font-size: 11px;
    padding: 2px 5px;
  }
  .toolbar-right button {
    padding: 3px 6px;
    font-size: 11px;
  }
  .account-menu-trigger {
    font-size: 11px;
    padding: 3px 6px;
  }

  .month-cell { min-height: 26px; padding: 1px; }
  .cell-date { font-size: 10px; }
  .month-card { font-size: 8px; padding: 1px; gap: 1px; }
  .month-day-name { padding: 3px 2px; font-size: 10px; }
  .mini-time { font-size: 8px; }
  .mini-nature { font-size: 7px; }
  .more-label { font-size: 8px; padding: 1px 3px; }

  .q-cell { min-height: 24px; padding: 1px; }
  .q-day-name { padding: 3px; font-size: 10px; }
  .quarter-card { font-size: 8px; padding: 1px; }

  .day-column { min-width: 120px; }
  .time-column-header, .time-labels { width: 36px; min-width: 36px; }
}