/* ==========================================================================
   拾光 (ShiGuang) — Main Stylesheet
   ========================================================================== */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-primary);
  background-color: var(--bg-app);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

.tabular-nums {
  font-variant-numeric: tabular-nums;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ==========================================================================
   App Shell Layout
   ========================================================================== */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-surface);
  border-right: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 30;
  transition: background-color var(--transition), border-color var(--transition);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 10px 20px;
}

.brand-logo {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), #7c5cff);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(79, 110, 247, 0.28);
  flex-shrink: 0;
}

.brand-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.brand-sub {
  font-size: 11px;
  color: var(--text-muted);
}

.nav-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-weight: 500;
  transition: all var(--transition);
  text-align: left;
  width: 100%;
  position: relative;
}

.nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.85;
}

.nav-item:hover {
  background: var(--bg-surface-subtle);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.nav-item.active svg {
  opacity: 1;
}

.nav-badge {
  margin-left: auto;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: var(--radius-full);
  background: var(--bg-surface-subtle);
  color: var(--text-secondary);
}

.nav-item.active .nav-badge {
  background: var(--accent);
  color: #fff;
}

.sidebar-footer {
  padding-top: 14px;
  border-top: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sidebar-action {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13px;
  transition: all var(--transition);
  width: 100%;
  text-align: left;
}

.sidebar-action:hover {
  background: var(--bg-surface-subtle);
  color: var(--text-primary);
}

.sidebar-action svg {
  width: 16px;
  height: 16px;
}

/* Main Content */
.main-area {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  height: var(--topbar-height);
  padding: 0 28px;
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar-left {
  display: flex;
  align-items: baseline;
  gap: 12px;
  min-width: 0;
}

.page-title {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.page-date {
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.view-container {
  padding: 24px 28px 40px;
  max-width: 1320px;
  width: 100%;
  margin: 0 auto;
  animation: fadeIn 200ms ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   Buttons & Inputs
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn svg {
  width: 15px;
  height: 15px;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 6px rgba(79, 110, 247, 0.25);
}

.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-light);
}

.btn-secondary:hover {
  background: var(--bg-surface-subtle);
  border-color: var(--border-strong);
}

.btn-ghost {
  color: var(--text-secondary);
}

.btn-ghost:hover {
  background: var(--bg-surface-subtle);
  color: var(--text-primary);
}

.btn-danger {
  background: var(--rose-soft);
  color: var(--rose);
}

.btn-danger:hover {
  background: var(--rose);
  color: #fff;
}

.btn-icon {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.btn-icon:hover {
  background: var(--bg-surface-subtle);
  color: var(--text-primary);
}

.btn-icon svg {
  width: 18px;
  height: 18px;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

.input, .select, .textarea {
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  background: var(--bg-surface);
  color: var(--text-primary);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.input:focus, .select:focus, .textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.textarea {
  resize: vertical;
  min-height: 76px;
}

/* ==========================================================================
   Cards & Common Elements
   ========================================================================== */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-xs);
  transition: background-color var(--transition), border-color var(--transition), box-shadow var(--transition);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title svg {
  width: 17px;
  height: 17px;
  color: var(--accent);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
}

.badge-accent { background: var(--accent-soft); color: var(--accent); }
.badge-rose { background: var(--rose-soft); color: var(--rose); }
.badge-emerald { background: var(--emerald-soft); color: var(--emerald); }
.badge-amber { background: var(--amber-soft); color: var(--amber); }
.badge-violet { background: var(--violet-soft); color: var(--violet); }
.badge-neutral { background: var(--bg-surface-subtle); color: var(--text-secondary); }

.empty-state {
  text-align: center;
  padding: 36px 20px;
  color: var(--text-muted);
}

.empty-state svg {
  width: 36px;
  height: 36px;
  margin-bottom: 10px;
  opacity: 0.45;
}

.empty-state p {
  font-size: 13px;
  margin-bottom: 12px;
}

.segmented {
  display: inline-flex;
  padding: 3px;
  background: var(--bg-surface-subtle);
  border-radius: var(--radius-sm);
  gap: 2px;
}

.segmented-btn {
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition);
}

.segmented-btn.active {
  background: var(--bg-surface);
  color: var(--text-primary);
  box-shadow: var(--shadow-xs);
  font-weight: 600;
}

/* ==========================================================================
   Dashboard View
   ========================================================================== */
.dashboard-stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}

.stat-mini {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.stat-mini-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-mini-icon svg {
  width: 20px;
  height: 20px;
}

.stat-mini-val {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.stat-mini-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 20px;
  align-items: start;
}

.dashboard-col {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Pinned Anniversary Banner */
.hero-anniversary {
  background: linear-gradient(135deg, rgba(244, 63, 94, 0.09) 0%, rgba(79, 110, 247, 0.08) 100%);
  border: 1px solid rgba(244, 63, 94, 0.22);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
}

.hero-anniversary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.hero-ann-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hero-ann-tag {
  font-size: 11px;
  font-weight: 600;
  color: var(--rose);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.hero-ann-title {
  font-size: 18px;
  font-weight: 700;
}

.hero-ann-date {
  font-size: 12px;
  color: var(--text-secondary);
}

.hero-ann-days {
  text-align: right;
  flex-shrink: 0;
}

.hero-ann-num {
  font-size: 36px;
  font-weight: 800;
  line-height: 1;
  color: var(--rose);
  letter-spacing: -0.03em;
}

.hero-ann-unit {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* Schedule Timeline List */
.timeline-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.timeline-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--bg-surface-subtle);
  border-left: 3px solid var(--accent);
  cursor: pointer;
  transition: background-color var(--transition), transform var(--transition);
}

.timeline-item:hover {
  background: var(--bg-surface-hover);
  transform: translateX(2px);
}

.timeline-time {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  width: 84px;
  flex-shrink: 0;
  padding-top: 2px;
}

.timeline-body {
  flex: 1;
  min-width: 0;
}

.timeline-title {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 2px;
}

.timeline-desc {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==========================================================================
   Calendar & Schedule View
   ========================================================================== */
.calendar-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
}

.calendar-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.calendar-period-label {
  font-size: 17px;
  font-weight: 700;
  min-width: 136px;
  text-align: center;
}

/* Month Grid */
.calendar-month-grid {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: var(--bg-surface-subtle);
  border-bottom: 1px solid var(--border-light);
}

.calendar-weekday {
  padding: 10px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.calendar-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.calendar-cell {
  min-height: 106px;
  padding: 8px;
  border-right: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
  transition: background-color var(--transition);
  min-width: 0;
}

.calendar-cell:nth-child(7n) {
  border-right: none;
}

.calendar-cell:hover {
  background: var(--bg-surface-subtle);
}

.calendar-cell.other-month {
  opacity: 0.42;
}

.calendar-cell.selected {
  background: var(--accent-soft);
}

.cell-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2px;
}

.cell-day-num {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
}

.calendar-cell.is-today .cell-day-num {
  background: var(--accent);
  color: #fff;
}

.cell-event-pill {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
  cursor: pointer;
}

.cell-ann-pill {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--rose-soft);
  color: var(--rose);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 600;
}

.cell-more {
  font-size: 11px;
  color: var(--text-muted);
  padding-left: 4px;
}

/* Week / Day Grid */
.week-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 10px;
}

.week-col {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 12px 10px;
  min-height: 360px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.week-col.is-today {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-soft);
}

.week-col-header {
  text-align: center;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-light);
}

.week-col-dow {
  font-size: 11px;
  color: var(--text-muted);
}

.week-col-date {
  font-size: 16px;
  font-weight: 700;
  margin-top: 2px;
}

.week-col.is-today .week-col-date {
  color: var(--accent);
}

.day-view-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 20px;
  align-items: start;
}

.hour-grid {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.hour-row {
  display: flex;
  min-height: 52px;
  border-bottom: 1px solid var(--border-light);
}

.hour-row:last-child {
  border-bottom: none;
}

.hour-label {
  width: 64px;
  padding: 8px 10px;
  font-size: 11px;
  color: var(--text-muted);
  text-align: right;
  border-right: 1px solid var(--border-light);
  flex-shrink: 0;
}

.hour-slot {
  flex: 1;
  padding: 6px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
}

.hour-slot:hover {
  background: var(--bg-surface-subtle);
}

/* ==========================================================================
   Plans & Todos View
   ========================================================================== */
.plans-layout {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 20px;
  align-items: start;
}

.plan-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 14px;
}

.plan-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.plan-title {
  font-size: 15px;
  font-weight: 700;
}

.plan-meta {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 3px;
}

.progress-bar {
  height: 7px;
  border-radius: var(--radius-full);
  background: var(--bg-surface-subtle);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, var(--accent), var(--emerald));
  transition: width 300ms ease;
}

.subtask-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.subtask-item {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 7px 8px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  transition: background-color var(--transition);
}

.subtask-item:hover {
  background: var(--bg-surface-subtle);
}

.subtask-item.done .subtask-text {
  text-decoration: line-through;
  color: var(--text-muted);
}

.subtask-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.subtask-repeat-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
}

