* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: #f0f0f0;
  color: #1a1a1a;
  line-height: 1.6;
  overflow: hidden;
  height: 100vh;
}

main::-webkit-scrollbar {
  width: 6px;
}
main::-webkit-scrollbar-track {
  background: transparent;
}
main::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,0.12);
  border-radius: 3px;
}

:root {
  --panel-offset: 0px;
}

main {
  position: absolute;
  top: 12px;
  left: calc(88px + var(--panel-offset));
  right: 12px;
  bottom: 12px;
  background: #fff;
  border-radius: 30px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  padding: 2rem 2.5rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  transition: left 0.25s ease;
}

/* --- Left Sidebar (icon-only) --- */
#sidebar {
  position: fixed;
  top: 12px;
  left: 12px;
  bottom: 12px;
  width: 64px;
  background: transparent;
  border-radius: 30px;
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow: visible;
}

.sidebar-top {
  display: flex;
  flex-direction: column;
  padding-top: 1rem;
  gap: 0.25rem;
  align-items: center;
}

.sidebar-bottom {
  margin-top: auto;
  padding-bottom: 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.sidebar-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  padding: 0;
  background: none;
  border: none;
  border-radius: 14px;
  color: #1a1a1a;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
  position: relative;
}

.sidebar-btn:hover {
  background: rgba(0,0,0,0.04);
}

.sidebar-btn.active,
.sidebar-btn.panel-active {
  color: #1a1a1a;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.10);
}

.sidebar-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

/* Sidebar labels as hover tooltips */
.sidebar-label {
  position: absolute;
  left: 54px;
  top: 50%;
  transform: translateY(-50%);
  background: #333;
  color: #fff;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.8rem;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
  z-index: 200;
}

.sidebar-btn:hover .sidebar-label {
  opacity: 1;
}

/* Plus button in sidebar */
.sidebar-btn-plus:hover {
  background: rgba(0,0,0,0.04);
}

/* --- Folder Panel --- */
.folder-panel {
  position: fixed;
  top: 12px;
  left: 76px;
  bottom: 12px;
  width: 0;
  background: #f7f7f7;
  border-radius: 20px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  overflow: hidden;
  transition: width 0.25s ease;
  z-index: 90;
  display: flex;
  flex-direction: column;
}

.folder-panel.open {
  width: 240px;
}

.folder-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1rem 0.75rem;
  border-bottom: 1px solid rgba(0,0,0,0.06);
  min-height: 56px;
}

.folder-panel-title {
  font-size: 1rem;
  font-weight: 700;
  color: #1a1a1a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.folder-panel-close {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: #888;
  padding: 4px;
  border-radius: 6px;
  line-height: 1;
}

.folder-panel-close:hover {
  background: rgba(0,0,0,0.06);
}

.folder-panel-tree {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem 0;
}

.panel-tree-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: #333;
  cursor: pointer;
  border-radius: 8px;
  margin: 1px 0.5rem;
  transition: background 0.15s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.panel-tree-item:hover {
  background: rgba(0,0,0,0.04);
}

.panel-tree-item.active {
  background: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  font-weight: 600;
}

.panel-tree-item.depth-1 { padding-left: 2rem; }
.panel-tree-item.depth-2 { padding-left: 3rem; }

.panel-tree-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.6;
}

/* Drag-and-drop in panel */
.panel-tree-item.folder-drop-target {
  background: rgba(212, 160, 23, 0.18);
  box-shadow: 0 0 0 2px #d4a017;
}

.folder-dragging {
  opacity: 0.3;
}

.cf-folder-draggable {
  cursor: grab;
}
.cf-folder-draggable:active {
  cursor: grabbing;
}

/* ── Folder Management Tree View ─────────────────── */
.cf-folder-tree {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.tree-node {
  border-radius: 6px;
}

.tree-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 6px;
  cursor: default;
  transition: background 0.15s;
}
.tree-row:hover {
  background: rgba(255, 255, 255, 0.05);
}

.tree-depth-0 { padding-left: 10px; }
.tree-depth-1 { padding-left: 28px; }
.tree-depth-2 { padding-left: 46px; }
.tree-depth-3 { padding-left: 64px; }
.tree-depth-4 { padding-left: 82px; }
.tree-depth-5 { padding-left: 100px; }

.tree-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: #d4a017;
}

.tree-team > .tree-row .tree-icon {
  color: #6bc0e2;
}

.tree-name {
  flex: 1;
  font-size: 14px;
  color: #1a1a1a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tree-action {
  background: none;
  border: none;
  color: #999;
  font-size: 14px;
  cursor: pointer;
  padding: 2px 5px;
  border-radius: 4px;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s;
}
.tree-row:hover .tree-action {
  opacity: 1;
}
.tree-action:hover {
  color: #333;
  background: rgba(0, 0, 0, 0.08);
}
.tree-action.tree-delete:hover {
  color: #ff6b6b;
}

.tree-rename-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid #d4a017;
  border-radius: 4px;
  color: #fff;
  font-size: 14px;
  padding: 2px 6px;
  outline: none;
}

.tree-row[draggable="true"] {
  cursor: grab;
}
.tree-row[draggable="true"]:active {
  cursor: grabbing;
}

.tree-drop-highlight {
  background: rgba(212, 160, 23, 0.18) !important;
  box-shadow: 0 0 0 2px #d4a017;
}

.tree-children {
  display: flex;
  flex-direction: column;
}

/* ── Location Tree (chart assignment) ────────── */
.cf-location-tree {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 8px;
}

.loc-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}
.loc-row:hover {
  background: rgba(0, 0, 0, 0.04);
}

