/* ==================== 1. EISENHOWER MATRIX ==================== */
.matrix-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(260px, 1fr));
  gap: 14px;
  height: calc(100vh - 102px);
}

.matrix-quadrant {
  background: var(--bg-card);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.matrix-quadrant.drag-over {
  border-color: var(--accent-neon);
  box-shadow: 0 0 0 2px var(--accent-dim);
}

.quad-head {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 12px 15px;
  border-bottom: 1px solid var(--border-hairline);
  font-size: 13.5px;
  font-weight: 700;
}

.quad-roman {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #050507;
  flex-shrink: 0;
}

.quad-body {
  flex: 1;
  overflow-y: auto;
  padding: 6px 0;
}

.quad-add {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-top: 1px solid var(--border-hairline);
  background: rgba(255, 255, 255, 0.015);
}
.quad-add input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  outline: none;
}

@media (max-width: 820px) {
  .matrix-grid { grid-template-columns: 1fr; height: auto; }
  .matrix-quadrant { min-height: 220px; }
}

/* ==================== 2. CALENDAR & TIMELINE ==================== */
.cal-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  gap: 16px;
  height: calc(100vh - 102px);
}

.cal-main {
  background: var(--bg-card);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.cal-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-hairline);
}

.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border-bottom: 1px solid var(--border-hairline);
  background: rgba(255, 255, 255, 0.02);
}

.cal-weekday {
  text-align: center;
  padding: 8px 4px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
}

.cal-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  grid-auto-rows: minmax(86px, 1fr);
  overflow-y: auto;
}

.cal-cell {
  border-inline-end: 1px solid var(--border-hairline);
  border-bottom: 1px solid var(--border-hairline);
  padding: 6px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: background .12s ease;
  min-width: 0;
}
.cal-cell:hover { background: var(--bg-hover); }
.cal-cell.other-month { opacity: 0.35; }
.cal-cell.selected { background: rgba(0, 255, 135, 0.06); box-shadow: inset 0 0 0 1px var(--accent-neon); }

.cal-day-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--text-secondary);
}
.cal-cell.is-today .cal-day-num {
  background: var(--accent-neon);
  color: #050507;
  font-weight: 700;
  box-shadow: 0 0 12px rgba(0, 255, 135, 0.45);
}

.cal-pill {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: rgba(0, 255, 135, 0.14);
  color: var(--text-primary);
  border-inline-start: 2px solid var(--accent-neon);
}
.cal-pill.p5 { background: rgba(255, 71, 87, 0.16); border-inline-start-color: var(--prio-high); }
.cal-pill.p3 { background: rgba(255, 184, 0, 0.16); border-inline-start-color: var(--prio-med); }
.cal-pill.p1 { background: rgba(0, 210, 255, 0.16); border-inline-start-color: var(--prio-low); }

.cal-side {
  background: var(--bg-card);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.cal-side-head {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-hairline);
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cal-side-body {
  flex: 1;
  overflow-y: auto;
  padding: 10px 12px;
}

.timeline-slot {
  display: flex;
  gap: 10px;
  padding: 8px 4px;
  border-bottom: 1px dashed var(--border-hairline);
  font-size: 12px;
}
.timeline-hour {
  width: 44px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  flex-shrink: 0;
}

@media (max-width: 960px) {
  .cal-layout { grid-template-columns: 1fr; height: auto; }
  .cal-grid { grid-auto-rows: minmax(68px, auto); }
}

/* ==================== 3. FOCUS / POMODORO ==================== */
.focus-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 18px;
  max-width: 1120px;
  margin: 0 auto;
}

.focus-stage {
  background: var(--bg-card);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.focus-mode-tabs {
  display: inline-flex;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  padding: 4px;
  gap: 4px;
}
.focus-mode-tab {
  padding: 7px 20px;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all .15s ease;
}
.focus-mode-tab.active {
  background: var(--accent-neon);
  color: #050507;
}

.pomo-ring-wrap {
  position: relative;
  width: 256px;
  height: 256px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pomo-ring-svg {
  transform: rotate(-90deg);
  width: 256px;
  height: 256px;
}

.pomo-time-display {
  position: absolute;
  text-align: center;
}
.pomo-digits {
  font-family: var(--font-mono);
  font-size: 48px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--text-primary);
}
.pomo-status {
  font-size: 12px;
  color: var(--accent-neon);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.noise-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.noise-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-sm);
  padding: 12px 8px;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  transition: all .14s ease;
}
.noise-btn:hover { border-color: rgba(0, 255, 135, 0.4); color: var(--text-primary); }
.noise-btn.active {
  background: var(--accent-dim);
  border-color: var(--accent-neon);
  color: var(--accent-neon);
}