.subtask-mini-bar {
  height: 4px;
  border-radius: var(--radius-full);
  background: var(--bg-surface-hover);
  overflow: hidden;
  max-width: 220px;
}

.subtask-mini-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--accent);
  transition: width 260ms ease;
}

.subtask-add-row {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

/* Todo Items */
.todo-filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.todo-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.todo-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-radius: var(--radius-md);
  background: var(--bg-surface-subtle);
  transition: all var(--transition);
}

.todo-item:hover {
  background: var(--bg-surface-hover);
}

.todo-check {
  width: 19px;
  height: 19px;
  border-radius: 6px;
  border: 2px solid var(--border-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition);
  color: transparent;
}

.todo-check.checked {
  background: var(--emerald);
  border-color: var(--emerald);
  color: #fff;
}

.todo-check svg {
  width: 12px;
  height: 12px;
}

.todo-content {
  flex: 1;
  min-width: 0;
}

.todo-title {
  font-size: 13.5px;
  font-weight: 500;
  word-break: break-word;
}

.todo-item.done .todo-title {
  text-decoration: line-through;
  color: var(--text-muted);
}

.todo-sub {
  font-size: 11.5px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
}

.priority-dot {
  width: 7px;
  height: 7px;
  border-radius: var(--radius-full);
  display: inline-block;
}
.priority-high { background: var(--rose); }
.priority-medium { background: var(--amber); }
.priority-low { background: var(--emerald); }