.loc-depth-0 { padding-left: 8px; }
.loc-depth-1 { padding-left: 28px; }
.loc-depth-2 { padding-left: 48px; }
.loc-depth-3 { padding-left: 68px; }
.loc-depth-4 { padding-left: 88px; }
.loc-depth-5 { padding-left: 108px; }

.loc-checkbox {
  accent-color: #d4a017;
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.loc-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: #d4a017;
}
.loc-depth-0 .loc-icon {
  color: #6bc0e2;
}

.loc-name {
  font-size: 14px;
  color: #1a1a1a;
}

/* --- Tabs --- */
.tab-content {
  display: none;
}

.tab-content.active {
  display: flex;
}

/* --- Tab Header Row --- */
.tab-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.tab-title {
  font-size: 1.4rem;
  color: #1a1a1a;
  font-weight: 700;
}

.present-controls {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.refresh-btn {
  background: #e8e8e8;
  color: #555;
  font-size: 0.8rem;
  padding: 0.4rem 1rem;
  border-radius: 6px;
}

.refresh-btn:hover {
  background: #ddd;
  color: #333;
}

#play-btn {
  background: #2e7d32;
  font-size: 0.8rem;
  padding: 0.4rem 1rem;
  border-radius: 6px;
}

#play-btn:hover {
  background: #388e3c;
}

/* --- Present Filters --- */
.present-filters {
  display: flex;
  gap: 0.5rem;
  width: 100%;
}

.filter-btn {
  padding: 0.4rem 1.25rem;
  border-radius: 20px;
  background: #fff;
  color: #888;
  font-size: 0.85rem;
  border: 1px solid #ddd;
  cursor: pointer;
  transition: all 0.2s;
}

.filter-btn:hover {
  background: #f0f0f0;
  color: #555;
}

.filter-btn.active {
  background: #d4a017;
  color: #fff;
  border-color: #d4a017;
}

/* --- Tab Empty State --- */
.tab-empty {
  color: #999;
  text-align: center;
  padding: 4rem 1rem;
  font-size: 0.95rem;
  width: 100%;
}

/* --- Tab Filter Bar --- */
.tab-filter-bar {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

/* --- Custom Select Dropdown --- */
.custom-select {
  position: relative;
  display: inline-block;
}
.custom-select-btn {
  padding: 0.45rem 1.8rem 0.45rem 0.75rem;
  border: 1.5px solid #d4a017;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  background: #fff;
  color: #555;
  cursor: pointer;
  white-space: nowrap;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='%23d4a017'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.6rem center;
  transition: border-color 0.15s, background 0.15s;
}
.custom-select-btn:hover {
  background: #fdf8ec;
}
.custom-select.open .custom-select-btn {
  border-color: #b8880f;
}
.custom-select-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 100%;
  background: #fff;
  border: 1px solid #e8e8e8;
  border-radius: 12px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.1);
  z-index: 200;
  padding: 0.3rem 0;
}
.custom-select-option {
  padding: 0.55rem 0.85rem;
  font-size: 0.9rem;
  color: #333;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.1s;
}
.custom-select-option:hover {
  background: #fdf8ec;
}
.custom-select-option.selected {
  color: #d4a017;
  font-weight: 600;
}
.custom-select-option.selected::after {
  content: " \2713";
  margin-left: 0.4rem;
}

.tab-tag-filter {
  display: flex;
  align-items: center;
}

.tab-filter-dates {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.tab-filter-dates input[type="date"],
.tab-filter-dates input.flatpickr-input {
  padding: 0.45rem 0.75rem;
  border: 1.5px solid #e0e0e0;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  background: #fff;
  color: #333;
  min-width: 130px;
  transition: border-color 0.15s;
}

.tab-filter-dates input[type="date"]:focus,
.tab-filter-dates input.flatpickr-input:focus {
  outline: none;
  border-color: #d4a017;
}

.filter-date-sep {
  color: #999;
  font-size: 0.85rem;
}

.filter-date-apply {
  padding: 0.45rem 0.85rem;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 20px;
}

/* --- Chart Grid --- */
.chart-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  width: 100%;
}

.chart-card {
  padding: 1rem;
}

.chart-card.presenting {
  border-color: #d4a017;
  box-shadow: 0 0 0 1px #d4a017;
}

/* --- Chart Toolbar --- */
.chart-toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.chart-title-row {
  text-align: center;
  margin-bottom: 0.25rem;
}

.chart-trend-subtitle {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  margin-top: 2px;
}
.chart-trend-subtitle.hidden {
  display: none;
}
.chart-trend-subtitle.trend-up {
  color: #16a34a;
}
.chart-trend-subtitle.trend-down {
  color: #dc2626;
}

.chart-title-edit {
  font-size: 1rem;
  font-weight: 700;
  color: #1a1a1a;
  cursor: pointer;
  display: inline;
}

.chart-title-edit.untitled {
  color: #bbb;
  font-weight: 400;
  font-style: italic;
}

.chart-title-input {
  padding: 0.2rem 0.4rem;
  font-size: 1rem;
  font-weight: 700;
  background: #fff;
  color: #1a1a1a;
  border: 1px solid #d4a017;
  border-radius: 6px;
  outline: none;
  text-align: center;
  width: 60%;
}

.chart-title-input::placeholder {
  color: #bbb;
  font-weight: 400;
}

/* ── Axis title labels on chart cards ────────── */
.chart-axis-area {
  display: flex;
  align-items: stretch;
}

.chart-canvas-wrap {
  flex: 1;
  min-width: 0;
}

