/* ========================================
   Canvas Dashboard 鈥?Optimized Design
   ======================================== */

/* ---- Page Enter Animation ---- */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.enter-top-bar { animation: fadeInUp 0.7s cubic-bezier(0.22, 0.61, 0.36, 1) both; }
.enter-main-card { animation: fadeInUp 0.7s 0.08s cubic-bezier(0.22, 0.61, 0.36, 1) both; }

.enter-item {
  animation: fadeInUp 0.55s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}

/* ---- Variables ---- */
:root {
  --bg: #faf9f7;
  --surface: #f4f2ed;
  --card-bg: #ffffff;
  --text: #1a1a1a;
  --text-secondary: #555555;
  --text-muted: #767676;
  --border: #e0dcd5;
  --border-light: #edebe5;

  --accent: #3b5998;
  --accent-hover: #2d4475;
  --accent-subtle: #eef1f7;
  --danger: #c44242;
  --danger-hover: #a53535;
  --danger-bg: #fef5f5;
  --danger-border: #f5d5d5;
  --warning: #d67e2a;
  --warning-bg: #fefaf5;

  --src-canvas: #c44242;
  --src-canvas-bg: #fef5f5;
  --src-haoke: #3d8b5e;
  --src-haoke-bg: #f2faf5;
  --src-zhixuemeng: #3d6fa3;
  --src-zhixuemeng-bg: #f2f7fc;
  --src-zhihuishu: #8a6a2f;
  --src-zhihuishu-bg: #fbf7ed;
  --src-custom: #6e6e6e;
  --src-custom-bg: #f5f5f5;

  --radius: 8px;
  --radius-sm: 5px;
}

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

body {
  font-family: "PingFang SC", "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 15px;
  font-weight: 400;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

.hidden { display: none !important; }

/* ---- Dashboard ---- */
.dashboard {
  max-width: 860px;
  margin: 0 auto;
  padding: 40px 32px 96px;
}

.site-footer {
  padding: 4px 0 20px;
  text-align: center;
  font-size: 12px;
}

.site-footer a {
  color: var(--text-muted);
}

/* ---- Card Container ---- */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

/* ---- Top Bar ---- */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.top-bar .clock-section {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  flex: 1;
}

.clock-section .time {
  font-size: 56px;
  font-weight: 400;
  letter-spacing: 0.08em;
  line-height: 1;
  height: 56px;
  display: flex;
  align-items: center;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

.clock-section .date-info {
  display: flex;
  align-items: center;
  gap: 20px;
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 8px;
  min-height: 20px;
  line-height: 1.4;
  letter-spacing: 0.02em;
}

.term-info {
  font-size: 14px;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
  text-align: left;
  margin-top: 8px;
  min-height: 20px;
  display: flex;
  align-items: center;
  line-height: 1.4;
}

.term-refresh-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-secondary);
  opacity: 0.4;
  padding: 0 0 0 4px;
  transition: opacity 0.2s;
  line-height: 1;
}

.term-refresh-btn:hover {
  opacity: 1;
}

.term-refresh-btn:disabled {
  cursor: not-allowed;
  opacity: 0.3;
}

/* Top Right Group */
.top-right-group {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

/* Weather */
.weather-card {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 56px;
}

.weather-left {
  display: flex;
  align-items: center;
  gap: 6px;
}

.weather-emoji {
  font-size: 30px;
  line-height: 1;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,0.12));
}

.weather-temp {
  font-size: 36px;
  font-weight: 300;
  line-height: 1;
  color: var(--text);
  letter-spacing: -0.03em;
}

.weather-right {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
}

.weather-desc {
  font-size: 14px;
  line-height: 1.2;
  font-weight: 500;
  color: var(--text-secondary);
}

.weather-detail {
  font-size: 12px;
  line-height: 1.2;
  color: var(--text-muted);
}

/* ---- Main Column ---- */
.main-column {
  min-height: 300px;
}

