@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500&family=IBM+Plex+Sans:wght@400;500;600&display=swap");

body { margin: 0; font-family: var(--font-sans); font-size: 16px; line-height: 26px; background: var(--surface); color: var(--ink); }

/* Logo: wordmark and short form. Sizes follow font-size; braces and colon are em-sized shapes. */
.tc-logo { display: inline-block; font-family: var(--font-mono); font-weight: 500; line-height: 1; letter-spacing: -0.02em; white-space: nowrap; color: var(--ink); }
.tc-logo svg { display: inline-block; overflow: visible; }
.tc-logo .tc-brace { width: 0.39em; height: 0.9em; vertical-align: -0.13em; }
.tc-logo .tc-brace-l { margin-right: 0.1em; }
.tc-logo .tc-brace-r { margin-left: 0.1em; }
.tc-logo .tc-colon { width: 0.6em; height: 0.52em; vertical-align: baseline; }
.tc-logo .tc-brace path { fill: none; stroke: var(--moss); stroke-linecap: square; stroke-linejoin: miter; }
.tc-logo .tc-colon rect { fill: var(--moss); }
.tc-logo.tc-on-moss, .tc-logo.tc-on-moss .tc-colon rect { color: var(--on-moss); fill: var(--on-moss); }
.tc-logo.tc-on-moss .tc-brace path { stroke: var(--on-moss); }
.tc-logo.tc-mono .tc-brace path { stroke: currentColor; }
.tc-logo.tc-mono .tc-colon rect { fill: currentColor; }

/* Mark {:} and app icon */
.tc-mark { display: inline-block; vertical-align: middle; }
.tc-mark .tc-b { fill: none; stroke: var(--moss); stroke-linecap: square; stroke-linejoin: miter; }
.tc-mark .tc-d { fill: var(--ink); }
.tc-mark.tc-mono .tc-b { stroke: currentColor; }
.tc-mark.tc-mono .tc-d { fill: currentColor; }
.tc-appicon { display: inline-block; vertical-align: middle; }
.tc-appicon .tc-tile { fill: var(--moss); }
.tc-appicon .tc-b { fill: none; stroke: var(--on-moss); stroke-linecap: square; stroke-linejoin: miter; }
.tc-appicon .tc-d { fill: var(--on-moss); }

/* Button */
.tc-btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); height: 40px; padding: 0 var(--space-4); font-family: var(--font-sans); font-size: 15px; font-weight: 500; line-height: 1; border-radius: var(--radius-md); border: 1px solid var(--line-strong); background: var(--surface-raised); color: var(--ink); cursor: pointer; transition: background-color 120ms ease-out, border-color 120ms ease-out; }
.tc-btn:hover { background: var(--surface); }
.tc-btn:focus-visible { outline: 2px solid transparent; box-shadow: var(--focus-ring); }
.tc-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.tc-btn-sm { height: 32px; padding: 0 var(--space-3); font-size: 14px; }
.tc-btn-primary { background: var(--moss); border-color: var(--moss); color: var(--on-moss); }
.tc-btn-primary:hover { background: var(--moss-strong); border-color: var(--moss-strong); }
.tc-btn-danger { background: var(--danger); border-color: var(--danger); color: var(--on-danger); }
.tc-btn-danger:hover { background: var(--danger); filter: brightness(0.92); }

/* Tag */
.tc-tag { display: inline-flex; align-items: center; height: 22px; padding: 0 var(--space-2); font-family: var(--font-mono); font-size: 12px; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; border-radius: var(--radius-sm); background: var(--surface); color: var(--ink-muted); border: 1px solid var(--line); white-space: nowrap; }
.tc-tag-moss { background: var(--moss-soft); color: var(--moss); border-color: transparent; }
.tc-tag-danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }

/* Slot: a typed value */
.tc-slot { display: inline-flex; align-items: baseline; gap: var(--space-1); padding: 3px var(--space-2); font-family: var(--font-mono); font-size: 14px; line-height: 20px; border-radius: var(--radius-sm); background: var(--moss-soft); color: var(--ink); border: 1px solid transparent; white-space: nowrap; }
.tc-slot-label { color: var(--ink-muted); font-weight: 400; }
.tc-slot-label::after { content: ":"; color: var(--moss); font-weight: 600; margin-left: 1px; }
.tc-slot-value { font-weight: 500; color: var(--moss); }
.tc-slot-open { background: transparent; border: 1px dashed var(--moss); }
.tc-slot-open .tc-slot-value { color: var(--ink); font-style: normal; }
.tc-slot-invalid { background: var(--danger-soft); }
.tc-slot-invalid .tc-slot-value { color: var(--danger); text-decoration: line-through; }
.tc-slot-invalid .tc-slot-label::after { color: var(--danger); }

/* Message */
.tc-msg { display: flex; flex-direction: column; gap: var(--space-2); max-width: 560px; }
.tc-msg-user { align-self: flex-end; align-items: flex-end; }
.tc-msg-assistant { align-self: flex-start; align-items: flex-start; }
.tc-msg-bubble { padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); font-family: var(--font-sans); font-size: 16px; line-height: 26px; }
.tc-msg-user .tc-msg-bubble { background: var(--surface-raised); border: 1px solid var(--line); color: var(--ink); }
.tc-msg-assistant .tc-msg-bubble { background: transparent; padding-left: 0; padding-right: 0; color: var(--ink); }
.tc-msg-slots { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-2); }
.tc-msg-meta { font-family: var(--font-mono); font-size: 12px; line-height: 16px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-muted); }

/* Confirm card */
.tc-confirm { display: flex; flex-direction: column; gap: var(--space-4); max-width: 440px; padding: var(--space-4); background: var(--surface-raised); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--raise); }
.tc-confirm-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); }
.tc-confirm-title { margin: 0; font-family: var(--font-mono); font-size: 18px; line-height: 26px; font-weight: 500; color: var(--ink); }
.tc-confirm-fields { margin: 0; display: grid; grid-template-columns: max-content 1fr; column-gap: var(--space-4); row-gap: var(--space-2); font-family: var(--font-mono); font-size: 14px; line-height: 20px; }
.tc-confirm-fields dt { color: var(--ink-muted); }
.tc-confirm-fields dt::after { content: ":"; color: var(--moss); font-weight: 600; margin-left: 1px; }
.tc-confirm-fields dd { margin: 0; color: var(--ink); font-weight: 500; overflow-wrap: anywhere; }
.tc-confirm-digest { font-family: var(--font-mono); font-size: 12px; line-height: 16px; color: var(--ink-muted); border-top: 1px solid var(--line); padding-top: var(--space-3); overflow-wrap: anywhere; }
.tc-confirm-actions { display: flex; gap: var(--space-2); flex-wrap: wrap; }

/* Composer */
.tc-composer { display: flex; align-items: flex-end; gap: var(--space-2); padding: var(--space-2); background: var(--surface-raised); border: 1px solid var(--line-strong); border-radius: var(--radius-lg); box-shadow: var(--raise); max-width: 640px; }
.tc-composer:focus-within { box-shadow: var(--focus-ring); }
.tc-composer-input { flex: 1; min-width: 0; min-height: 40px; max-height: 160px; resize: none; border: 0; outline: 0; background: transparent; padding: 8px var(--space-2); font-family: var(--font-sans); font-size: 16px; line-height: 24px; color: var(--ink); }
.tc-composer-input::placeholder { color: var(--ink-muted); }
.tc-visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* preview helpers */
.tc-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-4); padding: var(--space-4); }
.tc-col { display: flex; flex-direction: column; gap: var(--space-4); padding: var(--space-4); }

@media (prefers-reduced-motion: reduce) { .tc-btn { transition: none; } }