.chart-y-label {
  writing-mode: vertical-lr;
  transform: rotate(180deg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: #888;
  cursor: pointer;
  padding: 0 4px;
  white-space: nowrap;
  transition: color 0.15s;
  user-select: none;
}
.chart-y-label:hover {
  color: #d4a017;
}
.chart-y-label.axis-auto {
  color: #bbb;
}

.chart-x-label {
  display: block;
  text-align: center;
  font-size: 0.75rem;
  color: #888;
  cursor: pointer;
  padding: 2px 0;
  transition: color 0.15s;
  user-select: none;
}
.chart-x-label:hover {
  color: #d4a017;
}
.chart-x-label.axis-auto {
  color: #bbb;
}

.chart-axis-label-input {
  padding: 2px 6px;
  font-size: 0.75rem;
  background: #fff;
  color: #1a1a1a;
  border: 1px solid #d4a017;
  border-radius: 4px;
  outline: none;
  text-align: center;
  width: 120px;
}
.chart-axis-label-input::placeholder {
  color: #bbb;
  font-style: italic;
}

.time-period-select {
  padding: 0.35rem 0.6rem;
  font-size: 0.8rem;
  font-weight: 600;
  background: #fff;
  color: #555;
  border: 1.5px solid #e0e0e0;
  border-radius: 20px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='%23999'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
  padding-right: 1.5rem;
}

.time-period-select:hover {
  border-color: #d4a017;
}

.time-period-select:focus {
  outline: none;
  border-color: #d4a017;
}

/* --- Chart Feature Pills & Dropdown --- */
.chart-features {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.chart-feature-pills {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.chart-feature-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  background: #f5f0e0;
  border: 1.5px solid #d4a017;
  color: #8a6a0a;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  user-select: none;
}

.chart-feature-pill-x {
  cursor: pointer;
  font-size: 0.85rem;
  line-height: 1;
  opacity: 0.6;
  transition: opacity 0.15s;
}

.chart-feature-pill-x:hover {
  opacity: 1;
}

.chart-feature-add {
  position: relative;
}

.chart-feature-plus {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1.5px solid #ddd;
  background: #fff;
  color: #888;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  padding: 0;
  line-height: 1;
}

.chart-feature-plus:hover {
  border-color: #d4a017;
  color: #d4a017;
  background: #fdf8eb;
}

.chart-feature-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 50;
  background: #fff;
  border: 1px solid #e8e8e8;
  border-radius: 10px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.1);
  min-width: 220px;
  overflow: hidden;
}

.chart-feature-option {
  padding: 0.55rem 0.85rem;
  font-size: 0.82rem;
  font-weight: 500;
  color: #444;
  cursor: pointer;
  transition: background 0.12s;
}

.chart-feature-option:hover {
  background: #f8f6f0;
}

.chart-feature-option.feature-active {
  color: #d4a017;
  background: #fdf8eb;
}

.chart-feature-option.feature-active::after {
  content: " \2713";
  font-weight: 700;
}

.chart-feature-sep {
  height: 1px;
  background: #e8e8e8;
  margin: 0.25rem 0;
}

.chart-feature-delete {
  color: #d44 !important;
}

.chart-feature-delete:hover {
  background: #fef2f2 !important;
}

/* --- Custom Chart Dropdowns --- */
.chart-dropdown {
  position: relative;
}

.chart-dropdown-btn {
  padding: 0.35rem 0.6rem;
  padding-right: 1.5rem;
  font-size: 0.8rem;
  font-weight: 600;
  background: #fff;
  color: #555;
  border: 1.5px solid #e0e0e0;
  border-radius: 20px;
  cursor: pointer;
  white-space: nowrap;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='%23999'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
  transition: border-color 0.15s;
  line-height: 1.4;
}

.chart-dropdown-btn:hover {
  border-color: #d4a017;
}

.chart-dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 50;
  background: #fff;
  border: 1px solid #e8e8e8;
  border-radius: 10px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.1);
  min-width: 160px;
  overflow: hidden;
}

.chart-dropdown-option {
  padding: 0.55rem 0.85rem;
  font-size: 0.82rem;
  font-weight: 500;
  color: #444;
  cursor: pointer;
  transition: background 0.12s;
}

.chart-dropdown-option:hover {
  background: #f8f6f0;
}

.chart-dropdown-option.active {
  color: #d4a017;
  background: #fdf8eb;
}

.chart-dropdown-option.active::after {
  content: " \2713";
  font-weight: 700;
}

/* --- Metric Form: Loading Spinner --- */
#cf-metric-loading {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.75rem 0;
}
.metric-spinner {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border: 3px solid #e0e0e0;
  border-top-color: #d4a017;
  border-radius: 50%;
  animation: metric-spin 0.7s linear infinite;
}
.metric-loading-text {
  font-size: 0.88rem;
  color: #888;
}
@keyframes metric-spin {
  to { transform: rotate(360deg); }
}

/* --- Create Graph: Sheets Dropdown --- */
.cf-sheets-dropdown .chart-dropdown-btn {
  width: 100%;
  border-radius: 8px;
  font-size: 0.9rem;
  padding: 0.5rem 1.75rem 0.5rem 0.75rem;
  text-align: left;
}
.cf-sheets-dropdown .chart-dropdown-menu {
  width: 100%;
  max-height: 200px;
  overflow-y: auto;
}

/* --- Drag & Drop --- */
.draggable {
  cursor: grab;
  transition: opacity 0.2s, box-shadow 0.2s;
}

.draggable:active {
  cursor: grabbing;
}

.draggable.dragging {
  opacity: 0.4;
  box-shadow: 0 0 0 2px #d4a017;
}

.drag-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #eee;
}

.drag-handle {
  color: #bbb;
  font-size: 1.1rem;
  cursor: pointer;
  user-select: none;
  transition: color 0.2s;
}

