/* gokkayak.fr — chat UI. Monochrome, restraint-first, professional. */
:root{
  --bg:#0a0a0c; --surface:#141417; --surface-2:#0f0f11; --surface-3:#1c1c20;
  --border:#27272c; --hairline:rgba(255,255,255,.055);
  --ink:#f2f2f4; --ink-2:#c7c7cd; --muted:#7d7d86;
  --accent:#e8e8ea; --success:#3ecf8e; --danger:#e5533b;
  --radius:12px; --shadow:0 24px 64px rgba(0,0,0,.55);
  --sidebar-w:280px;
}
*{box-sizing:border-box;margin:0;padding:0}
html,body{height:100%}
body{
  background:var(--bg);
  color:var(--ink);
  font-family:system-ui,-apple-system,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
  font-size:15px;line-height:1.55;
  -webkit-font-smoothing:antialiased;
  overscroll-behavior:none;
}
a{color:var(--ink);text-decoration:none}
button{font-family:inherit;cursor:pointer}
img{max-width:100%}

/* ---------- login ---------- */
.login-wrap{min-height:100vh;display:flex;align-items:center;justify-content:center;padding:20px}
.login-card{width:380px;max-width:100%;background:var(--surface);border:1px solid var(--border);
  border-radius:var(--radius);padding:36px;box-shadow:var(--shadow)}
.login-card .logo{display:flex;align-items:center;gap:11px;margin-bottom:8px}
.login-card .dot{width:11px;height:11px;border-radius:50%;background:var(--ink)}
.login-card h1{font-size:20px;font-weight:600;letter-spacing:.2px}
.login-card .sub{color:var(--muted);font-size:13px;margin-bottom:26px}
.login-card label{display:block;font-size:12px;color:var(--muted);margin:0 0 8px}
.login-card input{width:100%;padding:13px 14px;border-radius:8px;border:1px solid var(--border);
  background:var(--surface-2);color:var(--ink);font-size:16px;outline:none;letter-spacing:2px;
  text-align:center}
.login-card input:focus{border-color:var(--accent)}
.login-card button{width:100%;margin-top:20px;padding:13px;border:none;border-radius:8px;
  background:var(--ink);color:var(--bg);font-size:15px;font-weight:600}