/* ---- Section Header ---- */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.section-header h2 {
  font-family: "Noto Serif SC", "Source Han Serif SC", "SimSun", "STSong", serif;
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.03em;
  line-height: 1;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.account-menu-wrap {
  position: relative;
}

.account-menu-trigger {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  background: var(--surface);
  font: inherit;
  font-size: 13px;
  line-height: 1.2;
  cursor: pointer;
}

.account-menu-trigger:hover,
.account-menu-trigger[aria-expanded="true"] {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-subtle);
}

.account-menu-arrow {
  color: var(--text-muted);
  font-size: 10px;
}

.account-menu {
  position: absolute;
  z-index: 30;
  top: calc(100% + 7px);
  right: 0;
  width: max-content;
  min-width: 156px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  box-shadow: 0 10px 28px rgba(36, 34, 30, 0.11);
}

.account-menu button {
  display: block;
  width: 100%;
  padding: 10px 13px;
  border: 0;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-secondary);
  background: transparent;
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.account-menu button:last-child {
  border-bottom: 0;
}

.account-menu button:hover {
  color: var(--accent);
  background: var(--accent-subtle);
}

.account-menu button.danger {
  color: var(--danger);
}

.account-menu button.danger:hover {
  background: var(--danger-bg);
}

.calendar-subscription-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.58);
}

.calendar-subscription-panel {
  position: relative;
  width: min(520px, 100%);
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card-bg);
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.18);
}

.calendar-subscription-panel h2 {
  margin: 0 32px 8px 0;
}

.calendar-subscription-panel p {
  color: var(--text-secondary);
  line-height: 1.55;
}

.calendar-subscription-panel input {
  width: 100%;
  margin: 8px 0 14px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  background: var(--bg);
}

.calendar-subscription-close {
  position: absolute;
  top: 12px;
  right: 14px;
  border: 0;
  color: var(--text-muted);
  background: transparent;
  font-size: 24px;
  cursor: pointer;
}

.calendar-subscription-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.calendar-subscription-actions a,
.calendar-subscription-actions button {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  background: var(--card-bg);
  cursor: pointer;
  font: inherit;
}

.calendar-subscription-actions .calendar-subscription-open {
  color: white;
  border-color: var(--accent);
  background: var(--accent);
}

.calendar-subscription-actions .danger {
  color: var(--danger);
}

.calendar-subscription-status {
  min-height: 1.5em;
  margin-bottom: 0;
  font-size: 13px;
}

.last-updated {
  font-size: 12px;
  color: var(--text-muted);
}

.btn-refresh {
  background: var(--card-bg);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 15px;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.btn-refresh:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-subtle);
}

/* ---- Stats Bar ---- */
.stats-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 42px;
}

.stats-bar {
  display: flex;
  gap: 20px;
  padding: 10px 0;
  font-size: 13px;
  color: var(--text-secondary);
}

.stats-bar .stat-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.stats-bar .stat-count {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

.stats-bar .stat-count.urgent {
  color: var(--danger);
}

.source-filters {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 0 1px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.source-filter {
  flex: 0 0 auto;
  padding: 6px 11px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  background: var(--surface);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.source-filter:hover {
  color: var(--text-secondary);
  border-color: var(--border);
}

.source-filter.active {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
  background: var(--accent-subtle);
}

.source-filter span {
  margin-left: 3px;
  font-variant-numeric: tabular-nums;
}

/* ---- Error Banner ---- */
.error-banner {
  background: var(--danger-bg);
  color: var(--danger);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 16px;
  border: 1px solid var(--danger-border);
}

/* ---- Setup Hint ---- */
.setup-hint {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 8px;
}

.setup-hint small { color: var(--text-muted); font-size: 12px; }

/* ---- Platform Row ---- */
.platform-row { display: flex; gap: 20px; margin-bottom: 20px; }
.platform-col { flex: 1; min-width: 0; }

/* ---- Forms ---- */
.add-todo-form {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.add-todo-form input {
  flex: 1;
  padding: 10px 14px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.add-todo-form input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59,89,152,0.08);
}

.add-todo-form input::placeholder { color: var(--text-muted); }

.add-todo-form .date-input {
  width: 146px;
  flex: none;
}

.add-todo-form .date-input::-webkit-calendar-picker-indicator {
  opacity: 0.5;
  cursor: pointer;
}

.add-todo-form button {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 20px;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 300;
  flex-shrink: 0;
  font-family: inherit;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.add-todo-form button:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-subtle);
}

.add-todo-form .btn-wide {
  width: auto;
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 400;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  height: auto;
}

.add-todo-form .btn-wide:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-subtle);
}