/* ==========================================================================
   Anniversaries View
   ========================================================================== */
.ann-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.ann-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
}

.ann-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.ann-card-accent {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
}

.ann-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.ann-card-title {
  font-size: 16px;
  font-weight: 700;
}

.ann-card-date {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.ann-card-counter {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.ann-days-big {
  font-size: 38px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.03em;
}

.ann-days-label {
  font-size: 13px;
  color: var(--text-secondary);
}

.ann-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 12px;
  border-top: 1px solid var(--border-light);
  font-size: 12px;
  color: var(--text-muted);
}

/* ==========================================================================
   Stats & Focus View
   ========================================================================== */
.stats-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 20px;
  align-items: start;
}

.chart-bars {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  height: 180px;
  padding-top: 20px;
}

.chart-bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  height: 100%;
  justify-content: flex-end;
}

.chart-bar-track {
  width: 100%;
  max-width: 34px;
  height: 130px;
  background: var(--bg-surface-subtle);
  border-radius: 8px;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}

.chart-bar-fill {
  width: 100%;
  background: linear-gradient(180deg, var(--accent), #7c5cff);
  border-radius: 8px;
  transition: height 400ms ease;
}

.chart-bar-val {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
}

.chart-bar-label {
  font-size: 11px;
  color: var(--text-muted);
}

/* Focus Timer */
.focus-card {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.focus-ring {
  position: relative;
  width: 176px;
  height: 176px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.focus-ring svg {
  transform: rotate(-90deg);
}

.focus-time {
  position: absolute;
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.focus-controls {
  display: flex;
  gap: 10px;
}

/* ==========================================================================
   Modal & Toast
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 100;
}

.modal-backdrop.open {
  display: flex;
  animation: fadeIn 150ms ease;
}

.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 16px;
  font-weight: 700;
}

.modal-body {
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.color-swatches {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.color-swatch {
  width: 26px;
  height: 26px;
  border-radius: var(--radius-full);
  border: 2px solid transparent;
  transition: transform var(--transition);
}

.color-swatch.selected {
  transform: scale(1.15);
  box-shadow: 0 0 0 2px var(--bg-surface), 0 0 0 4px var(--text-primary);
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  cursor: pointer;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 340px;
}

.toast {
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-light);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  box-shadow: var(--shadow-md);
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  animation: slideUp 220ms ease;
}

.toast-rose { border-left-color: var(--rose); }
.toast-emerald { border-left-color: var(--emerald); }
.toast-amber { border-left-color: var(--amber); }

@keyframes slideUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Mobile Bottom Nav */
.mobile-nav {
  display: none;
}

/* ==========================================================================
   Reward & Punishment System (奖惩机制)
   ========================================================================== */
.rp-box {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: var(--bg-surface-subtle);
  font-size: 12px;
}

.rp-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.rp-label {
  font-size: 11px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.rp-label-reward { color: var(--emerald); }
.rp-label-punish { color: var(--rose); }

.rp-text {
  color: var(--text-primary);
  word-break: break-word;
}

.plan-settle-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  font-size: 12.5px;
  font-weight: 500;
}

.plan-settle-bar.ready-reward {
  background: var(--emerald-soft);
  color: var(--emerald);
  border: 1px solid rgba(16, 185, 129, 0.28);
}

.plan-settle-bar.ready-punish {
  background: var(--rose-soft);
  color: var(--rose);
  border: 1px solid rgba(244, 63, 94, 0.28);
}

.plan-settle-bar.settled {
  background: var(--bg-surface-subtle);
  color: var(--text-secondary);
}

.wallet-banner {
  background: linear-gradient(135deg, rgba(79, 110, 247, 0.12) 0%, rgba(16, 185, 129, 0.1) 100%);
  border: 1px solid rgba(79, 110, 247, 0.22);
  border-radius: var(--radius-xl);
  padding: 22px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 18px;
  margin-bottom: 20px;
}

.wallet-points {
  font-size: 40px;
  font-weight: 800;
  line-height: 1;
  color: var(--accent);
  letter-spacing: -0.03em;
}

.wallet-stats {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}

.wallet-stat-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.wallet-stat-num {
  font-size: 18px;
  font-weight: 700;
}

.wallet-stat-label {
  font-size: 11.5px;
  color: var(--text-muted);
}

.rewards-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 20px;
  align-items: start;
}

.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px;
}

.shop-card {
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform var(--transition), border-color var(--transition);
}

.shop-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
}

.shop-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px;
}

