
/* Compact clean layout (reverted) + model inline + empty-state bottom */
#luwn-ai-app{ --panel:#fff; --muted:#fafafa; --border:#e3e3e7; --text:#121212; --subtext:#6b6b6f; --accent:#111; --accent-contrast:#fff; }
.pix-dark #luwn-ai-app{ --panel:#17181c; --muted:#111215; --border:#2a2b31; --text:#eee; --subtext:#a6a7ad; --accent:#111; --accent-contrast:#fff; }

#luwn-ai-app.luwn-shell{ display:grid; grid-template-columns:320px 1fr; gap:12px; padding:12px; }
@media (max-width:980px){ #luwn-ai-app.luwn-shell{ grid-template-columns:1fr; } }

.panel{ background:var(--panel); border:1px solid var(--border); border-radius:16px; box-shadow:0 2px 8px rgba(0,0,0,.06); overflow:hidden; }
.panel .panel-body{ padding:14px; display:flex; flex-direction:column; gap:10px; height:100%; }
.panel-left .panel-body{ height:calc(100vh - 72px); }
.panel-right .panel-body{ min-height:calc(100vh - 72px); }

.btn{ padding:10px 12px; border-radius:12px; border:1px solid var(--border); background:var(--muted); color:var(--text); cursor:pointer; }
.btn.primary{ background:var(--accent); color:var(--accent-contrast); border-color:var(--accent); }
.btn.ghost{ background:var(--muted); }
.btn.danger{ background:#e11d48; color:#fff; border-color:#e11d48; }
.btn.xs{ padding:6px 8px; border-radius:10px; }
.btn.icon{ width:44px; height:36px; display:inline-flex; align-items:center; justify-content:center; font-size:18px; padding:0; }

.luwn-brand{ display:flex; align-items:center; gap:8px; }
.luwn-brand .spacer{ flex:1; }
.logo-img{ width:36px; height:36px; border-radius:8px; object-fit:contain; }
.title{ font-weight:800; letter-spacing:.2px; }
.luwn-search input{ width:100%; }

.luwn-chat-list{ display:flex; flex-direction:column; gap:8px; overflow:auto; flex:1; max-height:calc(100vh - 340px); }

.chat-item{ padding:10px 12px; border:1px solid var(--border); border-radius:12px; background:var(--muted); cursor:pointer; }
.chat-item.active{ outline: 2px solid rgba(0,0,0,.06); }
.chat-item .name{ font-weight:700; }
.chat-item .meta{ color:var(--subtext); font-size:.85rem; }

.luwn-header{ display:flex; align-items:center; justify-content:space-between; padding:6px 0 2px; gap:10px; }
.luwn-header h3#luwn-chat-title{ font-size:2.4rem; line-height:1.15; font-weight:800; margin:0; }
.header-left{ display:flex; align-items:center; gap:8px; }
.badge{ display:inline-flex; align-items:center; gap:6px; padding:2px 8px; border-radius:999px; border:1px solid var(--border); background:var(--muted); font-size:.78rem; color:var(--subtext); }
.header-right{ display:flex; align-items:center; gap:10px; flex-wrap:nowrap; }
.header-right .model-inline select{ background:var(--muted); border:1px solid var(--border); color:var(--text); padding:8px 10px; border-radius:10px; outline:none; }

.luwn-tools.switches{ display:grid; grid-template-columns:repeat(5, minmax(150px, 1fr)); gap:10px; }
@media (max-width:1100px){ .luwn-tools.switches{ grid-template-columns:repeat(3, 1fr); } }
@media (max-width:720px){ .luwn-tools.switches{ grid-template-columns:repeat(2, 1fr); } }
@media (max-width:520px){ .luwn-tools.switches{ grid-template-columns:1fr; } }
.luwn-tools .tool{ display:flex; align-items:center; gap:8px; width:100%; border:1px solid var(--border); background:var(--muted); padding:8px 10px; border-radius:12px; min-height:40px; }
.luwn-tools .tool .label{ font-weight:700; font-size:.95rem; }
.luwn-tools .tool .spacer{ flex:1; }
.luwn-tools .tool .info{ width:18px; height:18px; display:inline-flex; align-items:center; justify-content:center; font-weight:700; font-size:.8rem; border:1px solid var(--border); border-radius:50%; background:var(--muted); color:var(--subtext); position:relative; }
.luwn-tools .tool .info::after{ content:attr(data-tip); position:absolute; right:0; bottom:calc(100% + 8px); width:max(180px,18ch); max-width:300px; background:var(--panel); color:var(--text); border:1px solid var(--border); border-radius:10px; padding:8px 10px; box-shadow:0 10px 30px rgba(0,0,0,.12); opacity:0; pointer-events:none; transition:opacity .15s ease; }
.luwn-tools .tool .info:hover::after{ opacity:1; }

.switch{ position:relative; width:44px; height:24px; border-radius:12px; border:1px solid var(--border); background:#d6d6da; cursor:pointer; outline:none; display:inline-block; }
.switch::after{ content:''; position:absolute; top:50%; left:2px; transform:translateY(-50%); width:20px; height:20px; border-radius:50%; background:#fff; box-shadow:0 1px 1px rgba(0,0,0,.18); transition:left .18s ease; }
.switch[aria-checked="true"]{ background:var(--accent); border-color:var(--accent); }
.switch[aria-checked="true"]::after{ left:22px; }
.switch:focus-visible{ box-shadow:0 0 0 3px rgba(0,0,0,.10); border-color:var(--accent); }

.luwn-config{ display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.luwn-config.hidden{ display:none !important; }
.luwn-config.one-col{ grid-template-columns:1fr !important; }
.field label{ display:block; font-weight:700; margin-bottom:6px; color:var(--subtext); }
textarea{ width:100%; min-height:90px; resize:vertical; background:var(--muted); border:1px solid var(--border); color:var(--text); padding:10px; border-radius:12px; outline:none; }
textarea:focus{ box-shadow:0 0 0 3px rgba(0,0,0,.10); border-color:var(--accent); }

/* Messages + composer: keep bottom-anchored when empty */
.luwn-messages{ flex:1; overflow:auto; padding:10px 0; display:flex; flex-direction:column; gap:10px; }
.luwn-messages.empty, .luwn-messages:has(.empty-state){ justify-content:flex-end; }
.bubble{ max-width:900px; padding:10px 12px; border:1px solid var(--border); background:var(--muted); border-radius:12px; }
.bubble.user{ align-self:flex-end; }
.bubble .meta-line{ margin-top:6px; font-size:.8rem; color:var(--subtext); }

.luwn-composer{ border-top:1px solid var(--border); padding-top:10px; }
.composer-inner{ background:var(--muted); border:1px solid var(--border); border-radius:12px; padding:8px; display:flex; flex-direction:column; gap:8px; }
.composer-inner textarea{ background:transparent; border:0; min-height:46px; }
.composer-actions{ display:flex; align-items:center; justify-content:space-between; }
.hint{ color:var(--subtext); font-size:.85rem; }

.luwn-modal-root{ position:fixed; inset:0; display:none; align-items:center; justify-content:center; z-index:10000; }
.luwn-modal-root.show{ display:flex; }
.luwn-modal-backdrop{ position:absolute; inset:0; background:rgba(0,0,0,.55); }
.luwn-modal-box{ position:relative; width:min(560px, calc(100% - 40px)); background:var(--panel); border:1px solid var(--border); border-radius:16px; box-shadow:0 20px 60px rgba(0,0,0,.2); display:flex; flex-direction:column; overflow:hidden; }
.modal-header, .modal-footer{ padding:10px 12px; display:flex; align-items:center; justify-content:space-between; border-bottom:1px solid var(--border); }
.modal-footer{ border-top:1px solid var(--border); border-bottom:0; }
.modal-body{ padding:12px; }
.modal-close{ width:32px; height:32px; display:inline-flex; align-items:center; justify-content:center; border:1px solid var(--border); background:var(--muted); border-radius:8px; padding:0; cursor:pointer; }


/* v0.6.0 chat-frame + better search */

/* Bordered frame to visually group header + tools + prompts */
.chat-frame{
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:16px;
  padding:10px;
  box-shadow:0 1px 0 rgba(0,0,0,.02), 0 6px 24px rgba(0,0,0,.02);
  display:flex;
  flex-direction:column;
  gap:10px;
}

/* Sidebar search: pill + icon + focus ring */
.luwn-search{ position:relative; }
.luwn-search input{
  width:100%;
  height:42px;
  padding:10px 14px 10px 42px;
  border-radius:12px;
  border:1px solid var(--border);
  background:var(--muted);
  color:var(--text);
  outline:none;
  transition:border-color .15s ease, box-shadow .15s ease;
  box-shadow: inset 0 1px 2px rgba(0,0,0,.04);
}
.luwn-search input::placeholder{ color:var(--subtext); }
.luwn-search::before{
  content:'🔎';
  position:absolute;
  left:12px;
  top:50%;
  transform:translateY(-50%);
  font-size:14px;
  opacity:.7;
  pointer-events:none;
}
.luwn-search input:focus{
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0,0,0,.08);
}


/* v0.6.2 toggles clickability */
.luwn-tools .tool{ cursor:pointer; }
.luwn-tools .tool .switch{ position:relative; z-index:2; pointer-events:auto; cursor:pointer; }
.luwn-tools .tool .info::after{ pointer-events:none; } /* tooltip doesn't steal clicks */


/* v0.6.3: class-based switch state as safety net */
.switch.on{ background:var(--accent); border-color:var(--accent); }
.switch.on::after{ left:22px; }


/* v0.6.5: checkbox + label switch */
.switch-input{ position:absolute; opacity:0; width:0; height:0; pointer-events:none; }
.luwn-tools .tool .switch{ position:relative; width:44px; height:24px; border-radius:12px; border:1px solid var(--border); background:#d6d6da; cursor:pointer; display:inline-block; z-index:2; }
.luwn-tools .tool .switch::after{ content:''; position:absolute; top:50%; left:2px; transform:translateY(-50%); width:20px; height:20px; border-radius:50%; background:#fff; box-shadow:0 1px 1px rgba(0,0,0,.18); transition:left .18s ease; }
.switch-input:checked + .switch{ background:var(--accent); border-color:var(--accent); }
.switch-input:checked + .switch::after{ left:22px; }
/* backup class if needed */
.switch.on{ background:var(--accent); border-color:var(--accent); }
.switch.on::after{ left:22px; }
