*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg:#0e0e0e; --surface:#161616; --surface2:#1e1e1e; --surface3:#252525;
  --border:rgba(255,255,255,0.07); --text:#e8e4dc; --text-muted:#7a7670;
  --accent:#c8a96e; --accent2:#7eb8c9; --iris:#b89fd4; --radius:12px;
}
html { scroll-behavior:smooth; }
body { background:var(--bg); color:var(--text); font-family:'DM Sans',sans-serif; font-weight:300; min-height:100vh; }

/* NAV */
nav { position:fixed; top:0; left:0; right:0; z-index:100; display:flex; align-items:center; justify-content:space-between; padding:1.2rem 3rem; background:rgba(14,14,14,0.92); backdrop-filter:blur(20px); border-bottom:1px solid var(--border); }
.nav-logo { font-family:'Cormorant Garamond',serif; font-size:1.4rem; font-weight:300; letter-spacing:0.06em; color:var(--text); text-decoration:none; }
.nav-logo .g { color:var(--accent); } .nav-logo .p { color:var(--accent2); }
.nav-back { color:var(--text-muted); text-decoration:none; font-size:0.76rem; letter-spacing:0.12em; text-transform:uppercase; transition:color .25s; display:flex; align-items:center; gap:0.5rem; }
.nav-back:hover { color:var(--text); }
.lang-toggle { display:flex; background:var(--surface2); border-radius:6px; overflow:hidden; border:1px solid var(--border); }
.lang-btn { background:none; border:none; color:var(--text-muted); padding:0.32rem 0.65rem; font-size:0.72rem; cursor:pointer; transition:all .2s; font-family:'DM Sans',sans-serif; }
.lang-btn.active { background:var(--iris); color:#fff; font-weight:500; }

/* LAYOUT */
.page { padding-top: 80px; min-height:100vh; display:flex; flex-direction:column; }
.page-header { padding:3rem 3rem 2rem; border-bottom:1px solid var(--border); }
.page-title { font-family:'Cormorant Garamond',serif; font-size:2.4rem; font-weight:300; margin-bottom:0.5rem; }
.page-title span { color:var(--iris); font-style:italic; }
.page-sub { font-size:0.85rem; color:var(--text-muted); line-height:1.65; max-width:520px; }

/* EMAIL AUTH */
.auth-bar { background:rgba(184,159,212,0.05); border:1px solid rgba(184,159,212,0.15); border-radius:var(--radius); padding:1.2rem 1.5rem; margin-top:1.2rem; }
.auth-bar.hidden { display:none; }
.auth-label { font-size:0.72rem; letter-spacing:0.1em; text-transform:uppercase; color:var(--iris); margin-bottom:0.7rem; }
.auth-row { display:flex; gap:0.7rem; flex-wrap:wrap; }
.auth-input { flex:1; min-width:200px; background:var(--surface2); border:1px solid var(--border); color:var(--text); border-radius:8px; padding:0.55rem 1rem; font-size:0.84rem; font-family:'DM Sans',sans-serif; outline:none; transition:border-color .2s; }
.auth-input:focus { border-color:var(--iris); }
.auth-input::placeholder { color:var(--text-muted); }
.auth-btn { background:linear-gradient(135deg,var(--iris),var(--accent2)); border:none; color:#0e0e0e; padding:0 1.3rem; height:38px; border-radius:8px; cursor:pointer; font-size:0.78rem; font-family:'DM Sans',sans-serif; font-weight:500; white-space:nowrap; transition:opacity .2s; }
.auth-btn:hover { opacity:0.85; }
.auth-note { font-size:0.7rem; color:var(--text-muted); margin-top:0.6rem; opacity:0.7; }
.auth-saved { display:flex; align-items:center; gap:0.6rem; font-size:0.78rem; color:var(--text-muted); }
.auth-saved-email { color:var(--iris); }
.auth-change { background:none; border:none; color:var(--text-muted); font-size:0.7rem; cursor:pointer; font-family:'DM Sans',sans-serif; text-decoration:underline; transition:color .2s; }
.auth-change:hover { color:var(--text); }
.auth-limit { font-size:0.72rem; color:var(--text-muted); margin-top:0.4rem; }
.limit-used { color:var(--accent); }

.workspace { display:grid; grid-template-columns:1fr 1fr; gap:0; flex:1; }

/* LEFT — Upload & Preview */
.doc-panel { padding:2.5rem 3rem; border-right:1px solid var(--border); display:flex; flex-direction:column; gap:1.5rem; }
.panel-label { font-size:0.7rem; letter-spacing:0.18em; text-transform:uppercase; color:var(--text-muted); margin-bottom:0.8rem; }

/* Drop zone */
.drop-zone { border:2px dashed var(--border); border-radius:var(--radius); padding:2.5rem 1.5rem; text-align:center; cursor:pointer; transition:all .25s; position:relative; }
.drop-zone:hover, .drop-zone.drag-over { border-color:rgba(184,159,212,0.4); background:rgba(184,159,212,0.04); }
.drop-zone input[type=file] { position:absolute; inset:0; opacity:0; cursor:pointer; }
.drop-icon { font-size:2rem; margin-bottom:0.8rem; opacity:0.4; }
.drop-title { font-family:'Cormorant Garamond',serif; font-size:1.1rem; color:var(--text-muted); margin-bottom:0.4rem; }
.drop-sub { font-size:0.72rem; color:var(--text-muted); opacity:0.5; line-height:1.6; }
.drop-types { display:flex; justify-content:center; gap:0.5rem; margin-top:0.8rem; flex-wrap:wrap; }
.type-pill { font-size:0.62rem; letter-spacing:0.1em; padding:0.18rem 0.6rem; border-radius:20px; border:1px solid var(--border); color:var(--text-muted); }
.type-pdf  { border-color:rgba(200,100,100,0.3); color:#e09090; }
.type-txt  { border-color:rgba(100,200,100,0.3); color:#90c090; }
.type-docx { border-color:rgba(100,150,200,0.3); color:var(--accent2); }
.type-md   { border-color:rgba(200,169,110,0.3); color:var(--accent); }

/* File info */
.file-info { background:var(--surface2); border-radius:10px; padding:1rem 1.2rem; border:1px solid var(--border); display:none; }
.file-info.visible { display:block; }
.file-info-row { display:flex; align-items:center; justify-content:space-between; }
.file-name { font-size:0.85rem; font-weight:500; color:var(--text); display:flex; align-items:center; gap:0.5rem; }
.file-icon { font-size:1.1rem; }
.file-meta { font-size:0.72rem; color:var(--text-muted); margin-top:0.35rem; }
.file-remove { background:none; border:none; color:var(--text-muted); cursor:pointer; font-size:1rem; padding:0.2rem; transition:color .2s; }
.file-remove:hover { color:#e09090; }

/* Progress */
.parse-progress { background:var(--surface2); border-radius:8px; padding:0.8rem 1rem; border:1px solid var(--border); display:none; }
.parse-progress.visible { display:flex; align-items:center; gap:0.8rem; }
.spin { width:16px; height:16px; border:2px solid var(--border); border-top-color:var(--iris); border-radius:50%; animation:spin .8s linear infinite; flex-shrink:0; }
@keyframes spin{to{transform:rotate(360deg)}}
.parse-text { font-size:0.8rem; color:var(--text-muted); }

/* Doc preview */
.doc-preview { background:var(--surface2); border-radius:var(--radius); border:1px solid var(--border); overflow:hidden; flex:1; min-height:300px; }
.doc-preview-header { padding:0.8rem 1.2rem; border-bottom:1px solid var(--border); display:flex; align-items:center; justify-content:space-between; }
.doc-preview-title { font-size:0.72rem; letter-spacing:0.12em; text-transform:uppercase; color:var(--text-muted); }
.doc-preview-stats { font-size:0.68rem; color:var(--accent); }
.doc-preview-body { padding:1.2rem; height:320px; overflow-y:auto; font-size:0.8rem; line-height:1.75; color:var(--text-muted); scrollbar-width:thin; white-space:pre-wrap; word-break:break-word; }
.doc-preview-empty { display:flex; flex-direction:column; align-items:center; justify-content:center; height:100%; opacity:0.35; }
.doc-preview-empty-icon { font-size:2rem; margin-bottom:0.5rem; }
.doc-preview-empty-text { font-size:0.78rem; }

/* RIGHT — Chat */
.chat-panel { padding:2.5rem 3rem; display:flex; flex-direction:column; gap:1rem; }
.model-row { display:flex; align-items:center; gap:0.8rem; flex-wrap:wrap; }
.model-label { font-size:0.7rem; letter-spacing:0.12em; text-transform:uppercase; color:var(--text-muted); }
.model-select { background:var(--surface2); border:1px solid var(--border); color:var(--text); border-radius:8px; padding:0.45rem 2rem 0.45rem 0.9rem; font-size:0.78rem; font-family:'DM Sans',sans-serif; outline:none; cursor:pointer; appearance:none; background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%237a7670' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat:no-repeat; background-position:right 0.7rem center; transition:border-color .2s; }
.model-select:focus { border-color:var(--iris); }

/* Chat messages */
.chat-box { background:var(--surface2); border:1px solid var(--border); border-radius:var(--radius); overflow:hidden; flex:1; display:flex; flex-direction:column; }
.chat-msgs { flex:1; overflow-y:auto; padding:1.2rem; display:flex; flex-direction:column; gap:0.8rem; scrollbar-width:thin; min-height:320px; max-height:420px; }
.cmsg { max-width:88%; padding:0.8rem 1.1rem; border-radius:12px; font-size:0.82rem; line-height:1.6; animation:msgIn .2s ease; white-space:pre-wrap; word-break:break-word; }
@keyframes msgIn { from{opacity:0;transform:translateY(4px)} to{opacity:1;transform:translateY(0)} }
.cmsg.bot { background:var(--surface3); align-self:flex-start; border-bottom-left-radius:4px; }
.cmsg.user { background:linear-gradient(135deg,var(--iris),var(--accent2)); color:#0e0e0e; align-self:flex-end; border-bottom-right-radius:4px; font-weight:400; }
.cmsg.typing { color:var(--text-muted); font-style:italic; }

/* Suggestions */
.chat-sugg { padding:0.5rem 1rem; display:flex; flex-wrap:wrap; gap:0.4rem; border-top:1px solid var(--border); }
.csugg { background:var(--surface3); border:1px solid var(--border); color:var(--text-muted); border-radius:20px; padding:0.26rem 0.8rem; font-size:0.7rem; cursor:pointer; transition:all .2s; font-family:'DM Sans',sans-serif; }
.csugg:hover { border-color:var(--iris); color:var(--iris); }
.csugg:disabled { opacity:0.3; cursor:not-allowed; }

/* Input */
.chat-inp-row { display:flex; gap:0.5rem; padding:0.8rem; border-top:1px solid var(--border); }
.chat-inp { flex:1; background:var(--surface3); border:1px solid var(--border); color:var(--text); border-radius:8px; padding:0.55rem 0.9rem; font-size:0.82rem; font-family:'DM Sans',sans-serif; outline:none; transition:border-color .2s; resize:none; height:42px; }
.chat-inp:focus { border-color:var(--iris); }
.chat-inp::placeholder { color:var(--text-muted); }
.chat-inp:disabled { opacity:0.4; cursor:not-allowed; }
.chat-send { background:linear-gradient(135deg,var(--iris),var(--accent2)); border:none; color:#0e0e0e; padding:0 1.1rem; height:42px; border-radius:8px; cursor:pointer; font-size:0.78rem; font-family:'DM Sans',sans-serif; font-weight:500; white-space:nowrap; transition:opacity .2s; }
.chat-send:hover:not(:disabled) { opacity:0.85; }
.chat-send:disabled { opacity:0.35; cursor:not-allowed; }

/* No doc warning */
.no-doc-banner { background:rgba(184,159,212,0.06); border:1px solid rgba(184,159,212,0.15); border-radius:8px; padding:0.7rem 1rem; font-size:0.78rem; color:var(--iris); display:none; }
.no-doc-banner.visible { display:block; }

/* Clear btn */
.clear-btn { background:none; border:1px solid var(--border); color:var(--text-muted); border-radius:6px; padding:0.3rem 0.8rem; font-size:0.7rem; cursor:pointer; font-family:'DM Sans',sans-serif; transition:all .2s; }
.clear-btn:hover { border-color:rgba(224,144,144,0.4); color:#e09090; }

/* Tip box */
.tip-box { background:var(--surface2); border-radius:var(--radius); padding:1.2rem 1.5rem; border:1px solid var(--border); font-size:0.78rem; color:var(--text-muted); line-height:1.7; }
.tip-box strong { color:var(--text); }
.tip-box code { color:var(--iris); background:rgba(184,159,212,0.08); padding:0.1rem 0.35rem; border-radius:3px; font-size:0.74rem; }

footer { padding:2rem 3rem; border-top:1px solid var(--border); display:flex; align-items:center; justify-content:space-between; color:var(--text-muted); font-size:0.74rem; }
.footer-logo { font-family:'Cormorant Garamond',serif; font-size:1rem; }
.fl-g{color:var(--accent);} .fl-p{color:var(--accent2);}

@media(max-width:900px){
  .workspace { grid-template-columns:1fr; }
  .doc-panel { border-right:none; border-bottom:1px solid var(--border); }
  nav { padding:1rem 1.5rem; }
  .page-header,.doc-panel,.chat-panel { padding:2rem 1.5rem; }
  footer { padding:1.5rem; flex-direction:column; gap:0.6rem; text-align:center; }
}
