.palacecode input, .palacecode textarea, .palacecode select { font-size: 16px; }
.palacecode a { color: var(--gold); text-decoration: none; }
.palacecode a:hover { text-decoration: underline; }
.palacecode h1 { font-size: 26px; font-weight: 700; color: var(--text); margin-bottom: 2px; }
.palacecode h2 { font-size: 18px; font-weight: 600; color: var(--text); }
.hdr { margin-bottom: 16px; }
.subtitle { font-size: 15px; color: var(--text-faint); }
.sec-hdr { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; position: relative; z-index: 10; }
.sec-hdr-right { display: flex; align-items: center; gap: 12px; }
.sub { font-size: 14px; color: var(--text-faint); }
.plus-btn { width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--border); background: var(--card); color: var(--text); font-size: 20px; font-weight: 300; cursor: pointer; display: flex; align-items: center; justify-content: center; line-height: 1; }
.plus-btn:hover { border-color: var(--gold); color: var(--gold); }
.window-pill { font-size: 12px; font-weight: 600; font-family: inherit; color: var(--gold); background: color-mix(in srgb, var(--gold) 10%, transparent); border: 1px solid color-mix(in srgb, var(--gold) 25%, transparent); border-radius: 12px; padding: 3px 10px; cursor: pointer; white-space: nowrap; }
.window-pill:hover { background: color-mix(in srgb, var(--gold) 18%, transparent); }
.window-picker-wrap { position: relative; }
.window-picker-dd { position: absolute; top: 100%; right: 0; z-index: 50; background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 4px; margin-top: 4px; min-width: 100px; box-shadow: 0 4px 12px rgba(0,0,0,0.3); }
.window-picker-opt { padding: 6px 10px; border-radius: 4px; cursor: pointer; font-size: 13px; color: var(--text); white-space: nowrap; }
.window-picker-opt:hover { background: var(--surface); }
.window-picker-opt.active { background: var(--surface); color: var(--gold); font-weight: 600; }
.window-picker-divider { border-top: 1px solid var(--border); margin: 4px 0; }
.gamepad-badge { display: flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600; color: #3fb950; background: #3fb9501a; border: 1px solid #3fb95033; padding: 3px 8px; border-radius: 12px; }
.empty { text-align: center; color: var(--text-faint); padding: 40px 0; font-size: 16px; }
.split-view { display: flex; gap: 0; flex: 1; min-height: 0; }
.split-left { width: var(--split-pos, 340px); flex-shrink: 0; overflow-y: auto; touch-action: pan-y; overscroll-behavior: contain; }
.split-divider { width: 12px; flex-shrink: 0; cursor: col-resize; user-select: none; touch-action: none; display: flex; align-items: center; justify-content: center; }
.split-divider::after { content: ''; width: 2px; height: 48px; background: var(--border); border-radius: 1px; transition: background 0.15s; }
.split-divider:hover::after, .split-divider:active::after { background: var(--gold); }
.split-right { flex: 1; min-width: 0; min-height: 0; overflow: hidden; }
.tcard-swipe-wrap { position: relative; overflow: hidden; border-radius: 10px; margin-bottom: 6px; }
.tcard-swipe-bg { position: absolute; inset: 0; color: #fff; font-size: 13px; font-weight: 600; display: flex; align-items: center; border-radius: 10px; }
.tcard-swipe-delete { background: #f85149; justify-content: flex-end; padding-right: 20px; }
.tcard-swipe-archive { background: #3fb950; justify-content: flex-start; padding-left: 20px; }
.tcard { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 12px; cursor: pointer; transition: border-color 0.15s; position: relative; z-index: 1; }
.tcard-swipe-wrap .tcard { margin-bottom: 0; }
.tcard:hover { border-color: var(--text-faint); }
.tcard.selected { border-color: var(--gold); background: var(--surface); }
.tcard-deleted, .tcard-archived { display: flex; align-items: center; justify-content: space-between; opacity: 0.5; padding: 12px; margin-bottom: 6px; border-radius: 10px; }
.tcard-action-label { font-size: 13px; color: var(--text-faint); font-style: italic; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.tcard-undo-btn { display: flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 500; color: var(--gold); background: none; border: 1px solid var(--border); border-radius: 6px; padding: 4px 10px; cursor: pointer; font-family: inherit; }
.tcard-undo-btn:hover { border-color: var(--gold); }
.tcard-hdr { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.tcard-title { font-size: 14px; font-weight: 500; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.tcard-dur { font-size: 13px; color: var(--text-faint); flex-shrink: 0; }
.tcard-dur.long { color: #d29922; }
.tcard-dur.very-long { color: #f85149; }
.tcard-meta { font-size: 12px; color: var(--text-faint); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.status-dot.active { background: #d29922; }
.status-dot.queued { background: #7d8590; }
.status-dot.completed { background: #3fb950; }
.status-dot.failed { background: #f85149; }
.pulse { animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
.linear-badge { font-size: 12px; font-weight: 700; color: var(--gold); background: color-mix(in srgb, var(--gold) 10%, transparent); border: 1px solid color-mix(in srgb, var(--gold) 20%, transparent); padding: 1px 6px; border-radius: 4px; text-decoration: none; flex-shrink: 0; }
.linear-badge:hover { text-decoration: none; border-color: color-mix(in srgb, var(--gold) 40%, transparent); }
.badge { display: inline-block; padding: 2px 8px; border-radius: 12px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.badge.processing { background: #d299221a; color: #d29922; border: 1px solid #d2992233; }
.badge.queued { background: #7d85901a; color: #7d8590; border: 1px solid #7d859033; }
.badge.replied { background: #3fb9501a; color: #3fb950; border: 1px solid #3fb95033; }
.badge.no_reply { background: #7d85901a; color: #7d8590; border: 1px solid #7d859033; }
.badge.failed { background: #f851491a; color: #f85149; border: 1px solid #f8514933; }
.badge.stalled { background: #f851491a; color: #f85149; border: 1px solid #f8514933; }
.badge.skipped { background: #7d85901a; color: #7d8590; border: 1px solid #7d859033; }
.badge.deleted { background: #f851491a; color: #f85149; border: 1px solid #f8514933; }
.badge.archived { background: #7d85901a; color: #7d8590; border: 1px solid #7d859033; }
.ch-tag { font-size: 11px; color: var(--text-faint); }
.usage-tag { font-size: 11px; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.usage-tag:hover { color: var(--text); text-decoration: underline; }
.log-modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 100; display: flex; align-items: center; justify-content: center; }
.log-modal { background: var(--card); border: 1px solid var(--border); border-radius: 8px; width: 80vw; max-width: 900px; height: 80vh; display: flex; flex-direction: column; overflow: hidden; }
.log-modal-header { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; border-bottom: 1px solid var(--border); font-size: 13px; font-weight: 500; flex-shrink: 0; }
.log-modal-close { background: none; border: none; cursor: pointer; color: var(--text-faint); padding: 2px; display: flex; }
.log-modal-close:hover { color: var(--text); }
.log-modal-body { flex: 1; overflow-y: auto; margin: 0; padding: 16px; font-size: 12px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; color: var(--text); font-family: var(--mono, monospace); }
.badge-clickable { cursor: pointer; }
.badge-clickable:hover { opacity: 0.8; }
.status-badge-wrap { position: relative; }
.status-dd { position: absolute; top: 100%; left: 0; z-index: 50; background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 4px; margin-top: 4px; min-width: 150px; box-shadow: 0 4px 12px rgba(0,0,0,0.3); }
.status-dd-opt { padding: 6px 8px; border-radius: 4px; cursor: pointer; }
.status-dd-opt:hover { background: var(--surface); }
.status-dd-opt.active { background: var(--surface); }
.thread-group { margin-bottom: 16px; }
.thread-group-label { font-size: 11px; font-weight: 600; letter-spacing: 0.5px; color: var(--text-faint); margin-bottom: 6px; padding-left: 4px; }
.detail-panel { display: flex; flex-direction: column; height: 100%; background: var(--card); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.detail-header { padding: 14px 16px; display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.detail-title { font-size: 16px; font-weight: 500; color: var(--text); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.detail-meta { padding: 8px 16px; display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--text-faint); border-bottom: 1px solid var(--border); flex-shrink: 0; flex-wrap: wrap; }
.detail-log { flex: 1; overflow-y: auto; padding: 12px 16px; font-size: 13px; line-height: 1.6; touch-action: pan-y; overscroll-behavior: contain; }
.detail-empty { display: flex; align-items: center; justify-content: center; height: 100%; color: var(--text-faint); font-size: 15px; }
.detail-actions { padding: 8px 16px; border-bottom: 1px solid var(--border); }
.debug-btn { padding: 3px 10px; font-size: 12px; font-weight: 600; font-family: inherit; background: #f851491a; color: #f85149; border: 1px solid #f8514933; border-radius: 5px; cursor: pointer; flex-shrink: 0; }
.debug-btn:hover { background: #f851493a; }
.debug-btn:disabled { opacity: 0.5; cursor: wait; }
.draft-close { background: none; border: none; color: var(--text-faint); font-size: 20px; cursor: pointer; padding: 0 4px; line-height: 1; flex-shrink: 0; }
.draft-close:hover { color: var(--text); }
.draft-meta { padding: 8px 16px; display: flex; gap: 8px; align-items: center; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.draft-title-input { flex: 1; min-width: 0; padding: 0; font-size: 16px; font-weight: 500; background: transparent; border: none; color: var(--text); outline: none; font-family: inherit; }
.draft-title-input::placeholder { color: var(--text-faint); font-weight: 400; }
.draft-attached { cursor: pointer; }
.draft-attached:hover { opacity: 0.7; }
.sess-entry { margin-bottom: 2px; }
.sess-entry.sess-user { display: flex; flex-direction: column; align-items: flex-end; }
.sess-header { display: flex; align-items: center; gap: 6px; padding: 2px 0; font-size: 12px; }
.sess-collapsible { cursor: pointer; border-radius: 4px; padding: 3px 4px; margin: 0 -4px; }
.sess-collapsible:hover { background: var(--surface); }
.sess-chevron { color: var(--text-faint); flex-shrink: 0; transition: transform 0.15s; }
.sess-chevron.open { transform: rotate(90deg); }
.sess-ts { color: var(--text-faint); white-space: nowrap; font-size: 11px; flex-shrink: 0; }
.sess-type { font-weight: 600; white-space: nowrap; font-size: 12px; flex-shrink: 0; }
.sess-type.tool-call { color: #d29922; }
.sess-type.tool-result { color: var(--text-faint); }
.sess-type.text { color: #3fb950; }
.sess-type.result { color: var(--gold); }
.sess-type.session { color: #f0883e; }
.sess-type.user { color: #bc8cff; }
.sess-preview { color: var(--text-faint); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.sess-body { color: var(--text); font-size: 13px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; padding: 2px 0 6px; }
.sess-user .sess-body { background: color-mix(in srgb, var(--gold) 15%, transparent); padding: 8px 12px; border-radius: 14px; border-bottom-right-radius: 4px; max-width: 80%; text-align: left; }
.sess-collapsed-body { background: var(--bg); border: 1px solid var(--border); border-radius: 4px; padding: 8px; margin: 4px 0 6px; max-height: 200px; overflow-y: auto; font-size: 12px; color: var(--text-faint); }
.sess-row { padding: 3px 0; font-size: 13px; line-height: 1.5; }
.sess-content { color: var(--text); word-break: break-word; }
.sess-loading { color: var(--text-faint); padding: 8px 0; font-size: 13px; }
.sess-none { color: var(--text-faint); font-size: 13px; font-style: italic; padding: 20px 0; text-align: center; }
.attach-btn { font-size: 13px; color: var(--gold); cursor: pointer; background: none; border: none; font-family: inherit; padding: 0; }
.attach-btn:hover { text-decoration: underline; }
.attach-dd { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 8px; margin-top: 8px; }
.attach-search { width: 100%; padding: 8px 10px; font-size: 14px; background: var(--bg); border: 1px solid var(--border); border-radius: 4px; color: var(--text); outline: none; margin-bottom: 6px; font-family: inherit; box-sizing: border-box; }
.attach-search:focus { border-color: var(--gold); }
.issue-list { max-height: 200px; overflow-y: auto; }
.issue-opt { padding: 6px 8px; border-radius: 4px; cursor: pointer; display: flex; gap: 8px; align-items: center; }
.issue-opt:hover { background: var(--border); }
.issue-id { font-size: 13px; font-weight: 700; color: var(--gold); flex-shrink: 0; }
.issue-title { font-size: 14px; color: var(--text-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.no-issues { font-size: 14px; color: var(--text-faint); padding: 8px; text-align: center; }
.detail-input { padding: 10px 14px; border-top: 1px solid var(--border); display: flex; gap: 8px; align-items: flex-end; flex-shrink: 0; }
.chat-reply-mic { width: 38px; height: 38px; display: flex; align-items: center; justify-content: center; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; cursor: pointer; flex-shrink: 0; color: var(--text-faint); transition: border-color 0.2s, color 0.2s; }
.chat-reply-mic:hover { border-color: var(--text-faint); color: var(--text); }
.chat-reply-mic.recording { background: color-mix(in srgb, var(--gold) 12%, transparent); border-color: var(--gold); color: var(--gold); animation: pulse 1s ease-in-out infinite; }
.chat-reply-mic.transcribing { opacity: 0.5; cursor: wait; }
.chat-reply-input { flex: 1; padding: 8px 12px; font-size: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; color: var(--text); outline: none; font-family: inherit; transition: border-color 0.2s; }
.chat-reply-input:focus { border-color: var(--gold); }
.chat-reply-send { width: 38px; height: 38px; display: flex; align-items: center; justify-content: center; background: var(--gold); color: var(--bg); border: none; border-radius: 10px; cursor: pointer; flex-shrink: 0; transition: opacity 0.2s; }
.chat-reply-send:hover { opacity: 0.85; }
.chat-reply-send:disabled { opacity: 0.4; cursor: not-allowed; }
.chat-waiting { font-size: 13px; color: var(--text-faint); padding: 6px 0; font-style: italic; }
.chat-msg { display: flex; flex-direction: column; margin-bottom: 10px; }
.chat-msg-user { align-items: flex-end; }
.chat-msg-ace { align-items: flex-start; }
.chat-bubble { max-width: 85%; padding: 10px 14px; border-radius: 16px; font-size: 14px; line-height: 1.55; word-break: break-word; }
.chat-msg-user .chat-bubble { background: color-mix(in srgb, var(--gold) 18%, transparent); border-bottom-right-radius: 4px; color: var(--text); }
.chat-msg-ace .chat-bubble { background: var(--surface); border: 1px solid var(--border); border-bottom-left-radius: 4px; color: var(--text); }
.chat-bubble-md p { margin: 0 0 8px; }
.chat-bubble-md p:last-child { margin-bottom: 0; }
.chat-bubble-md li { margin-left: 20px; }
.chat-bubble-md code { background: var(--bg); padding: 1px 5px; border-radius: 3px; font-size: 0.9em; font-family: var(--mono, monospace); }
.chat-bubble-md pre { margin: 8px 0; background: var(--bg); border-radius: 4px; padding: 8px; overflow-x: auto; }
.chat-bubble-md pre code { background: none; padding: 0; }
.chat-bubble-md h1, .chat-bubble-md h2, .chat-bubble-md h3 { margin: 8px 0 4px; font-weight: 600; }
.chat-bubble-md strong { font-weight: 600; }
.chat-ts { font-size: 11px; color: var(--text-faint); margin-top: 3px; padding: 0 4px; }
.chat-thinking { font-style: italic; color: var(--text-faint); }
@media (max-width: 768px) {
  .split-view { flex-direction: column; flex: 1; min-height: 0; }
  .split-left { width: 100%; flex: 0 0 var(--split-pos, 38%); max-height: none; overflow-y: auto; padding-right: 0; }
  .split-divider { width: 100%; height: 12px; cursor: row-resize; }
  .split-divider::after { width: 40px; height: 2px; }
  .split-right { flex: 1; min-height: 0; overflow: hidden; margin-left: calc(-1 * var(--page-pad, 12px)); margin-right: calc(-1 * var(--page-pad, 12px)); }
  .split-right .detail-panel { border-radius: 0; border-left: none; border-right: none; border-bottom: none; }
  .detail-header { padding-left: 10px; padding-right: 10px; }
  .detail-meta { padding-left: 10px; padding-right: 10px; }
  .detail-log { padding-left: 8px; padding-right: 8px; }
  .detail-input { padding-left: 8px; padding-right: 8px; }
}