.shop-card-title {
  font-weight: 600;
  font-size: 14px;
}

.shop-card-cost {
  font-size: 13px;
  font-weight: 700;
  color: var(--amber);
}

.punish-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--rose-soft);
  border-left: 3px solid var(--rose);
  margin-bottom: 10px;
}

.punish-card.done {
  background: var(--bg-surface-subtle);
  border-left-color: var(--emerald);
  opacity: 0.72;
}

.pool-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pool-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: var(--radius-full);
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-light);
  font-size: 12.5px;
}

.ledger-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 360px;
  overflow-y: auto;
}

.ledger-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-subtle);
  font-size: 12.5px;
}

.ledger-delta {
  font-weight: 700;
  white-space: nowrap;
}

.ledger-delta.pos { color: var(--emerald); }
.ledger-delta.neg { color: var(--rose); }

@media (max-width: 1024px) {
  .rewards-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .rp-box {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   Timetable / Course Schedule (课程表)
   ========================================================================== */
.tt-meta-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  margin-bottom: 14px;
  font-size: 12.5px;
  color: var(--text-secondary);
}

.tt-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.tt-grid-wrap {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  overflow-x: auto;
  box-shadow: var(--shadow-xs);
}

.tt-table {
  width: 100%;
  min-width: 780px;
  border-collapse: collapse;
  table-layout: fixed;
}

.tt-table th,
.tt-table td {
  border-right: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
  vertical-align: top;
}

.tt-table th:last-child,
.tt-table td:last-child {
  border-right: none;
}

.tt-table tr:last-child td {
  border-bottom: none;
}

.tt-table thead th {
  background: var(--bg-surface-subtle);
  padding: 10px 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  text-align: center;
}

.tt-table thead th.is-today-col {
  color: var(--accent);
  background: var(--accent-soft);
}

.tt-slot-col {
  width: 92px;
  background: var(--bg-surface-subtle);
  padding: 10px 6px;
  text-align: center;
}

.tt-slot-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
}

