/* Floating Pomodoro player (.pm-), Copilot button + drawer and the
   AI breakdown modal (.ai-). */

/* ---------- Pomodoro ---------- */
.pm { --pm-c: var(--brand); width: 320px; max-width: calc(100vw - 28px); overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-3); animation: menu-in 160ms var(--ease); }
.pm[data-phase="short"], .pm[data-phase="long"] { --pm-c: var(--success); }
.pm-bar { display: flex; align-items: center; gap: 2px; padding: 8px; }
.pm-ring { position: relative; width: 48px; height: 48px; flex: none; margin-right: 8px; border-radius: 50%; color: var(--pm-c); }
.pm-ring > svg { width: 48px; height: 48px; transform: rotate(-90deg); }
.pm-ring-bg { fill: none; stroke: var(--surface-3); stroke-width: 4; }
.pm-ring-fg { fill: none; stroke: var(--pm-c); stroke-width: 4; stroke-linecap: round; transition: stroke-dashoffset 250ms linear; }
.pm-ring-ico { position: absolute; inset: 7px; display: grid; place-items: center; border-radius: 50%; transition: background var(--dur); }
.pm-ring:hover .pm-ring-ico { background: color-mix(in srgb, var(--pm-c) 14%, transparent); }
.pm-ring-ico .ico { width: 18px; height: 18px; }
.pm-info { display: flex; flex-direction: column; min-width: 0; }
.pm-time { font-size: 20px; font-weight: 700; line-height: 1.15; letter-spacing: -.01em; }
.pm-phase { margin-left: 6px; padding: 1px 7px; border-radius: var(--r-pill); font-size: 11.5px; font-weight: 600; color: var(--pm-c); background: color-mix(in srgb, var(--pm-c) 13%, transparent); white-space: nowrap; }
.pm-task-link { max-width: 100%; font-size: 12.5px; color: var(--text-2); text-align: left; }
.pm-task-link:hover { color: var(--text); text-decoration: underline; }
.pm-task-none { font-size: 12.5px; color: var(--text-3); }
.pm-panel { display: flex; flex-direction: column; gap: 14px; max-height: min(52vh, 440px); overflow-y: auto; padding: 12px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.pm-sec { display: flex; flex-direction: column; gap: 6px; }
.pm-label { font-size: 12px; font-weight: 600; color: var(--text-2); }
.pm-search { height: 32px; }
.pm-tasks { display: flex; flex-direction: column; gap: 1px; max-height: 170px; overflow-y: auto; }
.pm-task { display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 8px; border-radius: var(--r-sm); font-size: 13px; text-align: left; }
.pm-task:hover { background: var(--hover); }
.pm-task .t-key { flex: none; white-space: nowrap; }
.pm-task.is-on { background: var(--brand-soft); color: var(--brand-text); font-weight: 500; }
.pm-empty { padding: 6px 8px; }
.pm-dots { display: inline-flex; gap: 5px; }
.pm-dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--surface-3); box-shadow: inset 0 0 0 1px var(--line-strong); }
.pm-dots i.is-on { background: var(--brand); box-shadow: none; }
.pm-cfg { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.pm-cfg label { display: flex; flex-direction: column; gap: 3px; font-size: 11.5px; color: var(--text-3); }
.pm-cfg .input { height: 30px; padding: 0 4px; text-align: center; }
.pm-foot { display: flex; align-items: center; gap: 6px; }

/* ---------- Copilot button ---------- */
.ai-fab { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 50%; background: var(--side-bg); color: #7fd3f3; box-shadow: var(--shadow-3), inset 0 0 0 1px rgba(255, 255, 255, .12); transition: transform var(--dur) var(--ease), background var(--dur), color var(--dur); }
.ai-fab:hover { transform: translateY(-1px); background: var(--side-bg-2); }
.ai-fab.is-on { background: var(--brand); color: #fff; }
.ai-fab[data-tip]:hover::after { left: auto; right: 0; transform: none; }
body.ai-open .floating-layer { right: 424px; }

/* ---------- Copilot drawer (non-blocking panel) ---------- */
.ai-drawer { position: fixed; top: calc(var(--top-h) + 8px); right: 8px; bottom: 8px; z-index: 65; width: min(400px, calc(100vw - 16px)); display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--shadow-3); animation: sheet-in 200ms var(--ease); }
.ai-head { display: flex; align-items: center; gap: 10px; padding: 12px 10px 12px 14px; border-bottom: 1px solid var(--line); }
.ai-head b { font-size: 15px; }
.ai-head small { display: block; font-size: 12px; color: var(--text-3); }
.ai-head-ico { width: 32px; height: 32px; flex: none; display: grid; place-items: center; border-radius: 10px; background: var(--brand-soft); color: var(--brand-text); }
.ai-body { flex: 1; display: flex; flex-direction: column; gap: 16px; overflow-y: auto; padding: 16px 14px; }
.ai-hello { display: flex; flex-direction: column; gap: 10px; padding: 8px 2px; }
.ai-hello-ico { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 14px; background: var(--brand-soft); color: var(--brand-text); }
.ai-hello h3 { font-size: 16px; font-weight: 600; }
.ai-hello p { font-size: 13px; color: var(--text-2); }
.ai-suggs { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.ai-sugg { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); color: var(--text); font-size: 13px; text-align: left; transition: border-color var(--dur), background var(--dur); }
.ai-sugg:hover { border-color: var(--brand); background: var(--brand-soft); }
.ai-sugg .ico { color: var(--text-3); }
.ai-follow { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.ai-follow .ai-sugg { padding: 4px 10px; border-radius: var(--r-pill); font-size: 12.5px; }
.ai-msg.is-user { align-self: flex-end; max-width: 85%; padding: 8px 12px; border-radius: 14px 14px 4px 14px; background: var(--brand); color: #fff; font-size: 13.5px; }
.ai-msg.is-ai { display: flex; align-items: flex-start; gap: 10px; }
.ai-avatar { width: 26px; height: 26px; flex: none; display: grid; place-items: center; border-radius: 8px; background: var(--brand-soft); color: var(--brand-text); }
.ai-answer { flex: 1; min-width: 0; font-size: 13.5px; line-height: 1.6; }
.ai-answer p { margin: 0 0 6px; }
.ai-answer ol, .ai-answer ul { display: flex; flex-direction: column; gap: 4px; margin: 0 0 8px; padding-left: 18px; }
.ai-answer ol { list-style: decimal; } .ai-answer ul { list-style: disc; }
.ai-why { display: block; font-size: 12px; color: var(--text-3); }
.ai-ref { display: inline-flex; align-items: center; height: 20px; margin-right: 3px; padding: 0 6px; vertical-align: 1px; border-radius: var(--r-xs); background: var(--brand-soft); color: var(--brand-text); font-size: 11.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.ai-ref:hover { background: var(--brand-soft-2); }
.ai-ref[data-tip]:hover::after { max-width: 260px; white-space: normal; width: max-content; }
.ai-typing { display: inline-flex; gap: 4px; padding: 8px 0; }
.ai-typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--text-3); animation: ai-dot 1s infinite; }
.ai-typing i:nth-child(2) { animation-delay: .15s; } .ai-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes ai-dot { 0%, 80%, 100% { opacity: .3; transform: none; } 40% { opacity: 1; transform: translateY(-3px); } }
.ai-caret { display: inline-block; width: 7px; height: 14px; margin-left: 2px; vertical-align: -2px; background: var(--brand); animation: ai-blink .8s steps(2) infinite; }
@keyframes ai-blink { 50% { opacity: 0; } }
.ai-compose { padding: 10px 12px; border-top: 1px solid var(--line); }
.ai-input { display: flex; align-items: flex-end; gap: 8px; padding: 6px 6px 6px 12px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-md); transition: border-color var(--dur), box-shadow var(--dur); }
.ai-input:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-ring); }
.ai-input textarea { flex: 1; max-height: 120px; padding: 4px 0; border: 0; outline: none; resize: none; background: transparent; color: var(--text); font-size: 13.5px; line-height: 1.45; }
.ai-input textarea::placeholder { color: var(--text-3); }
.ai-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; font-size: 11.5px; color: var(--text-3); }
.ai-meta > span:first-child { white-space: nowrap; }
.ai-meta .is-low { color: var(--warning); font-weight: 600; }
.ai-privacy { display: inline-flex; align-items: center; gap: 4px; text-align: right; }

/* ---------- AI breakdown modal ---------- */
.ai-bd { display: flex; flex-direction: column; gap: 10px; }
.ai-bd-ctx { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: var(--r-md); background: var(--surface-2); font-size: 13.5px; }
.ai-bd-list { display: flex; flex-direction: column; gap: 6px; min-height: 186px; }
.ai-bd-row { display: flex; align-items: center; gap: 8px; animation: au-in 220ms var(--ease) both; }
.ai-bd-input { height: 32px; }
.ai-bd-row.is-off .ai-bd-input { color: var(--text-3); text-decoration: line-through; }
.ai-bd-skel { display: flex; align-items: center; gap: 10px; height: 32px; }
.ai-bd-note { display: flex; align-items: flex-start; gap: 6px; }
.ai-bd-note .ico { margin-top: 1px; }

@media (max-width: 860px) {
  .ai-drawer { inset: 0; z-index: 79; width: auto; border: 0; border-radius: 0; }
  body.ai-open .floating-layer { right: 14px; }
  .ai-privacy { display: none; }
}
