:root {
  color-scheme: light;
  --bg: #f3f6fb;
  --surface: #ffffff;
  --surface-soft: #f7f9fd;
  --line: #e5eaf2;
  --line-strong: #d8e0ec;
  --text: #172033;
  --muted: #6e7b91;
  --primary: #2878e8;
  --primary-strong: #1764d0;
  --primary-soft: #e9f2ff;
  --green: #20a66a;
  --amber: #e39a16;
  --rose: #df476d;
  --indigo: #5968d9;
  --cyan: #1596b8;
  --shadow: 0 18px 44px rgba(36, 53, 84, 0.1);
  --slot-height: 60px;
  --time-width: 78px;
  --radius: 18px;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body { margin: 0; min-height: 100vh; color: var(--text); background: radial-gradient(circle at 85% 0%, #e3efff 0, transparent 30%), var(--bg); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid rgba(40, 120, 232, 0.22); outline-offset: 2px; }

.app-shell { min-height: 100vh; }
.app-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 82px;
  padding: 14px clamp(16px, 2.4vw, 34px);
  background: rgba(247, 249, 253, 0.92);
  border-bottom: 1px solid rgba(216, 224, 236, 0.82);
  backdrop-filter: blur(18px);
}

.brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.brand h1 { margin: 0; font-size: clamp(20px, 2.1vw, 28px); line-height: 1.15; letter-spacing: -0.02em; }
.brand p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.brand-mark { position: relative; width: 46px; height: 46px; flex: 0 0 auto; border-radius: 15px; background: linear-gradient(145deg, #368cf6, #1d66d7); box-shadow: 0 10px 24px rgba(40, 120, 232, 0.28); }
.brand-mark span { position: absolute; left: 12px; right: 12px; height: 2px; border-radius: 99px; background: white; }
.brand-mark span:nth-child(1) { top: 15px; }
.brand-mark span:nth-child(2) { top: 22px; opacity: .78; }
.brand-mark span:nth-child(3) { top: 29px; opacity: .54; }
.header-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }

.primary-button, .secondary-button, .icon-button, .round-add, .text-button, .danger-text-button {
  border: 0;
  transition: transform .16s ease, background .16s ease, border-color .16s ease, color .16s ease, box-shadow .16s ease;
}
.primary-button, .secondary-button, .icon-button { min-height: 40px; border-radius: 12px; padding: 0 16px; font-weight: 700; }
.primary-button { color: white; background: var(--primary); box-shadow: 0 8px 20px rgba(40, 120, 232, .2); }
.primary-button:hover { background: var(--primary-strong); transform: translateY(-1px); }
.secondary-button, .icon-button { color: #31405a; background: white; border: 1px solid var(--line-strong); }
.secondary-button:hover, .icon-button:hover { color: var(--primary); border-color: #a9c8f5; background: #f7fbff; }
.icon-button { min-width: 58px; }
.round-add { width: 40px; height: 40px; border-radius: 50%; color: white; background: var(--primary); font-size: 24px; line-height: 1; }
.round-add:hover { background: var(--primary-strong); transform: rotate(8deg); }
.text-button, .danger-text-button { padding: 4px 2px; color: var(--primary); background: transparent; font-weight: 700; font-size: 13px; }
.danger-text-button { color: var(--rose); }

.sync-pill { display: flex; align-items: center; gap: 7px; height: 38px; padding: 0 12px; border: 1px solid var(--line); border-radius: 99px; background: white; color: var(--muted); font-size: 12px; font-weight: 700; white-space: nowrap; }
.sync-dot { width: 8px; height: 8px; border-radius: 50%; background: #aeb8c8; box-shadow: 0 0 0 4px rgba(174, 184, 200, .12); }
.sync-pill.online .sync-dot { background: var(--green); box-shadow: 0 0 0 4px rgba(32, 166, 106, .12); }
.sync-pill.saving .sync-dot { background: var(--amber); animation: pulse 1s infinite; }
.sync-pill.offline .sync-dot { background: var(--rose); box-shadow: 0 0 0 4px rgba(223, 71, 109, .12); }
@keyframes pulse { 50% { opacity: .35; } }

.app-main {
  display: grid;
  grid-template-columns: minmax(270px, 310px) minmax(0, 1fr);
  align-items: start;
  gap: 18px;
  padding: 18px clamp(14px, 2vw, 30px) 30px;
}
.task-panel, .calendar-panel { border: 1px solid rgba(216, 224, 236, .9); background: rgba(255, 255, 255, .94); box-shadow: var(--shadow); }
.task-panel { position: sticky; top: 101px; max-height: calc(100vh - 120px); overflow: auto; border-radius: var(--radius); padding: 18px; }
.calendar-panel { min-width: 0; overflow: hidden; border-radius: 22px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.panel-heading h2 { margin: 2px 0 0; font-size: 22px; }
.eyebrow { margin: 0; color: var(--primary); font-size: 10px; font-weight: 900; letter-spacing: .16em; }
.task-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 18px 0; }
.task-summary > div { padding: 13px; border-radius: 14px; background: var(--surface-soft); border: 1px solid var(--line); }
.task-summary strong { display: block; font-size: 22px; }
.task-summary span { color: var(--muted); font-size: 11px; }
.task-section + .task-section { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.section-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.section-title h3 { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 14px; }
.section-dot, .legend-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.section-dot.short, .legend-dot.short { background: var(--primary); }
.section-dot.long, .legend-dot.long { background: var(--green); }
.task-list { display: grid; gap: 9px; }
.empty-tasks { padding: 16px; border: 1px dashed var(--line-strong); border-radius: 13px; color: var(--muted); text-align: center; font-size: 12px; }
.task-card { position: relative; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: white; transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease; }
.task-card:hover { transform: translateY(-1px); border-color: #bfd5f4; box-shadow: 0 8px 18px rgba(44, 70, 112, .08); }
.task-card.done { opacity: .62; }
.task-card.done .task-card-title { text-decoration: line-through; }
.task-card-top { display: flex; align-items: flex-start; gap: 9px; }
.task-check { width: 17px; height: 17px; margin: 2px 0 0; accent-color: var(--primary); flex: 0 0 auto; }
.task-card-main { min-width: 0; flex: 1; }
.task-card-title { margin: 0; font-size: 13px; line-height: 1.35; overflow-wrap: anywhere; }
.task-card-meta { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 7px; color: var(--muted); font-size: 10px; }
.task-chip { padding: 2px 7px; border-radius: 99px; background: var(--primary-soft); color: var(--primary); font-weight: 800; }
.task-chip.long { background: #e8f8f0; color: #168354; }
.task-chip.priority-high { background: #ffedf1; color: #c42a51; }
.task-chip.priority-low { background: #f0f3f8; color: #68758a; }
.task-progress { height: 5px; margin-top: 10px; overflow: hidden; border-radius: 99px; background: #edf1f6; }
.task-progress span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #20a66a, #4ec98d); }
.task-actions { display: flex; gap: 10px; margin-top: 9px; }
.task-action { border: 0; padding: 0; color: var(--primary); background: transparent; font-size: 10px; font-weight: 800; }
.task-action.danger { color: var(--rose); }

.calendar-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 62px; padding: 12px 18px; border-bottom: 1px solid var(--line); background: linear-gradient(180deg, #fff, #fbfcff); }
.view-switch { display: flex; padding: 4px; border-radius: 12px; background: #edf2f9; }
.view-button { min-height: 32px; padding: 0 13px; border: 0; border-radius: 9px; color: var(--muted); background: transparent; font-size: 12px; font-weight: 800; }
.view-button.active { color: var(--primary); background: white; box-shadow: 0 3px 9px rgba(44, 70, 112, .1); }
.legend { display: flex; gap: 14px; margin-left: auto; color: var(--muted); font-size: 11px; }
.legend span { display: flex; align-items: center; gap: 6px; }
.legend-dot.long { background: var(--green); }
.day-picker { display: flex; gap: 6px; margin-left: auto; overflow-x: auto; }
.day-picker button { min-width: 42px; height: 34px; border: 1px solid var(--line); border-radius: 10px; background: white; color: var(--muted); font-size: 11px; font-weight: 800; }
.day-picker button.active { color: white; background: var(--primary); border-color: var(--primary); }

.calendar-stage { overflow: auto; max-height: calc(100vh - 196px); background: #fff; }
.week-view { min-width: 920px; }
.week-header { position: sticky; top: 0; z-index: 12; display: grid; grid-template-columns: var(--time-width) 1fr; height: 62px; border-bottom: 1px solid var(--line-strong); background: rgba(255,255,255,.97); backdrop-filter: blur(10px); }
.time-header { display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 11px; font-weight: 800; border-right: 1px solid var(--line); }
.day-headings { display: grid; grid-template-columns: repeat(7, minmax(110px, 1fr)); }
.day-heading { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border-right: 1px solid var(--line); }
.day-heading strong { font-size: 13px; }
.day-heading span { color: var(--muted); font-size: 10px; }
.day-heading.today strong { color: var(--primary); }
.week-body { display: grid; grid-template-columns: var(--time-width) 1fr; }
.time-axis { border-right: 1px solid var(--line); background: #fbfcff; }
.time-cell { height: var(--slot-height); padding: 7px 8px 0; border-bottom: 1px solid var(--line); }
.time-cell strong { display: block; font-size: 11px; text-align: center; }
.time-cell span { display: block; margin-top: 2px; color: var(--muted); font-size: 10px; text-align: center; }
.day-columns { display: grid; grid-template-columns: repeat(7, minmax(110px, 1fr)); min-width: 780px; }
.day-column { position: relative; height: calc(var(--slot-height) * 15); border-right: 1px solid var(--line); background-image: repeating-linear-gradient(to bottom, transparent 0, transparent calc(var(--slot-height) - 1px), var(--line) calc(var(--slot-height) - 1px), var(--line) var(--slot-height)); background-color: white; }
.day-column.today { background-color: #f8fbff; }
.day-column.weekend { background-color: #fcfdff; }
.slot-hit-area { position: absolute; inset: 0; display: grid; grid-template-rows: repeat(15, var(--slot-height)); }
.slot-target { border: 0; border-bottom: 1px solid transparent; background: transparent; opacity: 0; transition: opacity .18s ease, background .18s ease; }
.day-column:hover .slot-target { opacity: 1; }
.slot-target:hover { background: rgba(40, 120, 232, .055); }
.slot-target::after { content: '＋'; color: transparent; }
.slot-target:hover::after { color: rgba(40, 120, 232, .42); font-size: 20px; }
.schedule-card { position: absolute; z-index: 3; min-width: 0; overflow: hidden; padding: 8px 9px; border: 0; border-radius: 9px; color: white; text-align: left; box-shadow: 0 5px 12px rgba(32, 68, 121, .14); transition: transform .15s ease, box-shadow .15s ease, filter .15s ease; }
.schedule-card:hover { z-index: 8; transform: translateY(-1px); filter: saturate(1.08); box-shadow: 0 10px 22px rgba(32, 68, 121, .22); }
.schedule-card.short { background: linear-gradient(145deg, #3488f1, #2776df); }
.schedule-card.long { background: linear-gradient(145deg, #27ae70, #188a58); }
.schedule-card[data-color="cyan"] { background: linear-gradient(145deg, #21a9c7, #178ca6); }
.schedule-card[data-color="indigo"] { background: linear-gradient(145deg, #6877e6, #4d5cc6); }
.schedule-card[data-color="green"] { background: linear-gradient(145deg, #2ab878, #168c58); }
.schedule-card[data-color="amber"] { background: linear-gradient(145deg, #e8a42d, #c68113); }
.schedule-card[data-color="rose"] { background: linear-gradient(145deg, #e95f83, #ca3d65); }
.schedule-card.completed { opacity: .58; }
.schedule-card strong { display: -webkit-box; overflow: hidden; -webkit-line-clamp: 2; -webkit-box-orient: vertical; font-size: 12px; line-height: 1.25; overflow-wrap: anywhere; }
.schedule-card small { display: block; margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; opacity: .8; font-size: 9px; }
.schedule-card .card-progress { height: 3px; margin-top: 6px; overflow: hidden; border-radius: 99px; background: rgba(255,255,255,.28); }
.schedule-card .card-progress span { display: block; height: 100%; background: white; }
.schedule-card.compact { padding: 5px 6px; }
.schedule-card.compact small, .schedule-card.compact .card-progress { display: none; }
.schedule-card.compact strong { font-size: 10px; }

.day-view { min-width: 650px; }
.day-view-header { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: center; height: 48px; border-bottom: 1px solid var(--line); background: white; font-size: 14px; font-weight: 800; }
.day-view-body { display: grid; grid-template-columns: var(--time-width) 1fr; }
.single-day-column { position: relative; height: calc(var(--slot-height) * 15); background-image: repeating-linear-gradient(to bottom, transparent 0, transparent calc(var(--slot-height) - 1px), var(--line) calc(var(--slot-height) - 1px), var(--line) var(--slot-height)); }
.single-day-column .slot-hit-area { position: absolute; inset: 0; }
.single-day-column .schedule-card strong { font-size: 13px; }
.single-day-column .schedule-card small { font-size: 10px; }

.demo-notice { display: flex; align-items: center; justify-content: flex-end; gap: 12px; padding: 10px 16px; border-top: 1px solid var(--line); color: var(--muted); background: #fbfcff; font-size: 11px; }
.demo-notice button { border: 0; color: var(--primary); background: transparent; font-weight: 800; }
.mobile-tabs { display: none; }

.modal-backdrop { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 18px; background: rgba(15, 25, 43, .46); backdrop-filter: blur(5px); }
.modal-backdrop[hidden] { display: none; }
.modal { position: relative; width: min(760px, 100%); max-height: min(90vh, 900px); overflow: auto; padding: 25px; border-radius: 22px; background: white; box-shadow: 0 28px 80px rgba(12, 24, 48, .28); animation: modalIn .18s ease-out; }
.access-modal, .share-modal { width: min(520px, 100%); }
@keyframes modalIn { from { opacity: 0; transform: translateY(10px) scale(.985); } }
.modal h2 { margin: 5px 0 0; font-size: 24px; letter-spacing: -.02em; }
.modal-intro { margin: 12px 0 20px; color: var(--muted); font-size: 13px; line-height: 1.65; }
.modal-close { position: absolute; top: 14px; right: 14px; width: 34px; height: 34px; border: 0; border-radius: 50%; color: var(--muted); background: var(--surface-soft); font-size: 22px; line-height: 1; }
.modal-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding-right: 34px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.span-2 { grid-column: span 2; }
.field { display: grid; gap: 7px; min-width: 0; }
.field > span { color: #48566e; font-size: 12px; font-weight: 800; }
.field input, .field select, .field textarea, .copy-row input { width: 100%; border: 1px solid var(--line-strong); border-radius: 11px; color: var(--text); background: #fbfcff; }
.field input, .field select { height: 42px; padding: 0 11px; }
.field textarea { min-height: 80px; padding: 10px 11px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: #83b4ef; background: white; }
.kind-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 20px 0 18px; padding: 5px; border-radius: 14px; background: #edf2f9; }
.kind-switch label { cursor: pointer; }
.kind-switch input { position: absolute; opacity: 0; pointer-events: none; }
.kind-switch span { display: flex; align-items: center; justify-content: center; min-height: 40px; border-radius: 10px; color: var(--muted); font-size: 13px; font-weight: 800; }
.kind-switch input:checked + span { color: var(--primary); background: white; box-shadow: 0 4px 12px rgba(44, 70, 112, .1); }
.checkbox-card { display: flex; align-items: center; gap: 8px; min-height: 42px; align-self: end; padding: 0 11px; border: 1px solid var(--line); border-radius: 11px; background: #fbfcff; color: #48566e; font-size: 12px; font-weight: 700; }
.checkbox-card input { width: 16px; height: 16px; accent-color: var(--primary); }
.schedule-box { margin-top: 18px; padding: 15px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface-soft); }
.schedule-toggle { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.schedule-toggle input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--primary); }
.schedule-toggle strong { display: block; font-size: 13px; }
.schedule-toggle small { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.schedule-fields { margin-top: 15px; padding-top: 15px; border-top: 1px solid var(--line); }
.schedule-fields[hidden] { display: none; }
.copy-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.copy-row input { height: 42px; padding: 0 11px; }
.share-hint { display: grid; gap: 4px; margin-top: 16px; padding: 12px 14px; border-radius: 12px; background: var(--primary-soft); color: #375987; font-size: 11px; }
.toast { position: fixed; left: 50%; bottom: 24px; z-index: 200; max-width: min(440px, calc(100vw - 30px)); padding: 11px 17px; border-radius: 12px; color: white; background: #202b3f; box-shadow: 0 14px 40px rgba(15, 25, 43, .28); opacity: 0; transform: translate(-50%, 12px); pointer-events: none; transition: opacity .18s ease, transform .18s ease; font-size: 12px; }
.toast.visible { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 1000px) {
  .app-main { grid-template-columns: 250px minmax(0, 1fr); gap: 12px; padding-inline: 12px; }
  .task-panel { padding: 14px; }
  .sync-pill { display: none; }
  .brand p { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

@media (max-width: 760px) {
  :root { --time-width: 66px; --slot-height: 64px; }
  body { padding-bottom: env(safe-area-inset-bottom); }
  .app-header { position: relative; align-items: flex-start; min-height: auto; padding: 13px 14px 12px; }
  .brand-mark { width: 40px; height: 40px; border-radius: 13px; }
  .brand-mark span { left: 10px; right: 10px; }
  .brand h1 { font-size: 18px; }
  .brand p { max-width: 190px; font-size: 11px; }
  .header-actions { gap: 6px; }
  .header-actions .icon-button, .header-actions .secondary-button { min-height: 36px; padding: 0 10px; font-size: 11px; }
  .header-actions .primary-button { width: 38px; min-height: 38px; padding: 0; overflow: hidden; white-space: nowrap; font-size: 0; }
  .header-actions .primary-button span { font-size: 22px; }
  .mobile-tabs { position: sticky; top: 0; z-index: 25; display: grid; grid-template-columns: 1fr 1fr; gap: 5px; padding: 7px 14px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.96); backdrop-filter: blur(12px); }
  .mobile-tab { min-height: 38px; border: 0; border-radius: 10px; color: var(--muted); background: transparent; font-size: 13px; font-weight: 800; }
  .mobile-tab.active { color: var(--primary); background: var(--primary-soft); }
  .app-main { display: block; padding: 10px 8px 20px; }
  .calendar-panel { border-radius: 16px; }
  .task-panel { position: static; display: none; max-height: none; border-radius: 16px; }
  body[data-mobile-tab="tasks"] .task-panel { display: block; }
  body[data-mobile-tab="tasks"] .calendar-panel { display: none; }
  .calendar-toolbar { flex-wrap: wrap; padding: 9px 10px; }
  .legend { display: none; }
  .day-picker { order: 3; width: 100%; margin: 0; }
  .day-picker button { flex: 1; min-width: 38px; }
  .calendar-stage { max-height: none; overflow: visible; }
  .week-view { overflow-x: auto; }
  .week-header { top: 52px; }
  .day-headings, .day-columns { min-width: 700px; }
  .day-columns { grid-template-columns: repeat(7, minmax(100px, 1fr)); }
  .day-view { min-width: 0; }
  .day-view-body { grid-template-columns: var(--time-width) minmax(0, 1fr); }
  .modal { padding: 21px 16px; border-radius: 18px; }
  .form-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: span 1; }
  .short-fields, .long-fields { grid-template-columns: 1fr 1fr; }
  .short-fields .span-2, .long-fields .span-2 { grid-column: span 2; }
  .modal-actions { position: sticky; bottom: -21px; margin: 20px -16px -21px; padding: 13px 16px; background: white; border-top: 1px solid var(--line); }
}

@media (max-width: 430px) {
  .brand p { max-width: 130px; }
  .header-actions .icon-button, .header-actions .secondary-button { display: none; }
  .short-fields, .long-fields { grid-template-columns: 1fr; }
  .short-fields .span-2, .long-fields .span-2 { grid-column: span 1; }
  .schedule-fields .form-grid { grid-template-columns: 1fr 1fr; }
  .schedule-fields .form-grid .field:nth-child(2) { grid-column: span 2; }
}


/* V2: page navigation, long-term goals and time-slot actions */
.desktop-nav {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px;
  border-radius: 14px;
  background: #edf2f9;
}
.nav-button {
  min-height: 38px;
  padding: 0 15px;
  border: 0;
  border-radius: 10px;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
  font-weight: 850;
}
.nav-button.active {
  color: var(--primary);
  background: white;
  box-shadow: 0 4px 12px rgba(44, 70, 112, .1);
}
.task-summary.single { grid-template-columns: 1fr; }
.panel-tip {
  display: grid;
  gap: 5px;
  margin-top: 20px;
  padding: 14px;
  border: 1px solid #dbe9fb;
  border-radius: 15px;
  background: linear-gradient(145deg, #f0f7ff, #f8fbff);
  color: var(--muted);
  font-size: 11px;
}
.panel-tip strong { color: var(--text); font-size: 13px; }
.panel-tip button {
  justify-self: start;
  margin-top: 4px;
  padding: 0;
  border: 0;
  color: var(--primary);
  background: transparent;
  font-size: 11px;
  font-weight: 850;
}

.goals-panel {
  display: none;
  grid-column: 1 / -1;
  min-width: 0;
  padding: clamp(20px, 3vw, 36px);
  border: 1px solid rgba(216, 224, 236, .9);
  border-radius: 22px;
  background: linear-gradient(180deg, #ffffff, #fbfdff);
  box-shadow: var(--shadow);
}
body[data-page="goals"] .goals-panel { display: block; }
body[data-page="goals"] .task-panel,
body[data-page="goals"] .calendar-panel { display: none; }
body[data-page="tasks"] .calendar-panel { display: none; }
body[data-page="tasks"] .task-panel {
  position: static;
  grid-column: 1 / -1;
  max-height: none;
  padding: 24px;
}
body[data-page="tasks"] .task-list {
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}
.goals-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}
.goals-hero h2 {
  margin: 7px 0 7px;
  font-size: clamp(28px, 4vw, 42px);
  letter-spacing: -.04em;
}
.goals-hero p {
  max-width: 640px;
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
  font-size: 14px;
}
.goal-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 13px;
  margin: 22px 0;
}
.goal-stats article {
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-soft);
}
.goal-stats span { display: block; color: var(--muted); font-size: 11px; }
.goal-stats strong { display: block; margin-top: 5px; font-size: 25px; letter-spacing: -.03em; }
.goal-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 20px 0 16px;
}
.goal-toolbar p { margin: 0; color: var(--muted); font-size: 11px; }
.goal-filters { display: flex; gap: 7px; flex-wrap: wrap; }
.goal-filters button {
  min-height: 34px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
  background: white;
  font-size: 11px;
  font-weight: 800;
}
.goal-filters button.active { color: white; background: var(--primary); border-color: var(--primary); }
.goal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 15px;
}
.goal-card {
  position: relative;
  overflow: hidden;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: white;
  box-shadow: 0 8px 24px rgba(44, 70, 112, .06);
  transition: transform .17s ease, box-shadow .17s ease, border-color .17s ease;
}
.goal-card:hover { transform: translateY(-2px); border-color: #bfd5f4; box-shadow: 0 15px 34px rgba(44, 70, 112, .11); }
.goal-card::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: linear-gradient(#36b87b, #1b8f5c);
}
.goal-card.completed::before { background: linear-gradient(#55a2f5, #2878e8); }
.goal-card.paused::before { background: linear-gradient(#c8d0dc, #9aa7b9); }
.goal-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.goal-card h3 { margin: 0; font-size: 17px; line-height: 1.35; overflow-wrap: anywhere; }
.goal-status {
  flex: 0 0 auto;
  padding: 4px 8px;
  border-radius: 99px;
  color: #137849;
  background: #e7f8ef;
  font-size: 9px;
  font-weight: 900;
}
.goal-status.completed { color: #236bbf; background: #e9f3ff; }
.goal-status.paused { color: #68758a; background: #eef1f5; }
.goal-date {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 11px;
}
.goal-notes {
  min-height: 38px;
  margin: 12px 0 0;
  color: #59677d;
  font-size: 12px;
  line-height: 1.55;
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.goal-progress-head {
  display: flex;
  justify-content: space-between;
  margin: 17px 0 7px;
  color: var(--muted);
  font-size: 10px;
}
.goal-progress-head strong { color: var(--text); font-size: 12px; }
.goal-progress {
  height: 8px;
  overflow: hidden;
  border-radius: 99px;
  background: #edf1f6;
}
.goal-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #20a66a, #55c98f);
}
.goal-card.completed .goal-progress span { background: linear-gradient(90deg, #2878e8, #65a9f5); }
.goal-schedule {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
  padding: 10px 11px;
  border-radius: 11px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 10px;
}
.goal-card-actions {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-top: 15px;
  padding-top: 13px;
  border-top: 1px solid var(--line);
}
.goal-card-actions button {
  padding: 0;
  border: 0;
  color: var(--primary);
  background: transparent;
  font-size: 11px;
  font-weight: 850;
}
.goal-card-actions .goal-delete { color: var(--rose); margin-left: auto; }
.empty-goals {
  display: grid;
  place-items: center;
  gap: 6px;
  min-height: 260px;
  border: 1px dashed var(--line-strong);
  border-radius: 18px;
  color: var(--muted);
}
.empty-goals strong { color: var(--text); font-size: 18px; }

.slot-modal { width: min(580px, 100%); }
.slot-task-list { display: grid; gap: 10px; }
.slot-task-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-soft);
}
.slot-task-row strong { display: block; font-size: 13px; }
.slot-task-row span { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; }
.slot-task-actions { display: flex; gap: 9px; }
.slot-task-actions button {
  min-height: 31px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  color: var(--primary);
  background: white;
  font-size: 10px;
  font-weight: 800;
}
.slot-task-actions button.delete { color: var(--rose); }
.slot-empty { padding: 18px; border: 1px dashed var(--line-strong); border-radius: 13px; color: var(--muted); text-align: center; font-size: 12px; }
.slot-add-button {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: 12px;
  width: 100%;
  margin-top: 14px;
  padding: 14px;
  border: 1px solid #bed6f6;
  border-radius: 14px;
  color: var(--primary);
  text-align: left;
  background: var(--primary-soft);
}
.slot-add-button > span { grid-row: 1 / 3; align-self: center; font-size: 25px; }
.slot-add-button strong { font-size: 13px; }
.slot-add-button small { margin-top: 2px; color: #6681a5; font-size: 10px; }

@media (max-width: 1100px) {
  .desktop-nav { display: none; }
  .mobile-tabs { display: grid; }
}
body[data-page="goals"] .mobile-tabs .mobile-tab.active,
body[data-page="tasks"] .mobile-tabs .mobile-tab.active { color: var(--primary); background: var(--primary-soft); }

@media (max-width: 760px) {
  .mobile-tabs { grid-template-columns: repeat(3, 1fr); }
  .goals-panel { padding: 16px; border-radius: 16px; }
  .goals-hero { align-items: flex-start; flex-direction: column; }
  .goals-hero .primary-button { width: 100%; }
  .goal-stats { grid-template-columns: repeat(2, 1fr); }
  .goal-toolbar { align-items: flex-start; flex-direction: column; }
  .goal-grid { grid-template-columns: 1fr; }
  .slot-task-row { grid-template-columns: 1fr; }
  .slot-task-actions { justify-content: flex-end; }
}

.connection-help {
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface-soft);
  color: #526078;
  font-size: 11px;
}
.connection-help summary { color: var(--primary); font-weight: 850; cursor: pointer; }
.connection-help ol { margin: 10px 0 0; padding-left: 20px; line-height: 1.75; }

[hidden] { display: none !important; }

