:root {
  --bg: #0f0f10;
  --panel: #1a1a1c;
  --cell: #242422;
  --fg: #f3f0e8;
  --gold: #c9a86a;
  --green: #5fbf6f;
  --red: #e0645a;
  --gray: #8a8a8a;
  --unscheduled: #3a3a38;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  min-height: 100%;
  overscroll-behavior-y: contain;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 8px;
}
.topbar-actions { display: flex; gap: 8px; }
#notifyBtn.enabled { color: var(--green); }
.topbar h1 {
  font-size: 20px;
  letter-spacing: 1px;
  color: var(--gold);
  margin: 0;
  font-weight: 800;
}

.ghost-btn {
  background: var(--panel);
  color: var(--fg);
  border: none;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 14px;
  cursor: pointer;
}
.ghost-btn:active { background: #2a2a28; }

.stockpile {
  margin: 8px 16px;
  background: var(--panel);
  border-radius: 12px;
  padding: 14px 16px;
}
#stockpileText { font-weight: 700; font-size: 14px; margin-bottom: 8px; }
.progress {
  height: 8px;
  background: #2a2a28;
  border-radius: 4px;
  overflow: hidden;
}
.progress-bar { height: 100%; width: 0%; background: var(--gold); transition: width .3s; }

.week-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 12px 16px 4px;
}
.week-label { font-weight: 700; color: var(--gold); font-size: 14px; }

.calendar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 16px 24px;
}

.day-row {
  background: var(--panel);
  border-radius: 12px;
  padding: 10px 12px;
}
.day-title {
  font-size: 12px;
  color: var(--gray);
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: .5px;
}
.slot-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.slot-cell {
  background: var(--cell);
  border-radius: 10px;
  padding: 10px;
  border: 1px solid var(--unscheduled);
  min-height: 74px;
  cursor: pointer;
}
.slot-cell .slot-tag {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .5px;
}
.slot-cell .slot-time {
  font-weight: 600;
  color: var(--gray);
  letter-spacing: 0;
  margin-left: 4px;
}
.slot-cell .motiv {
  font-size: 15px;
  font-weight: 800;
  margin-top: 4px;
}
.slot-cell .title {
  font-size: 11px;
  color: var(--gray);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.status-generating { border-color: var(--gray); }
.status-generating .slot-tag { color: var(--gray); }
.status-ready { border-color: var(--gold); }
.status-ready .slot-tag { color: var(--gold); }
.status-posted { border-color: var(--green); }
.status-posted .slot-tag { color: var(--green); }
.status-empty { border-color: var(--unscheduled); opacity: .55; }
.status-empty .slot-tag { color: var(--unscheduled); }

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  display: flex;
  align-items: flex-end;
  z-index: 50;
}
.overlay.hidden { display: none; }

.sheet {
  background: var(--panel);
  width: 100%;
  max-height: 92vh;
  overflow-y: auto;
  border-radius: 18px 18px 0 0;
  padding: 16px 16px 28px;
}
.sheet-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}
.detail-motiv { font-size: 18px; font-weight: 800; color: var(--gold); }
.detail-status { font-size: 12px; color: var(--gray); margin-top: 2px; text-transform: capitalize; }

.images-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 12px;
}
.images-row img {
  height: 160px;
  border-radius: 8px;
  flex-shrink: 0;
  cursor: pointer;
}

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.94);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox.hidden { display: none; }
.lightbox-img {
  max-width: 92vw;
  max-height: 88vh;
  object-fit: contain;
  border-radius: 6px;
  user-select: none;
  -webkit-user-drag: none;
}
.lightbox-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: var(--panel);
  color: var(--fg);
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  font-size: 18px;
  cursor: pointer;
  z-index: 101;
}
.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(26,26,28,.8);
  color: var(--fg);
  border: none;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  z-index: 101;
}
.lightbox-prev { left: 10px; }
.lightbox-next { right: 10px; }
.lightbox-counter {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(26,26,28,.8);
  color: var(--fg);
  font-size: 12px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 12px;
}
.images-row .no-images {
  color: var(--gray);
  font-size: 13px;
  padding: 20px 0;
}

.field { margin-bottom: 10px; }
.field label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.copy-row { display: flex; gap: 6px; align-items: flex-start; }
.copy-row textarea {
  flex: 1;
  background: var(--cell);
  color: var(--fg);
  border: none;
  border-radius: 8px;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 13px;
  resize: none;
  min-height: 44px;
}
.copy-btn {
  background: var(--cell);
  color: var(--fg);
  border: none;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12px;
  white-space: nowrap;
  cursor: pointer;
}
.copy-btn.copied { color: var(--green); }

.music-note label { text-transform: none; letter-spacing: 0; font-size: 10px; }
.music-text {
  color: var(--gray);
  font-size: 13px;
  padding: 8px 10px;
  background: var(--cell);
  border-radius: 8px;
}

.sheet-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}
.primary-btn {
  flex: 1;
  background: var(--gold);
  color: #14140f;
  text-align: center;
  text-decoration: none;
  padding: 12px;
  border-radius: 10px;
  font-weight: 800;
}
.danger-btn {
  flex: 1;
  background: transparent;
  color: var(--red);
  border: 1px solid var(--red);
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
}
