/* Layer 5 of 5 — feature surfaces: home, composer, model selection, Fikr Control, commands, conversation. */

/* =====================================================================
   Home
   ===================================================================== */
.home {
  min-height: 100%; display: flex; flex-direction: column; justify-content: center; align-items: center;
  gap: var(--sp-6); padding: var(--sp-8) var(--sp-5) var(--sp-10); text-align: center;
  animation: fade-in var(--dur-panel) var(--ease-out);
}
.home-mark { position: relative; }
.home-mark::after { /* restrained halo, static */
  content: ""; position: absolute; inset: -18px; border-radius: 50%; z-index: -1;
  background: radial-gradient(circle, var(--accent-soft), transparent 70%);
}
.home h1 { font-size: clamp(var(--fs-xl), 3.4vw, var(--fs-3xl)); font-weight: var(--fw-bold); letter-spacing: -0.01em; line-height: 1.4; }
.home .home-sub { color: var(--text-2); font-size: var(--fs-md); margin-top: var(--sp-1); }
.suggestions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-2); width: min(100%, 34rem); }
.suggestion {
  display: flex; align-items: center; gap: var(--sp-3); min-height: 52px; padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-md); border: 1px solid var(--border); background: var(--surface-2);
  color: var(--text); text-align: start; font-size: var(--fs-base);
  transition: border-color var(--dur-fast), background-color var(--dur-fast), transform var(--dur-fast) var(--ease-out);
}
.suggestion:hover { border-color: var(--accent-border); background: color-mix(in srgb, var(--surface-2) 88%, var(--accent)); }
.suggestion:active { transform: scale(0.99); }
.suggestion .icon { color: var(--accent-text); }
.suggestion small { display: block; color: var(--text-3); font-size: var(--fs-xs); margin-top: 1px; }
.home-foot { font-size: var(--fs-xs); color: var(--text-3); }
@media (max-width: 480px) { .suggestions { grid-template-columns: 1fr; } .suggestion { min-height: 48px; } }

/* =====================================================================
   Composer
   ===================================================================== */
.composer {
  position: relative; display: flex; flex-direction: column;
  border-radius: var(--r-xl); background: var(--surface-2);
  box-shadow: var(--composer-shadow);
  transition: box-shadow var(--dur-base) var(--ease-out);
}
.composer:focus-within { box-shadow: var(--composer-shadow), 0 0 0 1px var(--accent-border); }
.composer.is-dragover { box-shadow: var(--composer-shadow), 0 0 0 2px var(--accent); }
.composer-context { display: flex; flex-wrap: wrap; gap: var(--sp-2); padding: var(--sp-3) var(--sp-3) 0; }
.composer-attachments { display: flex; gap: var(--sp-2); padding: var(--sp-3) var(--sp-3) 0; overflow-x: auto; scrollbar-width: thin; }
.attach-card {
  position: relative; flex: none; display: flex; align-items: center; gap: var(--sp-2);
  height: 56px; max-width: 220px; padding: var(--sp-1) var(--sp-3) var(--sp-1) var(--sp-1);
  border-radius: var(--r-md); border: 1px solid var(--border); background: var(--surface-hover);
}
.attach-card.is-image { width: 56px; padding: 0; overflow: hidden; }
.attach-card img { width: 100%; height: 100%; object-fit: cover; }
.attach-card .file-ic { display: grid; place-items: center; width: 46px; height: 46px; border-radius: var(--r-sm); background: var(--accent-soft); color: var(--accent-text); font-size: var(--fs-2xs); font-weight: var(--fw-bold); flex: none; }
.attach-card .meta { display: grid; min-width: 0; line-height: 1.3; }
.attach-card .meta strong { font-size: var(--fs-sm); font-weight: var(--fw-medium); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach-card .meta small { font-size: var(--fs-xs); color: var(--text-3); }
.attach-card .remove { position: absolute; top: 3px; inset-inline-end: 3px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--overlay); color: #fff; }
.attach-card.is-image .remove { top: 3px; }
.attach-card.is-uploading::after { content: ""; position: absolute; inset: 0; background: var(--overlay); }
.attach-card .spinner { position: absolute; inset: 0; margin: auto; z-index: 1; color: #fff; }

.composer textarea {
  display: block; width: 100%; min-height: 52px; max-height: min(40vh, 280px);
  padding: var(--sp-4) var(--sp-5) var(--sp-1);
  border: 0; background: transparent; color: var(--text); resize: none;
  font-size: var(--fs-md); line-height: var(--lh-snug); overflow-y: auto;
}
.composer textarea::placeholder { color: var(--text-3); }
.composer textarea:focus-visible { outline: none; }
.composer-bar { display: flex; align-items: center; gap: var(--sp-1); padding: var(--sp-2) var(--sp-2) var(--sp-2) var(--sp-2); }
.composer-tools { display: flex; align-items: center; gap: 2px; min-width: 0; flex: 1; }
.composer-end { display: flex; align-items: center; gap: var(--sp-2); }
.composer .icon-btn { border-radius: var(--r-pill); }

.pill-trigger {
  display: inline-flex; align-items: center; gap: 7px; min-width: 0;
  height: var(--control-h); padding: 0 var(--sp-3) 0 var(--sp-2);
  border-radius: var(--r-pill); color: var(--text-2); font-size: var(--fs-sm); font-weight: var(--fw-medium);
  transition: background-color var(--dur-fast), color var(--dur-fast);
}
.pill-trigger:hover, .pill-trigger[aria-expanded="true"] { background: var(--surface-hover); color: var(--text); }
.pill-trigger .label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill-trigger .chev { width: 14px; height: 14px; color: var(--text-3); }
.pill-trigger .model-glyph { width: 22px; height: 22px; border-radius: 7px; }
.pill-trigger .model-glyph .icon { width: 14px; height: 14px; }
.pill-trigger.has-override::after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--warning); }
@media (pointer: coarse) { .pill-trigger { height: 40px; } }

