:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f3f4f6;
  color: #111827;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at top, #ffffff 0, #f3f4f6 48%, #e5e7eb 100%); }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.6; }
.app-shell { width: min(920px, calc(100% - 32px)); margin: 0 auto; padding: 48px 0; }
.app-card { overflow: hidden; border: 1px solid #d1d5db; border-radius: 22px; background: rgba(255,255,255,0.96); box-shadow: 0 22px 60px rgba(17,24,39,0.12); }
.app-header { display: flex; justify-content: space-between; gap: 24px; padding: 30px 34px 24px; border-bottom: 1px solid #e5e7eb; }
.eyebrow { margin: 0 0 7px; font-size: 0.72rem; font-weight: 800; letter-spacing: 0.13em; color: #6b7280; }
h1, h2 { margin: 0; }
h1 { font-size: clamp(2rem, 5vw, 3rem); letter-spacing: -0.045em; }
.subtitle { margin: 8px 0 0; color: #6b7280; line-height: 1.55; }
.status-dot { width: 11px; height: 11px; margin-top: 9px; border-radius: 999px; background: #22c55e; box-shadow: 0 0 0 5px rgba(34,197,94,.13); }
.response-panel { min-height: 260px; padding: 30px 34px; border-bottom: 1px solid #e5e7eb; background: #fafafa; }
.response-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.response-heading h2 { font-size: 0.9rem; text-transform: uppercase; letter-spacing: .08em; color: #4b5563; }
.model-label { font-size: .78rem; color: #6b7280; }
.response-text { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.7; }
.empty-state { color: #9ca3af; }
.response-meta { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 20px; }
.usage-text { font-size: .78rem; color: #6b7280; }
.composer { padding: 26px 34px 30px; }
textarea { width: 100%; resize: vertical; min-height: 128px; border: 1px solid #cbd5e1; border-radius: 14px; padding: 15px 16px; outline: none; line-height: 1.55; background: #fff; }
textarea:focus, input:focus, select:focus { border-color: #111827; box-shadow: 0 0 0 3px rgba(17,24,39,.09); outline: none; }
.attachment-chip { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; padding: 9px 12px; border-radius: 10px; background: #eef2ff; color: #3730a3; font-size: .84rem; }
.remove-attachment, .close-button { border: 0; background: transparent; font-size: 1.5rem; line-height: 1; color: inherit; }

.project-panel { margin-top: 12px; border: 1px solid #c7d2fe; border-radius: 12px; padding: 14px; background: #f5f7ff; }
.project-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.project-header > div { min-width: 0; }
.project-header strong { display: block; overflow-wrap: anywhere; color: #312e81; }
.project-summary { display: block; margin-top: 4px; color: #5b6380; font-size: .78rem; line-height: 1.45; }
.project-warning { margin: 10px 0 0; color: #7c2d12; font-size: .78rem; line-height: 1.5; }
.compact-button { flex: 0 0 auto; padding: 7px 10px; }
.project-details { margin-top: 12px; }
.project-details > summary, .ignored-files > summary { cursor: pointer; color: #3730a3; font-size: .8rem; font-weight: 750; }
.project-file-list { max-height: 300px; overflow: auto; margin-top: 10px; border: 1px solid #dbe2ff; border-radius: 9px; background: #fff; }
.project-file-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 9px; padding: 8px 10px; border-bottom: 1px solid #eef0f7; font-size: .78rem; }
.project-file-row:last-child { border-bottom: 0; }
.project-file-row input { width: 16px; height: 16px; accent-color: #3730a3; }
.project-file-path { min-width: 0; overflow-wrap: anywhere; color: #1f2937; }
.project-file-size { color: #6b7280; white-space: nowrap; }
.ignored-files { padding: 9px 10px; border-top: 1px solid #eef0f7; }
.ignored-files ul { margin: 8px 0 0; padding-left: 20px; color: #6b7280; font-size: .75rem; line-height: 1.55; }

.options-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; margin-top: 18px; }
.option-field, .memory-control { padding: 14px; border: 1px solid #e5e7eb; border-radius: 12px; background: #fafafa; }
.option-field label, .dialog-section label { display: block; margin-bottom: 8px; font-size: .8rem; font-weight: 750; color: #374151; }
select, .dialog-section input { width: 100%; border: 1px solid #cbd5e1; border-radius: 9px; padding: 9px 10px; background: #fff; }
.memory-control { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.toggle-row { display: flex; align-items: center; gap: 9px; font-weight: 700; color: #374151; }
.toggle-row input { width: 18px; height: 18px; accent-color: #111827; }
.text-button { padding: 0; border: 0; background: transparent; color: #4338ca; font-weight: 700; }
.option-note, .help-text { margin: 9px 0 0; color: #6b7280; font-size: .78rem; line-height: 1.5; }
.composer-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 20px; }
.icon-button { display: grid; place-items: center; width: 42px; height: 42px; border: 1px solid #cbd5e1; border-radius: 11px; background: #fff; font-size: 1.5rem; }
.folder-button { min-height: 42px; border: 1px solid #cbd5e1; border-radius: 11px; padding: 0 14px; background: #fff; color: #1f2937; font-weight: 720; }
.shortcut-hint { flex: 1; color: #9ca3af; font-size: .77rem; }
.send-button { min-width: 105px; display: inline-flex; align-items: center; justify-content: center; gap: 9px; border: 0; border-radius: 11px; padding: 12px 18px; background: #111827; color: #fff; font-weight: 750; }
.spinner { width: 15px; height: 15px; border: 2px solid rgba(255,255,255,.35); border-top-color: #fff; border-radius: 999px; animation: spin .75s linear infinite; }
.folder-note { margin: 10px 0 0; color: #6b7280; font-size: .76rem; line-height: 1.5; }
.folder-status { min-height: 20px; margin: 8px 0 0; color: #4338ca; font-size: .8rem; font-weight: 650; line-height: 1.45; }
.folder-status.error { color: #b91c1c; }
.error-text { min-height: 20px; margin: 12px 0 0; color: #b91c1c; font-size: .85rem; }
.memory-dialog { width: min(720px, calc(100% - 28px)); max-height: 86vh; border: 0; border-radius: 18px; padding: 0; box-shadow: 0 26px 80px rgba(0,0,0,.25); }
.memory-dialog::backdrop { background: rgba(15,23,42,.58); }
.dialog-header { display: flex; justify-content: space-between; align-items: flex-start; padding: 24px 26px 18px; border-bottom: 1px solid #e5e7eb; }
.dialog-section { padding: 18px 26px 0; }
.inline-input { display: grid; grid-template-columns: 1fr auto; gap: 9px; }
.secondary-button, .danger-button { border-radius: 9px; padding: 9px 12px; background: #fff; font-weight: 700; }
.secondary-button { border: 1px solid #cbd5e1; color: #1f2937; }
.danger-button { border: 1px solid #fecaca; color: #b91c1c; }
.optional { font-weight: 500; color: #9ca3af; }
.dialog-toolbar { display: flex; justify-content: space-between; gap: 12px; padding: 20px 26px 6px; }
#memoryStatus { padding: 0 26px; min-height: 18px; }
.memory-list { padding: 10px 26px 20px; display: grid; gap: 8px; }
.memory-item { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: stretch; }
.memory-file-button { display: flex; justify-content: space-between; gap: 12px; text-align: left; border: 1px solid #e5e7eb; border-radius: 9px; padding: 11px 12px; background: #fafafa; color: #1f2937; }
.memory-file-button span { color: #6b7280; font-size: .78rem; }
.delete-file-button { border: 1px solid #fecaca; border-radius: 9px; background: #fff; color: #b91c1c; padding: 0 11px; }
.memory-preview { margin: 0 26px 26px; max-height: 300px; overflow: auto; border: 1px solid #d1d5db; border-radius: 10px; padding: 14px; background: #111827; color: #e5e7eb; white-space: pre-wrap; font-size: .78rem; line-height: 1.55; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (max-width: 640px) {
  .app-shell { width: min(100% - 18px, 920px); padding: 12px 0; }
  .app-header, .response-panel, .composer { padding-left: 20px; padding-right: 20px; }
  .options-grid { grid-template-columns: 1fr; }
  .shortcut-hint { display: none; }
  .send-button { margin-left: auto; }
  .project-header { flex-direction: column; }
  .compact-button { align-self: flex-start; }
  .memory-control { align-items: flex-start; }
  .dialog-toolbar { flex-direction: column; }
}