.tt-slot-sub {
  font-size: 10.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

.tt-slot-time {
  font-size: 10.5px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.tt-cell {
  padding: 4px;
  min-height: 58px;
  height: 58px;
  cursor: pointer;
  transition: background-color var(--transition);
}

.tt-cell.tt-merged {
  vertical-align: top;
  height: 1px;
}

.tt-course-card {
  padding: 7px 8px;
  border-radius: 8px;
  border-left: 3px solid var(--accent);
  margin-bottom: 6px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  transition: transform var(--transition), box-shadow var(--transition);
}

.tt-course-period {
  font-size: 10px;
  font-weight: 600;
  opacity: 0.78;
  margin-bottom: 2px;
}

.tt-cell:hover {
  background: var(--bg-surface-subtle);
}

.tt-cell.is-today-col {
  background: rgba(79, 110, 247, 0.03);
}

.tt-course-card {
  padding: 7px 8px;
  border-radius: 8px;
  border-left: 3px solid var(--accent);
  margin-bottom: 6px;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
}

.tt-course-card:last-child {
  margin-bottom: 0;
}

.tt-course-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-xs);
}

.tt-course-name {
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.3;
  word-break: break-word;
}

.tt-course-loc {
  font-size: 11px;
  margin-top: 3px;
  font-weight: 500;
  opacity: 0.9;
}

.tt-course-meta {
  font-size: 10.5px;
  margin-top: 2px;
  opacity: 0.78;
  line-height: 1.3;
}

.tt-course-note {
  margin-top: 5px;
  padding: 3px 6px;
  border-radius: 5px;
  background: var(--bg-surface);
  color: var(--rose);
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1.35;
  word-break: break-word;
  border: 1px solid rgba(244, 63, 94, 0.25);
}

.tt-course-note.general {
  color: var(--text-secondary);
  border-color: var(--border-light);
  font-weight: 500;
}

.tt-note-bar {
  margin-top: 14px;
  padding: 12px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-left: 3px solid var(--amber);
  border-radius: var(--radius-md);
  font-size: 12.5px;
  color: var(--text-secondary);
}

.tt-adj-tag {
  display: inline-block;
  margin-top: 4px;
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--amber-soft);
  color: var(--amber);
  font-size: 10px;
  font-weight: 700;
}

.tt-adj-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.tt-adj-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  background: var(--bg-surface-subtle);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
}

.slot-row-item {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 10px;
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}

.slot-row-line {
  display: grid;
  grid-template-columns: 0.9fr 1fr 1fr auto;
  gap: 6px;
  align-items: center;
}

.slot-row-line-sub {
  display: grid;
  grid-template-columns: 1.1fr 0.75fr 1fr;
  gap: 6px;
  align-items: center;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */
@media (max-width: 1024px) {
  .dashboard-stats-row {
    grid-template-columns: repeat(2, 1fr);
  }
  .dashboard-grid,
  .plans-layout,
  .stats-grid,
  .day-view-layout {
    grid-template-columns: 1fr;
  }
  .week-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .sidebar {
    display: none;
  }
  .main-area {
    margin-left: 0;
    padding-bottom: 72px;
  }
  .topbar {
    padding: 0 16px;
  }
  .page-date {
    display: none;
  }
  .view-container {
    padding: 16px;
  }
  .calendar-cell {
    min-height: 76px;
    padding: 4px;
  }
  .week-grid {
    grid-template-columns: 1fr;
  }
  .form-row {
    grid-template-columns: 1fr;
  }
  .mobile-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 62px;
    background: var(--bg-surface);
    border-top: 1px solid var(--border-light);
    z-index: 40;
    justify-content: space-around;
    align-items: center;
    padding: 0 6px;
  }
  .mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    font-size: 11px;
    color: var(--text-muted);
    padding: 6px 10px;
    border-radius: var(--radius-sm);
  }
  .mobile-nav-item svg {
    width: 20px;
    height: 20px;
  }
  .mobile-nav-item.active {
    color: var(--accent);
    font-weight: 600;
  }
  .toast-container {
    bottom: 76px;
    right: 12px;
    left: 12px;
    max-width: none;
  }
}