.send-btn {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; flex: none;
  background: var(--accent); color: var(--text-on-accent);
  transition: background-color var(--dur-fast), transform var(--dur-instant), opacity var(--dur-fast);
}
.send-btn:hover:not(:disabled) { background: var(--accent-hover); }
.send-btn:active:not(:disabled) { transform: scale(0.94); }
.send-btn:disabled { background: var(--surface-active); color: var(--text-disabled); }
.send-btn.is-stop { background: var(--text); color: var(--bg); }
.send-btn .icon { width: 19px; height: 19px; stroke-width: 2; }
@media (pointer: coarse) { .send-btn { width: 42px; height: 42px; } }

.composer-meta { display: flex; align-items: center; justify-content: center; gap: var(--sp-3); min-height: 22px; padding-top: var(--sp-2); font-size: var(--fs-xs); color: var(--text-3); text-align: center; }
.composer-meta .quota.is-low { color: var(--warning); }
.composer-access { margin-bottom: var(--sp-2); }
@media (max-width: 767px) {
  .composer { border-radius: var(--r-lg); }
  .composer textarea { padding: var(--sp-3) var(--sp-4) 2px; min-height: 46px; font-size: 16px; /* prevents iOS zoom */ }
  .pill-trigger { padding-inline: var(--sp-2); }
  .pill-trigger .chev { display: none; }
  .composer-meta .disclaimer { display: none; }
}
@media (max-width: 380px) { .pill-trigger .label.is-secondary { display: none; } }

/* =====================================================================
   Model selector
   ===================================================================== */
.model-menu { width: 320px; padding: var(--sp-1); }
.model-option {
  display: flex; align-items: center; gap: var(--sp-3); width: 100%;
  padding: var(--sp-2) var(--sp-3); border-radius: var(--r-sm); text-align: start; min-height: 52px;
}
.model-option:hover, .model-option[data-active="true"] { background: var(--surface-hover); }
.model-option[aria-checked="true"] { background: var(--surface-selected); }
.model-option .text { flex: 1; min-width: 0; display: grid; gap: 1px; }
.model-option .text strong { font-size: var(--fs-md); font-weight: var(--fw-semibold); display: flex; align-items: center; gap: var(--sp-2); }
.model-option .text small { color: var(--text-2); font-size: var(--fs-sm); }
.model-option .check { width: 18px; height: 18px; color: var(--accent-text); visibility: hidden; }
.model-option[aria-checked="true"] .check { visibility: visible; }
.model-menu-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); padding: var(--sp-2) var(--sp-3) var(--sp-1); margin-top: var(--sp-1); border-top: 1px solid var(--border-subtle); font-size: var(--fs-xs); color: var(--text-3); }
.model-menu-foot button { color: var(--accent-text); font-size: var(--fs-xs); font-weight: var(--fw-medium); padding: 4px 6px; border-radius: var(--r-xs); }
.model-menu-foot button:hover { background: var(--surface-hover); }

