/* Clipboard (Story 5650) -- Leonardo's Clipboard, the Renaissance clipboard, and the history. */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { background: #F2F2F4; color: #222; font-family: "Segoe UI", system-ui, sans-serif; }

/* ---- pinned shell: the band and header never scroll off ---- */
.clip-board.page-shell { display: flex; flex-direction: column; height: 100vh; height: 100dvh; overflow: hidden; }
.clip-board #lwIconBand, .clip-board .ct-header { flex: 0 0 auto; }

.ct-header { background: #3C3C3C; color: #fff; padding: 10px 16px; display: flex; align-items: center; gap: 10px; }
.ct-header h1 { margin: 0; font-size: 14pt; font-weight: 600; flex: 1; }
.ct-header button { color: #fff; background: #4F46E5; border: none; border-radius: 4px; padding: 7px 14px; font: inherit; font-size: 13px; cursor: pointer; }
.ct-header button:hover { background: #6257F0; }
.ct-header .clip-foldall { background: transparent; border: 1px solid #6B6B6B; padding: 6px 10px; }

.clip-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 14px 16px 32px; }
.clip-body > * { max-width: 760px; margin-left: auto; margin-right: auto; }

/* ---- cards that fold ---- */
.clip-card { background: #fff; border: 1px solid #E0E0E2; border-radius: 10px; padding: 12px 16px; margin-bottom: 12px; box-shadow: 0 1px 3px rgba(0,0,0,.05); }
.clip-leo { border-left: 4px solid #4F46E5; }
.clip-head { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.clip-head h2 { margin: 0; font-size: 13pt; font-weight: 600; color: #1A1A1A; flex: 0 1 auto; }
.clip-caret { width: 16px; color: #64748B; font-size: 15px; flex: 0 0 auto; }
.clip-sum { font-size: 12px; color: #666; flex: 1 1 auto; min-width: 0; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clip-fold-body { margin-top: 10px; }
.clip-card.is-folded .clip-fold-body { display: none; }
.clip-card p { margin: 0 0 10px; color: #555; font-size: 11pt; line-height: 1.45; }

.clip-card textarea, .clip-modal textarea {
    width: 100%; min-height: 120px; padding: 10px 12px; border: 1px solid #C9D0D9; border-radius: 6px;
    font: 11pt "Segoe UI", system-ui, sans-serif; color: #1F2329; background: #FAFAFB; resize: vertical; margin-bottom: 10px;
}
.clip-card textarea:focus, .clip-modal textarea:focus, .clip-search:focus { border-color: #2A6FE3; outline: none; box-shadow: 0 0 0 3px rgba(42,111,227,.15); }
.clip-readonly { background: #F4F4F6; }
.clip-card textarea[hidden], .clip-note[hidden], .clip-dirty[hidden] { display: none; }

.clip-meta { font-size: 12px; color: #555; margin-bottom: 8px; }
.clip-dirty { font-size: 12px; color: #92400E; margin-top: 6px; }
.clip-note { font-size: 12px; color: #444; margin-top: 4px; }

.clip-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 4px; }
.clip-btn { border: 1px solid #C9D0D9; background: #fff; color: #1F2329; border-radius: 6px; padding: 9px 14px; font: inherit; font-size: 13px; cursor: pointer; }
.clip-btn:hover { background: #F2F4F8; }
.clip-btn:disabled { opacity: .5; cursor: default; }
.clip-btn.clip-primary { background: #2A6FE3; border-color: #2A6FE3; color: #fff; font-weight: 600; }
.clip-btn.clip-primary:hover { background: #1F5BC4; }
.clip-btn.clip-danger { color: #9C2D31; border-color: #F1C4C6; }
.clip-wide { flex: 1 1 100%; padding: 13px 14px; font-size: 14px; }
.clip-grow { flex: 1 1 auto; }

.clip-result { margin-top: 8px; padding: 8px 10px; background: #FAFAFB; border: 1px solid #E0E0E2; border-radius: 6px; font-size: 10pt; color: #2A3037; min-height: 1.4em; white-space: pre-wrap; word-break: break-word; }
.clip-result:empty { display: none; }
.clip-result.error { background: #FFF1F2; border-color: #FBD9DA; color: #9C2D31; }
.clip-result.ok    { background: #E8F5EC; border-color: #C7E5D1; color: #1F5A2D; }

.clip-bridge-banner { padding: 10px 14px; border-radius: 8px; font: 600 11pt "Segoe UI", system-ui, sans-serif; margin: 6px auto 12px; line-height: 1.4; }
.clip-bridge-banner.alive   { background: #E8F5EC; border: 1px solid #C7E5D1; color: #1F5A2D; }
.clip-bridge-banner.dead    { background: #FFF1F2; border: 1px solid #FBD9DA; color: #9C2D31; }
.clip-bridge-banner.unknown { background: #FFF7E6; border: 1px solid #F5D58A; color: #6B4E00; }
.clip-bridge-banner small   { display: block; font-weight: normal; margin-top: 4px; font-size: 10pt; }
.clip-bridge-banner a       { color: inherit; text-decoration: underline; }

/* ---- history ---- */
.clip-search { width: 100%; padding: 9px 12px; border: 1px solid #C9D0D9; border-radius: 6px; font: inherit; font-size: 13px; margin-bottom: 10px; }
.clip-hist { display: flex; flex-direction: column; gap: 8px; }
.clip-empty { font-size: 13px; color: #777; }
.clip-row { border: 1px solid #E4E4E8; border-left: 4px solid #CBD5E1; border-radius: 8px; padding: 9px 12px; background: #FCFCFD; }
.clip-row.is-current { border-left-color: #15803D; background: #F3FBF5; }
.clip-row-text { font-size: 13px; color: #1B1B1F; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; cursor: pointer; }
.clip-row-meta { font-size: 11px; color: #666; margin-top: 4px; }
.clip-badge { display: inline-block; font-size: 11px; font-weight: 600; color: #15803D; margin-right: 6px; }
.clip-row .clip-actions { margin-top: 8px; margin-bottom: 0; }
.clip-row .clip-btn { padding: 6px 11px; font-size: 12px; }
.clip-more { display: block; margin: 12px auto 0; }
.clip-more[hidden] { display: none; }

/* ---- modal: closed only by its own buttons or Escape ---- */
.clip-modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 1000; display: flex; align-items: flex-start; justify-content: center; padding: 24px 12px; overflow: auto; }
.clip-modal-bg[hidden] { display: none; }
.clip-modal { background: #fff; border-radius: 12px; width: 100%; max-width: 640px; padding: 18px 20px 16px; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.clip-modal h2 { margin: 0 0 8px; font-size: 16px; }
.clip-modal textarea { min-height: 240px; }
.clip-modal-actions { align-items: center; }

@media (max-width: 520px) {
    .clip-body { padding: 10px 10px 28px; }
    .clip-card { padding: 10px 12px; }
}