.drag-handle:hover {
  color: #d4a017;
}

.drag-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: #666;
  flex: 1;
}

.collapse-title {
  display: none;
  font-size: 0.95rem;
  font-weight: 600;
  color: #1a1a1a;
  flex: 1;
  text-align: left;
}

/* Collapsed card: hide body, show title in header */
.chart-card.collapsed .chart-body {
  display: none;
}

.chart-card.collapsed .drag-header {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.chart-card.collapsed .drag-label {
  display: none;
}

.chart-card.collapsed .collapse-title {
  display: inline;
}

/* --- Saved Charts List --- */
.saved-chart-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0;
  border-bottom: 1px solid #eee;
}

.saved-chart-item:last-child {
  border-bottom: none;
}

.saved-chart-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.delete-chart-btn {
  background: #f0f0f0;
  color: #ef5350;
  font-size: 0.8rem;
  padding: 0.3rem 0.75rem;
}

.delete-chart-btn:hover {
  background: #ef5350;
  color: #fff;
}

/* --- Notes Date Row (Play tab) --- */
.notes-date-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.notes-date-row label {
  font-size: 0.9rem;
  font-weight: 600;
  color: #555;
  white-space: nowrap;
}

.notes-date-row input[type="date"],
.notes-date-row input.flatpickr-input {
  padding: 0.45rem 0.75rem;
  border: 1.5px solid #e0e0e0;
  border-radius: 20px;
  font-size: 0.85rem;
  background: #fff;
  color: #333;
  min-width: 130px;
}

.notes-date-row input[type="date"]:focus,
.notes-date-row input.flatpickr-input:focus {
  outline: none;
  border-color: #d4a017;
}

/* --- Per-Card Notes Section (Play tab) --- */
.chart-notes-section {
  border-top: 1px solid #eee;
  margin-top: 0.75rem;
  padding-top: 0.5rem;
}

.chart-notes-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  color: #888;
  padding: 0.25rem 0;
  user-select: none;
}

.chart-notes-header:hover {
  color: #d4a017;
}

.notes-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  background: #eee;
  color: #888;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0 5px;
}

.chart-notes-body {
  padding-top: 0.5rem;
}

.chart-notes-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.5rem;
  max-height: 200px;
  overflow-y: auto;
}

.note-mini-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.45rem 0.65rem;
  background: #f8f8f8;
  border: 1px solid #e8e8e8;
  border-radius: 8px;
  font-size: 0.85rem;
  color: #333;
}

.note-text {
  flex: 1;
  line-height: 1.4;
}

.note-remove {
  background: none;
  color: #ccc;
  font-size: 1.1rem;
  padding: 0 0.3rem;
  line-height: 1;
  border-radius: 4px;
  flex-shrink: 0;
}

.note-remove:hover {
  color: #ef5350;
  background: #f0f0f0;
}

.note-add-row {
  display: flex;
  gap: 0.4rem;
}

.note-add-row .note-input {
  flex: 1;
  padding: 0.4rem 0.6rem;
  font-size: 0.85rem;
  background: #f8f8f8;
  color: #333;
  border: 1px solid #ddd;
  border-radius: 8px;
}

.note-add-row .note-input:focus {
  outline: none;
  border-color: #d4a017;
}

/* --- Full-width config field --- */
.config-field.full-width {
  grid-column: 1 / -1;
}

/* --- Fullscreen Slideshow --- */
#slideshow {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: #f5f5f5;
  display: flex;
  align-items: center;
  justify-content: center;
}

#slide-body {
  display: flex;
  width: 90vw;
  height: 82vh;
  gap: 1.5rem;
}

#slide-canvas-wrap {
  flex: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  flex-direction: column;
}

#slide-canvas {
  max-width: 100%;
  max-height: 100%;
}

#slide-chart-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: #1a1a1a;
  text-align: center;
  margin-bottom: 0.5rem;
  flex-shrink: 0;
}

#slide-notes-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  padding: 1rem;
  min-width: 0;
  max-height: 100%;
}

.slide-notes-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #e0e0e0;
}

.slide-notes-title {
  font-size: 1rem;
  font-weight: 700;
  color: #d4a017;
}

.slide-notes-header input[type="date"],
.slide-notes-header input.flatpickr-input {
  padding: 0.4rem 0.65rem;
  border: 1.5px solid #ccc;
  border-radius: 20px;
  font-size: 0.8rem;
  background: #fff;
  color: #1a1a1a;
  min-width: 120px;
}

.slide-notes-header input[type="date"]:focus,
.slide-notes-header input.flatpickr-input:focus {
  outline: none;
  border-color: #d4a017;
}

#slide-notes-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.slide-note-card {
  padding: 0.75rem 0.9rem;
  background: #f5f5f5;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  font-size: 0.95rem;
  color: #1a1a1a;
  line-height: 1.5;
}

.slide-notes-empty {
  color: #999;
  font-size: 0.9rem;
  text-align: center;
  padding: 2rem 0.5rem;
}

#slide-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  color: #999;
  font-size: 2rem;
  padding: 0.25rem 0.75rem;
  border-radius: 8px;
  line-height: 1;
}

#slide-close:hover {
  color: #1a1a1a;
  background: #e8e8e8;
}

#slide-prev,
#slide-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0,0,0,0.05);
  color: #666;
  font-size: 2rem;
  padding: 1rem 0.75rem;
  border-radius: 8px;
  line-height: 1;
}

#slide-prev { left: 1rem; }
#slide-next { right: 1rem; }

#slide-prev:hover,
#slide-next:hover {
  background: rgba(0,0,0,0.1);
  color: #1a1a1a;
}

