:root {
  --gk-bg: #181818;
  --gk-bg-2: #1e1e1e;
  --gk-bg-3: #252526;
  --gk-bar: #141414;
  --gk-line: #2c2c2c;
  --gk-text: #e8e8e8;
  --gk-dim: #9b9b9b;
  --gk-mute: #6f6f6f;
  --gk-acc: #88c0d0;
  --gk-chip: #2a2a2a;
  --gk-hover: #2f2f2f;
  --gk-input: #252526;
  --gk-radius: 10px;
  --gk-side: 264px;
  --font: "Inter", ui-sans-serif, system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html, body {
  height: 100%; height: 100dvh; margin: 0;
  background: var(--gk-bg); color: var(--gk-text); font-family: var(--font);
  overflow: hidden;
}
button, textarea, input { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
textarea, input { overflow-wrap: anywhere; }

.gk-app {
  display: flex; height: 100%; height: 100dvh; min-height: 0; min-width: 0;
  overflow: hidden; position: relative;
}
.gk-backdrop {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  z-index: 16;
}

.gk-side {
  width: var(--gk-side); flex: none; background: #141414;
  background-image: linear-gradient(180deg, rgba(20,20,20,0.92), rgba(20,20,20,0.96)), url("assets/web/49-sidebar-wash.png");
  background-size: cover;
  background-position: center;
  border-right: 1px solid var(--gk-line);
  display: flex; flex-direction: column; min-height: 0; min-width: 0;
}
@media (min-width: 861px) {
  .gk-app.collapsed .gk-side {
    width: 0; max-width: 0; min-width: 0; overflow: hidden;
    border-right-width: 0; opacity: 0; pointer-events: none;
  }
}
.gk-brand { display: flex; align-items: center; gap: 10px; padding: 14px 14px 10px; }
.gk-brand img { width: 22px; height: 22px; border-radius: 5px; }
.gk-brand b { font-size: 13px; font-weight: 600; letter-spacing: -0.02em; }
.gk-side-x { display: none; margin-left: auto; width: 28px; height: 28px; border-radius: 8px; color: var(--gk-dim); font-size: 18px; }
.gk-search {
  margin: 0 12px 8px; display: flex; align-items: center; gap: 8px;
  background: var(--gk-chip); border: 1px solid var(--gk-line); border-radius: 8px; padding: 7px 10px;
}
.gk-search input { flex: 1; min-width: 0; background: none; border: 0; outline: none; font-size: 12px; }
.gk-search kbd { font: 10px/1 var(--mono); color: var(--gk-mute); border: 1px solid var(--gk-line); padding: 2px 5px; border-radius: 4px; flex: none; }
.gk-new {
  margin: 0 12px 12px; height: 32px; border-radius: 8px; background: #fff; color: #111;
  font-size: 12px; font-weight: 600;
}
.gk-new:hover { filter: brightness(0.94); }
.gk-agents { flex: 1; overflow: auto; padding: 0 8px 12px; }
.gk-agents h5 { margin: 10px 8px 6px; font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--gk-mute); font-weight: 600; }
.gk-agent {
  width: 100%; display: flex; gap: 8px; align-items: flex-start; text-align: left;
  padding: 8px; border-radius: 8px; color: var(--gk-dim);
}
.gk-agent:hover { background: var(--gk-hover); color: var(--gk-text); }
.gk-agent.on { background: var(--gk-hover); color: var(--gk-text); }
.gk-agent.archived { opacity: 0.55; }
.gk-ava { width: 22px; height: 22px; border-radius: 6px; object-fit: cover; flex: none; margin-top: 1px; background: #111; }
.gk-dot { width: 7px; height: 7px; border-radius: 50%; margin-top: 5px; background: #5a5a5a; flex: none; }
.gk-dot.live { background: #7dcea0; box-shadow: 0 0 0 3px rgba(125,206,160,0.12); }
.gk-agent-meta { flex: 1; min-width: 0; }
.gk-agent b { display: block; font-size: 12px; font-weight: 560; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gk-agent small { display: block; font-size: 11px; color: var(--gk-mute); margin-top: 2px; line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gk-agent time { flex: none; font-size: 10px; color: var(--gk-mute); margin-top: 3px; }
.gk-side-foot { padding: 10px 12px calc(14px + var(--safe-b)); border-top: 1px solid var(--gk-line); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.gk-side-foot a, .gk-side-foot button { font-size: 11px; color: var(--gk-dim); }
.gk-side-foot a:hover, .gk-side-foot button:hover { color: var(--gk-text); }
.gk-backend { margin-left: auto; font-size: 10px; color: var(--gk-dim); letter-spacing: 0.02em; }
.gk-backend.live { color: #7dcea0; }
.gk-backend.git { color: #c8a36a; }
.gk-backend.off { color: #8a8a8a; }

.gk-main { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--gk-bg); overflow: hidden; }
.gk-tabs {
  height: 40px; display: flex; align-items: center; gap: 2px; padding: 0 8px;
  border-bottom: 1px solid var(--gk-line); background: var(--gk-bg-2); flex: none;
  position: relative; z-index: 3;
}
.gk-tab {
  height: 28px; padding: 0 10px; border-radius: 6px; font-size: 12px; color: var(--gk-dim);
  display: flex; align-items: center; gap: 6px;
}
.gk-tab.on { background: var(--gk-chip); color: var(--gk-text); }
.gk-tab-add { width: 28px; height: 28px; border-radius: 6px; color: var(--gk-dim); }
.gk-tab-add:hover, .gk-tab:hover { background: var(--gk-hover); color: var(--gk-text); }
.gk-tabs .grow { flex: 1; min-width: 0; }
.gk-icon { width: 28px; height: 28px; border-radius: 6px; color: var(--gk-dim); display: grid; place-items: center; flex: none; }
.gk-icon:hover { background: var(--gk-hover); color: var(--gk-text); }
.gk-title {
  max-width: 160px; height: 28px; padding: 0 8px; border-radius: 6px;
  font-size: 12px; color: var(--gk-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.gk-title:hover { color: var(--gk-text); background: var(--gk-hover); }
.gk-handoff, .gk-share {
  height: 28px; padding: 0 10px; border-radius: 6px; font-size: 12px; color: var(--gk-dim); white-space: nowrap;
}
.gk-handoff:hover, .gk-share:hover { background: var(--gk-hover); color: var(--gk-text); }

.gk-thread { flex: 1; overflow: auto; padding: 28px 8vw 16px; min-height: 0; }
.gk-empty { max-width: 640px; margin: 8vh auto 0; text-align: center; }
.gk-empty-art { width: min(420px, 92%); height: auto; border-radius: 12px; margin: 0 auto 18px; display: block; opacity: 0.88; }
.gk-new-folder-form { display: flex; gap: 6px; padding: 6px 6px 2px; }
.gk-new-folder-form[hidden] { display: none; }
.gk-new-folder-form input {
  flex: 1; min-width: 0; background: var(--gk-chip); border: 1px solid var(--gk-line);
  border-radius: 7px; padding: 6px 8px; font-size: 12px; outline: none;
}
.gk-new-folder-form button { height: 28px; padding: 0 10px; border-radius: 7px; background: #fff; color: #111; font-size: 11px; font-weight: 600; }
.gk-empty h1, .gk-wizard h1 { font-size: 28px; font-weight: 560; letter-spacing: -0.04em; margin: 0 0 8px; overflow-wrap: anywhere; }
.gk-empty p, .gk-wizard p { margin: 0 0 22px; color: var(--gk-dim); font-size: 14px; overflow-wrap: anywhere; }
.gk-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.gk-chips button {
  border: 1px solid var(--gk-line); background: var(--gk-bg-2); border-radius: 999px;
  padding: 7px 12px; font-size: 12px; color: var(--gk-dim);
}
.gk-chips button:hover { color: var(--gk-text); background: var(--gk-hover); }
.gk-msg { max-width: 760px; margin: 0 auto 22px; }
.gk-msg .who { font-size: 11px; color: var(--gk-mute); margin-bottom: 6px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.gk-msg .bubble { font-size: 14.5px; line-height: 1.65; color: var(--gk-text); white-space: pre-wrap; overflow-wrap: anywhere; }
.gk-msg.user .bubble { color: #d7d7d7; }
.gk-msg .tools { display: flex; gap: 6px; margin-top: 8px; }
.gk-msg .tools button { font-size: 11px; color: var(--gk-mute); }
.gk-msg .tools button:hover { color: var(--gk-text); }

.gk-wizard { flex: 1; overflow: auto; padding: 8vh 8vw 16px; min-height: 0; }
.gk-wizard-inner { max-width: 640px; margin: 0 auto; text-align: center; }
.gk-repo-wrap { position: relative; display: inline-block; margin: 0 0 22px; text-align: left; }
.gk-repo-btn {
  display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 12px;
  border: 1px solid var(--gk-line); background: var(--gk-bg-2); border-radius: 8px; font-size: 12px; color: var(--gk-text);
}
.gk-repo-btn:hover { background: var(--gk-hover); }
.gk-repo-fly {
  position: absolute; top: calc(100% + 6px); left: 0;
  display: flex; min-width: 420px; background: var(--gk-bg-3); border: 1px solid var(--gk-line);
  border-radius: 10px; box-shadow: 0 12px 40px rgba(0,0,0,0.45); z-index: 12; overflow: hidden;
}
.gk-repo-col { min-width: 200px; padding: 6px; }
.gk-repo-col + .gk-repo-col { border-left: 1px solid var(--gk-line); }
.gk-repo-col button, .gk-repo-col label {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  text-align: left; padding: 8px 10px; border-radius: 8px; font-size: 12px; color: var(--gk-dim);
}
.gk-repo-col button:hover, .gk-repo-col label:hover, .gk-repo-col button.on { background: var(--gk-hover); color: var(--gk-text); }
.gk-repo-folders .folder {
  width: 100%; display: flex; align-items: center; gap: 8px; padding: 8px 10px;
  border-radius: 8px; font-size: 12px; color: var(--gk-dim);
}
.gk-repo-folders .folder:hover, .gk-repo-folders .folder.on { background: var(--gk-hover); color: var(--gk-text); }
.gk-repo-folders .folder input { accent-color: #fff; }
.gk-multi { font-size: 11px; color: var(--gk-mute); }
.gk-new-folder { color: var(--gk-acc) !important; }
.gk-ws { display: flex; gap: 6px; padding: 8px 6px 4px; }
.gk-ws input {
  flex: 1; min-width: 0; background: var(--gk-chip); border: 1px solid var(--gk-line);
  border-radius: 7px; padding: 6px 8px; font-size: 12px; outline: none;
}
.gk-ws button { height: 28px; padding: 0 10px; border-radius: 7px; background: #fff; color: #111; font-size: 11px; font-weight: 600; }

.gk-composer-wrap { padding: 8px 8vw calc(16px + var(--safe-b)); flex: none; }
.gk-composer {
  max-width: 760px; margin: 0 auto; background: var(--gk-input); border: 1px solid var(--gk-line);
  border-radius: 14px; padding: 8px;
}
.gk-composer textarea {
  width: 100%; min-height: 52px; max-height: 180px; resize: none; background: none; border: 0; outline: none;
  padding: 8px 8px 4px; font-size: 14px; line-height: 1.5;
}
.gk-row { display: flex; align-items: center; gap: 6px; padding: 0 4px 2px; min-width: 0; }
.gk-row .grow { flex: 1; min-width: 4px; }
.gk-pills { display: flex; align-items: center; gap: 6px; min-width: 0; }
.gk-pill {
  height: 26px; padding: 0 9px; border-radius: 7px; background: var(--gk-chip); color: var(--gk-dim);
  font-size: 11px; border: 1px solid var(--gk-line); white-space: nowrap;
}
.gk-pill.on { color: var(--gk-text); }
.gk-send { width: 28px; height: 28px; border-radius: 8px; background: #eee; color: #111; display: grid; place-items: center; flex: none; }
.gk-send:disabled { opacity: 0.35; cursor: default; }
.gk-hint { max-width: 760px; margin: 8px auto 0; font-size: 11px; color: var(--gk-mute); text-align: center; overflow-wrap: anywhere; }

.gk-diffs { flex: 1; overflow: auto; padding: 28px 8vw 16px; min-height: 0; }
.gk-diffs header { max-width: 760px; margin: 0 auto 18px; }
.gk-diffs header b { display: block; font-size: 18px; margin-bottom: 6px; }
.gk-diffs header span { color: var(--gk-dim); font-size: 13px; }
.gk-diff-file {
  max-width: 760px; margin: 0 auto 12px; background: var(--gk-bg-2);
  border: 1px solid var(--gk-line); border-radius: 12px; padding: 16px;
}
.gk-diff-file.staged { outline: 1px solid rgba(125,206,160,0.35); }
.gk-diff-file code { font-size: 12px; color: var(--gk-acc); overflow-wrap: anywhere; }
.gk-diff-file pre { margin: 12px 0; font: 12px/1.55 var(--mono); color: #c8e6c9; white-space: pre-wrap; overflow-wrap: anywhere; }
.gk-diff-file .minus { color: #e8a0a0; }
.gk-diff-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.gk-diff-actions button, .gk-diff-file button {
  height: 28px; padding: 0 10px; border-radius: 7px; background: var(--gk-chip);
  border: 1px solid var(--gk-line); font-size: 12px;
}
.gk-diff-actions button:hover, .gk-diff-file button:hover { color: #fff; }
.gk-commit-box { max-width: 760px; margin: 16px auto 0; }
.gk-commit-box input {
  width: 100%; margin-bottom: 10px; background: var(--gk-input); border: 1px solid var(--gk-line);
  border-radius: 8px; padding: 9px 12px; outline: none; font-size: 13px;
}
.gk-pr-num { font-size: 12px; color: var(--gk-acc); }

.gk-sidechat {
  width: 320px; flex: none; border-left: 1px solid var(--gk-line); background: var(--gk-bg-2);
  display: none; flex-direction: column; min-width: 0; min-height: 0;
}
.gk-sidechat.open { display: flex; }
.gk-sidechat header {
  height: 40px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 12px; font-size: 12px; border-bottom: 1px solid var(--gk-line); flex: none;
}
.gk-sidechat header button { width: 28px; height: 28px; border-radius: 6px; color: var(--gk-dim); }
.gk-sidechat .body { flex: 1; overflow: auto; padding: 14px; font-size: 13px; color: var(--gk-dim); line-height: 1.5; }
.gk-side-line { margin: 0 0 12px; overflow-wrap: anywhere; }
.gk-side-line b { display: block; font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--gk-mute); margin-bottom: 4px; }
.gk-side-compose {
  display: flex; gap: 8px; align-items: flex-end; padding: 10px 12px calc(12px + var(--safe-b));
  border-top: 1px solid var(--gk-line);
}
.gk-side-compose textarea {
  flex: 1; min-width: 0; min-height: 40px; max-height: 120px; resize: none;
  background: var(--gk-input); border: 1px solid var(--gk-line); border-radius: 10px;
  padding: 8px 10px; outline: none; font-size: 13px;
}
.gk-side-compose button {
  width: 36px; height: 36px; border-radius: 8px; background: #eee; color: #111; flex: none;
}

.gk-pal {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 40;
  align-items: flex-start; justify-content: center; padding-top: 12vh;
}
.gk-pal.open { display: flex; }
.gk-pal-box { width: min(560px, 92vw); background: var(--gk-bg-3); border: 1px solid var(--gk-line); border-radius: 12px; overflow: hidden; }
.gk-pal-box input { width: 100%; background: none; border: 0; border-bottom: 1px solid var(--gk-line); padding: 14px 16px; outline: none; font-size: 14px; }
.gk-pal-list { max-height: 320px; overflow: auto; }
.gk-pal-list button { width: 100%; text-align: left; padding: 10px 16px; font-size: 13px; color: var(--gk-dim); overflow-wrap: anywhere; }
.gk-pal-list button:hover, .gk-pal-list button.on { background: var(--gk-hover); color: var(--gk-text); }
.gk-pal-list em { display: block; font-style: normal; font-size: 11px; color: var(--gk-mute); margin-top: 2px; }

.gk-menu {
  position: fixed; z-index: 50; min-width: 140px; background: var(--gk-bg-3);
  border: 1px solid var(--gk-line); border-radius: 8px; padding: 4px; box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.gk-menu button { display: block; width: 100%; text-align: left; padding: 8px 10px; border-radius: 6px; font-size: 12px; color: var(--gk-dim); }
.gk-menu button:hover { background: var(--gk-hover); color: var(--gk-text); }

@media (max-width: 860px) {
  .gk-side {
    position: fixed; left: 0; top: 0; z-index: 20; height: 100%; height: 100dvh;
    width: min(272px, 86vw); transform: translateX(-100%);
    transition: transform 0.2s ease; background: #141414;
    box-shadow: 8px 0 32px rgba(0,0,0,0.45);
  }
  .gk-app.collapsed .gk-side { width: min(272px, 86vw); max-width: min(272px, 86vw); opacity: 1; pointer-events: auto; }
  .gk-side.open { transform: none; }
  .gk-side-x { display: grid; place-items: center; }
  .gk-backdrop:not([hidden]) { display: block; }
  .gk-thread, .gk-composer-wrap, .gk-wizard, .gk-diffs { padding-left: 16px; padding-right: 16px; }
  .gk-empty h1, .gk-wizard h1 { font-size: 22px; }
  .gk-empty p, .gk-wizard p { font-size: 13px; }
  .gk-composer-wrap { padding-bottom: calc(12px + var(--safe-b)); }
  .gk-row { flex-wrap: wrap; }
  .gk-pills { flex: 1 1 auto; overflow-x: auto; flex-wrap: wrap; }
  .gk-send { width: 44px; height: 44px; border-radius: 10px; }
  .gk-tab-add, #gk-toggle-side { min-width: 36px; min-height: 36px; }
  .gk-title { max-width: 88px; }
  .gk-sidechat {
    position: fixed; left: 0; right: 0; bottom: 0; width: 100%; height: min(68dvh, 560px);
    border-left: 0; border-top: 1px solid var(--gk-line); border-radius: 12px 12px 0 0;
    z-index: 18; box-shadow: 0 -12px 40px rgba(0,0,0,0.4);
  }
  .gk-side-compose button { width: 44px; height: 44px; }
  .gk-repo-fly { min-width: min(92vw, 420px); left: 0; transform: none; flex-direction: column; }
  .gk-repo-col + .gk-repo-col { border-left: 0; border-top: 1px solid var(--gk-line); }
}

@media (max-width: 430px) {
  .gk-handoff { padding: 0 6px; font-size: 11px; }
  .gk-hint { display: none; }
}
