:root {
  --ink: #eaf7f1;
  --muted: #8aa399;
  --faint: #53675f;
  --bg: #07100d;
  --panel: rgba(12, 25, 20, .9);
  --panel-2: #10231c;
  --line: rgba(150, 192, 174, .14);
  --mint: #75f1bd;
  --mint-2: #31c887;
  --amber: #f7bf6a;
  --danger: #ff8c86;
  --shadow: 0 28px 80px rgba(0, 0, 0, .34);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--bg);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; background: radial-gradient(circle at 20% 15%, #102820 0, transparent 33%), var(--bg); overflow-x: hidden; }
button, textarea, input { font: inherit; }
button, a, label { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }

.ambient { position: fixed; border-radius: 999px; filter: blur(90px); pointer-events: none; opacity: .16; }
.ambient-a { width: 420px; height: 420px; right: -180px; top: 12%; background: #31c887; }
.ambient-b { width: 300px; height: 300px; left: 36%; bottom: -180px; background: #c7ff53; opacity: .08; }

.brand { display: inline-flex; align-items: center; gap: 12px; letter-spacing: .08em; }
.brand-mark { display: grid; place-items: center; width: 42px; height: 42px; border: 1px solid rgba(117, 241, 189, .45); background: rgba(117, 241, 189, .08); color: var(--mint); font: 700 20px/1 Georgia, serif; transform: rotate(45deg); }
.brand-mark b { transform: rotate(-45deg); }
.brand > span:last-child { display: flex; flex-direction: column; gap: 2px; }
.brand strong { font-size: 15px; }
.brand small { color: var(--muted); font-size: 8px; letter-spacing: .18em; }
.brand.compact .brand-mark { width: 35px; height: 35px; font-size: 17px; }

.login-view { min-height: 100vh; padding: 28px clamp(24px, 5vw, 76px) 48px; position: relative; z-index: 1; }
.landing-nav { display: flex; justify-content: space-between; align-items: center; max-width: 1400px; margin: auto; }
.nav-link { font-size: 12px; color: var(--muted); letter-spacing: .08em; transition: color .2s; }
.nav-link:hover { color: var(--mint); }
.login-grid { min-height: calc(100vh - 120px); max-width: 1280px; margin: auto; display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(340px, .7fr); gap: clamp(50px, 9vw, 140px); align-items: center; }
.hero-copy { max-width: 760px; }
.eyebrow { display: inline-flex; align-items: center; gap: 10px; color: var(--mint); letter-spacing: .2em; font-size: 10px; font-weight: 700; }
.eyebrow i, .secure-label i { width: 6px; height: 6px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 14px var(--mint); }
.eyebrow.small { font-size: 8px; letter-spacing: .16em; }
.hero-copy h1 { margin: 28px 0 24px; font: 500 clamp(44px, 6vw, 82px)/1.08 Georgia, "Songti SC", serif; letter-spacing: -.04em; }
.hero-copy h1 em { color: var(--mint); font-style: italic; font-weight: 400; }
.hero-copy > p { color: var(--muted); max-width: 650px; font-size: 16px; line-height: 1.9; }
.trust-row { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 30px; }
.trust-row span { border: 1px solid var(--line); background: rgba(255,255,255,.025); color: #afc7bd; border-radius: 999px; padding: 8px 12px; font-size: 11px; }

.login-card { border: 1px solid rgba(117, 241, 189, .16); background: linear-gradient(145deg, rgba(16,35,28,.96), rgba(8,18,14,.96)); box-shadow: var(--shadow); padding: 34px; position: relative; overflow: hidden; }
.login-card::after { content: ""; position: absolute; width: 160px; height: 160px; right: -80px; top: -80px; border: 1px solid rgba(117,241,189,.14); transform: rotate(45deg); }
.login-card-head { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 8px; letter-spacing: .16em; }
.login-card-head span:last-child { margin-left: auto; color: var(--mint); }
.status-dot { width: 6px; height: 6px; background: var(--mint); border-radius: 50%; }
.login-card h2 { margin: 44px 0 12px; font: 500 28px/1.2 Georgia, serif; }
.login-card > p { color: var(--muted); font-size: 12px; line-height: 1.8; }
.login-steps { list-style: none; margin: 30px 0; padding: 0; border-top: 1px solid var(--line); }
.login-steps li { display: flex; align-items: center; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.login-steps li > span { color: var(--mint); font: 12px Georgia, serif; }
.login-steps div { display: flex; flex-direction: column; gap: 3px; }
.login-steps strong { font-size: 12px; font-weight: 600; }
.login-steps small { color: var(--faint); font-size: 10px; }
.primary-button { width: 100%; border: 0; background: var(--mint); color: #07100d; padding: 15px 18px; cursor: pointer; display: flex; justify-content: space-between; font-weight: 750; font-size: 12px; transition: transform .2s, background .2s; }
.primary-button:hover { transform: translateY(-2px); background: #98f8cf; }
.primary-button:disabled { opacity: .6; cursor: wait; }
.form-error { min-height: 18px; color: var(--danger) !important; margin-bottom: 0; }

.workspace-view { min-height: 100vh; position: relative; z-index: 1; }
.app-header { height: 66px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; padding: 0 24px; background: rgba(7,16,13,.86); backdrop-filter: blur(16px); }
.header-context { display: flex; align-items: center; gap: 12px; }
.secure-label { display: flex; align-items: center; gap: 8px; color: var(--mint); font-size: 8px; letter-spacing: .15em; }
.wallet-pill { border: 1px solid var(--line); border-radius: 999px; color: #b8cec5; padding: 7px 11px; font: 10px ui-monospace, SFMono-Regular, Menlo, monospace; }
.ghost-button, .mini-button, .icon-button { background: transparent; border: 1px solid var(--line); cursor: pointer; color: var(--muted); }
.ghost-button { border-radius: 999px; padding: 7px 12px; font-size: 10px; }
.ghost-button:hover, .mini-button:hover { color: var(--mint); border-color: rgba(117,241,189,.35); }

.app-grid { height: calc(100vh - 66px); display: grid; grid-template-columns: 245px minmax(420px, 1fr) 330px; }
.case-sidebar, .context-panel { background: rgba(8,18,14,.74); }
.case-sidebar { border-right: 1px solid var(--line); padding: 18px 14px; display: flex; flex-direction: column; min-height: 0; }
.new-case-button { width: 100%; border: 1px solid rgba(117,241,189,.2); background: rgba(117,241,189,.07); color: var(--mint); padding: 12px; cursor: pointer; text-align: left; font-size: 11px; }
.new-case-button span { margin-right: 8px; }
.side-section-title { display: flex; justify-content: space-between; margin: 27px 7px 10px; color: var(--faint); text-transform: uppercase; font-size: 9px; letter-spacing: .15em; }
.case-list { overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.case-item { display: flex; flex-direction: column; gap: 5px; padding: 11px 10px; border-left: 2px solid transparent; cursor: pointer; color: #9bb1a8; }
.case-item:hover { background: rgba(255,255,255,.025); }
.case-item.active { background: rgba(117,241,189,.065); border-left-color: var(--mint); color: var(--ink); }
.case-item strong { font-size: 11px; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
.case-item small { color: var(--faint); font-size: 9px; }
.sidebar-foot { margin-top: auto; border-top: 1px solid var(--line); padding: 16px 7px 0; display: flex; justify-content: space-between; font-size: 8px; color: var(--faint); letter-spacing: .12em; }
.sidebar-foot strong { color: var(--mint); font-size: 8px; }

.conversation-panel { min-width: 0; display: flex; flex-direction: column; background: rgba(7,16,13,.42); }
.conversation-head { min-height: 96px; padding: 24px clamp(20px, 4vw, 55px) 18px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.conversation-head h1 { margin: 8px 0 0; font: 500 22px Georgia, "Songti SC", serif; }
.icon-button { display: none; width: 34px; height: 34px; }
.messages { flex: 1; min-height: 0; overflow-y: auto; padding: 30px clamp(20px, 6vw, 90px); scroll-behavior: smooth; }
.empty-chat { max-width: 580px; margin: 10vh auto 0; text-align: center; }
.empty-symbol { margin: 0 auto 25px; width: 64px; height: 64px; display: grid; place-items: center; border: 1px solid rgba(117,241,189,.25); color: var(--mint); font: 26px Georgia, serif; transform: rotate(45deg); }
.empty-symbol span { transform: rotate(-45deg); }
.empty-chat h2 { font: 400 28px Georgia, "Songti SC", serif; }
.empty-chat p { color: var(--muted); font-size: 12px; line-height: 1.8; }
.prompt-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 24px; }
.prompt-chips button { border: 1px solid var(--line); background: rgba(255,255,255,.02); color: #a8bdb4; padding: 9px 12px; cursor: pointer; font-size: 10px; }
.prompt-chips button:hover { border-color: rgba(117,241,189,.35); color: var(--mint); }
.message { max-width: 760px; margin: 0 auto 24px; display: grid; grid-template-columns: 34px 1fr; gap: 13px; }
.message.user { grid-template-columns: 1fr 34px; }
.message.user .message-avatar { grid-column: 2; background: #263d34; }
.message.user .message-body { grid-row: 1; grid-column: 1; justify-self: end; background: rgba(117,241,189,.1); border-color: rgba(117,241,189,.16); max-width: 82%; }
.message-avatar { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid var(--line); background: var(--panel-2); color: var(--mint); font: 12px Georgia, serif; }
.message-body { border: 1px solid var(--line); background: rgba(14,29,23,.82); padding: 15px 17px; color: #c8ddd4; font-size: 13px; line-height: 1.8; white-space: pre-wrap; overflow-wrap: anywhere; }
.message-meta { display: flex; gap: 9px; margin-top: 10px; color: var(--faint); font-size: 8px; letter-spacing: .08em; }
.thinking .message-body { color: var(--muted); }
.thinking-dots::after { content: ""; animation: dots 1.2s infinite; }
@keyframes dots { 0% { content: ""; } 33% { content: "."; } 66% { content: ".."; } 100% { content: "..."; } }

.composer-wrap { border-top: 1px solid var(--line); padding: 14px clamp(20px, 6vw, 90px) 18px; background: rgba(7,16,13,.9); }
.composer { max-width: 760px; margin: auto; display: grid; grid-template-columns: 38px 1fr 38px; align-items: end; border: 1px solid rgba(117,241,189,.18); background: #0d1e18; padding: 8px; }
.attach-button, .send-button { width: 36px; height: 36px; display: grid; place-items: center; border: 0; cursor: pointer; }
.attach-button { color: var(--mint); background: rgba(117,241,189,.07); }
.send-button { background: var(--mint); color: #07100d; font-size: 19px; }
.send-button:disabled { opacity: .5; cursor: wait; }
.composer textarea { width: 100%; max-height: 130px; resize: none; border: 0; outline: 0; color: var(--ink); background: transparent; padding: 9px 12px; font-size: 12px; line-height: 1.5; }
.composer textarea::placeholder { color: var(--faint); }
.composer-meta { max-width: 760px; margin: 7px auto 0; display: flex; justify-content: space-between; color: #4f635b; font-size: 8px; }
.upload-queue { max-width: 760px; margin: 0 auto 8px; color: var(--mint); font-size: 10px; }

.context-panel { border-left: 1px solid var(--line); padding: 18px; overflow-y: auto; }
.context-section { border-bottom: 1px solid var(--line); padding-bottom: 20px; margin-bottom: 20px; }
.context-section > header { display: flex; justify-content: space-between; align-items: center; color: #b7cbc2; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }
.context-section > header small { color: var(--faint); font-size: 8px; }
.mini-button { padding: 5px 8px; font-size: 8px; }
.balance-card { background: linear-gradient(145deg, rgba(117,241,189,.07), transparent); border: 1px solid rgba(117,241,189,.14); padding: 15px; }
.balance-primary { display: flex; align-items: baseline; gap: 9px; margin: 24px 0; }
.balance-primary strong { color: var(--mint); font: 32px Georgia, serif; }
.balance-primary span { color: var(--muted); font-size: 10px; }
.balance-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); }
.balance-stats div { background: #0c1b15; padding: 10px; display: flex; flex-direction: column; gap: 3px; }
.balance-stats span { font: 15px Georgia, serif; }
.balance-stats small { color: var(--faint); font-size: 8px; }
.file-list, .tool-runs { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.file-card, .tool-card { border: 1px solid var(--line); background: rgba(255,255,255,.018); padding: 10px; }
.file-card-head, .tool-card-head { display: flex; align-items: center; gap: 8px; }
.file-icon { width: 28px; height: 32px; display: grid; place-items: center; background: rgba(117,241,189,.08); color: var(--mint); font-size: 8px; }
.file-card-text { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.file-card-text strong { font-size: 9px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-card-text small, .tool-card small { color: var(--faint); font-size: 8px; }
.status-tag { margin-left: auto; font-size: 7px; letter-spacing: .08em; color: var(--mint); }
.status-tag.failed { color: var(--danger); }
.drop-zone { margin-top: 10px; min-height: 82px; border: 1px dashed rgba(117,241,189,.2); display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; color: var(--muted); }
.drop-zone:hover, .drop-zone.dragging { background: rgba(117,241,189,.04); border-color: var(--mint); }
.drop-zone > span { color: var(--mint); }
.drop-zone strong { margin-top: 6px; font-size: 9px; }
.drop-zone small { margin-top: 4px; color: var(--faint); font-size: 8px; }
.tool-card-head strong { font-size: 9px; flex: 1; }
.tool-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--mint); }
.tool-dot.failed { background: var(--danger); }
.tool-card > small { display: block; margin-top: 6px; line-height: 1.5; }
.empty-context { color: var(--faint); font-size: 9px; line-height: 1.6; padding: 8px 0; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 20; background: #dffbed; color: #07100d; box-shadow: var(--shadow); padding: 11px 16px; font-size: 11px; }
.toast.error { background: #ffd7d4; }

@media (max-width: 1050px) {
  .app-grid { grid-template-columns: 210px 1fr; }
  .context-panel { position: fixed; z-index: 10; right: 0; top: 66px; bottom: 0; width: min(340px, 92vw); transform: translateX(105%); transition: transform .25s; box-shadow: var(--shadow); }
  .context-panel.open { transform: translateX(0); }
  .icon-button { display: block; }
}

@media (max-width: 760px) {
  .login-view { padding: 20px; }
  .login-grid { display: block; padding-top: 70px; }
  .hero-copy h1 { font-size: 46px; }
  .hero-copy > p { font-size: 13px; }
  .login-card { margin: 52px 0 20px; padding: 25px; }
  .nav-link, .secure-label { display: none; }
  .app-grid { display: block; height: calc(100vh - 66px); }
  .case-sidebar { display: none; }
  .conversation-panel { height: 100%; }
  .conversation-head { min-height: 80px; padding: 18px 20px; }
  .messages { padding: 22px 14px; }
  .composer-wrap { padding: 11px 12px 13px; }
  .composer-meta { display: none; }
  .message.user .message-body { max-width: 92%; }
  .wallet-pill { max-width: 126px; overflow: hidden; text-overflow: ellipsis; }
}
