:root {
  --bg: #050608;
  --bg-soft: #080a0d;
  --panel: #0b0d11;
  --panel-2: #101319;
  --panel-3: #151a22;
  --line: rgba(255,255,255,.085);
  --line-strong: rgba(255,255,255,.15);
  --text: #f1f4f8;
  --muted: #9099a8;
  --faint: #5c6573;
  --accent: #d7ff64;
  --accent-2: #73d7ff;
  --danger: #ff6b7a;
  --ok: #73ffa4;
  --shadow: 0 18px 58px rgba(0,0,0,.42);
  --radius: 16px;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font-family: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, sans-serif; }
body::before { content:""; position: fixed; inset: 0; pointer-events: none; background: radial-gradient(circle at 14% -10%, rgba(215,255,100,.075), transparent 30%), radial-gradient(circle at 90% 12%, rgba(115,215,255,.055), transparent 25%), linear-gradient(180deg, rgba(255,255,255,.018), transparent 22%); }
button, input, textarea { font: inherit; }
button { border: 0; cursor: pointer; color: var(--text); }
button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2px solid rgba(215,255,100,.65); outline-offset: 2px; }
.shell { display: grid; grid-template-columns: 218px 1fr; min-height: 100vh; position: relative; }
.sidebar { border-right: 1px solid var(--line); background: rgba(6,7,10,.88); backdrop-filter: blur(18px); padding: 14px; display:flex; flex-direction: column; gap: 14px; position: sticky; top:0; height:100vh; }
.side-brand { display:flex; align-items:center; gap: 10px; padding: 6px 4px 14px; border-bottom: 1px solid var(--line); }
.side-brand strong { letter-spacing: -.02em; }
.side-brand span { display:block; color: var(--muted); font-size: 11px; margin-top: 1px; }
.brand-mark { width: 54px; height:54px; border-radius: 16px; display:grid; place-items:center; background: linear-gradient(135deg, var(--accent), #ffffff); color:#050608; font-weight: 950; box-shadow: 0 0 34px rgba(215,255,100,.18); }
.brand-mark.small { width: 34px; height: 34px; border-radius: 11px; }
nav { display:flex; flex-direction:column; gap: 6px; }
.nav, .ghost, .secondary { border:1px solid var(--line); background: rgba(255,255,255,.032); border-radius: 11px; padding: 10px 11px; text-align:left; transition: border-color .16s ease, background .16s ease, transform .16s ease; min-height: 40px; }
.nav:hover, .ghost:hover, .secondary:hover { border-color: var(--line-strong); background: rgba(255,255,255,.065); }
.nav.active { background: rgba(215,255,100,.105); border-color: rgba(215,255,100,.34); color: var(--accent); }
.ghost { margin-top:auto; text-align:center; color: var(--muted); }
.secondary { text-align:center; color: #0a0c10; background: var(--accent); border-color: transparent; font-weight: 850; }
.secondary:hover { background: #e3ff82; border-color: transparent; }
.ghost.small-btn, .secondary.small-btn { padding: 7px 10px; font-size: 12px; min-height: 34px; }
.content { padding: 20px; min-width: 0; }
.tab { display:none; }
.tab.active { display:block; }
.topline { display:flex; align-items:center; justify-content:space-between; gap: 18px; margin-bottom: 14px; }
.chat-topline { margin-bottom: 10px; }
h1 { margin:0; font-size: clamp(27px, 3.6vw, 40px); letter-spacing: -.055em; line-height: .95; }
.eyebrow { margin:0 0 5px; text-transform: uppercase; letter-spacing:.14em; color: var(--accent); font-size: 10px; font-weight: 850; }
.muted { color: var(--muted); }
.chat-actions { display:flex; gap: 8px; align-items:center; }
.chat-switcher-wrap { border:1px solid var(--line); background: rgba(255,255,255,.026); border-radius: 14px; padding: 8px; margin-bottom: 12px; box-shadow: 0 10px 34px rgba(0,0,0,.22); }
.chat-switcher-head { display:flex; align-items:center; justify-content:space-between; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .12em; padding: 0 4px 7px; }
.chat-switcher-head small { color: var(--faint); text-transform: none; letter-spacing: 0; font-size: 11px; }
.chat-layout { display:grid; grid-template-columns: minmax(0, 1.45fr) minmax(320px, .78fr); gap: 12px; height: calc(100vh - 138px); min-height: 560px; }
.chat-tabs-panel, .terminal-card, .proxy-card, .panel, .login-card { border:1px solid var(--line); background: linear-gradient(180deg, rgba(255,255,255,.042), rgba(255,255,255,.02)); border-radius: var(--radius); box-shadow: var(--shadow); overflow:hidden; }
.chat-tabs-panel { padding: 10px; }
.chat-tabs { display:flex; gap: 7px; overflow:auto; scrollbar-width: thin; }
.chat-tabs.compact { flex-direction:row; }
.chat-tab { flex: 0 0 auto; min-width: 154px; max-width: 210px; padding: 7px 9px; border-radius: 12px; color: var(--muted); background: rgba(255,255,255,.035); border: 1px solid var(--line); display:flex; align-items:center; gap: 8px; min-height: 46px; text-align:left; }
.chat-tab:hover { border-color: var(--line-strong); background: rgba(255,255,255,.058); }
.chat-tab.active { color: var(--text); border-color: rgba(215,255,100,.38); background: rgba(215,255,100,.095); box-shadow: inset 0 0 0 1px rgba(215,255,100,.04); }
.tab-dot { width: 28px; height: 28px; border-radius: 9px; display:grid; place-items:center; background: rgba(255,255,255,.07); color: var(--accent); font-weight: 900; font-size: 12px; flex: 0 0 auto; }
.chat-tab.active .tab-dot { background: var(--accent); color: #050608; }
.tab-copy { min-width: 0; display:block; }
.tab-copy strong { display:block; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; font-size: 13px; letter-spacing: -.01em; }
.tab-copy small { display:block; margin-top:1px; color: var(--faint); font-size: 10px; }
.terminal-card, .proxy-card { display:flex; flex-direction:column; min-height:0; }
.card-head { display:flex; justify-content:space-between; align-items:center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); background: rgba(0,0,0,.18); }
.card-head strong { letter-spacing: -.015em; }
.card-head span { display:block; margin-top:2px; color: var(--muted); font-size: 12px; }
#terminal { flex: 1; min-height: 0; padding: 8px; background:#050608; }
.messages { flex:1; overflow:auto; padding: 12px; display:flex; flex-direction:column; gap: 9px; }
.msg { border:1px solid var(--line); background: rgba(255,255,255,.04); padding: 9px 10px; border-radius: 13px; white-space: pre-wrap; color: var(--muted); font-size: 13px; line-height: 1.45; }
.msg span { display:block; text-transform: uppercase; letter-spacing: .12em; font-size: 9px; color: var(--faint); margin-bottom: 5px; }
.msg.user { color: var(--text); border-color: rgba(115,215,255,.24); background: rgba(115,215,255,.055); }
.msg.assistant { color: #dce6ef; border-color: rgba(215,255,100,.18); }
.empty-chat { margin:auto; color: var(--faint); border:1px dashed var(--line); border-radius: 14px; padding: 18px; text-align:center; }
.quick-chat { display:flex; gap: 8px; padding: 10px; border-top:1px solid var(--line); }
input, textarea { width:100%; border:1px solid var(--line); background: rgba(0,0,0,.25); color: var(--text); border-radius: 11px; padding: 10px 11px; outline:none; }
input:focus, textarea:focus { border-color: rgba(215,255,100,.45); box-shadow: 0 0 0 3px rgba(215,255,100,.08); }
.quick-chat button, .login-form button { background: var(--accent); color:#060709; border-radius: 11px; padding: 0 15px; font-weight: 850; min-height: 40px; }
.split { display:grid; grid-template-columns: minmax(320px, .9fr) minmax(420px, 1.1fr); gap: 12px; height: calc(100vh - 112px); }
.panel { min-height: 0; }
.toolbar { display:flex; gap: 9px; padding: 10px; border-bottom:1px solid var(--line); }
.rows { overflow:auto; max-height: calc(100vh - 178px); }
.row { display:grid; grid-template-columns: minmax(160px, .7fr) minmax(180px, 1fr) auto; gap: 9px; align-items:center; padding: 9px 11px; border-bottom:1px solid var(--line); }
.row:hover { background: rgba(255,255,255,.02); }
.row code { color: var(--accent-2); font-size: 12px; word-break: break-all; }
.row .value { color: var(--muted); font-size: 13px; word-break: break-word; }
.row button { padding: 7px 10px; border-radius: 10px; background: rgba(255,255,255,.06); border:1px solid var(--line); }
.editor-panel { padding: 0; }
textarea#configRaw { height:100%; resize:none; border:0; border-radius:0; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; line-height: 1.55; }
.metrics { display:grid; grid-template-columns: repeat(5, minmax(120px, 1fr)); gap: 10px; margin-bottom: 12px; }
.metric { border:1px solid var(--line); background: rgba(255,255,255,.038); border-radius: 14px; padding: 14px; }
.metric span { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .1em; }
.metric strong { display:block; margin-top: 7px; font-size: 22px; letter-spacing:-.035em; }
.segmented { display:flex; gap: 5px; border:1px solid var(--line); padding: 4px; border-radius: 13px; background:rgba(255,255,255,.03); }
.segmented button { background: transparent; padding: 8px 11px; border-radius: 9px; color: var(--muted); min-height: 34px; }
.segmented button.active { background: var(--accent); color:#050608; font-weight:850; }
.table-head { display:flex; align-items:center; justify-content:space-between; padding: 13px 15px; border-bottom:1px solid var(--line); background: rgba(0,0,0,.16); }
.table-head strong { display:block; }
.table-head span { display:block; margin-top:2px; color: var(--muted); font-size: 12px; }
.usage-panel { overflow:hidden; }
.usage-table-wrap { overflow:auto; max-height: calc(100vh - 242px); }
.usage-table { width:100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.usage-table th { position: sticky; top: 0; z-index: 1; background: #0b0d11; color: var(--faint); text-transform: uppercase; letter-spacing: .11em; font-size: 10px; font-weight: 850; text-align:right; padding: 10px 14px; border-bottom:1px solid var(--line); }
.usage-table th:first-child { text-align:left; }
.usage-table td { padding: 12px 14px; border-bottom:1px solid var(--line); text-align:right; color: #dfe5ed; }
.usage-table td:first-child { text-align:left; }
.usage-table td strong { display:block; font-size: 13px; color: var(--text); }
.usage-table td span { display:block; margin-top:2px; font-size: 11px; color: var(--faint); }
.usage-table tr:hover td { background: rgba(255,255,255,.025); }
.empty-cell { text-align:center !important; color: var(--muted) !important; padding: 28px !important; }
.skills-grid { display:grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 10px; }
.skill-card { border:1px solid var(--line); background: rgba(255,255,255,.038); border-radius: 15px; padding: 14px; }
.skill-card h3 { margin:0 0 8px; letter-spacing: -.02em; }
.skill-card p { color: var(--muted); margin: 0 0 12px; font-size: 13px; line-height:1.45; }
.tags { display:flex; flex-wrap:wrap; gap: 6px; }
.tags span { border:1px solid var(--line); color: var(--muted); border-radius: 999px; padding: 4px 7px; font-size: 11px; }
.login-body { min-height:100vh; display:grid; place-items:center; padding: 20px; }
.login-card { width:min(440px, 100%); padding: 28px; }
.login-card h1 { margin-top: 16px; }
.login-form { display:grid; gap: 10px; margin-top: 22px; }
.login-form button { height: 46px; }
@media (max-width: 1180px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position:static; height:auto; flex-direction:row; align-items:center; overflow:auto; }
  .side-brand { border-bottom:0; padding:0; min-width:178px; }
  nav { flex-direction:row; }
  .ghost { margin-top:0; margin-left:auto; min-width:86px; }
  .chat-layout, .split { grid-template-columns:1fr; height:auto; min-height:0; }
  .terminal-card { height: 550px; }
  .proxy-card { height: 500px; }
  .metrics { grid-template-columns: repeat(2,1fr); }
  .usage-table-wrap { max-height: 680px; }
}
@media (max-width: 640px) {
  .content { padding: 12px; }
  .sidebar { padding: 9px; gap: 8px; }
  .nav { padding: 9px 10px; }
  .topline { align-items:flex-start; flex-direction:column; }
  .chat-actions { width:100%; }
  .chat-actions button { flex:1; }
  .chat-tab { min-width: 142px; }
  .metrics { grid-template-columns:1fr; }
  .row { grid-template-columns: 1fr; }
  .usage-table th, .usage-table td { padding: 10px 9px; }
  .terminal-card { height: 500px; }
  .proxy-card { height: 440px; }
}
