:root {
  --tomf-bg-card: #ffffff;
  --tomf-border: #e2e8f0;
  --tomf-text: #1e293b;
  --tomf-muted: #64748b;
  --tomf-primary: #0284c7;
  --tomf-primary-hover: #0369a1;
  --tomf-primary-fg: #ffffff;
  --tomf-btn-bg: #f8fafc;
  --tomf-btn-border: #cbd5e1;
  --tomf-btn-hover: #e2e8f0;
  --tomf-stat-bg: #f8fafc;
  --tomf-work-bg: #10b981;
  --tomf-flex-bg: #f59e0b;
  --tomf-sleep-bg: #cbd5e1;
  --tomf-feedback-bg: #e0f2fe;
  --tomf-feedback-text: #0369a1;
}

.tomf-main {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.5rem 1rem;
}

.tomf-card {
  background: var(--tomf-bg-card);
  border: 1px solid var(--tomf-border);
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.tomf-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.tomf-toolbar-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tomf-toolbar-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--tomf-muted);
}

.tomf-btn {
  padding: 0.45rem 0.85rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.tomf-btn-primary {
  background: var(--tomf-primary);
  color: var(--tomf-primary-fg);
  border: 1px solid var(--tomf-primary);
}

.tomf-btn-primary:hover {
  background: var(--tomf-primary-hover);
}

.tomf-btn-outline {
  background: var(--tomf-btn-bg);
  color: var(--tomf-text);
  border: 1px solid var(--tomf-btn-border);
}

.tomf-btn-outline:hover {
  background: var(--tomf-btn-hover);
}

.tomf-city-picker-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.25rem;
  padding: 1rem;
  background-color: var(--tomf-stat-bg);
  border: 1px solid var(--tomf-border);
  border-radius: 8px;
}

.tomf-add-city-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.tomf-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--tomf-text);
}

.tomf-picker-row {
  display: flex;
  gap: 0.5rem;
}

.tomf-select {
  padding: 0.45rem 0.75rem;
  font-size: 0.875rem;
  border: 1px solid var(--tomf-border);
  border-radius: 6px;
  background-color: var(--tomf-bg-card);
  color: var(--tomf-text);
}

.tomf-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.75rem;
  color: var(--tomf-text);
}

.tomf-legend-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.tomf-legend-color {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.tomf-work-color { background-color: var(--tomf-work-bg); }
.tomf-flex-color { background-color: var(--tomf-flex-bg); }
.tomf-sleep-color { background-color: var(--tomf-sleep-bg); }

.tomf-best-window {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background-color: var(--tomf-feedback-bg);
  border: 1px solid var(--tomf-border);
  border-radius: 8px;
  margin-bottom: 1.5rem;
}

.tomf-window-icon {
  font-size: 1.25rem;
}

.tomf-window-info {
  font-size: 0.875rem;
  color: var(--tomf-feedback-text);
}

.tomf-matrix-wrap {
  border: 1px solid var(--tomf-border);
  border-radius: 8px;
  overflow-x: auto;
  margin-bottom: 1.5rem;
}

.tomf-matrix-header {
  display: flex;
  align-items: center;
  background-color: var(--tomf-stat-bg);
  border-bottom: 1px solid var(--tomf-border);
  padding: 0.5rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--tomf-muted);
  min-width: 680px;
}

.tomf-col-city {
  width: 180px;
  flex-shrink: 0;
}

.tomf-col-hours {
  display: flex;
  justify-content: space-between;
  flex-grow: 1;
  padding-left: 0.5rem;
}

.tomf-city-rows {
  display: flex;
  flex-direction: column;
  min-width: 680px;
}

.tomf-city-row {
  display: flex;
  align-items: center;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--tomf-border);
  background-color: var(--tomf-bg-card);
}

.tomf-city-row:last-child {
  border-bottom: none;
}

.tomf-city-meta {
  width: 180px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.tomf-btn-remove-city {
  background: none;
  border: none;
  color: var(--tomf-muted);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 0.25rem;
}

.tomf-btn-remove-city:hover {
  color: #ef4444;
}

.tomf-city-name {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--tomf-text);
}

.tomf-city-tz {
  display: block;
  font-size: 0.75rem;
  color: var(--tomf-muted);
}

