/* 各畫面：登入、專案頁（看板、點子牆、日曆）、項目頁、設定、活動紀錄、上傳 */

/* 登入 */
.login-page { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px; padding: calc(24px + var(--safe-t)) 16px calc(24px + var(--safe-b));
  background: radial-gradient(1200px 500px at 50% -10%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%), var(--bg); }
.login-card { width: min(400px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 28px 22px; box-shadow: var(--shadow-2); display: flex; flex-direction: column; gap: 20px; }
.login-card form { display: flex; flex-direction: column; gap: 14px; }
.login-head { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; }
.login-head h1 { font-size: 22px; margin-top: 6px; }
.code-input { text-align: center; letter-spacing: .5em; font-size: 26px; font-variant-numeric: tabular-nums; font-weight: 700; padding-left: calc(12px + .5em); }
.login-row { display: flex; justify-content: space-between; }
.login-foot { color: var(--muted); font-size: 13px; }
.dev-code { font-size: 13px; color: var(--accent-ink); font-family: var(--mono); }
.dev-code:empty { display: none; }

/* 專案頁工具列 */
.project-head { align-items: flex-start; }
.toolbar { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 12px; padding: 3px; gap: 2px; align-self: flex-start; max-width: 100%; }
.seg-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 0 14px; border-radius: 9px; border: 0; background: none; color: var(--ink-2); font-weight: 650; cursor: pointer; white-space: nowrap; }
.seg-btn.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }
.seg.sm .seg-btn { min-height: 34px; padding: 0 12px; }
.filters { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; -webkit-overflow-scrolling: touch; }
.filters::-webkit-scrollbar { display: none; }
.filters select { flex: none; }
.search-wrap { position: relative; display: flex; align-items: center; flex: 1 0 180px; min-width: 160px; }
.search-wrap .ic { position: absolute; left: 10px; color: var(--muted); pointer-events: none; }
.search-wrap .input { padding-left: 36px; min-height: 38px; font-size: 15px; }
@media (min-width: 768px) {
  .toolbar { flex-direction: row; align-items: center; justify-content: space-between; }
  .filters { overflow: visible; }
  .search-wrap { flex: 0 1 260px; }
}

/* 看板 */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(270px, 84vw); gap: 12px; overflow-x: auto; padding: 2px 2px 12px; scroll-snap-type: x mandatory; overscroll-behavior-x: contain; margin: 0 -16px; padding-left: 16px; padding-right: 16px; scroll-padding: 0 16px; }
.col { background: var(--surface-2); border-radius: 14px; padding: 8px; display: flex; flex-direction: column; gap: 8px; scroll-snap-align: start; min-height: 200px; transition: background .15s; }
.col.drop { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent); }
.col-head { display: flex; align-items: center; gap: 8px; padding: 6px 6px 2px; font-weight: 700; font-size: 14px; }
.col-head .count { margin-left: auto; color: var(--muted); font-size: 12.5px; font-weight: 650; }
.col-list { display: flex; flex-direction: column; gap: 8px; min-height: 40px; }
.col-empty { color: var(--muted); text-align: center; padding: 14px 0; font-size: 13px; }
.board-hint { margin-top: 2px; }
@media (min-width: 768px) {
  .board { grid-auto-columns: minmax(250px, 1fr); margin: 0; padding: 2px 0 12px; scroll-snap-type: none; }
  .board .item-card[draggable=true] { cursor: grab; }
}
@media (min-width: 1500px) { .board { grid-auto-columns: minmax(220px, 1fr); } }