#slide-counter {
  position: absolute;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  color: #888;
  font-size: 0.9rem;
}

/* --- Creation Overlay --- */
/* --- Create Tab --- */
.create-actions-card {
  padding: 1.25rem;
}

.create-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
}

.create-data-section {
  padding: 0.25rem 0;
}

.create-section-title {
  font-size: 1rem;
  font-weight: 700;
  color: #333;
  margin-bottom: 0.75rem;
}

.create-card {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 16px;
  padding: 1.25rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.create-card:hover {
  background: #fafafa;
  border-color: #d4a017;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.create-card:active {
  transform: translateY(0);
}

.create-card-icon {
  margin-bottom: 0.5rem;
  line-height: 0;
  opacity: 0.85;
}
.create-card-icon svg {
  width: 32px;
  height: 32px;
}

.create-card-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: #444;
  line-height: 1.3;
}

.create-card-empty {
  opacity: 0.4;
  cursor: default;
}

.create-card-empty:hover {
  background: #fff;
  border-color: #e0e0e0;
  transform: none;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

/* --- Creation Form Overlay --- */
.create-form-overlay {
  position: fixed;
  top: 12px;
  left: calc(88px + var(--panel-offset));
  right: 12px;
  bottom: 12px;
  transition: left 0.25s ease;
  z-index: 95;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 30px;
  overflow: hidden;
}

.create-form-backdrop {
  display: none;
}

.create-form-panel {
  position: relative;
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem 1.25rem 5rem;
}

.create-form-back {
  background: none;
  color: #888;
  font-size: 0.95rem;
  padding: 0.5rem 0.75rem;
  margin-bottom: 1rem;
  border-radius: 8px;
}

.create-form-back:hover {
  color: #1a1a1a;
  background: #eee;
}

#create-form-content .card {
  border: none;
  padding: 0;
  background: transparent;
}

#create-form-content .card h2 {
  font-size: 1.3rem;
  margin-bottom: 1rem;
}

/* --- Graph Creator: Live Preview --- */
.cf-preview-wrap {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  padding: 0.75rem;
  margin-bottom: 1.25rem;
  min-height: 200px;
  position: relative;
}

.cf-preview-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #bbb;
  font-size: 0.85rem;
  text-align: center;
  padding: 1rem;
}

/* --- Graph Creator: Section + Labels --- */
.cf-section {
  margin-bottom: 1rem;
}

.cf-axis-titles-row {
  display: flex;
  gap: 1rem;
}
.cf-axis-field {
  flex: 1;
}

.cf-label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  color: #555;
  margin-bottom: 0.35rem;
}

.cf-section select,
.cf-section input[type="text"] {
  width: 100%;
}

/* --- Aggregation Controls --- */
.cf-agg-toggle-label {
  cursor: pointer;
  user-select: none;
}
.cf-agg-toggle-label input[type="checkbox"] {
  margin-right: 0.4rem;
  vertical-align: middle;
}
.cf-agg-controls {
  padding-left: 1.25rem;
  border-left: 3px solid #e0e0e0;
  margin-top: 0.6rem;
}
.cf-agg-controls.hidden { display: none; }
.cf-agg-row { margin-bottom: 0.65rem; }
.cf-agg-row select { width: 100%; }
.cf-agg-inline {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.cf-agg-inline input[type="number"] {
  width: 5rem !important;
}
.cf-agg-check-label {
  font-size: 0.85rem;
  color: #555;
  white-space: nowrap;
  cursor: pointer;
}
.cf-agg-check-label input[type="checkbox"] {
  margin-right: 0.3rem;
  vertical-align: middle;
}
.cf-agg-preview {
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  background: #fafafa;
}
.cf-agg-preview table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.cf-agg-preview th,
.cf-agg-preview td {
  padding: 0.35rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid #f0f0f0;
}
.cf-agg-preview th {
  font-weight: 600;
  color: #555;
  position: sticky;
  top: 0;
  background: #fafafa;
}
.cf-agg-preview td:last-child,
.cf-agg-preview th:last-child {
  text-align: right;
}

/* --- Graph Creator: Pill Toggle (Sam/Nick) --- */
.cf-pill-row {
  display: flex;
  gap: 0.5rem;
}

.cf-pill {
  flex: 1;
  padding: 0.5rem 1rem;
  border-radius: 10px;
  background: #f8f8f8;
  border: 1px solid #ddd;
  color: #888;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.cf-pill:hover {
  background: #f0f0f0;
  color: #555;
}

.cf-pill.active {
  background: #d4a017;
  border-color: #d4a017;
  color: #fff;
}

/* --- Graph Creator: Y-Axis Tabs --- */
.cf-y-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 0.75rem;
  border-bottom: 2px solid #eee;
}

.cf-y-tab {
  flex: 1;
  padding: 0.55rem 0;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  color: #aaa;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: -2px;
  transition: color 0.2s, border-color 0.2s;
}

.cf-y-tab:hover {
  color: #666;
  background: none;
}

.cf-y-tab.active {
  color: #d4a017;
  border-bottom-color: #d4a017;
  background: none;
}

.cf-y-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  background: #eee;
  color: #888;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0 5px;
  margin-left: 4px;
}

.cf-y-tab.active .cf-y-count {
  background: #d4a017;
  color: #fff;
}

.cf-y-panel {
  min-height: 60px;
}

/* --- Chip Page Navigation --- */
.chip-page-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.6rem;
  padding: 0.35rem 0.5rem;
  background: #f4f4f4;
  border-radius: 8px;
}
.chip-nav-arrow {
  background: none;
  border: none;
  font-size: 1.4rem;
  font-weight: 700;
  color: #999;
  cursor: pointer;
  padding: 0 0.5rem;
  line-height: 1;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}
