:root {
  --ink: #303334;
  --muted: #7b7f80;
  --paper: #f1eee5;
  --panel: #fdfbf6;
  --line: #e1ded6;
  --today: #df6248;
  --content: #267c83;
  --course: #7158a6;
  --life: #c27a2d;
  --music: #b64568;
  --hour-height: 64px;
  --day-width: 132px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; background: var(--panel); }
body { margin: 0; min-width: 0; height: 100vh; height: 100dvh; overflow: hidden; }
button, input, textarea, select { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid rgba(217,95,63,.25); outline-offset: 2px; }

.topbar { height: 78px; display: grid; grid-template-columns: 290px 1fr auto; align-items: center; gap: 24px; padding: 0 24px; background: #fffdf8; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 34px; height: 34px; display: grid; place-items: center; border: 0; padding: 0; border-radius: 50%; background: #424849; cursor: pointer; transition: transform .18s ease, background .18s ease; }
.brand-mark span { grid-area: 1 / 1; width: 17px; height: 4px; border-radius: 999px; background: #fffdf8; }
.brand-mark span:nth-child(1) { transform: translate(0, -7px); }
.brand-mark span:nth-child(2) { width: 19px; transform: translate(4px, 0); }
.brand-mark span:nth-child(3) { width: 16px; transform: translate(-3px, 7px); }
body.ideas-collapsed .brand-mark { transform: rotate(180deg); background: #424849; }
.brand strong, .brand small { display: block; }
.brand strong { letter-spacing: .08em; }
.brand small, .month-nav small { margin-top: 3px; color: var(--muted); font-size: 11px; }
.month-nav { justify-self: center; display: flex; align-items: center; gap: 16px; text-align: center; }
.month-nav button { border: 0; background: transparent; cursor: pointer; font-size: 20px; }
.month-nav span { display: block; font-size: 19px; font-weight: 720; letter-spacing: -.02em; }
.top-actions { display: flex; gap: 9px; }
.sync-button { display: flex; align-items: center; gap: 7px; border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; color: var(--muted); background: #fffdf8; cursor: pointer; }
.sync-dot { width: 7px; height: 7px; border-radius: 50%; background: #aaa; }.sync-button.is-online .sync-dot { background: #3d9a69; box-shadow: 0 0 0 3px rgba(61,154,105,.13); }.sync-button.is-error .sync-dot { background: #d35d4b; }
.ghost-button, .primary-button { border: 1px solid var(--line); border-radius: 8px; padding: 9px 14px; background: #fcfdfb; cursor: pointer; }
.primary-button { border-color: #424849; background: #424849; color: #f8faf8; }

.workspace { display: grid; grid-template-columns: 290px minmax(0, 1fr); height: calc(100vh - 78px); height: calc(100dvh - 78px); min-height: 0; overflow: hidden; transition: grid-template-columns .22s ease; }
.idea-panel { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; padding: 24px 18px 18px; overflow: hidden; background: #404040; color: #f8f8f8; transition: opacity .15s ease, padding .22s ease; }
body.ideas-collapsed .workspace { grid-template-columns: 0 minmax(0, 1fr); }
body.ideas-collapsed .idea-panel { padding-left: 0; padding-right: 0; opacity: 0; pointer-events: none; }
.panel-heading { display: flex; justify-content: space-between; gap: 12px; }
.eyebrow { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; letter-spacing: .16em; color: #f0a064; }
.panel-heading h1 { margin: 9px 0 18px; font-size: 24px; line-height: 1.22; font-weight: 720; letter-spacing: -.035em; }
.idea-count { width: 30px; height: 30px; display: grid; place-items: center; border: 1px solid #666; border-radius: 50%; color: #ddd; }
.quick-add { border: 1px solid #666; border-radius: 10px; overflow: hidden; background: #4a4a4a; }
.quick-add textarea { width: 100%; resize: none; border: 0; padding: 12px; color: #f8faf8; background: transparent; line-height: 1.5; }
.quick-add textarea::placeholder { color: #b8b8b8; }
.quick-add button { width: 100%; padding: 8px 12px; border: 0; border-top: 1px solid #666; text-align: left; font-size: 12px; color: #e0e0e0; background: transparent; cursor: pointer; }
.idea-list { flex: 1; min-height: 100px; overflow-y: auto; padding: 14px 0; }
.idea-card { margin-bottom: 9px; padding: 12px; border-left: 3px solid var(--category-color, #e58a48); border-radius: 4px 9px 9px 4px; background: #4c4c4c; box-shadow: 0 5px 14px rgba(20,20,20,.16); cursor: grab; }
.idea-card:active { cursor: grabbing; }
.idea-card.dragging { opacity: .45; }
.drop-indicator { flex: 0 0 3px; width: 100%; height: 3px; margin: 2px 0 10px; border-radius: 3px; background: #f0a064; box-shadow: 0 0 0 2px rgba(240,160,100,.16); pointer-events: none; }
.idea-card strong { display: block; font-size: 13px; line-height: 1.4; }
.idea-card small { display: block; margin-top: 7px; color: #bdbdbd; }
.panel-tip { border-top: 1px solid #606060; padding-top: 14px; }
.panel-tip span { font-size: 11px; color: #f0a064; }
.panel-tip p { margin: 5px 0 0; color: #bdbdbd; font-size: 11px; line-height: 1.55; }

.calendar-shell { min-width: 0; min-height: 0; overflow: hidden; display: flex; flex-direction: column; background: var(--panel); }
.calendar-toolbar { height: 48px; flex: 0 0 48px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 18px; border-bottom: 1px solid var(--line); }
.category-tools, .legend, .zoom-control { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 11px; white-space: nowrap; }
.legend { max-width: min(48vw, 560px); overflow-x: auto; scrollbar-width: none; }.legend::-webkit-scrollbar { display: none; }
.category-manage-button { flex: 0 0 auto; border: 0; border-left: 1px solid var(--line); padding: 4px 0 4px 12px; color: var(--muted); background: transparent; font-size: 11px; cursor: pointer; }
.zoom-control input { width: 105px; accent-color: var(--today); }
.legend span { display: flex; align-items: center; gap: 6px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--category-color); }
.calendar-scroll { flex: 1 1 0; width: 100%; height: 0; min-height: 0; overflow: auto; overscroll-behavior: contain; touch-action: pan-x pan-y; -webkit-overflow-scrolling: touch; scrollbar-gutter: stable; }
.calendar-grid { position: relative; display: grid; grid-template-columns: 64px max-content; grid-template-rows: 58px 46px auto; min-width: max-content; -webkit-user-select: none; user-select: none; }
.corner-cell { position: sticky; top: 0; left: 0; z-index: 8; display: flex; flex-direction: column; justify-content: center; padding-left: 13px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--panel); }
.corner-cell span { font-family: ui-monospace, monospace; font-weight: 700; }.corner-cell small { color: var(--muted); }
.day-headers { position: sticky; top: 0; z-index: 7; display: grid; grid-auto-flow: column; grid-auto-columns: var(--day-width); background: var(--panel); }
.day-header { height: 58px; display: flex; align-items: center; gap: 8px; padding: 8px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.day-header b { font-size: 21px; font-weight: 760; letter-spacing: -.04em; }.day-header span { color: var(--muted); font-size: 10px; }.day-header.today { color: var(--today); background: #fff2ee; }
.all-day-label { position: sticky; top: 58px; left: 0; z-index: 8; display: grid; place-items: center; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); color: var(--muted); background: var(--panel); font-size: 10px; }
.all-day-row { position: sticky; top: 58px; z-index: 6; display: grid; grid-auto-flow: column; grid-auto-columns: var(--day-width); height: 46px; background: var(--panel); }
.all-day-slot { min-width: 0; padding: 6px 4px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); overflow: hidden; }.all-day-slot.today { background: #fff9f6; }.all-day-slot.drag-over { background: #f6e6de; }
.all-day-task { width: 100%; overflow: hidden; border: 1px solid color-mix(in srgb, var(--category-color) 72%, #202020); border-radius: 5px; padding: 4px 6px; color: white; background: var(--category-color); font-size: 10px; font-weight: 650; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; box-shadow: inset 0 0 0 1px rgba(255,255,255,.18); cursor: grab; }
.time-labels { position: sticky; left: 0; z-index: 6; background: var(--panel); border-right: 1px solid var(--line); }
.time-label { height: var(--hour-height); display: flex; align-items: baseline; justify-content: flex-end; gap: 3px; padding: 7px 9px; border-bottom: 1px solid var(--line); color: var(--muted); font-family: ui-monospace, monospace; font-size: 10px; text-align: right; }.time-label small { font-size: 7px; font-weight: 700; letter-spacing: .04em; }.time-label.period-label span { color: var(--ink); font-weight: 700; }
.day-columns { display: grid; grid-auto-flow: column; grid-auto-columns: var(--day-width); }
.day-column { position: relative; height: calc(var(--hour-height) * 15); border-right: 1px solid var(--line); background: repeating-linear-gradient(to bottom, transparent 0, transparent calc(var(--hour-height) / 2 - 1px), #f0f2f0 calc(var(--hour-height) / 2), transparent calc(var(--hour-height) / 2 + 1px), transparent calc(var(--hour-height) - 1px), var(--line) var(--hour-height)); }
.day-column.weekend { background-color: #f5f7f5; }.day-column.today { background-color: #fff9f6; }
.day-column.drag-over { background-color: #edf4f3; box-shadow: inset 0 0 0 2px #70a6a2; }
.day-column.long-pressing { -webkit-touch-callout: none; }.day-column.long-pressing::after { content: attr(data-long-press-label); position: absolute; top: var(--long-press-top); left: 4px; right: 4px; z-index: 1; height: var(--long-press-height, calc(var(--hour-height) / 2 - 3px)); min-height: 16px; display: grid; place-items: center; overflow: hidden; border: 1px dashed var(--today); border-radius: 5px; color: var(--today); background: rgba(223,98,72,.09); font-size: 9px; font-weight: 700; pointer-events: none; }
.day-column.long-press-ready::after { border-style: solid; background: rgba(223,98,72,.16); }
.task-block { position: absolute; left: 5px; right: 5px; min-height: 16px; container-type: inline-size; display: flex; flex-direction: column; gap: 3px; overflow: visible; border: 2px solid var(--category-color); border-radius: 6px; padding: 6px 7px; color: var(--category-color); background: color-mix(in srgb, var(--category-color) 9%, #fff); box-shadow: 0 2px 7px rgba(55,48,44,.12); cursor: grab; transition: transform .14s ease, box-shadow .14s ease; }
.task-block:hover { transform: translateY(-1px); box-shadow: 0 5px 13px rgba(55,48,44,.18); }.task-block:active { cursor: grabbing; }
.task-block strong { display: block; flex: 1 1 auto; min-width: 0; min-height: 0; overflow: hidden; font-size: 11px; font-weight: 700; line-height: 1.2; white-space: normal; }.task-block small { flex: 0 0 auto; max-width: 100%; margin-top: auto; overflow: hidden; opacity: .72; font-size: 9px; font-weight: 700; line-height: 1; text-overflow: ellipsis; white-space: nowrap; }
.task-block.compact { gap: 1px; padding: 4px 6px; }.task-block.compact strong { font-size: 10px; white-space: nowrap; }.task-block.compact small { font-size: 8px; }
.task-block.micro { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 3px; padding: 1px 4px; border-width: 1px; }.task-block.micro strong { display: block; overflow: hidden; font-size: 8px; line-height: 1; text-overflow: ellipsis; white-space: nowrap; }.task-block.micro small { margin: 0; font-size: 7px; line-height: 1; }
@container (max-width: 78px) { .task-block strong { font-size: 9px; }.task-block small { font-size: 8px; }.task-block.micro strong { font-size: 8px; }.task-block.micro small { font-size: 7px; } }
.task-block.compact.roomy { padding-top: 3px; padding-bottom: 3px; }.task-block.compact.roomy strong { line-height: 1.15; white-space: normal; }
.resize-handle { position: absolute; left: -2px; right: -2px; bottom: -2px; z-index: 2; height: 14px; border: 0; cursor: ns-resize; touch-action: none; }
.task-block.micro .resize-handle { bottom: -1px; height: 7px; }
.today-line { position: absolute; left: 0; right: 0; height: 2px; z-index: 4; background: var(--today); pointer-events: none; }.today-line::before { content: ""; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--today); }

dialog { width: 460px; border: 0; border-radius: 14px; padding: 0; color: var(--ink); background: #fcfdfb; box-shadow: 0 24px 80px rgba(35,42,42,.25); }
dialog::backdrop { background: rgba(47,35,30,.45); backdrop-filter: blur(3px); }
#taskForm { padding: 26px; }.dialog-heading { display: flex; justify-content: space-between; }.dialog-heading h2 { margin: 6px 0 22px; font-size: 25px; font-weight: 740; letter-spacing: -.025em; }.dialog-heading button { border: 0; background: transparent; font-size: 26px; cursor: pointer; }
#taskForm label { display: flex; min-width: 0; flex-direction: column; gap: 8px; margin-bottom: 18px; color: var(--muted); font-size: 14px; font-weight: 600; }#taskForm input, #taskForm select { width: 100%; min-width: 0; min-height: 44px; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; color: var(--ink); background: white; font-size: 15px; font-weight: 450; }.form-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }.schedule-fields.is-hidden { display: none; }.dialog-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 8px; }.dialog-spacer { flex: 1; }.delete-button { display: none; border: 0; padding: 9px 4px; color: #b74747; background: transparent; cursor: pointer; }.delete-button.is-visible { display: inline-block; }
#taskForm select { height: 44px; line-height: 22px; }
.all-day-option { flex-direction: row !important; align-items: center; gap: 9px !important; margin-top: -5px; }.all-day-option[hidden] { display: none !important; }.all-day-option input { width: 18px !important; min-width: 18px !important; min-height: 18px !important; height: 18px; margin: 0; accent-color: var(--today); }.all-day-option span { color: var(--ink); font-size: 13px; font-weight: 500; }#taskForm input:disabled, #taskForm select:disabled { opacity: .45; background: #f2f2ef; }
.category-dialog form { padding: 26px; }.category-dialog h2 { margin: 6px 0 8px; font-size: 25px; }.category-description { margin: 0 0 18px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.category-list { display: grid; gap: 9px; max-height: min(48vh, 380px); overflow-y: auto; padding: 2px; }
.category-row { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; align-items: center; gap: 9px; }.category-row input[type="color"] { width: 44px; height: 42px; border: 1px solid var(--line); border-radius: 8px; padding: 4px; background: white; cursor: pointer; }.category-row input[type="text"] { width: 100%; min-width: 0; height: 42px; border: 1px solid var(--line); border-radius: 8px; padding: 8px 11px; color: var(--ink); background: white; font-size: 14px; }
.remove-category-button { border: 0; padding: 8px 2px; color: #b74747; background: transparent; font-size: 12px; cursor: pointer; }.remove-category-button:disabled { opacity: .3; cursor: default; }
.add-category-button { width: 100%; margin-top: 11px; border: 1px dashed #c9c5bb; border-radius: 8px; padding: 10px; color: var(--muted); background: transparent; cursor: pointer; }
.auth-dialog form { padding: 26px; }.auth-dialog h2 { margin: 6px 0 12px; font-size: 25px; }.auth-description { margin: 0 0 22px; color: var(--muted); font-size: 14px; line-height: 1.55; }.auth-dialog label { display: flex; flex-direction: column; gap: 8px; color: var(--muted); font-size: 14px; font-weight: 600; }.auth-dialog input { width: 100%; height: 44px; margin-bottom: 8px; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; font-size: 15px; }.auth-dialog .otp-field { display: none; }.auth-dialog.is-code-sent .otp-field { display: flex; }.auth-message { min-height: 20px; margin: 4px 0 14px; color: #a65b31; font-size: 13px; }.auth-dialog .delete-button { display: none; }.auth-dialog.is-signed-in .delete-button { display: inline-block; }.auth-dialog.is-signed-in #sendLoginCode { display: none; }.auth-dialog.is-signed-in .otp-field { display: none; }
.toast { position: fixed; bottom: 22px; left: 50%; z-index: 20; transform: translate(-50%, 20px); opacity: 0; padding: 9px 14px; border-radius: 7px; color: #f8faf8; background: #424849; font-size: 12px; pointer-events: none; transition: .2s ease; }.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 1100px) { .topbar { grid-template-columns: 220px 1fr auto; }.brand small, .top-actions .ghost-button { display: none; }.workspace { grid-template-columns: 240px minmax(0,1fr); }.zoom-control { gap: 7px; }.zoom-control input { width: 80px; } }
@media (max-width: 700px) {
  :root { --day-width: 96px; }
  html, body { height: auto; min-height: 100%; }
  body { min-height: 100vh; min-height: 100lvh; overflow-x: hidden; overflow-y: auto; -webkit-overflow-scrolling: touch; }
  .topbar { position: sticky; top: 0; z-index: 30; height: calc(62px + env(safe-area-inset-top)); grid-template-columns: auto 1fr auto; gap: 8px; padding: env(safe-area-inset-top) max(10px, env(safe-area-inset-right)) 0 max(10px, env(safe-area-inset-left)); }
  .brand div { display: none; }.brand-mark { width: 32px; height: 32px; }
  .month-nav { gap: 7px; }.month-nav span { font-size: 16px; }.month-nav small { display: none; }
  .top-actions .primary-button { padding: 8px 10px; font-size: 12px; }
  .sync-button { width: 34px; padding: 8px; justify-content: center; }.sync-button #syncButtonText { display: none; }
  .workspace { height: auto; min-height: calc(100vh - 62px - env(safe-area-inset-top)); min-height: calc(100lvh - 62px - env(safe-area-inset-top)); grid-template-columns: 1fr; grid-template-rows: 176px auto; overflow: visible; transition: grid-template-rows .2s ease; }
  .idea-panel { padding: 12px; display: grid; grid-template-columns: 150px minmax(150px, 1fr); grid-template-rows: auto 1fr; gap: 8px 12px; overflow: hidden; transition: opacity .15s ease, padding .2s ease; }
  body.ideas-collapsed .workspace { grid-template-columns: 1fr; grid-template-rows: 0 auto; }
  body.ideas-collapsed .idea-panel { padding: 0; opacity: 0; pointer-events: none; }
  .panel-heading { grid-column: 1; grid-row: 1; }.panel-heading h1 { margin: 4px 0 0; font-size: 17px; }.idea-count { width: 25px; height: 25px; }
  .quick-add { grid-column: 1; grid-row: 2; }.quick-add textarea { height: 58px; padding: 8px; font-size: 12px; }.quick-add button { padding: 5px 8px; font-size: 10px; }
  .idea-list { grid-column: 2; grid-row: 1 / 3; display: flex; gap: 8px; padding: 0; overflow-x: auto; overflow-y: hidden; }
  .idea-card { flex: 0 0 156px; height: 100%; margin: 0; padding: 10px; }
  .drop-indicator { width: 3px; height: 100%; margin: 0 3px; }
  .panel-tip { display: none; }
  .calendar-shell { overflow: visible; }
  .calendar-toolbar { height: 46px; flex-basis: 46px; padding: 0 10px; overflow-x: auto; }.category-tools, .legend { gap: 8px; }.legend { max-width: none; }.legend span { font-size: 0; }.legend .dot { width: 9px; height: 9px; }.category-manage-button { padding-left: 8px; font-size: 10px; }.zoom-control { gap: 5px; }.zoom-control input { width: 70px; }
  .calendar-scroll { flex: none; width: 100%; height: auto; min-height: 0; overflow-x: auto; overflow-y: hidden; padding-bottom: 0; }
  .calendar-grid { grid-template-columns: 52px max-content; grid-template-rows: 52px 44px auto; }
  .corner-cell { padding-left: 8px; }.day-header { height: 52px; padding: 6px; }.day-header b { font-size: 18px; }
  .all-day-label, .all-day-row { top: 52px; }.all-day-row { height: 44px; }.all-day-slot { padding: 5px 3px; }.all-day-task { padding: 5px; font-size: 9px; }
  .time-label { padding: 6px; }.task-block { left: 3px; right: 3px; padding: 6px; touch-action: pan-x pan-y; }.task-block strong { font-size: 10px; }
  .task-block.touch-lifted, .task-block.touch-moving { z-index: 100000 !important; opacity: .9; box-shadow: 0 12px 28px rgba(35,35,35,.34); }
  .task-block.touch-lifted { transform: translateY(-3px) scale(1.025); }
  .task-block.touch-moving { transition: none; }
  dialog { width: calc(100% - 24px); max-height: calc(100dvh - 24px); }
  .form-row { width: 100%; min-width: 0; grid-template-columns: minmax(0, 1fr); gap: 0; }
  .schedule-fields { display: block; width: 100%; min-width: 0; }
  .schedule-fields label { display: block; width: 100%; min-width: 0; overflow: hidden; }
  #taskForm input[type="date"], #taskForm input[type="time"] { display: block; box-sizing: border-box; width: 100% !important; min-width: 0 !important; max-width: 100% !important; -webkit-appearance: none; appearance: none; }
  #taskForm input[type="date"]::-webkit-date-and-time-value, #taskForm input[type="time"]::-webkit-date-and-time-value { width: 100%; min-width: 0; text-align: center; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