.model-card { display: grid; grid-template-columns: auto 1fr; gap: var(--sp-3) var(--sp-4); padding: var(--sp-4); border-radius: var(--r-md); border: 1px solid var(--border-subtle); background: var(--surface-hover); }
.model-card .model-glyph { width: 40px; height: 40px; border-radius: var(--r-md); }
.model-card .model-glyph .icon { width: 22px; height: 22px; }
.model-card h3 { font-size: var(--fs-md); display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; color: var(--text); }
.model-card p { color: var(--text-2); font-size: var(--fs-sm); margin-top: 2px; }
.model-card dl { grid-column: 1 / -1; display: grid; grid-template-columns: auto 1fr; gap: var(--sp-1) var(--sp-4); font-size: var(--fs-sm); }
.model-card dt { color: var(--text-3); }
.model-card dd { margin: 0; color: var(--text); }
.model-card.is-retired { opacity: 0.85; }

/* =====================================================================
   Fikr Control — signature reasoning interaction
   ===================================================================== */
.fikr { width: 340px; padding: var(--sp-4); display: grid; gap: var(--sp-4); }
.sheet .fikr { width: auto; padding: var(--sp-2) var(--sp-3) var(--sp-3); }
.fikr-head { display: flex; align-items: center; gap: var(--sp-3); }
.fikr-head .title { flex: 1; display: grid; line-height: 1.3; }
.fikr-head .title strong { font-size: var(--fs-md); font-weight: var(--fw-semibold); }
.fikr-head .title small { color: var(--text-3); font-size: var(--fs-xs); }
.fikr-auto { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-sm); color: var(--text-2); cursor: pointer; user-select: none; }
.fikr-auto:has(input:checked) { color: var(--accent-text); font-weight: var(--fw-medium); }

.fikr-track-wrap { position: relative; padding: var(--sp-2) 0 0; }
.fikr-track {
  position: relative; height: 72px; touch-action: none; cursor: pointer; user-select: none;
  display: grid; grid-template-columns: repeat(6, 1fr); align-items: end; gap: 6px;
  border-radius: var(--r-md); outline-offset: 4px;
}
.fikr-bar { position: relative; height: 100%; display: flex; align-items: flex-end; justify-content: center; }
.fikr-bar span {
  display: block; width: 100%; border-radius: 7px; background: var(--surface-active);
  transition: background-color var(--dur-base) var(--ease-out), height var(--dur-base) var(--ease-spring), opacity var(--dur-base), transform var(--dur-base) var(--ease-spring);
}
.fikr-bar:nth-child(1) span { height: 26%; } .fikr-bar:nth-child(2) span { height: 38%; } .fikr-bar:nth-child(3) span { height: 52%; }
.fikr-bar:nth-child(4) span { height: 66%; } .fikr-bar:nth-child(5) span { height: 82%; } .fikr-bar:nth-child(6) span { height: 100%; }
.fikr-bar.is-on span { background: linear-gradient(to top, var(--energy-1), var(--energy-2)); }
.fikr-bar.is-current span { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent-text); }
.fikr-bar.is-blocked span {
  background: repeating-linear-gradient(135deg, var(--surface-hover) 0 5px, transparent 5px 10px);
  border: 1px dashed var(--border-strong);
}
.fikr-bar.is-blocked .lock { position: absolute; bottom: 6px; width: 13px; height: 13px; color: var(--text-3); }
.fikr-track.is-dragging .fikr-bar span { transition-duration: var(--dur-fast); }
.fikr-track[aria-disabled="true"] { cursor: default; }
.fikr-track[aria-disabled="true"] .fikr-bar span { opacity: 0.38; }
.fikr-track[aria-disabled="true"] .fikr-bar.is-on span { background: var(--accent-border); }
.fikr.is-auto .fikr-track .fikr-bar:not(.is-blocked) span { animation: energy-breathe 2.6s var(--ease-in-out) infinite; }
.fikr.is-auto .fikr-bar:nth-child(2) span { animation-delay: 0.15s; } .fikr.is-auto .fikr-bar:nth-child(3) span { animation-delay: 0.3s; }
.fikr.is-auto .fikr-bar:nth-child(4) span { animation-delay: 0.45s; } .fikr.is-auto .fikr-bar:nth-child(5) span { animation-delay: 0.6s; } .fikr.is-auto .fikr-bar:nth-child(6) span { animation-delay: 0.75s; }
.fikr-ticks { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin-top: var(--sp-2); }
.fikr-ticks button {
  min-height: 26px; border-radius: var(--r-xs); font-size: var(--fs-2xs); color: var(--text-3); text-align: center; line-height: 1.2;
  transition: color var(--dur-fast), background-color var(--dur-fast);
}
.fikr-ticks button:hover:not(:disabled) { color: var(--text); background: var(--surface-hover); }
.fikr-ticks button[aria-pressed="true"] { color: var(--accent-text); font-weight: var(--fw-semibold); }
.fikr-ticks button:disabled { color: var(--text-disabled); text-decoration: line-through; text-decoration-thickness: 1px; }