.chip-nav-arrow:hover {
  color: #d4a017;
  background: #eee;
}
.chip-nav-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: #555;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* --- Graph Creator: Column Chips --- */
.chip-group-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #999;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 0.6rem;
  margin-bottom: 0.25rem;
}

.chip-group-label:first-child {
  margin-top: 0;
}

.col-chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.col-chip {
  padding: 0.4rem 0.85rem;
  border-radius: 20px;
  background: #f8f8f8;
  border: 1px solid #ddd;
  color: #777;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.col-chip:hover {
  background: #f0f0f0;
  border-color: #bbb;
  color: #444;
}

.col-chip.active {
  background: #d4a017;
  border-color: #d4a017;
  color: #fff;
}

.formula-metric-btn {
  background: #eef8ee;
  border-color: #8cb88c;
  color: #2d6e2d;
}
.formula-metric-btn:hover {
  background: #d8f0d8;
  border-color: #6ea86e;
  color: #1d5e1d;
}

.time-chip {
  background: #eef2f8;
  border-color: #9ab0cc;
  color: #4a6fa5;
  font-weight: 600;
}

.time-chip:hover {
  background: #dde6f2;
  border-color: #6b8cba;
  color: #2e5080;
}

.time-chip.active {
  background: #6b8cba;
  border-color: #6b8cba;
  color: #fff;
}

.time-chip-row {
  margin-bottom: 0.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #eee;
}

.time-series-label .hint {
  font-size: 0.75rem;
  color: #888;
  margin-left: 0.3rem;
}
#cf-metric-col-buttons .formula-col-btn {
  font-size: 0.78rem;
  padding: 0.3rem 0.7rem;
}

/* --- Settings Cards Grid --- */
.settings-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}

#settings-form-content .card {
  border: none;
  padding: 0;
  background: transparent;
}

#settings-form-content .card h2 {
  font-size: 1.3rem;
  margin-bottom: 1rem;
}

/* --- Week Start Day Selector --- */
.weekstart-days {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}
.weekstart-day {
  padding: 0.5rem 1rem;
  border: 1.5px solid #ddd;
  border-radius: 8px;
  background: #fff;
  color: #444;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.weekstart-day:hover {
  border-color: #d4a017;
  color: #d4a017;
}
.weekstart-day.active {
  background: #d4a017;
  border-color: #d4a017;
  color: #fff;
}
#weekstart-preview {
  margin-top: 0.75rem;
  font-weight: 600;
  color: #666;
}

/* --- Cards --- */
.card {
  background: #f8f8fa;
  border: 1px solid #ebebeb;
  border-radius: 16px;
  padding: 1.5rem;
}

.card h2 {
  font-size: 1.15rem;
  margin-bottom: 0.75rem;
  color: #d4a017;
}

.hint {
  font-size: 0.85rem;
  color: #999;
  margin-bottom: 0.5rem;
}

/* --- Data Input --- */
.input-row {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.input-row input {
  flex: 1;
}

#sheet-title {
  flex: 0 0 180px;
}

input[type="text"],
select {
  padding: 0.6rem 0.75rem;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 0.95rem;
  background: #f8f8f8;
  color: #333;
  transition: border-color 0.2s;
}

input[type="text"]:focus,
select:focus {
  outline: none;
  border-color: #d4a017;
}

select option {
  background: #fff;
  color: #333;
}

button {
  padding: 0.6rem 1.25rem;
  border: none;
  border-radius: 8px;
  background: #d4a017;
  color: #fff;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.2s;
}

button:hover {
  background: #b8880f;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

#load-status {
  margin-top: 0.5rem;
  font-size: 0.9rem;
}

.status-error { color: #ef5350; }
.status-success { color: #43a047; }
.status-loading { color: #999; }

/* --- Data Preview --- */
#table-wrapper {
  max-height: 300px;
  overflow: auto;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
}

#preview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

#preview-table th,
#preview-table td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid #eee;
  text-align: left;
  white-space: nowrap;
}

#preview-table th {
  background: #f8f8f8;
  position: sticky;
  top: 0;
  font-weight: 600;
  color: #555;
}

#preview-table tr:hover td {
  background: #fafaf5;
}

/* --- Chart Config --- */
.config-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

.config-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.config-field label {
  font-weight: 600;
  font-size: 0.9rem;
  color: #555;
}

.config-field select,
.config-field input {
  width: 100%;
}

/* --- Y-Axis Series List --- */
.y-add-row {
  display: flex;
  gap: 0.5rem;
}

.y-add-row select {
  flex: 1;
}

.btn-small {
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
  white-space: nowrap;
}

.series-list {
  margin-bottom: 1rem;
}

.series-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.65rem;
  background: #f8f8f8;
  border: 1px solid #e8e8e8;
  border-radius: 8px;
  margin-bottom: 0.4rem;
}

.series-color {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 6px;
  padding: 0;
  cursor: pointer;
  background: none;
}

.series-color::-webkit-color-swatch-wrapper {
  padding: 0;
}

.series-color::-webkit-color-swatch {
  border: 1px solid #ddd;
  border-radius: 5px;
}

.series-name {
  flex: 1;
  font-size: 0.9rem;
  color: #333;
}

.series-remove {
  background: none;
  color: #ccc;
  font-size: 1.2rem;
  padding: 0 0.4rem;
  line-height: 1;
  border-radius: 4px;
}

.series-remove:hover {
  color: #ef5350;
  background: #f0f0f0;
}