.focus-stats-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}
.stat-tile {
  background: var(--bg-surface);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-sm);
  padding: 12px;
}
.stat-val {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 700;
  color: var(--accent-neon);
}
.stat-lbl {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

@media (max-width: 900px) {
  .focus-layout { grid-template-columns: 1fr; }
}

/* ==================== 4. HABIT TRACKER ==================== */
.habit-week-strip {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-bottom: 16px;
}

.habit-day-pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 8px 4px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
}
.habit-day-pill.active {
  background: var(--accent-dim);
  border-color: var(--accent-neon);
  color: var(--accent-neon);
}
.habit-day-num {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 700;
}

.habit-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-hairline);
  transition: background .12s ease;
}
.habit-row:last-child { border-bottom: none; }
.habit-row:hover { background: var(--bg-hover); }

.habit-icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 2px solid transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform .15s ease, box-shadow .15s ease;
}
.habit-icon-btn:hover { transform: scale(1.08); }
.habit-icon-btn.done {
  box-shadow: 0 0 18px rgba(0, 255, 135, 0.45);
}

.habit-streak-box {
  margin-inline-start: auto;
  text-align: end;
}
.habit-streak-num {
  font-family: var(--font-mono);
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
}
.habit-streak-lbl {
  font-size: 11px;
  color: var(--text-muted);
}

/* ==================== 5. SUMMARY MODULE ==================== */
.summary-shell {
  max-width: 1080px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.summary-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-md);
  padding: 12px 14px;
}

.summary-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.summary-kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-md);
  padding: 16px;
  position: relative;
  overflow: hidden;
}
.summary-kpi-card::after {
  content: '';
  position: absolute;
  inset-inline-start: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent-neon);
  opacity: 0.7;
}

.summary-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 16px;
}

.summary-editor {
  width: 100%;
  min-height: 320px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.7;
  padding: 14px;
  resize: vertical;
}
.summary-editor:focus {
  outline: none;
  border-color: var(--accent-neon);
}

@media (max-width: 900px) {
  .summary-kpis { grid-template-columns: repeat(2, 1fr); }
  .summary-grid { grid-template-columns: 1fr; }
}

/* ==================== 6. MULTI-TAB SETTINGS & AVATARS ==================== */
.settings-modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 680px;
  max-height: 88vh;
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  overflow: hidden;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.8);
}

.settings-nav {
  background: var(--bg-surface);
  border-inline-end: 1px solid var(--border-hairline);
  padding: 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.settings-content {
  padding: 20px 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.avatar-preview-lg {
  width: 68px;
  height: 68px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 700;
  color: #050507;
  overflow: hidden;
  flex-shrink: 0;
  border: 2px solid var(--accent-neon);
  box-shadow: 0 0 22px rgba(0, 255, 135, 0.28);
}
.avatar-preview-lg img, .rail-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.avatar-preset-btn {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 2px solid transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  color: #050507;
  transition: transform .12s ease, border-color .12s ease;
}
.avatar-preset-btn:hover { transform: scale(1.06); }
.avatar-preset-btn.active { border-color: #fff; box-shadow: 0 0 14px rgba(0, 255, 135, 0.5); }

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-sm);
}

.shortcut-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-hairline);
  font-size: 13px;
}
.kbd-badge {
  font-family: var(--font-mono);
  font-size: 11.5px;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--accent-neon);
}

@media (max-width: 680px) {
  .settings-modal-card { grid-template-columns: 1fr; }
  .settings-nav {
    flex-direction: row;
    overflow-x: auto;
    border-inline-end: none;
    border-bottom: 1px solid var(--border-hairline);
  }
}