.login-card button:hover{background:#fff}
.login-card .err{color:var(--danger);font-size:13px;margin-top:14px;text-align:center;min-height:18px}

/* ---------- layout ---------- */
#app{display:flex;height:100vh;height:100dvh;overflow:hidden}
.sidebar{width:var(--sidebar-w);flex:none;background:var(--surface);border-right:1px solid var(--border);
  display:flex;flex-direction:column;transition:transform .25s ease}
.sidebar .head{padding:16px;display:flex;align-items:center;justify-content:space-between;
  border-bottom:1px solid var(--border)}
.sidebar .brand{display:flex;align-items:center;gap:9px;font-weight:600;font-size:15px}
.sidebar .brand .dot{width:10px;height:10px;border-radius:50%;background:var(--ink)}
.icon-btn{background:none;border:none;color:var(--muted);padding:6px;border-radius:7px;line-height:0}
.icon-btn:hover{color:var(--ink);background:var(--surface-3)}
.new-chat{margin:14px 14px 8px;padding:11px 14px;border:1px solid var(--border);border-radius:9px;
  background:var(--surface-2);color:var(--ink);font-weight:600;font-size:14px;text-align:left;
  display:flex;align-items:center;gap:9px}
.new-chat:hover{border-color:var(--accent)}
.chat-list{flex:1;overflow-y:auto;padding:6px 8px}
.chat-item{display:flex;align-items:center;gap:8px;padding:10px 10px;border-radius:8px;
  color:var(--ink-2);font-size:13.5px;cursor:pointer;position:relative}
.chat-item:hover{background:var(--surface-3);color:var(--ink)}
.chat-item.active{background:var(--surface-3);color:var(--ink)}
.chat-item .t{flex:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.chat-item .del{opacity:0;border:none;background:none;color:var(--muted);font-size:16px;padding:2px 6px}
.chat-item:hover .del{opacity:1}
.chat-item .del:hover{color:var(--danger)}
.sidebar .foot{border-top:1px solid var(--border);padding:12px;display:flex;flex-direction:column;gap:4px}
.foot-btn{display:flex;align-items:center;gap:10px;padding:9px 10px;border-radius:8px;background:none;
  border:none;color:var(--ink-2);font-size:13.5px;text-align:left;width:100%}
.foot-btn:hover{background:var(--surface-3);color:var(--ink)}
.foot-btn .who{flex:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}

.main{flex:1;display:flex;flex-direction:column;min-width:0;position:relative}
.topbar{display:flex;align-items:center;gap:10px;padding:12px 16px;border-bottom:1px solid var(--border);
  background:rgba(10,10,12,.6);backdrop-filter:blur(6px);z-index:5}
.topbar .menu-btn{display:none}
.model-btn{display:flex;align-items:center;gap:8px;background:var(--surface-2);
  border:1px solid var(--border);color:var(--ink);padding:8px 13px;border-radius:8px;
  font-size:13.5px;font-weight:600;max-width:100%}
.model-btn:hover{border-color:var(--accent)}
.model-btn .chev{color:var(--muted)}
.pool-pill{margin-left:auto;display:flex;align-items:center;gap:7px;font-size:12.5px;color:var(--muted);
  border:1px solid var(--border);background:var(--surface-2);padding:7px 12px;border-radius:999px;
  white-space:nowrap}
.pool-pill .v{color:var(--success);font-weight:600;font-variant-numeric:tabular-nums}

/* ---------- messages ---------- */
.chat-scroll{flex:1;overflow-y:auto;padding:26px 0 30px}
.chat-inner{max-width:820px;margin:0 auto;padding:0 18px;display:flex;flex-direction:column;gap:22px}
.empty{margin:auto;text-align:center;color:var(--muted);padding:60px 20px}
.empty h2{color:var(--ink);font-size:22px;font-weight:600;margin-bottom:8px}
.empty p{font-size:14px}
.msg{display:flex;gap:14px}
.msg .avatar{width:30px;height:30px;border-radius:7px;flex:none;display:flex;align-items:center;
  justify-content:center;font-size:13px;font-weight:600;margin-top:2px}
.msg.user .avatar{background:var(--surface-3);color:var(--ink-2)}
.msg.assistant .avatar{background:var(--surface-3);border:1px solid var(--border);color:var(--muted)}
.msg.assistant .avatar.ai::after{content:'';width:6px;height:6px;border-radius:50%;background:var(--ink)}
.msg .bubble{min-width:0;flex:1}
.msg.user .bubble{background:var(--surface-3);border:1px solid var(--border);border-radius:12px;
  padding:11px 14px;width:fit-content;max-width:100%}
.msg.assistant .bubble{padding-top:2px}
.msg .bubble .imgs{display:flex;flex-wrap:wrap;gap:8px;margin-bottom:10px}
.msg .bubble .imgs img{max-height:180px;border-radius:9px;border:1px solid var(--border)}
.msg .text{white-space:pre-wrap;word-break:break-word;overflow-wrap:anywhere}
.msg .text code{background:var(--surface-2);border:1px solid var(--border);border-radius:5px;
  padding:1px 6px;font-size:13px;font-family:ui-monospace,SFMono-Regular,Menlo,monospace}
.typing{display:inline-flex;gap:5px;padding:8px 2px}
.typing span{width:7px;height:7px;border-radius:50%;background:var(--muted);
  animation:blink 1.2s infinite}
.typing span:nth-child(2){animation-delay:.2s}
.typing span:nth-child(3){animation-delay:.4s}
@keyframes blink{0%,60%,100%{opacity:.25}30%{opacity:1}}

/* ---------- composer ---------- */
.composer{padding:12px 16px calc(12px + env(safe-area-inset-bottom))}
.composer-inner{max-width:820px;margin:0 auto;background:var(--surface);
  border:1px solid var(--border);border-radius:14px;padding:10px 10px 8px;
  box-shadow:0 8px 30px rgba(0,0,0,.35)}
.composer-inner:focus-within{border-color:var(--accent)}
.thumbs{display:flex;gap:8px;flex-wrap:wrap;padding:2px 4px 10px}
.thumb{position:relative}
.thumb img{height:64px;width:64px;object-fit:cover;border-radius:8px;border:1px solid var(--border)}
.thumb button{position:absolute;top:-6px;right:-6px;width:20px;height:20px;border-radius:50%;
  background:var(--surface-3);border:1px solid var(--border);color:var(--ink);font-size:12px;line-height:1}
.composer-row{display:flex;align-items:flex-end;gap:8px}
.attach-btn,.send-btn{width:38px;height:38px;border-radius:9px;border:none;flex:none;
  display:flex;align-items:center;justify-content:center}
.attach-btn{background:none;color:var(--muted)}
.attach-btn:hover{color:var(--ink);background:var(--surface-3)}
#input{flex:1;background:none;border:none;outline:none;resize:none;color:var(--ink);
  font-size:15px;line-height:1.5;max-height:180px;padding:8px 4px;font-family:inherit}
#input::placeholder{color:var(--muted)}
.send-btn{background:var(--ink);color:var(--bg)}
.send-btn:disabled{background:var(--surface-3);color:var(--muted);cursor:default}
.send-btn.stop{background:var(--surface-3);color:var(--ink)}

/* ---------- overlays: sheets + modal ---------- */
.overlay{position:fixed;inset:0;background:rgba(0,0,0,.55);z-index:40;opacity:0;
  pointer-events:none;transition:opacity .2s}
.overlay.show{opacity:1;pointer-events:auto}
.sheet{position:fixed;left:50%;bottom:0;transform:translate(-50%,100%);width:min(560px,100%);
  background:var(--surface);border:1px solid var(--border);border-bottom:none;
  border-radius:16px 16px 0 0;z-index:41;max-height:78vh;display:flex;flex-direction:column;
  transition:transform .25s ease}
.sheet.show{transform:translate(-50%,0)}
.sheet .grab{padding:12px;display:flex;justify-content:center}
.sheet .grab i{width:40px;height:4px;border-radius:99px;background:var(--surface-3)}
.sheet h3{padding:0 20px 12px;font-size:16px;font-weight:600;border-bottom:1px solid var(--border)}
.sheet .scroll{overflow-y:auto;padding:8px 12px 20px}
.opt{display:flex;align-items:center;gap:12px;width:100%;padding:12px 12px;border-radius:9px;
  background:none;border:none;color:var(--ink);text-align:left;font-size:14px}
.opt:hover{background:var(--surface-3)}
.opt .meta{flex:1;min-width:0}
.opt .meta .n{font-weight:600}
.opt .meta .d{color:var(--muted);font-size:12px}
.opt.sel{background:var(--surface-3)}
.opt .check{color:var(--success);opacity:0}
.opt.sel .check{opacity:1}
.back-row{display:flex;align-items:center;gap:10px;padding:12px 12px;color:var(--ink-2);
  background:none;border:none;font-size:14px;width:100%}
.back-row:hover{background:var(--surface-3);color:var(--ink)}

.modal{position:fixed;left:50%;top:50%;transform:translate(-50%,-50%) scale(.97);opacity:0;
  pointer-events:none;width:min(680px,94vw);max-height:86vh;background:var(--surface);
  border:1px solid var(--border);border-radius:14px;z-index:42;display:flex;flex-direction:column;
  box-shadow:var(--shadow);transition:opacity .2s,transform .2s}
.modal.show{opacity:1;pointer-events:auto;transform:translate(-50%,-50%) scale(1)}
.modal .m-head{display:flex;align-items:center;justify-content:space-between;
  padding:18px 22px;border-bottom:1px solid var(--border)}
.modal .m-head h3{font-size:17px;font-weight:600}
.modal .m-body{overflow-y:auto;padding:20px 22px}
.m-section{margin-bottom:28px}
.m-section h4{font-size:12px;text-transform:uppercase;letter-spacing:.6px;color:var(--muted);
  margin-bottom:12px;font-weight:600}
.gauge{height:8px;border-radius:99px;background:var(--surface-2);border:1px solid var(--border);
  overflow:hidden;margin:8px 0 4px}
.gauge i{display:block;height:100%;background:var(--success);transition:width .5s}
.kv{display:flex;justify-content:space-between;font-size:13.5px;padding:5px 0;color:var(--ink-2)}
.kv b{color:var(--ink);font-variant-numeric:tabular-nums}
table.price{width:100%;border-collapse:collapse;font-size:13px}
table.price th{text-align:left;color:var(--muted);font-weight:600;font-size:11.5px;
  text-transform:uppercase;letter-spacing:.4px;padding:8px 6px;border-bottom:1px solid var(--border)}
table.price td{padding:9px 6px;border-bottom:1px solid var(--hairline);font-variant-numeric:tabular-nums}
table.price td:first-child{font-weight:600}
.admin-row{display:flex;align-items:center;gap:12px;padding:10px 0;border-bottom:1px solid var(--hairline)}
.admin-row .n{flex:1;font-weight:600}
.admin-row .badge{font-size:11px;color:var(--muted);border:1px solid var(--border);
  padding:2px 8px;border-radius:99px}
.admin-row .badge.admin{color:var(--ink);border-color:var(--muted)}
.field{display:flex;gap:8px;margin-top:10px}
.field input{flex:1;padding:10px 12px;border-radius:8px;border:1px solid var(--border);
  background:var(--surface-2);color:var(--ink);font-size:14px;outline:none}
.field input:focus{border-color:var(--accent)}
.btn{padding:10px 16px;border-radius:8px;border:1px solid var(--border);background:var(--surface-2);
  color:var(--ink);font-size:13.5px;font-weight:600}
.btn:hover{border-color:var(--accent)}
.btn.primary{background:var(--ink);border-color:var(--ink);color:var(--bg)}
.btn.primary:hover{background:#fff}
.btn.danger{color:var(--danger)}
.btn.sm{padding:6px 12px;font-size:12.5px}
.toast{position:fixed;left:50%;bottom:26px;transform:translateX(-50%) translateY(20px);
  background:var(--surface);border:1px solid var(--border);color:var(--ink);padding:12px 20px;
  border-radius:10px;box-shadow:var(--shadow);opacity:0;transition:.25s;z-index:60;font-size:13.5px;
  pointer-events:none;max-width:90vw}
.toast.show{opacity:1;transform:translateX(-50%) translateY(0)}

/* ---------- mobile ---------- */
@media (max-width:860px){
  .sidebar{position:fixed;left:0;top:0;bottom:0;z-index:30;transform:translateX(-100%)}
  .sidebar.open{transform:translateX(0)}
  .topbar .menu-btn{display:flex}
  .pool-pill span.lbl{display:none}
  .chat-inner{max-width:100%}
}
