:root {
  --em-bg: #0f1419;
  --em-panel: #151b24;
  --em-text: #e8eef4;
  --em-muted: #7a8a9a;
  --em-line: #243040;
  --em-accent: #6ec6a8;
  --em-autodj: #151b24;
  --em-autodj-text: #5f6f80;
  --em-mixxx: #1e3a4a;
  --em-studio: #3a2a1e;
  --em-autodj-mode: #2a2a1e;
  --em-now: #6ec6a8;
  --em-font: "Segoe UI", system-ui, sans-serif;
}

html.theme-light {
  --em-bg: #f4f6f8;
  --em-panel: #ffffff;
  --em-text: #1a2430;
  --em-muted: #5a6a7a;
  --em-line: #d0d8e0;
  --em-accent: #0a7a5c;
  --em-autodj: #eef2f6;
  --em-autodj-text: #8a96a4;
  --em-mixxx: #d4eaf4;
  --em-studio: #f4e6d4;
  --em-autodj-mode: #eef0d8;
  --em-now: #0a7a5c;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--em-bg);
  color: var(--em-text);
  font-family: var(--em-font);
  font-size: 14px;
  line-height: 1.35;
}

.em {
  padding: 0.75rem 0.85rem 1rem;
}

.em-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-bottom: 0.65rem;
}

.em-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.em-sub {
  margin: 0.15rem 0 0;
  color: var(--em-muted);
  font-size: 0.82rem;
}

.em-now {
  background: var(--em-panel);
  border: 1px solid var(--em-line);
  border-radius: 6px;
  padding: 0.55rem 0.75rem;
  margin-bottom: 0.75rem;
}

.em-now-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--em-accent);
  font-weight: 650;
}

.em-now-title {
  font-size: 1.05rem;
  font-weight: 650;
  margin-top: 0.15rem;
}

.em-now-meta {
  color: var(--em-muted);
  font-size: 0.82rem;
  margin-top: 0.1rem;
}

.em-error {
  color: #e07070;
  margin: 0 0 0.75rem;
  font-size: 0.85rem;
}

.em-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.5rem;
}

.em-btn {
  appearance: none;
  border: 1px solid var(--em-line);
  background: var(--em-panel);
  color: var(--em-text);
  border-radius: 4px;
  padding: 0.3rem 0.65rem;
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
}

.em-btn:hover {
  border-color: var(--em-accent);
  color: var(--em-accent);
}

.em-btn:disabled {
  opacity: 0.5;
  cursor: wait;
}

.em-range {
  color: var(--em-muted);
  font-size: 0.8rem;
  margin: 0 0 0.5rem;
}

.em-scroll {
  overflow-x: auto;
  border: 1px solid var(--em-line);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.15);
}

html.theme-light .em-scroll {
  background: #e8ecf0;
}

.em-grid {
  display: grid;
  grid-template-columns: 3rem repeat(7, minmax(4.5rem, 1fr));
  grid-template-rows: 2.2rem repeat(24, minmax(1.35rem, auto));
  min-width: 44rem;
  gap: 1px;
  background: var(--em-line);
}

.em-corner {
  background: var(--em-panel);
}

.em-dayhead {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.05rem;
  background: var(--em-panel);
  font-size: 0.72rem;
  padding: 0.2rem;
}

.em-dayhead.today {
  color: var(--em-accent);
  font-weight: 650;
}

.em-dayname {
  font-weight: 650;
}

.em-daynum {
  color: var(--em-muted);
  font-size: 0.65rem;
}

.em-hour {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  padding: 0.15rem 0.3rem 0 0;
  background: var(--em-panel);
  color: var(--em-muted);
  font-size: 0.65rem;
  font-variant-numeric: tabular-nums;
}

.em-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 0.05rem;
  padding: 0.15rem 0.25rem;
  min-height: 1.35rem;
  background: var(--em-autodj);
  color: var(--em-autodj-text);
  font-size: 0.68rem;
}

.em-cell.claim.mixxx {
  background: var(--em-mixxx);
  color: var(--em-text);
}

.em-cell.claim.studio {
  background: var(--em-studio);
  color: var(--em-text);
}

.em-cell.claim.autodj-mode {
  background: var(--em-autodj-mode);
  color: var(--em-text);
}

.em-cell.now {
  outline: 1px solid var(--em-now);
  outline-offset: -1px;
  z-index: 1;
}

.em-cell-title {
  font-weight: 650;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.em-cell-meta {
  color: var(--em-muted);
  font-size: 0.62rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.em-cell.claim .em-cell-meta {
  color: inherit;
  opacity: 0.8;
}

.em-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  margin-top: 0.65rem;
  color: var(--em-muted);
  font-size: 0.72rem;
}

.em-swatch {
  display: inline-block;
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 2px;
  margin-right: 0.3rem;
  vertical-align: -0.1rem;
}

.em-swatch.autodj { background: var(--em-autodj); border: 1px solid var(--em-line); }
.em-swatch.mixxx { background: var(--em-mixxx); }
.em-swatch.studio { background: var(--em-studio); }
.em-swatch.autodj-mode { background: var(--em-autodj-mode); }

/* Today list */
.em-day-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--em-line);
  border-radius: 6px;
  overflow: hidden;
}

.em-day-item {
  display: grid;
  grid-template-columns: 5.5rem 1fr;
  gap: 0.65rem;
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--em-line);
  background: var(--em-panel);
}

.em-day-item:last-child {
  border-bottom: 0;
}

.em-day-item.now {
  border-left: 3px solid var(--em-accent);
  background: color-mix(in srgb, var(--em-accent) 12%, var(--em-panel));
}

.em-day-item.autodj {
  color: var(--em-muted);
}

.em-day-time {
  font-variant-numeric: tabular-nums;
  font-size: 0.82rem;
  font-weight: 650;
}

.em-day-body {
  min-width: 0;
}

.em-day-show {
  font-weight: 650;
}

.em-day-meta {
  color: var(--em-muted);
  font-size: 0.78rem;
  margin-top: 0.1rem;
}

.em-day-item.mixxx .em-day-show::before,
.em-day-item.studio .em-day-show::before,
.em-day-item.autodj-mode .em-day-show::before {
  content: "";
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 2px;
  margin-right: 0.35rem;
  vertical-align: 0.05rem;
}

.em-day-item.mixxx .em-day-show::before { background: #3a8ab0; }
.em-day-item.studio .em-day-show::before { background: #c09050; }
.em-day-item.autodj-mode .em-day-show::before { background: #a0a050; }

.em-empty {
  color: var(--em-muted);
  padding: 1.25rem 0.75rem;
  text-align: center;
}
