:root {
  --ink: #332415;
  --muted: #70583e;
  --line: #eee0c7;
  --violet: #805000;
  --soft: #fff0cb;
  --sidebar: #fff7e6;
  --canvas: #fff9ed;
  --surface: #fffdf7;
  --thread-top: #fffaf0;
  --bubble: #fff9ec;
  --user-bubble: #fff0c7;
  --user-border: #f1d594;
  --control: #fff6df;
  --hover: #ffefc9;
  --secondary: #5e4932;
  --accent-text: #724500;
  --accent-fill: #8a5400;
  --accent-hover: #6f4200;
  --focus: #a06108;
  --warning: #795319;
  --error: #a13743;
  --media-bg: #f1e2c8;
  --star: #875500;
  --star-bg: #fff0b0;
  --backdrop: #38270955;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #fbefd8;
  --muted: #d2ba95;
  --line: #4c3925;
  --violet: #ffcf74;
  --soft: #493519;
  --sidebar: #251b12;
  --canvas: #1d150f;
  --surface: #2b2016;
  --thread-top: #291d13;
  --bubble: #32251a;
  --user-bubble: #483416;
  --user-border: #67491f;
  --control: #3b2b1b;
  --hover: #44311d;
  --secondary: #e2c9a3;
  --accent-text: #ffdb94;
  --accent-fill: #8a5400;
  --accent-hover: #6f4200;
  --focus: #ffcd71;
  --warning: #f3c777;
  --error: #ffa0a5;
  --media-bg: #45321f;
  --star: #ffda79;
  --star-bg: #4b3511;
  --backdrop: #0009;
}

:root[data-theme="extra-dark"] {
  color-scheme: dark;
  --ink: #faeed8;
  --muted: #c8b598;
  --line: #332619;
  --violet: #ffcf74;
  --soft: #382813;
  --sidebar: #100c08;
  --canvas: #080604;
  --surface: #151009;
  --thread-top: #110c06;
  --bubble: #1e160d;
  --user-bubble: #362610;
  --user-border: #533a18;
  --control: #2b1e11;
  --hover: #312211;
  --secondary: #dfc7a1;
  --accent-text: #ffdb94;
  --accent-fill: #8a5400;
  --accent-hover: #6f4200;
  --focus: #ffcd71;
  --warning: #f3c777;
  --error: #ffa0a5;
  --media-bg: #2e2113;
  --star: #ffda79;
  --star-bg: #3f2a0b;
  --backdrop: #000b;
}

