/* app.css — Guxee Web — Anchor Desktop Light */

:root {
  --bg:        #f5f0e8;
  --bg-dark:   #ede7d9;
  --bg-rail:   #e8e2d8;
  --dark:      #2c2416;
  --dark2:     #3a3024;
  --dark3:     #1e180e;
  --accent:    #8b6830;
  --accent-h:  #7a5a28;
  --green:     #216b45;
  --green-bg:  #e8f5ee;
  --text:      #2c2416;
  --sub:       #7a6a50;
  --border:    #c8b898;
  --radius:    5px;
  --rail-w:    188px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; font-family: Arial, 'Lato', sans-serif; font-size: 13px; color: var(--text); background: var(--bg); overflow: hidden; }

/* ── Shell ──────────────────────────────────────────────────────────── */
.shell { display: flex; flex-direction: column; height: 100vh; }

/* ── Top bar ────────────────────────────────────────────────────────── */
.topbar {
  display: flex; align-items: center; gap: 12px;
  height: 46px; padding: 0 14px;
  background: var(--dark); border-bottom: 2px solid var(--dark3);
  flex-shrink: 0;
  position: relative; z-index: 100;
}
.topbar-left  { display: flex; align-items: center; gap: 14px; flex-shrink: 0; }
.topbar-center{ flex: 1; min-width: 0; max-width: 520px; margin: 0 auto; }
.topbar-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.topbar-brand { display: flex; align-items: center; gap: 8px; }
.topbar-logo  { width: 26px; height: 26px; border-radius: 5px; background: var(--accent); display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 900; color: #fff; flex-shrink: 0; }
.topbar-name  { font-size: 16px; font-weight: 800; color: #f5f0e8; letter-spacing: -0.3px; }

.topbar-user  { font-size: 11px; color: #9a8a70; line-height: 1.4; }
.topbar-user strong { color: #c8b898; display: block; font-size: 12px; }

.topbar-search { width: 100%; padding: 6px 14px; border: 1px solid #4a3a2a; border-radius: 20px; background: #3a3024; color: #f5f0e8; font-size: 12px; font-family: inherit; outline: none; }
.topbar-search::placeholder { color: #5a4a38; }
.topbar-search:focus { border-color: var(--accent); background: #2c2416; }

.topbar-btn { padding: 5px 12px; border-radius: 12px; border: 1px solid var(--accent); background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; cursor: pointer; font-family: inherit; white-space: nowrap; }
.topbar-btn:hover { background: var(--accent-h); border-color: var(--accent-h); }
.topbar-btn-ghost { background: transparent; border-color: #4a3a2a; color: #7a6a50; }
.topbar-btn-ghost:hover { background: transparent; border-color: #7a6a50; color: #c8b898; }

/* ── Workspace ──────────────────────────────────────────────────────── */
.workspace { display: flex; flex: 1; overflow: hidden; }

/* ── Rail ───────────────────────────────────────────────────────────── */
.rail { width: var(--rail-w); flex-shrink: 0; background: var(--bg-rail); border-right: 1px solid var(--border); display: flex; flex-direction: column; overflow: hidden; }

.rail-section-head { padding: 9px 10px 7px; font-size: 9px; font-weight: 800; color: var(--sub); text-transform: uppercase; letter-spacing: 0.1em; border-bottom: 1px solid var(--border); flex-shrink: 0; display: flex; align-items: center; justify-content: space-between; }
.rail-add-btn { background: none; border: none; color: var(--accent); font-size: 16px; font-weight: 700; cursor: pointer; line-height: 1; padding: 0 2px; }
.rail-add-btn:hover { color: var(--accent-h); }

.tag-rail { flex: 1; overflow-y: auto; padding: 4px 2px; }

.empty-hint { padding: 10px 8px; font-size: 11px; color: var(--sub); line-height: 1.6; }

.tag-row { display: flex; align-items: center; gap: 5px; padding: 5px 7px; border-radius: var(--radius); cursor: pointer; user-select: none; position: relative; }
.tag-row:hover { background: var(--bg); }
.tag-row.inactive { opacity: 0.42; }
.tag-row.inactive .tag-label { font-style: italic; }

.tag-row input[type="checkbox"] { width: 13px; height: 13px; flex-shrink: 0; accent-color: var(--accent); cursor: pointer; }
.tag-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.tag-label { flex: 1; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag-perm { font-size: 8px; color: var(--accent); flex-shrink: 0; font-weight: 700; }

/* ── Main ───────────────────────────────────────────────────────────── */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }

/* ── Tab bar ────────────────────────────────────────────────────────── */
.tabbar-wrap { display: flex; align-items: stretch; background: var(--dark2); border-bottom: 1px solid var(--dark3); flex-shrink: 0; height: 34px; }

.tab-arrow { flex-shrink: 0; width: 20px; background: transparent; border: none; color: #6a5a48; font-size: 17px; cursor: pointer; padding: 0; display: flex; align-items: center; justify-content: center; }
.tab-arrow:hover { color: #f5f0e8; }

.tabbar { flex: 1; display: flex; overflow-x: auto; scrollbar-width: none; align-items: stretch; gap: 1px; }
.tabbar::-webkit-scrollbar { display: none; }

.tab { display: flex; align-items: center; gap: 5px; padding: 0 9px 0 8px; min-width: 100px; max-width: 180px; height: 34px; background: var(--dark); border-right: 1px solid var(--dark3); cursor: pointer; flex-shrink: 0; }
.tab:hover { background: #2f2518; }
.tab.active { background: var(--bg); border-bottom: 3px solid var(--accent); }
.tab.active .tab-label { color: var(--text); }
.tab-label { flex: 1; min-width: 0; font-size: 10px; font-weight: 600; color: #c8b898; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; user-select: none; }
.tab-close { flex-shrink: 0; width: 14px; height: 14px; background: transparent; border: none; color: #6a5a48; font-size: 13px; line-height: 1; cursor: pointer; padding: 0; border-radius: 3px; display: flex; align-items: center; justify-content: center; }
.tab-close:hover { background: #8b1a1a; color: #fff; }

/* + button and menu */
.tab-add-wrap { position: relative; flex-shrink: 0; display: flex; align-items: center; padding: 0 6px; border-left: 1px solid var(--dark3); }
.tab-add-btn { width: 22px; height: 22px; border-radius: 50%; background: #4a3a2a; border: none; color: #c8b898; font-size: 17px; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0; }
.tab-add-btn:hover { background: var(--accent); color: #fff; }

.tab-add-menu { display: none; position: absolute; top: 36px; right: 0; background: #fff; border: 1px solid var(--border); border-radius: 7px; box-shadow: 0 6px 20px rgba(0,0,0,0.18); min-width: 190px; z-index: 1000; padding: 5px 0; }
.tab-add-menu.open { display: block; }
.tam-item { padding: 8px 14px; font-size: 12px; color: var(--text); cursor: pointer; }
.tam-item:hover { background: var(--bg); }
.tam-sep { border-top: 1px solid var(--border); margin: 4px 0; }

/* ── Proto tag bar (prospective tagging) ─────────────────────────────── */
.proto-bar { display: flex; align-items: center; gap: 8px; padding: 5px 12px; background: #faf7f1; border-bottom: 1px solid var(--border); flex-shrink: 0; flex-wrap: wrap; }
.proto-label { font-size: 10px; font-weight: 700; color: var(--sub); text-transform: uppercase; letter-spacing: 0.07em; white-space: nowrap; flex-shrink: 0; }
.proto-chips { display: flex; gap: 5px; flex-wrap: wrap; flex: 1; }
.proto-chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 10px; border: 1px solid currentColor; font-size: 10px; font-weight: 700; cursor: pointer; background: transparent; }
.proto-chip.selected { color: #fff !important; border-color: transparent !important; }
#statusBar .proto-chip.selected { background: var(--accent); }
.proto-hint { font-size: 10px; color: #b0a088; white-space: nowrap; flex-shrink: 0; }

/* ── Content area ───────────────────────────────────────────────────── */
.content { flex: 1; overflow: hidden; position: relative; }

iframe.llm-frame { width: 100%; height: 100%; border: none; display: block; }

/* ── Replay pane ────────────────────────────────────────────────────── */
.replay-pane { display: flex; flex-direction: column; height: 100%; overflow: hidden; }
.replay-toolbar { display: flex; align-items: center; gap: 10px; padding: 8px 14px; background: var(--bg-dark); border-bottom: 1px solid var(--border); flex-shrink: 0; }
.replay-title { font-size: 11px; font-weight: 800; color: var(--sub); text-transform: uppercase; letter-spacing: 0.08em; }
.replay-filter-info { font-size: 11px; color: var(--sub); flex: 1; }
.replay-clear { background: none; border: 1px solid var(--border); border-radius: 10px; color: var(--sub); font-size: 10px; padding: 2px 8px; cursor: pointer; font-family: inherit; }
.replay-clear:hover { border-color: var(--accent); color: var(--accent); }

.replay-scroll { flex: 1; overflow-y: auto; padding: 14px 18px; }

.empty-replay { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; gap: 14px; color: var(--sub); text-align: center; font-size: 13px; line-height: 1.7; padding: 40px; }
.empty-icon { font-size: 42px; }

/* ── Turns ──────────────────────────────────────────────────────────── */
.turn { margin-bottom: 12px; border-radius: 7px; border: 1px solid var(--border); overflow: hidden; max-width: 860px; }
.turn-user      { border-left: 4px solid var(--accent); }
.turn-assistant { border-left: 4px solid var(--green); }

.turn-header { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; padding: 5px 10px; border-bottom: 1px solid var(--border); }
.turn-user      .turn-header { background: var(--bg-dark); }
.turn-assistant .turn-header { background: var(--green-bg); }

.turn-role { font-size: 10px; font-weight: 700; color: var(--sub); flex-shrink: 0; }
.turn-time { font-size: 10px; color: var(--sub); }
.turn-chips { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }

.tag-chip { display: inline-flex; align-items: center; padding: 2px 7px; border-radius: 10px; border: 1px solid currentColor; font-size: 9px; font-weight: 700; cursor: pointer; background: transparent; line-height: 1.4; }
.tag-chip:hover { opacity: 0.6; text-decoration: line-through; }

.tag-turn-btn { margin-left: auto; flex-shrink: 0; padding: 2px 8px; background: transparent; border: 1px solid var(--border); border-radius: 10px; font-size: 10px; font-weight: 700; color: var(--accent); cursor: pointer; font-family: inherit; white-space: nowrap; }
.tag-turn-btn:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

.turn-body { padding: 10px 12px; font-size: 13px; line-height: 1.65; color: var(--text); white-space: pre-wrap; word-break: break-word; background: #fff; max-height: 340px; overflow-y: auto; }

mark { background: #ffe58a; color: var(--text); border-radius: 2px; padding: 0 1px; }

/* ── Selection tag button ───────────────────────────────────────────── */
.sel-tag-btn { position: fixed; background: var(--accent); color: #fff; border-radius: 5px; padding: 5px 12px; font-size: 11px; font-weight: 700; cursor: pointer; z-index: 9999; box-shadow: 0 3px 14px rgba(0,0,0,0.22); user-select: none; white-space: nowrap; }
.sel-tag-btn:hover { background: var(--accent-h); }

/* ── Tag popover ────────────────────────────────────────────────────── */
.tag-popover { position: fixed; background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 12px 12px 8px; min-width: 180px; max-width: 240px; box-shadow: 0 8px 28px rgba(0,0,0,0.18); z-index: 10000; font-family: inherit; }
.popover-head { font-size: 10px; color: var(--sub); margin-bottom: 8px; padding-bottom: 7px; border-bottom: 1px solid var(--border); line-height: 1.4; }
.popover-row { display: flex; align-items: center; gap: 7px; padding: 4px 0; cursor: pointer; font-size: 12px; }
.popover-row input { accent-color: var(--accent); cursor: pointer; flex-shrink: 0; }
.popover-row:hover { color: var(--accent); }
.popover-empty { font-size: 11px; color: var(--sub); line-height: 1.5; }

/* ── Context menu ───────────────────────────────────────────────────── */
.ctx-menu { display: none; position: fixed; background: #fff; border: 1px solid var(--border); border-radius: 7px; box-shadow: 0 6px 20px rgba(0,0,0,0.16); z-index: 10001; min-width: 160px; padding: 4px 0; font-family: inherit; }
.ctx-menu.open { display: block; }
.ctx-item { padding: 7px 14px; font-size: 12px; cursor: pointer; color: var(--text); }
.ctx-item:hover { background: var(--bg); }
.ctx-danger { color: #8b1a1a; }
.ctx-danger:hover { background: #fff0f0; }

/* ── Guxee ecosystem dashboard ─────────────────────────────────────── */
.nav-rail { padding: 6px; display: flex; flex-direction: column; gap: 4px; }
.nav-row {
  width: 100%;
  text-align: left;
  padding: 8px 9px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.nav-row:hover { background: var(--bg); border-color: var(--border); }
.nav-row.active { background: #fff; border-color: var(--border); color: var(--accent); }

.dashboard-content {
  overflow-y: auto;
  padding: 22px;
  background: var(--bg);
}
.view { display: none; }
.view.active { display: block; }
.dashboard-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 18px;
  align-items: start;
  margin-bottom: 18px;
}
.dashboard-head h1 {
  font-size: 28px;
  line-height: 1.15;
  letter-spacing: -0.3px;
  color: var(--text);
  max-width: 760px;
  margin-bottom: 10px;
}
.dashboard-head p {
  font-size: 14px;
  line-height: 1.65;
  color: var(--sub);
  max-width: 760px;
}
.dash-eyebrow {
  font-size: 10px !important;
  line-height: 1 !important;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent) !important;
  margin-bottom: 9px;
}
.license-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  box-shadow: 0 3px 14px rgba(0,0,0,0.06);
}
.license-card strong {
  display: block;
  font-size: 13px;
  margin-bottom: 7px;
  color: var(--text);
}
.license-card span {
  display: block;
  font-size: 12px;
  line-height: 1.55;
  color: var(--sub);
}
.dash-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.dash-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.dash-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 17px;
  min-height: 190px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}
.dash-card h2 {
  font-size: 19px;
  color: var(--text);
}
.dash-card p {
  font-size: 13px;
  line-height: 1.62;
  color: var(--sub);
}
.dash-tag {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  background: #faf2df;
  border: 1px solid #e1d4bc;
  border-radius: 12px;
  padding: 4px 8px;
}
.dash-btn {
  margin-top: auto;
  padding: 8px 12px;
  border-radius: 6px;
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  font-family: inherit;
}
.dash-btn:hover { background: var(--accent-h); }
.feature-list {
  display: grid;
  gap: 10px;
  max-width: 900px;
}
.feature-list div {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 13px 15px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--sub);
}
.feature-list strong { color: var(--text); }
.dashboard-footer {
  margin-top: 24px;
  padding: 16px 0 4px;
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 14px;
  color: var(--sub);
  font-size: 11px;
}
.dashboard-footer nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px 13px;
}
.dashboard-footer a {
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
}
.dashboard-footer a:hover { color: var(--accent); }

@media (max-width: 900px) {
  html, body { overflow: auto; }
  .shell { min-height: 100vh; height: auto; }
  .workspace { flex-direction: column; overflow: visible; }
  .rail { width: 100%; max-height: none; border-right: none; border-bottom: 1px solid var(--border); }
  .nav-rail { flex-direction: row; overflow-x: auto; }
  .nav-row { white-space: nowrap; }
  .dashboard-head, .dash-grid, .dash-grid.three, .dashboard-footer { grid-template-columns: 1fr; }
  .dashboard-footer nav { justify-content: flex-start; }
  .dashboard-content { min-height: 70vh; }
}
.ctx-sep { border-top: 1px solid var(--border); margin: 3px 0; }
