*, *::before, *::after { box-sizing: border-box; }
:root {
  --bg: #0b0d16;
  --panel: rgba(255,255,255,.045);
  --line: rgba(255,255,255,.09);
  --text: #eef1f8;
  --muted: #98a0b8;
  --accent: #6d8bff;
  --accent-2: #29d3b0;
  --warn: #ffb45c;
}
html, body { margin: 0; min-height: 100%; }
body {
  background: radial-gradient(1200px 600px at 15% -10%, #1a2140 0%, transparent 60%), var(--bg);
  color: var(--text);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  padding: 28px 18px 40px;
  overflow-x: hidden;
}
.glow { position: fixed; border-radius: 50%; filter: blur(90px); opacity: .32; pointer-events: none; z-index: 0; }
.glow-a { width: 380px; height: 380px; background: #3d5bff; top: -140px; right: -80px; }
.glow-b { width: 320px; height: 320px; background: #16b38f; bottom: -160px; left: -100px; opacity: .2; }
.shell { position: relative; z-index: 1; max-width: 1080px; margin: 0 auto; }

.head { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 26px; }
.eyebrow { margin: 0 0 6px; font-size: 12px; letter-spacing: .18em; text-transform: uppercase; color: var(--accent); font-weight: 600; }
h1 { margin: 0; font-size: clamp(24px, 3.4vw, 34px); letter-spacing: -.02em; font-weight: 650; }
.sub { margin: 8px 0 0; color: var(--muted); font-size: 13.5px; }

.ring { position: relative; width: 84px; height: 84px; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .track, .ring .bar { fill: none; stroke-width: 7; stroke-linecap: round; }
.ring .track { stroke: rgba(255,255,255,.08); }
.ring .bar { stroke: url(#g); stroke: var(--accent-2); transition: stroke-dashoffset .5s ease; }
.ring-label { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring-label strong { display: block; font-size: 17px; }
.ring-label span { font-size: 10.5px; color: var(--muted); letter-spacing: .08em; }

.composer { display: flex; gap: 10px; background: var(--panel); border: 1px solid var(--line); padding: 8px; border-radius: 16px; backdrop-filter: blur(12px); }
.composer input {
  flex: 1; min-width: 0; background: transparent; border: 0; outline: 0; color: var(--text);
  font-size: 15px; padding: 10px 12px;
}
.composer input::placeholder { color: #6f7793; }
.composer button {
  border: 0; cursor: pointer; padding: 10px 20px; border-radius: 11px; font-size: 14px; font-weight: 600; color: #0d1226;
  background: linear-gradient(135deg, #8fa8ff, #45e0c0);
  transition: transform .15s ease, filter .15s ease;
}
.composer button:hover { filter: brightness(1.08); }
.composer button:active { transform: scale(.97); }
.composer:focus-within { border-color: rgba(109,139,255,.55); box-shadow: 0 0 0 4px rgba(109,139,255,.12); }
.hint { font-size: 13px; margin: 10px 4px 0; }
.error { color: #ff8f8f; }

.board { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 22px; align-items: start; }
.col {
  background: linear-gradient(180deg, rgba(255,255,255,.055), rgba(255,255,255,.02));
  border: 1px solid var(--line); border-radius: 18px; padding: 14px; min-height: 180px;
  transition: border-color .2s ease, background .2s ease;
}
.col[data-status="doing"] { border-color: rgba(109,139,255,.28); }
.col[data-status="done"] { border-color: rgba(41,211,176,.24); }
.col.drag-over { border-color: var(--accent); background: rgba(109,139,255,.1); }
.col-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.col-head h2 { font-size: 13px; margin: 0; letter-spacing: .1em; color: #c3cbe4; font-weight: 600; text-transform: uppercase; }
.count { font-size: 12px; color: var(--muted); background: rgba(255,255,255,.07); border-radius: 99px; padding: 1px 9px; }
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; }
.card {
  background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.07); border-radius: 13px; padding: 11px 12px;
  cursor: grab; transition: transform .15s ease, background .15s ease, border-color .15s ease;
}
.card:hover { background: rgba(255,255,255,.085); border-color: rgba(255,255,255,.14); }
.card:active { cursor: grabbing; }
.card.dragging { opacity: .45; transform: rotate(1.5deg) scale(.98); }
.card-top { display: flex; gap: 8px; align-items: flex-start; justify-content: space-between; }
.card-title { font-size: 14px; word-break: break-word; }
.col[data-status="done"] .card-title { color: #8e9ab5; text-decoration: line-through; text-decoration-color: rgba(255,255,255,.25); }
.card-actions { display: flex; gap: 4px; flex: none; }
.icon {
  width: 26px; height: 26px; display: grid; place-content: center; border-radius: 8px; border: 1px solid transparent;
  background: transparent; color: #93a0bf; cursor: pointer; font-size: 13px; line-height: 1; padding: 0;
  transition: background .15s ease, color .15s ease;
}
.icon:hover { background: rgba(255,255,255,.1); color: #fff; }
.icon.del:hover { background: rgba(255,90,90,.16); color: #ff9d9d; }
.empty { color: #666f8c; font-size: 12.5px; text-align: center; padding: 22px 0; margin: 0; }
.col.has-items .empty { display: none; }

.foot { display: flex; align-items: center; justify-content: space-between; margin-top: 18px; color: var(--muted); font-size: 13px; }
.ghost { background: transparent; border: 1px solid var(--line); color: var(--muted); border-radius: 10px; padding: 7px 13px; font-size: 12.5px; cursor: pointer; transition: color .15s, border-color .15s; }
.ghost:hover { color: #fff; border-color: rgba(255,255,255,.25); }

@media (max-width: 760px) {
  body { padding: 20px 14px 32px; }
  .board { grid-template-columns: 1fr; }
  .head { align-items: flex-start; }
  .ring { width: 68px; height: 68px; }
  .ring-label strong { font-size: 14px; }
}

/* ---- CoLink Bridge 状态 ---- */
.status-pill {
  display: inline-flex; align-items: center; gap: 7px; margin-top: 12px;
  padding: 4px 11px; border-radius: 99px; font-size: 11.5px; letter-spacing: .01em;
  border: 1px solid var(--line); background: rgba(255,255,255,.05); color: var(--muted);
  max-width: 100%;
}
.status-pill .dot { width: 6px; height: 6px; border-radius: 50%; background: #7d879f; flex: none; }
.status-pill[data-phase="waiting"] .dot,
.status-pill[data-phase="boot"] .dot { background: var(--warn); animation: pulse 1.4s ease-in-out infinite; }
.status-pill[data-phase="connected"] { color: #a8f0dd; border-color: rgba(41,211,176,.4); background: rgba(41,211,176,.1); }
.status-pill[data-phase="connected"] .dot { background: var(--accent-2); }
.status-pill[data-phase="failed"] { color: #ffb3b3; border-color: rgba(255,120,120,.4); background: rgba(255,90,90,.1); }
.status-pill[data-phase="failed"] .dot { background: #ff7b7b; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

/* ---- 浅色主题（宿主提供 theme=light 时启用）---- */
html[data-theme="light"] {
  --panel: rgba(15,23,42,.04);
  --line: rgba(15,23,42,.1);
  --text: #141b2c;
  --muted: #5c6579;
}
html[data-theme="light"] body {
  background: radial-gradient(1200px 600px at 15% -10%, #dfe7ff 0%, transparent 60%), #f4f6fc;
}
html[data-theme="light"] .glow { opacity: .18; }
html[data-theme="light"] .col { background: linear-gradient(180deg, rgba(255,255,255,.9), rgba(255,255,255,.6)); }
html[data-theme="light"] .card { background: #fff; border-color: rgba(15,23,42,.08); }
html[data-theme="light"] .card:hover { background: #fbfcff; }
html[data-theme="light"] .composer { background: rgba(255,255,255,.9); }
html[data-theme="light"] .count { background: rgba(15,23,42,.06); }
html[data-theme="light"] .col-head h2 { color: #3a4459; }
html[data-theme="light"] .status-pill { background: rgba(15,23,42,.04); }
html[data-theme="light"] .icon { color: #6b7488; }
html[data-theme="light"] .icon:hover { background: rgba(15,23,42,.07); color: #141b2c; }
html[data-theme="light"] .col[data-status="done"] .card-title { color: #8a91a3; }