/* 點子牆 */
.idea-wall { columns: 1; column-gap: 14px; }
.idea-card { break-inside: avoid; margin-bottom: 14px; overflow: hidden; }
.idea-body { padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.idea-top { display: flex; align-items: flex-start; gap: 10px; }
.idea-title { flex: 1; min-width: 0; padding-top: 6px; }
.idea-title h3 { font-size: 16px; }
.idea-meta { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.idea-meta span { display: inline-flex; align-items: center; gap: 3px; }
.vote { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; min-width: var(--tap); min-height: var(--tap); padding: 2px 8px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); font-weight: 750; font-size: 13px; cursor: pointer; line-height: 1.1; flex: none; }
.vote.on { color: #fff; background: var(--accent); border-color: var(--accent); }
.item-head .vote { flex-direction: row; gap: 6px; }
.idea-toggle { align-self: flex-start; }
.idea-toggle .ic { transition: transform .15s; }
.idea-toggle.open .ic { transform: rotate(180deg); }
.idea-children { display: flex; flex-direction: column; gap: 8px; }
.child-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.child { display: flex; align-items: center; gap: 8px; min-height: var(--tap); padding: 6px 10px; border-radius: 10px; background: var(--surface-2); border-left: 4px solid var(--pf); }
.child .ellipsis { flex: 1; }
@media (min-width: 640px) { .idea-wall { columns: 2; } }
@media (min-width: 1100px) { .idea-wall { columns: 3; } }
@media (min-width: 1600px) { .idea-wall { columns: 4; } }

/* 日曆 */
.calendar { display: flex; flex-direction: column; gap: 12px; }
.cal-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.cal-title { min-width: 120px; text-align: center; font-size: 16px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.cal-wd { background: var(--surface-2); text-align: center; font-size: 12px; font-weight: 700; color: var(--muted); padding: 6px 0; }
.cal-cell { background: var(--surface); min-height: 56px; padding: 4px; display: flex; flex-direction: column; gap: 2px; cursor: pointer; min-width: 0; position: relative; }
.cal-cell.other { background: var(--surface-2); color: var(--muted); }
.cal-cell.sel { box-shadow: inset 0 0 0 2px var(--accent); }
.cal-date { font-size: 12.5px; font-weight: 650; width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; }
.cal-cell.today .cal-date { background: var(--accent); color: #fff; }
.cal-evs { display: none; flex-direction: column; gap: 2px; min-width: 0; }
.cal-dots { display: flex; gap: 3px; flex-wrap: wrap; padding-left: 4px; }
.cal-dots i { width: 6px; height: 6px; border-radius: 50%; }
.cal-ev { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--pf); font-size: 13px; min-width: 0; min-height: var(--tap); }
.cal-ev .ellipsis { flex: 1; }
.cal-ev[data-st=published] { opacity: .75; }
.cal-time { font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 650; flex: none; }
.cal-day-list { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.cal-week { display: flex; flex-direction: column; gap: 8px; }
.cal-wday { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.cal-wday.today { border-color: var(--accent); }
.cal-wday-head { display: flex; gap: 8px; align-items: baseline; font-size: 13px; color: var(--muted); }
.cal-wday-head strong { color: var(--ink); }
.cal-unscheduled { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.cal-unscheduled ul { margin: 8px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }
@media (min-width: 900px) {
  .cal-cell { min-height: 108px; }
  .cal-evs { display: flex; }
  .cal-dots { display: none; }
  .cal-evs .cal-ev { min-height: 0; padding: 3px 6px; font-size: 12px; border-left-width: 3px; }
  .cal-day-list { display: none; }
  .cal-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .cal-wday { min-height: 320px; }
  .cal-wday .cal-ev { flex-direction: column; align-items: flex-start; gap: 2px; }
  .cal-wday .cal-ev .ellipsis { white-space: normal; }
}

/* 項目頁 */
.item-page { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; padding: 12px calc(16px + var(--safe-r)) 24px calc(16px + var(--safe-l)); max-width: 1440px; margin: 0 auto;
  grid-template-areas: "banner" "head" "kit" "preview" "comments" "text" "versions" "upload" "activity"; }
.new-version-banner { grid-area: banner; position: sticky; top: calc(var(--top-h) + var(--safe-t) + 8px); z-index: 25; display: flex; align-items: center; gap: 4px; background: var(--ink); color: var(--bg); border-radius: 12px; padding: 4px 4px 4px 6px; box-shadow: var(--shadow-2); }
.new-version-banner .icon-btn { color: inherit; }
.nv-btn { flex: 1; display: flex; align-items: center; gap: 8px; min-height: var(--tap); background: none; border: 0; color: inherit; font-weight: 650; text-align: left; cursor: pointer; padding: 0 8px; }
.item-head { grid-area: head; display: flex; flex-direction: column; gap: 10px; }
.kit-slot { grid-area: kit; }
.kit-slot:empty, .text-slot:empty { display: none; }
.preview-wrap { grid-area: preview; display: flex; flex-direction: column; gap: 10px; min-width: 0; scroll-margin-top: calc(var(--top-h) + 12px); }
.comments-slot { grid-area: comments; min-width: 0; scroll-margin-top: calc(var(--top-h) + 12px); }
.text-slot { grid-area: text; min-width: 0; }
.versions-slot { grid-area: versions; min-width: 0; }
.upload-slot { grid-area: upload; display: flex; flex-direction: column; gap: 10px; }
.item-activity { grid-area: activity; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 0 14px; }
.item-activity summary { min-height: var(--tap); display: flex; align-items: center; font-weight: 650; cursor: pointer; }
.item-activity[open] { padding-bottom: 12px; }
.item-head-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.item-crumbs { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; }
.link-chip { cursor: pointer; }
.title-input { font: inherit; font-size: 21px; font-weight: 750; border: 1px solid transparent; background: transparent; color: var(--ink); border-radius: 10px; padding: 4px 8px; margin: 0 -8px; width: calc(100% + 16px); min-height: var(--tap); }
.title-input:hover:not([readonly]) { border-color: var(--line); }
.title-input:focus { outline: none; border-color: var(--accent); background: var(--surface); }
.item-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mini-field { display: flex; flex-direction: column; gap: 3px; font-size: 12px; font-weight: 650; color: var(--muted); min-width: 0; }
.mini-field .input { width: 100%; }
.mini-field:last-child { grid-column: 1 / -1; }
.status-select { font-weight: 700; color: var(--c); border-color: color-mix(in srgb, var(--c) 40%, var(--line-strong)); }
.item-children { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.child-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px 4px 4px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); max-width: 100%; min-height: 36px; }
.preview-bar { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
@media (min-width: 768px) {
  .item-page { padding: 20px 28px 40px; }
  .item-fields { grid-template-columns: repeat(3, minmax(0, 220px)); }
  .mini-field:last-child { grid-column: auto; }
  .title-input { font-size: 26px; }
}
.item-side { display: contents; }
@media (min-width: 1100px) {
  .item-page { grid-template-columns: minmax(0, 1fr) 400px; column-gap: 28px; align-items: start; grid-template-rows: repeat(6, auto) 1fr;
    grid-template-areas: "banner banner" "head head" "kit side" "preview side" "text side" "upload side" "activity side"; }
  .item-side { display: flex; flex-direction: column; gap: 16px; grid-area: side; position: sticky; top: calc(var(--top-h) + 16px); max-height: calc(100dvh - var(--top-h) - 32px); overflow-y: auto; padding: 2px 4px 2px 2px; }
}
.act-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.act-list li { display: flex; justify-content: space-between; gap: 10px; }

/* 活動紀錄頁 */
.act-list.big { gap: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.act-list.big .act { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-top: 1px solid var(--line); }
.act-day { padding: 8px 14px; background: var(--surface-2); font-size: 12.5px; font-weight: 700; color: var(--muted); }
.act-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.act-detail { color: var(--ink-2); font-size: 14px; overflow-wrap: anywhere; }
a.act-detail:hover { color: var(--accent-ink); }
.act-time { flex: none; }

/* 設定 */
.usage-bar { display: flex; height: 14px; border-radius: 7px; background: var(--surface-3); overflow: hidden; }
.usage-bar span { display: block; height: 100%; }
.u-cur { background: var(--accent); }
.u-old { background: color-mix(in srgb, var(--accent) 40%, var(--surface-3)); }
.usage-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 10px 0 6px; }
.usage-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.invite { display: grid; grid-template-columns: 1fr; gap: 8px; margin-bottom: 16px; }
@media (min-width: 640px) { .invite { grid-template-columns: 1fr 220px auto; } }
.member-list { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; }
.member { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.member-info { flex: 1; min-width: 160px; display: flex; flex-direction: column; }
.me-card { display: flex; align-items: center; gap: 14px; }
.links { display: flex; flex-direction: column; padding: 6px; }
.row-link { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 0 12px; border-radius: 10px; border: 0; background: none; font-weight: 600; cursor: pointer; text-align: left; width: 100%; }
.row-link .ic:last-child { margin-left: auto; color: var(--muted); }
.row-link:hover { background: var(--surface-2); }
.row-link.danger { color: var(--danger); }

/* 上傳頁 */
.upl { gap: 16px; }
.big-pick { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 160px; border: 2px dashed var(--accent); border-radius: 16px; background: var(--accent-soft); color: var(--accent-ink); cursor: pointer; text-align: center; padding: 16px; }
.big-pick strong { font-size: 17px; color: var(--ink); }
.upl-chosen { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 6px; }
.upl-chosen:empty { display: none; }
.upl-thumb { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; background: var(--surface-3); }

/* 我 › 已連接的 AI */
.conn-list { list-style: none; margin: 8px 0 0; padding: 0; }
.conn-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.conn-main { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.conn-row.unverified { background: color-mix(in srgb, var(--danger) 8%, transparent); border-radius: 10px; padding: 10px; }
.chip.conn-warn { background: var(--danger); color: #fff; }
.conn-warn-text { color: var(--danger); margin-top: 2px; }
.comment-row.deleted .comment-body { font-style: italic; color: var(--muted); }