.tomf-hours-strip {
  display: flex;
  flex-grow: 1;
  height: 28px;
  border-radius: 4px;
  overflow: hidden;
  gap: 2px;
}

.tomf-hour-block {
  flex: 1;
  cursor: pointer;
  transition: opacity 0.1s ease, transform 0.1s ease;
}

.tomf-hour-block:hover {
  opacity: 0.85;
  transform: scaleY(1.1);
}

.tomf-h-work { background-color: var(--tomf-work-bg); }
.tomf-h-flex { background-color: var(--tomf-flex-bg); }
.tomf-h-sleep { background-color: var(--tomf-sleep-bg); }

.tomf-slot-detail {
  background-color: var(--tomf-stat-bg);
  border: 1px solid var(--tomf-border);
  border-radius: 8px;
  padding: 1rem;
}

.tomf-detail-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--tomf-text);
  margin: 0 0 0.5rem 0;
}

.tomf-detail-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tomf-chip {
  background-color: var(--tomf-bg-card);
  border: 1px solid var(--tomf-border);
  border-radius: 6px;
  padding: 0.35rem 0.65rem;
  font-size: 0.8125rem;
  color: var(--tomf-text);
}

.tomf-feedback {
  display: none;
  margin-top: 1rem;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  background-color: var(--tomf-feedback-bg);
  color: var(--tomf-feedback-text);
  font-size: 0.875rem;
  font-weight: 600;
  text-align: center;
}

/* Season and DST Controls */
.tomf-season-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 0.85rem 1rem;
  background: var(--tomf-stat-bg);
  border: 1px solid var(--tomf-border);
  border-radius: 8px;
  margin-bottom: 1.25rem;
}

.tomf-season-left {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.tomf-season-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tomf-input-date {
  padding: 0.35rem 0.65rem;
  font-size: 0.875rem;
  border: 1px solid var(--tomf-btn-border);
  border-radius: 6px;
  background: var(--tomf-bg-card);
  color: var(--tomf-text);
  min-height: 36px;
}

.tomf-season-pills {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.tomf-season-pill {
  padding: 0.35rem 0.75rem;
  font-size: 0.8125rem;
  font-weight: 500;
  border: 1px solid var(--tomf-btn-border);
  border-radius: 6px;
  background: var(--tomf-btn-bg);
  color: var(--tomf-text);
  cursor: pointer;
  transition: all 0.15s ease;
  min-height: 36px;
}

.tomf-season-pill:hover {
  background: var(--tomf-btn-hover);
}

.tomf-season-pill.active {
  background: var(--tomf-primary);
  color: var(--tomf-primary-fg);
  border-color: var(--tomf-primary);
}

.tomf-badge-dst {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  background: var(--tomf-feedback-bg);
  color: var(--tomf-feedback-text);
  border: 1px solid var(--tomf-primary);
}

.tomf-dst-tag {
  font-size: 0.7rem;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  margin-left: 0.35rem;
  font-weight: 600;
}

.tomf-dst-active {
  background: #dcfce7;
  color: #166534;
}

.tomf-dst-std {
  background: #f1f5f9;
  color: #475569;
}

/* tf:dark-palette — generated by migrate_chrome.py */
/* Neutrals inherit the shared chrome tokens so all tools share one
   ground; brand hues are kept and lightened, never inverted. */
[data-theme="dark"] {
  --tomf-bg-card: var(--tf-surface);
  --tomf-border: var(--tf-surface);
  --tomf-text: var(--tf-ink);
  --tomf-muted: var(--tf-ink-faint);
  --tomf-primary: #81bcda;
  --tomf-primary-hover: #69aed4;
  --tomf-primary-fg: var(--tf-surface);
  --tomf-btn-bg: var(--tf-surface);
  --tomf-btn-border: #98abc3;
  --tomf-btn-hover: var(--tf-surface);
  --tomf-stat-bg: var(--tf-surface);
  --tomf-work-bg: #81dabd;
  --tomf-flex-bg: #dab981;
  --tomf-sleep-bg: #98abc3;
  --tomf-feedback-bg: var(--tf-surface);
  --tomf-feedback-text: #69aed4;
}