.fikr-readout { display: grid; gap: var(--sp-1); min-height: 64px; }
.fikr-readout .level { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-md); font-weight: var(--fw-semibold); }
.fikr-readout .level .en { font-size: var(--fs-xs); color: var(--text-3); font-weight: var(--fw-regular); direction: ltr; }
.fikr-readout p { color: var(--text-2); font-size: var(--fs-sm); line-height: var(--lh-snug); }
.fikr-trade { display: grid; grid-template-columns: auto 1fr; gap: 6px var(--sp-3); align-items: center; font-size: var(--fs-xs); color: var(--text-3); }
.fikr-trade .meter { display: grid; grid-template-columns: repeat(6, 1fr); gap: 3px; }
.fikr-trade .meter i { height: 4px; border-radius: 2px; background: var(--surface-active); }
.fikr-trade .meter i.is-on { background: var(--text-2); }
.fikr-trade .meter.is-depth i.is-on { background: var(--accent-text); }
.fikr-foot { display: grid; gap: var(--sp-2); padding-top: var(--sp-3); border-top: 1px solid var(--border-subtle); }
.fikr-scope { display: flex; align-items: center; gap: var(--sp-3); font-size: var(--fs-sm); color: var(--text-2); cursor: pointer; }
.fikr-scope span { flex: 1; }
.fikr-scope small { display: block; color: var(--text-3); font-size: var(--fs-xs); }
.fikr-note { font-size: var(--fs-xs); color: var(--text-3); line-height: var(--lh-snug); }
.fikr-restrict { font-size: var(--fs-xs); }

/* =====================================================================
   Slash commands & command palette (shared list styles)
   ===================================================================== */
.cmd-menu { width: min(420px, calc(100vw - 16px)); padding: var(--sp-1); }
.cmd-item { display: flex; align-items: center; gap: var(--sp-3); width: 100%; padding: var(--sp-2) var(--sp-3); border-radius: var(--r-sm); text-align: start; min-height: 46px; }
.cmd-item[aria-selected="true"] { background: var(--surface-active); }
.cmd-item[aria-disabled="true"] { opacity: 0.55; }
.cmd-item .cmd-ic { display: grid; place-items: center; width: 30px; height: 30px; border-radius: var(--r-sm); background: var(--surface-hover); color: var(--text-2); flex: none; }
.cmd-item[aria-selected="true"] .cmd-ic { background: var(--accent-soft); color: var(--accent-text); }
.cmd-item .cmd-text { flex: 1; min-width: 0; display: grid; gap: 1px; }
.cmd-item .cmd-text strong { font-size: var(--fs-base); font-weight: var(--fw-medium); }
.cmd-item .cmd-text small { font-size: var(--fs-xs); color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmd-item .cmd-key { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--text-3); direction: ltr; }
.cmd-empty { padding: var(--sp-5) var(--sp-3); text-align: center; color: var(--text-3); font-size: var(--fs-sm); }
.cmd-hint { display: flex; gap: var(--sp-3); justify-content: flex-end; padding: var(--sp-2) var(--sp-3) var(--sp-1); font-size: var(--fs-2xs); color: var(--text-3); border-top: 1px solid var(--border-subtle); margin-top: var(--sp-1); }

.palette-layer { place-items: start center; padding-top: min(14vh, 120px); }
.palette { width: min(100%, 560px); border-radius: var(--r-lg); background: var(--surface-2); box-shadow: var(--shadow-3); overflow: hidden; animation: pop-in var(--dur-base) var(--ease-out); position: relative; }
.palette-input { display: flex; align-items: center; gap: var(--sp-3); padding: 0 var(--sp-4); border-bottom: 1px solid var(--border-subtle); }
.palette-input .icon { color: var(--text-3); }
.palette-input input { flex: 1; height: 54px; border: 0; background: transparent; font-size: var(--fs-md); color: var(--text); }
.palette-input input:focus-visible { outline: none; }
.palette-list { max-height: min(52vh, 420px); overflow: auto; padding: var(--sp-2); }
.sheet .fikr-head > .model-glyph, .sheet .fikr-head .title strong { display: none; }