.axis-check-label {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.8rem;
  color: #555;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

.axis-check-label input[type="checkbox"] {
  cursor: pointer;
  accent-color: #d4a017;
}

.axis-check-disabled {
  opacity: 0.35;
  cursor: default;
  pointer-events: none;
}

/* --- Marker Add Row (Turbo/Sales inputs) --- */
.marker-add-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.marker-add-row input[type="text"] {
  flex: 1;
}

.marker-add-row input[type="date"] {
  padding: 0.6rem 0.75rem;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 0.9rem;
  background: #f8f8f8;
  color: #333;
}

.marker-add-row input[type="date"]:focus {
  outline: none;
  border-color: #d4a017;
}

/* --- Marker List (saved turbo/sales entries) --- */
.marker-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.marker-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 0.75rem;
  background: #f8f8f8;
  border: 1px solid #e8e8e8;
  border-radius: 8px;
}

.marker-item.active-key {
  border-left: 3px solid #d4a017;
  background: #fdf8ec;
}

.marker-info {
  font-size: 0.9rem;
  color: #555;
}

.marker-info strong {
  color: #1a1a1a;
}

.marker-remove {
  background: none;
  color: #ccc;
  font-size: 1.2rem;
  padding: 0 0.4rem;
  line-height: 1;
  border-radius: 4px;
}

.marker-remove:hover {
  color: #ef5350;
  background: #f0f0f0;
}

/* --- Saved Sheets list --- */
.sheet-saved-title {
  font-weight: 600;
  color: #1a1a1a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 80px;
  max-width: 180px;
  flex-shrink: 0;
}

.sheet-saved-url {
  flex: 1;
  font-size: 0.82rem;
  color: #888;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

/* --- Settings Subsections --- */
.settings-subsection {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid #e8e8e8;
}
.settings-subsection:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}
.settings-subsection-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: #333;
  margin: 0 0 0.5rem 0;
}

/* --- Saved Sheet Cards with Tab Toggles --- */
.saved-sheet-card {
  background: #f8f8f8;
  border: 1px solid #e8e8e8;
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  margin-bottom: 0.5rem;
}
.saved-sheet-card.active-sheet {
  border-color: #d4a017;
}
.saved-sheet-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  overflow: hidden;
}
.saved-sheet-header.sheet-header-toggle {
  cursor: pointer;
}
.sheet-chevron {
  flex-shrink: 0;
  font-size: 1rem;
  color: #aaa;
  line-height: 1;
  transition: transform 0.2s ease;
  transform: rotate(0deg);
}
.sheet-chevron.open {
  transform: rotate(90deg);
}
.sheet-load-btn {
  flex-shrink: 0;
  padding: 0.25rem 0.6rem;
  font-size: 0.78rem;
}
.sheet-load-btn--loaded {
  background: #e6f4ea;
  border-color: #7cbf8a;
  color: #2e7d45;
  cursor: default;
}
.sheet-load-btn--loaded:hover {
  background: #e6f4ea;
  border-color: #7cbf8a;
}
.sheet-tabs-body {
  overflow: hidden;
}
.sheet-tabs-toggles {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid #e8e8e8;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.tab-toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.25rem 0;
  cursor: pointer;
}
.toggle-switch.toggle-inactive {
  opacity: 0.4;
  cursor: default;
  pointer-events: none;
}
.tab-toggle-name {
  font-size: 0.85rem;
  color: #555;
}
.toggle-switch {
  position: relative;
  width: 36px;
  height: 20px;
  background: #ccc;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
}
.toggle-switch.active {
  background: #d4a017;
}
.toggle-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
}
.toggle-switch.active .toggle-knob {
  transform: translateX(16px);
}

/* --- Turbo Popup Card --- */
.turbo-popup {
  position: fixed;
  z-index: 1100;
  background: #fff;
  border: 1px solid #ff6b6b;
  border-radius: 10px;
  padding: 1rem 1.25rem;
  max-width: 300px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  transform: translate(-50%, -110%);
  pointer-events: none;
}

.turbo-popup strong {
  display: block;
  font-size: 0.95rem;
  color: #ff6b6b;
  margin-bottom: 0.35rem;
}

.turbo-popup p {
  font-size: 0.85rem;
  color: #555;
  margin: 0;
  line-height: 1.5;
}

/* --- Marker Description Row --- */
.marker-desc-row {
  margin-bottom: 0.75rem;
}

.marker-desc-row input {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 0.95rem;
  background: #f8f8f8;
  color: #333;
}

.marker-desc-row input:focus {
  outline: none;
  border-color: #d4a017;
}

/* --- Sheet Tab Pills --- */
.sheet-tab-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}

.sheet-tab-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  border-radius: 20px;
  background: #f8f8f8;
  border: 1px solid #ddd;
  color: #555;
  font-size: 0.8rem;
  font-weight: 500;
}

.sheet-tab-pill.default {
  border-color: #d4a017;
  color: #d4a017;
}

.sheet-tab-pill.unloaded {
  opacity: 0.5;
}

.sheet-tab-pill .pill-remove {
  background: none;
  border: none;
  color: #ccc;
  font-size: 0.9rem;
  padding: 0;
  margin: 0;
  cursor: pointer;
  line-height: 1;
}

.sheet-tab-pill .pill-remove:hover {
  color: #ef5350;
}

/* --- HTML Legend Pills --- */
.html-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}

.legend-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.3rem 0.85rem;
  border-radius: 20px;
  color: #000000;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  transition: opacity 0.2s;
  border: 1.5px solid;
}

.legend-pill:hover {
  opacity: 0.85;
}

.legend-pill-hidden {
  opacity: 0.3;
  text-decoration: line-through;
}