*{box-sizing:border-box} :root{font:15px/1.45 Inter,"Segoe UI",sans-serif;color:var(--ink);background:var(--canvas);color-scheme:light}body{margin:0}button,input,textarea,select{font:inherit}button{cursor:pointer;color:inherit}button:disabled{opacity:.5;cursor:default}button:focus-visible,input:focus-visible,textarea:focus-visible,select:focus-visible{outline:2px solid var(--focus);outline-offset:2px}button{border:0;background:none}svg{width:18px;height:18px;display:block;flex:none} [data-icon]{display:inline-grid;place-items:center;flex:none} [hidden]{display:none!important}.shell{height:100vh;height:100dvh;display:grid;grid-template-columns:288px minmax(0,1fr);overflow:hidden}.sidebar{display:flex;min-height:0;flex-direction:column;background:var(--sidebar);border-right:1px solid var(--line)}.brand{display:flex;align-items:center;gap:12px;margin:25px 20px 23px}.brand-mark{width:42px;height:42px;border-radius:13px;background:#39220d;box-shadow:0 3px 8px #70481735;overflow:hidden}.brand-mark img{width:100%;height:100%;display:block}.brand strong{display:block;font-size:21px;line-height:1.15;letter-spacing:-.6px}.brand small{font-size:9px;font-weight:800;letter-spacing:2px;color:var(--muted)}.sidebar-actions{padding:0 16px}.primary{background:var(--accent-fill);color:#ffffff;font-weight:650;border-radius:10px;min-height:40px;padding:9px 15px}.primary:hover,.send:hover{background:var(--accent-hover)}.new-chat{display:flex;align-items:center;justify-content:center;gap:9px;width:100%;margin-bottom:11px}.search{display:flex;align-items:center;gap:9px;padding:0 10px;height:40px;border:1px solid var(--line);background:var(--surface);border-radius:10px;color:var(--muted)}.search input{min-width:0;width:100%;border:none;background:transparent;outline:none;font-size:13px}.search kbd{border:1px solid var(--line);border-radius:4px;padding:0 4px;font-size:11px}.search svg{width:16px}nav{padding:17px 12px 8px}.section-label{display:flex;align-items:center;justify-content:space-between;margin:12px 8px 5px;color:var(--muted);font-size:10px;font-weight:800;letter-spacing:1.35px;text-transform:uppercase;min-height:28px}.section-label button{font-size:inherit;font-weight:inherit;letter-spacing:inherit;text-transform:inherit;padding:3px;display:flex;align-items:center;gap:7px}.section-label svg{width:14px;height:14px}.nav-row{display:flex;width:100%;align-items:center;gap:9px;text-align:left;padding:8px 10px;border-radius:8px;font-size:13px;color:var(--secondary);min-height:36px}.nav-row>span:nth-child(2){flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.nav-row small{color:var(--muted)}.nav-row.selected,.chat-row.selected{background:var(--soft);color:var(--accent-text)}.nav-row:hover,.chat-row:hover,.icon-btn:hover,.tool:hover{background:var(--hover)}.chat-list{min-height:0;overflow:auto;padding:0 12px 12px;flex:1}.chat-row{display:flex;align-items:center;gap:10px;width:100%;padding:8px;text-align:left;border-radius:10px;min-height:57px}.chat-row .row-text{flex:1;min-width:0}.row-text strong,.row-text small{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.row-text strong{font-size:13px}.row-text small{font-size:11px;color:var(--muted);margin-top:2px}.chat-symbol{width:32px;height:32px;border:1px solid var(--line);background:var(--surface);border-radius:9px;color:var(--accent-text)}.chat-symbol svg{width:15px}.sidebar-foot{border-top:1px solid var(--line);padding:11px 14px}.settings-button{width:100%;display:flex;gap:10px;align-items:center;padding:8px 5px;color:var(--secondary);font-size:13px;text-align:left}.settings-button .status-dot{margin-left:auto}.status-dot{display:inline-block;width:7px;height:7px;border-radius:50%;background:#598e77}.status-dot.demo{background:#c0893d}.conversation{background:var(--surface);display:flex;flex-direction:column;min-width:0;min-height:0}.chat-header{display:flex;align-items:center;min-height:76px;gap:12px;padding:12px 24px;border-bottom:1px solid var(--line)}.header-text{min-width:0;flex:1}.header-text h1{font-size:17px;margin:0;line-height:1.25;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;letter-spacing:-.25px}.header-text small{font-size:12px;color:var(--muted)}.header-controls{display:flex;align-items:center;gap:6px}.model-control{display:flex;background:var(--control);border:1px solid var(--line);border-radius:9px;color:var(--accent-text);align-items:stretch;overflow:hidden}.model-control button{display:flex;align-items:center;gap:6px;padding:7px 9px;font-size:12px;font-weight:650;min-height:36px}.model-control button:hover{background:var(--soft)}.model-control button+button{border-left:1px solid var(--line)}.model-control svg{width:14px;height:14px}.active-model{max-width:185px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.icon-btn{display:inline-grid;place-items:center;width:36px;height:36px;border-radius:8px;color:var(--muted);flex:none}.mobile-only{display:none}.thread{flex:1;min-height:0;overflow:auto;scrollbar-gutter:stable;padding:24px clamp(15px,5vw,56px);background:linear-gradient(var(--thread-top) 0%,var(--surface) 46%)}.thread-inner{max-width:790px;margin:auto}.date{display:flex;align-items:center;gap:14px;font-size:11px;color:var(--muted);margin:3px 0 27px}.date::before,.date::after{content:"";height:1px;background:var(--line);flex:1}.entry{display:flex;gap:11px;margin:0 0 21px;align-items:flex-start}.entry.user{justify-content:flex-end}.entry-main{min-width:0;max-width:min(86%,630px)}.entry.user .entry-main{max-width:min(84%,570px)}.identity{display:flex;align-items:center;gap:8px;margin:0 0 5px;font-size:12px;font-weight:700}.user .identity{justify-content:flex-end}.identity time{font-size:10px;color:var(--muted);font-weight:400}.avatar{width:31px;height:31px;background:var(--soft);color:var(--violet);border-radius:10px;margin-top:1px}.avatar svg{width:16px}.bubble{border:1px solid var(--line);border-radius:4px 15px 15px;padding:12px 15px;white-space:pre-wrap;overflow-wrap:anywhere;background:var(--bubble);font-size:14px;line-height:1.65}.user .bubble{border-radius:15px 4px 15px 15px;background:var(--user-bubble);border-color:var(--user-border)}.notice{margin:8px 0 20px;color:var(--warning);font-size:13px}.album{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px;width:min(400px,64vw);margin-bottom:8px}.album:only-child{margin-bottom:0}.album img,.album video{width:100%;height:105px;object-fit:cover;border-radius:7px;background:var(--media-bg)}.album a{color:var(--accent-text);font-size:12px}.run-card{border:1px solid var(--line);border-radius:13px;padding:12px 14px;margin:0 0 18px;background:var(--control);font-size:13px}.run-card header{display:flex;align-items:center;gap:8px;flex-wrap:wrap}.run-card header strong{flex:1}.run-card p{white-space:pre-wrap;overflow-wrap:anywhere;margin:8px 0}.run-card small{color:var(--muted)}.tag{background:var(--soft);color:var(--accent-text);border-radius:30px;padding:3px 8px;font-size:10px;font-weight:700}.progress{width:100%;height:6px;accent-color:var(--violet)}.empty{display:grid;place-content:center;text-align:center;min-height:160px;color:var(--muted);font-size:13px}.composer-area{padding:0 clamp(15px,5vw,56px) 13px;max-width:902px;width:100%;margin:auto auto 0}.composer{border:1px solid var(--line);border-radius:15px;padding:8px 9px;background:var(--surface);box-shadow:0 4px 20px #5f3c140e}.input-line{display:flex;align-items:flex-end;gap:8px}.input-line textarea{flex:1;width:0;border:none;padding:8px 2px;resize:none;min-height:38px;max-height:120px;background:transparent;outline:none;line-height:1.45}.send{width:38px;height:38px;border-radius:10px;background:var(--accent-fill);color:#ffffff}.composer-tools{display:flex;gap:7px;flex-wrap:wrap;border-top:1px solid var(--line);margin-top:8px;padding-top:7px}.tool{display:inline-flex;align-items:center;justify-content:center;gap:6px;padding:5px 8px;border-radius:7px;font-size:12px;color:var(--secondary);min-height:31px}.tool svg{width:14px;height:14px}.composer-footer{display:flex;justify-content:space-between;color:var(--muted);font-size:10px;margin-top:8px}.composer-footer .status-dot{margin-right:4px}.composer-status{font-size:12px;color:var(--warning)}.draft-files{display:flex;gap:8px;overflow:auto}.draft-item{flex:0 0 94px;background:var(--soft);border-radius:8px;padding:5px;margin-bottom:6px;min-width:0}.draft-item img,.draft-item video{display:block;width:100%;height:55px;object-fit:cover;border-radius:4px}.draft-item small{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.draft-item button{font-size:13px;padding:3px 5px}.hint{color:var(--muted);font-size:13px}.small-action{font-size:12px;color:var(--violet);font-weight:700;padding:5px 8px;border-radius:7px}.small-action:hover{background:var(--soft)}dialog{border:1px solid var(--line);border-radius:16px;color:var(--ink);padding:0;width:min(460px,calc(100% - 28px));max-height:calc(100dvh - 28px);box-shadow:0 16px 90px #35261344}dialog::backdrop{background:var(--backdrop)}#dialog-form>header,#dialog-form>footer{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:12px 16px;border-bottom:1px solid var(--line)}#dialog-form>footer{border-top:1px solid var(--line);border-bottom:none;justify-content:flex-end}#dialog-form h2{margin:0;font-size:17px}#dialog-body{padding:14px 16px}#dialog-body>p:first-child{margin-top:0}.field{display:grid;gap:5px;margin:0 0 12px;font-size:13px;font-weight:650}.field input,.field textarea,.field select,.copy-link{border:1px solid var(--line);border-radius:8px;padding:8px;background:var(--surface);width:100%;min-width:0;color:var(--ink)}.field textarea{min-height:80px;resize:vertical}.option,.integration,.order-row{display:flex;gap:9px;align-items:center;padding:8px 0;border-bottom:1px solid var(--line);overflow-wrap:anywhere;font-size:13px}.option input{accent-color:var(--violet)}.integration>div,.order-row>span{flex:1;min-width:0}.integration small{display:block;color:var(--muted)}.options-list{max-height:180px;overflow:auto}.menu-action{width:100%;display:flex;gap:8px;text-align:left;padding:9px;border-radius:8px}.menu-action:hover{background:var(--soft)}.dialog-error{color:var(--error);font-size:12px;padding:0 16px}.dialog-error:empty{display:none}.toast{position:fixed;z-index:3;bottom:20px;left:50%;transform:translateX(-50%);background:#38230e;color:#ffffff;border-radius:9px;padding:9px 13px;font-size:13px;max-width:calc(100% - 25px)}.dragging{opacity:.5}
@media(max-width:700px){.shell{grid-template-columns:minmax(0,1fr)}.sidebar{display:none;border:0}.shell.show-list .sidebar{display:flex}.shell.show-list .conversation{display:none}.mobile-only{display:inline-grid}.chat-header{padding:8px 9px;min-height:58px;gap:5px}.chat-header .chat-symbol{display:none}.active-model{max-width:112px}.header-controls{gap:2px}.thread{padding:17px 12px}.composer-area{padding:0 10px max(7px,env(safe-area-inset-bottom))}.entry{gap:6px}.entry-main{max-width:calc(100% - 36px)}.input-line textarea,.field input,.field select,.field textarea{font-size:16px}.brand{margin-top:18px}.chat-list{padding-bottom:5px}}
@media(max-width:365px){.active-model{max-width:76px}.model-control button{padding-inline:5px}.chat-header .icon-btn{width:30px}.composer-tools .tool{font-size:11px}}


.chat-header .language-picker { margin: 0 0 0 auto; }

.model-results { max-height: min(37vh, 23rem); overflow: auto; margin-bottom: .8rem; }
.model-result { display: flex; align-items: center; gap: .4rem; border-bottom: 1px solid var(--line); }
.model-result label { display: flex; align-items: center; gap: .55rem; flex: 1; min-width: 0; padding: .55rem .25rem; cursor: pointer; }
.model-result label span { min-width: 0; overflow-wrap: anywhere; }
.model-result small { display: block; opacity: .75; }
.model-star { flex: 0 0 44px; min-height: 44px; border: 0; background: transparent; color: inherit; font-size: 1.45rem; cursor: pointer; }
.model-star.favorite { color: var(--star); background: var(--star-bg); border-radius: .55rem; }

dialog { background: var(--surface); }
input, textarea { color: var(--ink); }
input::placeholder, textarea::placeholder { color: var(--muted); }
.appearance-pickers { display: flex; flex-wrap: wrap; gap: 10px; }
.appearance-pickers > .field { flex: 1 1 125px; }
.chat-header > .appearance-pickers { margin-left: auto; }
.chat-header > .appearance-pickers > .field { margin: 0; }

.menu-action[data-dialog=delete] { color: var(--error); }
.primary.danger { background: #a52a46; color: #fff; }
.primary.danger:hover { background: #8a203a; }

.delete-chat { color: var(--error); }
.install-app { min-height: 44px; }
@media (max-width: 700px) {
  .chat-header .delete-chat { width: 44px; height: 44px; }
}

.sidebar { position: relative; }
.sidebar nav { overflow-y: auto; max-height: 43%; flex-shrink: 0; }
.sidebar [data-kind] { user-select: none; -webkit-touch-callout: none; }
.nav-row[data-kind=folder] { padding-inline-start: calc(10px + var(--folder-indent)); }
#drop-trash {
  position: absolute; z-index: 2; right: 12px; bottom: max(14px, env(safe-area-inset-bottom));
  left: 12px; min-height: 57px; display: flex; align-items: center; justify-content: center;
  gap: 8px; border-radius: 12px; border: 2px dashed var(--error);
  background: var(--surface); color: var(--error); font-weight: 700;
}
[data-drop-highlight=inside], [data-drop-highlight=root], [data-drop-highlight=pin] {
  background: var(--soft); outline: 2px solid var(--focus); outline-offset: -2px;
}
[data-drop-highlight=before] { box-shadow: inset 0 3px var(--focus); }
[data-drop-highlight=after] { box-shadow: inset 0 -3px var(--focus); }
#drop-trash[data-drop-highlight=trash] { border-style: solid; background: var(--error); color: var(--surface); }
#undo-list {
  position: fixed; z-index: 4; bottom: max(18px, env(safe-area-inset-bottom)); right: 14px;
  display: grid; gap: 6px; max-width: calc(100% - 28px);
}
.undo-delete {
  display: flex; align-items: center; gap: 9px; min-height: 44px; border-radius: 12px;
  padding: 8px 12px; background: #38230e; color: #fff;
}
.undo-delete strong { text-decoration: underline; }
.undo-delete svg { width: 22px; height: 22px; transform: rotate(-90deg); }
.undo-delete circle {
  fill: none; stroke: #fff; stroke-width: 2; stroke-dasharray: 56.55;
  animation: undo-countdown 5s linear var(--elapsed) both;
}
@keyframes undo-countdown { to { stroke-dashoffset: 56.55; } }

[data-provider-panel] { margin-top: 12px; min-width: 0; }
[data-provider-panel] select { text-overflow: ellipsis; }
.provider-note { margin: -5px 0 12px; }

.drag-handle { display: none; }
@media (any-pointer: coarse) {
  .drag-handle {
    display: inline-grid; flex: none; place-items: center; min-width: 36px; align-self: stretch;
    color: var(--muted); touch-action: none; -webkit-user-drag: none;
  }
  .drag-handle svg { pointer-events: none; transform: rotate(90deg); }
}

[data-refresh-catalog] { margin: 0 0 8px; }
[data-refresh-prices] { margin: 0 0 12px; }

.reply-status { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; margin: 3px 0 8px; }
.reply-pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--accent-text); animation: reply-pulse 1.4s ease-in-out infinite; }
@keyframes reply-pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .reply-pulse { animation: none; } }
.reply-tools { color: var(--muted); font-size: 12px; margin: 6px 0 8px; overflow-wrap: anywhere; }
.reply-tools ul { padding-inline-start: 18px; margin: 5px 0; }
.reply-tools li span { color: var(--secondary); margin-inline-start: 6px; }

#dictation { width: 44px; height: 44px; }
#dictation[aria-pressed=true] { color: var(--error); background: var(--soft); }
#dictation-status { color: var(--muted); font-size: 12px; padding: 4px 6px; overflow-wrap: anywhere; }
#dictation-status:empty { display: none; }

.brand-mark { display: block; flex: none; }
.sign-in-brand { display: flex; align-items: center; gap: 9px; min-width: 0; }
.sign-in-brand strong { overflow: hidden; text-overflow: ellipsis; font-size: 16px; }
.sign-in-brand .brand-mark { width: 36px; height: 36px; border-radius: 11px; }
@media (max-width: 420px) {
  .sign-in-brand { flex-direction: column; align-items: flex-start; gap: 4px; }
  .sign-in-brand strong { font-size: 12px; }
}