.add-todo-form.auth-form {
  flex-direction: column;
}

.add-todo-form.auth-form input,
.add-todo-form.auth-form .btn-wide {
  width: 100%;
  min-width: 0;
}

/* ---- Todo List ---- */
/* ---- Section Divider ---- */
.section-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 12px 0 8px;
}

.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 48px 0;
  font-size: 14px;
}

.todo-time-group + .todo-time-group {
  margin-top: 12px;
}

.todo-time-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
}

.todo-time-heading::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--border-light);
}

.todo-time-count {
  min-width: 20px;
  padding: 2px 6px;
  border-radius: 10px;
  color: var(--text-muted);
  background: var(--surface);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.35;
  text-align: center;
}

/* ---- Unified Todo Item ---- */
.unified-item {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 43px;
  padding: 8px 20px 8px 17px;
  border-top: 1px solid var(--border-light);
  transition: background 0.2s;
}

.unified-item:first-child { border-top: none; }

.unified-item:hover {
  background: #fafaf8;
  margin-left: -3px;
  margin-right: 0;
  padding-left: 17px;
  padding-right: 20px;
  border-radius: var(--radius-sm);
}

/* ---- Urgency left border (time-based only) ---- */
.unified-item {
  border-left: 3px solid transparent;
  margin-left: -3px;
}

/* Urgent: 鈮?4h 鈥?red */
.unified-item.urgent {
  border-left-color: var(--danger);
  background: var(--danger-bg);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-left: -3px;
  margin-right: 0;
  padding-right: 20px;
}