/* --- Flatpickr Theme Overrides --- */
.flatpickr-calendar {
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  border: 1px solid #e8e8e8;
  font-family: inherit;
}
.flatpickr-months .flatpickr-month {
  background: #fff;
  border-radius: 12px 12px 0 0;
}
.flatpickr-current-month .flatpickr-monthDropdown-months,
.flatpickr-current-month input.cur-year {
  font-weight: 600;
  color: #333;
}
.flatpickr-months .flatpickr-prev-month,
.flatpickr-months .flatpickr-next-month {
  color: #666;
  fill: #666;
}
.flatpickr-months .flatpickr-prev-month:hover,
.flatpickr-months .flatpickr-next-month:hover {
  color: #d4a017;
  fill: #d4a017;
}
span.flatpickr-weekday {
  color: #999;
  font-weight: 600;
  font-size: 0.75rem;
}
.flatpickr-day {
  border-radius: 8px;
  color: #333;
  font-weight: 500;
}
.flatpickr-day:hover {
  background: #f5f0e0;
  border-color: #f5f0e0;
}
.flatpickr-day.selected,
.flatpickr-day.startRange,
.flatpickr-day.endRange {
  background: #d4a017;
  border-color: #d4a017;
  color: #fff;
}
.flatpickr-day.selected:hover,
.flatpickr-day.startRange:hover,
.flatpickr-day.endRange:hover {
  background: #b8890f;
  border-color: #b8890f;
}
.flatpickr-day.inRange {
  background: #f5f0e0;
  border-color: #f5f0e0;
  box-shadow: -5px 0 0 #f5f0e0, 5px 0 0 #f5f0e0;
}
.flatpickr-day.today:not(.selected) {
  border-color: #d4a017;
}
.flatpickr-day.today:not(.selected):hover {
  background: #f5f0e0;
  border-color: #d4a017;
}

/* --- Utilities --- */
.hidden {
  display: none !important;
}

@media (max-width: 960px) {
  main {
    margin-left: 64px;
    max-width: none;
    padding: 0 1rem 2rem;
  }

  .settings-cards {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .settings-cards {
    grid-template-columns: 1fr;
  }

  .config-grid {
    grid-template-columns: 1fr;
  }

  .input-row {
    flex-direction: column;
  }

  .marker-add-row {
    flex-direction: column;
  }

  #slide-body {
    flex-direction: column;
    width: 95vw;
    height: 85vh;
  }

  #slide-canvas-wrap {
    flex: 2;
  }

  #slide-notes-panel {
    flex: 1;
    max-height: 30vh;
  }
}

/* ── Testing Portal ────────────────────────────────── */
.test-mode-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  background: #d4a017;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  text-align: center;
  padding: 4px 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  letter-spacing: 0.03em;
}
.test-mode-banner.hidden {
  display: none;
}

.testmode-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  background: #f7f7f7;
  border-radius: 10px;
  border: 1px solid #e0e0e0;
}

.testmode-toggle-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: #444;
}

/* Toggle switch (testmode label-based variant) */
.testmode-toggle-row .toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}
.testmode-toggle-row .toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: #ccc;
  border-radius: 24px;
  transition: background 0.2s;
}
.toggle-slider::before {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.testmode-toggle-row .toggle-switch input:checked + .toggle-slider {
  background: #d4a017;
}
.testmode-toggle-row .toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(20px);
}

/* ── Login Screen ─────────────────────────────────────────────── */

#login-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f0f0f0;
}

#login-screen.hidden {
  display: none;
}

.login-card {
  background: #fff;
  border-radius: 30px;
  box-shadow: 0 2px 24px rgba(0,0,0,0.10);
  padding: 3rem 2.5rem 2.5rem;
  width: 100%;
  max-width: 400px;
  text-align: center;
}

.login-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 0.25rem;
}

.login-subtitle {
  font-size: 0.95rem;
  color: #666;
  margin-bottom: 2rem;
}

#login-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  text-align: left;
}

.login-field label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: #1a1a1a;
  margin-bottom: 0.3rem;
}

.login-field input {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1px solid rgba(0,0,0,0.15);
  border-radius: 10px;
  font-size: 0.95rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}

.login-field input:focus {
  border-color: #d4a017;
  box-shadow: 0 0 0 3px rgba(212,160,23,0.12);
}

.login-error {
  background: #fef2f2;
  color: #b91c1c;
  font-size: 0.85rem;
  padding: 0.6rem 0.85rem;
  border-radius: 8px;
  text-align: center;
}

.login-error.hidden {
  display: none;
}

.login-btn {
  width: 100%;
  padding: 0.7rem;
  background: #d4a017;
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s;
  margin-top: 0.25rem;
}

.login-btn:hover {
  background: #b8890f;
}

.login-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.login-divider {
  display: flex;
  align-items: center;
  margin: 1.25rem 0;
  gap: 0.75rem;
}

.login-divider::before,
.login-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(0,0,0,0.12);
}

.login-divider span {
  font-size: 0.8rem;
  color: #999;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.login-quick {
  text-align: left;
}

.login-quick label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: #1a1a1a;
  margin-bottom: 0.3rem;
}

.login-code-row {
  display: flex;
  gap: 0.5rem;
}

.login-code-row input {
  flex: 1;
  padding: 0.65rem 0.85rem;
  border: 1px solid rgba(0,0,0,0.15);
  border-radius: 10px;
  font-size: 1.1rem;
  font-family: inherit;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  outline: none;
  transition: border-color 0.15s;
}

.login-code-row input:focus {
  border-color: #d4a017;
  box-shadow: 0 0 0 3px rgba(212,160,23,0.12);
}

.login-btn-small {
  width: auto;
  padding: 0.65rem 1.2rem;
  margin-top: 0;
}