.unified-item.urgent:hover { background: #fef0f0; }

.unified-item.urgent .item-due {
  color: var(--danger);
  font-weight: 500;
}

/* Approaching: 24-72h 鈥?orange */
.unified-item.approaching {
  border-left-color: var(--warning);
  background: var(--warning-bg);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-left: -3px;
  margin-right: 0;
  padding-right: 20px;
}

.unified-item.approaching:hover { background: #fef7ee; }

/* Remote: no deadline 鈥?gray, subtle */
.unified-item.remote {
  border-left-color: #c8c4bc;
}

/* Manual flag 鈥?active flag icon styling */
.unified-item.manual-flagged .btn-flag {
  color: var(--danger);
  font-weight: 700;
}

.unified-item.manual-flagged .item-title {
  font-weight: 500;
}

/* Dismissed / Done */
.unified-item.dismissed { opacity: 0.35; }
.unified-item.dismissed .item-title { text-decoration: line-through; }
.unified-item.dismissed:hover { opacity: 0.48; }
.unified-item.dismissed .btn-flag { color: var(--text-muted); font-weight: 400; }

/* Source badge */
.item-source-badge {
  font-size: 11px;
  font-weight: 500;
  padding: 3px 9px;
  border-radius: 3px;
  white-space: nowrap;
  flex-shrink: 0;
  letter-spacing: 0.02em;
}

/* Source badge colors */
.item-source-badge.src-canvas {
  color: var(--src-canvas);
  background: var(--src-canvas-bg);
  border: 1px solid #f1cccc;
}
.item-source-badge.src-haoke {
  color: var(--src-haoke);
  background: var(--src-haoke-bg);
  border: 1px solid #c8e6d2;
}
.item-source-badge.src-zhixuemeng {
  color: var(--src-zhixuemeng);
  background: var(--src-zhixuemeng-bg);
  border: 1px solid #c8d9ed;
}
.item-source-badge.src-zhihuishu {
  color: var(--src-zhihuishu);
  background: var(--src-zhihuishu-bg);
  border: 1px solid #ead9b8;
}
.item-source-badge.src-custom {
  color: var(--src-custom);
  background: var(--src-custom-bg);
  border: 1px solid #ddd;
}

/* Title */
.item-title {
  flex: 1;
  font-size: 15px;
  font-weight: 400;
  color: var(--text);
  line-height: 1.5;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-title-plain { cursor: default; }

/* Course */
.item-course {
  font-size: 12px;
  color: var(--text-muted);
  flex-shrink: 0;
  max-width: 116px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Labels */
.item-labels {
  display: flex;
  align-items: center;
  gap: 4px;
  max-width: 116px;
  overflow: hidden;
  flex-wrap: nowrap;
  flex-shrink: 1;
}

.label-badge {
  font-size: 11px;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 10px;
  white-space: nowrap;
  background: var(--surface);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  flex-shrink: 0;
}

/* Due date */
.item-due {
  min-width: 68px;
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 400;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
  text-align: right;
}

/* Action buttons */
.item-actions,
.item-subtask-slot {
  display: flex;
  align-items: center;
  gap: 0;
  flex-shrink: 0;
}

.item-desktop-actions {
  display: flex;
  align-items: center;
  gap: 0;
  flex-shrink: 0;
}

.mobile-action-trigger,
.item-mobile-actions {
  display: none;
}

.item-subtask-slot {
  margin-right: -5px;
}

.btn-flag,
.btn-dismiss,
.btn-delete {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 17px;
  cursor: pointer;
  padding: 5px 7px;
  border-radius: 3px;
  transition: all 0.15s;
  line-height: 1;
  font-family: inherit;
}

.btn-flag { color: var(--text-muted); }
.btn-flag.active { color: var(--danger); font-weight: 700; }
.btn-flag:hover { color: var(--danger); background: var(--danger-bg); }
.btn-dismiss:hover { color: var(--accent); background: var(--accent-subtle); }
.btn-delete:hover { color: var(--danger-hover); background: var(--danger-bg); }

/* ---- Inline Edit ---- */
.editable-title, .editable-due { cursor: text; }

.editable-title:hover, .editable-due:hover {
  outline: 1px solid var(--border);
  outline-offset: 3px;
  border-radius: 2px;
}

.inline-edit-input {
  flex: 1;
  min-width: 0;
  background: var(--bg);
  border: 1px solid var(--accent);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  font-weight: 400;
  padding: 2px 8px;
  border-radius: 3px;
  outline: none;
  line-height: 1.5;
}

.inline-edit-date-input {
  flex-shrink: 0;
  width: 140px;
  background: var(--bg);
  border: 1px solid var(--accent);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  font-weight: 400;
  padding: 2px 8px;
  border-radius: 3px;
  outline: none;
}

.inline-edit-date-input::-webkit-calendar-picker-indicator {
  opacity: 0.5;
  cursor: pointer;
}

/* ---- Custom Todo Subtasks ---- */
.unified-item-wrap {
  border-top: 1px solid var(--border-light);
}

.unified-item-wrap .unified-item {
  border-top: none;
}

.subtask-toggle {
  flex-shrink: 0;
  width: 31px;
  height: 27px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 17px;
  font-family: inherit;
  padding: 5px 7px;
  border-radius: 3px;
  cursor: pointer;
  line-height: 1;
  transition: all 0.15s;
}

.subtask-toggle:hover {
  color: var(--accent);
  background: var(--accent-subtle);
}

.subtask-toggle-placeholder {
  cursor: default;
  pointer-events: none;
}

.subtask-toggle-placeholder:hover {
  color: var(--text-muted);
  background: transparent;
}

.subtask-panel {
  margin: -4px 20px 12px 61px;
  padding: 8px 12px 10px;
  border-left: 2px solid var(--border);
  background: #fafaf8;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* Upcoming subtask preview (shown when collapsed) */
.subtask-upcoming-preview {
  margin: -2px 20px 8px 61px;
  padding: 4px 12px 6px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.6;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upcoming-subtask-item {
  color: var(--text-secondary);
}

.upcoming-subtask-due {
  color: var(--danger);
  font-weight: 500;
}

.upcoming-subtask-sep {
  color: var(--border);
  margin: 0 2px;
}

/* Subtask date input */
.subtask-due-input {
  width: 120px;
  flex-shrink: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 12px;
  font-family: inherit;
  padding: 2px 4px;
  border-radius: 3px;
  outline: none;
}

.subtask-due-input:focus {
  border-color: var(--accent);
}

.subtask-due-input::-webkit-calendar-picker-indicator {
  opacity: 0.4;
  cursor: pointer;
  font-size: 11px;
}

.subtask-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  font-size: 13px;
  color: var(--text-secondary);
}

.subtask-row input[type="checkbox"] {
  flex-shrink: 0;
}

.subtask-text {
  flex: 1;
  min-width: 0;
  line-height: 1.5;
  cursor: text;
  overflow-wrap: anywhere;
}

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

.subtask-delete {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 3px;
  cursor: pointer;
}

.subtask-delete:hover {
  color: var(--danger-hover);
  background: var(--danger-bg);
}

.subtask-empty {
  padding: 4px 0 8px;
  color: var(--text-muted);
  font-size: 13px;
}

.subtask-add-input,
.subtask-edit-input {
  width: 100%;
  box-sizing: border-box;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  padding: 5px 8px;
  border-radius: 3px;
  outline: none;
}

.subtask-add-input:focus,
.subtask-edit-input:focus {
  border-color: var(--accent);
}

/* ---- Login Trigger ---- */

.login-trigger {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 400;
  padding: 7px 11px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  white-space: nowrap;
  line-height: 1.2;
}

.login-trigger:hover,
.login-trigger[aria-expanded="true"] {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-subtle);
}

.login-trigger-arrow {
  font-size: 9px;
  transition: transform 0.2s;
}


/* ---- Login Cards (platform connection tiles) ---- */
.login-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.login-card {
  display: block;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-top: 3px solid var(--card-accent, var(--border));
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  text-decoration: none;
  transition: all 0.2s;
  cursor: pointer;
}

.login-card:hover {
  border-color: var(--card-accent, var(--accent));
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  transform: translateY(-1px);
}

.login-card[data-platform="canvas"] { --card-accent: var(--src-canvas); }
.login-card[data-platform="haoke"] { --card-accent: var(--src-haoke); }
.login-card[data-platform="zhixuemeng"] { --card-accent: var(--src-zhixuemeng); }
.login-card[data-platform="zhihuishu"] { --card-accent: var(--src-zhihuishu); }

.login-card-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.login-card-status {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-muted);
}

.login-card-status.connected { color: var(--src-haoke); }
.login-card-status.attention { color: var(--danger); }

@media (max-width: 768px) {
  .login-cards { grid-template-columns: repeat(2, 1fr); }
}

/* ---- Dedicated Login Page ---- */
.login-page-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.login-page-back:hover { color: var(--accent); }

/* ---- Status details ---- */
.status-grid {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 8px 14px;
  margin: 18px 0;
  font-size: 14px;
}

.status-grid dt {
  color: var(--text-muted);
}

.status-grid dd {
  color: var(--text);
  overflow-wrap: anywhere;
}

.setup-hint pre {
  margin: 8px 0 12px;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow-x: auto;
}

.zhihuishu-login-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.btn-primary,
.btn-secondary {
  min-height: 38px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary {
  color: #fff;
  background: var(--accent);
  border: 1px solid var(--accent);
}

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

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

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

.btn-primary:disabled,
.btn-secondary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.login-session-message {
  min-height: 22px;
  margin-top: 12px;
  font-size: 13px;
  color: var(--text-muted);
}

.login-session-message.connected { color: var(--src-haoke); }
.login-session-message.attention { color: var(--danger); }

/* ---- Logged-in status row ---- */
.logged-in-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.logged-in-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.logged-in-select {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  flex: 1;
  max-width: 280px;
}

.logged-in-select:focus { border-color: var(--accent); }

.logged-in-link {
  font-size: 12px;
  color: var(--text-muted);
}

.form-note {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 8px;
  text-align: right;
}

.form-note a { font-size: 12px; color: var(--text-muted); }

.form-note-left {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 8px;
}

.form-row {
  display: flex;
  gap: 8px;
  margin-bottom: 0;
}

.mt-s { margin-top: 8px; }
.mb-s { margin-bottom: 8px; }
.form-row.mt-s { margin-top: 8px; }

.btn-accent {
  background: var(--accent) !important;
  border-color: var(--accent) !important;
  color: #fff !important;
}
.btn-accent:hover {
  background: var(--accent-hover) !important;
  border-color: var(--accent-hover) !important;
}

/* ---- SMS button disabled ---- */
#zxm-send-sms-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ---- Scrollbar ---- */
.todo-list::-webkit-scrollbar { width: 4px; }
.todo-list::-webkit-scrollbar-track { background: transparent; }
.todo-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
.todo-list::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }


/* ---- Responsive ---- */
@media (max-width: 768px) {
  .enter-main-card { animation: none; }
  .dashboard { padding: 24px 14px 48px; }
  .card { padding: 16px; }
  .top-bar {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-end;
    gap: 12px;
  }
  .top-bar .clock-section {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    min-width: 0;
  }
  .clock-section .time { font-size: 36px; line-height: 1; }
  .clock-section .date-info {
    display: flex;
    gap: 6px;
    flex-wrap: nowrap;
    font-size: 12px;
    line-height: 1.4;
    color: var(--text-secondary);
    margin-top: 6px;
  }
/* ---- Responsive ---- */
@media (max-width: 768px) {
  .enter-main-card { animation: none; }
  .dashboard { padding: 24px 14px 48px; }
  .card { padding: 16px; }
  .top-bar {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-end;
    gap: 12px;
  }
  .top-bar .clock-section {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    min-width: 0;
  }
  .clock-section .time { font-size: 36px; line-height: 1; height: 36px; }
  .clock-section .date-info {
    display: flex;
    gap: 6px;
    flex-wrap: nowrap;
    font-size: 12px;
    line-height: 1.4;
    color: var(--text-secondary);
    margin-top: 6px;
  }
  .top-right-group {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: flex-end;
    min-width: 0;
    max-width: 58%;
  }
  .weather-card {
    display: flex;
    flex-direction: row;
    align-items: flex-end;
    justify-content: flex-end;
    min-width: 0;
    gap: 6px;
    height: 36px;
  }
  .weather-left { display: flex; flex-direction: row; align-items: center; gap: 4px; }
  .weather-emoji { font-size: 24px; line-height: 1; }
  .weather-temp { font-size: 30px; line-height: 1; }
  .weather-right { display: none !important; }
  .weather-desc,
  .weather-detail { display: none !important; }
  .term-info #term-info {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
    line-height: 1.4;
  }
  .term-info {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    min-width: 0;
    max-width: 100%;
    font-size: 12px;
    line-height: 1.4;
    text-align: right;
    margin-top: 2px;
  }
  .term-info #term-info { min-width: 0; font-size: 12px; }
  .term-refresh-btn { flex: 0 0 auto; font-size: 12px; }
  .section-header { flex-wrap: wrap; align-items: flex-start; gap: 8px; }
  .section-header h2 { align-self: center; }
  .header-right { margin-left: auto; gap: 6px; }
  .login-trigger,
  .account-menu-trigger { padding: 6px 8px; font-size: 12px; }
  .stats-toolbar { align-items: center; gap: 8px; }
  .stats-bar { gap: 12px; }
  .header-info { gap: 5px; }
  .last-updated { max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .source-filters {
    margin-right: 0;
    padding: 6px 0 2px;
    max-width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  .source-filters::-webkit-scrollbar { display: none; }
  .todo-time-group + .todo-time-group { margin-top: 8px; }
  .add-todo-form {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 8px;
  }
  .add-todo-form #new-todo-input { flex: 1; min-width: 0; }
  .add-todo-form .date-input {
    flex: 0 0 115px;
    width: 115px;
    min-width: 95px;
    height: 40px;
    padding: 6px 8px;
    color: var(--text);
    font-size: 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
  }
  .add-todo-form .date-input::-webkit-datetime-edit { color: var(--text); }
  .add-todo-form .date-input::-webkit-calendar-picker-indicator { opacity: 0.65; cursor: pointer; }
  .add-todo-form button { width: 44px; flex-shrink: 0; }
  .item-course { display: none; }
  .unified-item {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto auto auto;
    grid-template-areas:
      "source title due labels subtask more"
      "mobile-actions mobile-actions mobile-actions mobile-actions mobile-actions mobile-actions";
    align-items: center;
    column-gap: 6px;
    row-gap: 4px;
    margin-left: -3px;
    margin-right: 0;
    padding: 7px 0 7px 6px;
  }
  .unified-item:hover { margin-left: -3px; margin-right: 0; padding-left: 6px; padding-right: 0; }
  .unified-item.urgent, .unified-item.approaching { padding-right: 0; }
  .item-source-badge { grid-area: source; align-self: center; font-size: 11px; padding: 2px 6px; flex-shrink: 0; }
  .item-title { grid-area: title; font-size: 14px; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .item-due { grid-area: due; align-self: center; font-size: 12px; line-height: 1.2; text-align: left; color: var(--text-secondary); margin-top: 0; white-space: nowrap; }
  .item-labels { grid-area: labels; margin-top: 0; min-width: 0; max-width: 110px; overflow: hidden; white-space: nowrap; flex-wrap: nowrap; gap: 4px; display: flex; align-items: center; }
  .label-badge { font-size: 11px; padding: 2px 6px; max-width: 100%; box-sizing: border-box; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .item-subtask-slot {
    grid-area: subtask;
    justify-self: center;
    align-self: center;
    margin-right: 0;
    min-height: 36px;
    display: flex;
    align-items: center;
  }
  .item-desktop-actions { display: none; }
  .mobile-action-trigger {
    grid-area: more;
    display: inline-flex;
    width: 36px;
    height: 36px;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: none;
    border-radius: 3px;
    background: none;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    align-self: center;
  }
  .mobile-action-trigger:hover { color: var(--accent); background: var(--accent-subtle); }
  .item-mobile-actions {
    grid-area: mobile-actions;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    min-width: 0;
    padding-top: 4px;
  }
  .item-mobile-actions.open { display: flex; }
  .btn-flag, .btn-dismiss, .btn-delete, .subtask-toggle { width: 36px; height: 36px; padding: 0; font-size: 16px; }
  .login-cards { grid-template-columns: repeat(2, 1fr); }
  .platform-row { flex-direction: column; gap: 16px; }
  .subtask-panel { margin-left: 34px; margin-right: 0; }
  .subtask-upcoming-preview { margin-left: 34px; margin-right: 0; }
  .subtask-due-input { width: 100px; }
}





