:root {
  --bg: #0b0f17;
  --surface: #121826;
  --surface-2: #182032;
  --border: #26324a;
  --text: #e8eefc;
  --muted: #93a3c4;
  --primary: #5b8cff;
  --primary-hover: #4677f5;
  --good: #22c55e;
  --warn: #f59e0b;
  --danger: #ef4444;
  --accent-gemini: #38bdf8;
  --accent-gpt: #a78bfa;
  --radius: 12px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

.hidden {
  display: none !important;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Topbar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 22px;
  background: rgba(18, 24, 38, 0.92);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 20;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent-gemini), var(--accent-gpt));
  display: grid;
  place-items: center;
  font-size: 18px;
  box-shadow: 0 4px 14px rgba(91, 140, 255, 0.35);
}

.brand h1 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.brand-sub {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.status-pills {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
}

.pill-ok {
  border-color: rgba(34, 197, 94, 0.4);
  background: rgba(34, 197, 94, 0.14);
  color: #86efac;
}

.pill-err {
  border-color: rgba(239, 68, 68, 0.45);
  background: rgba(239, 68, 68, 0.14);
  color: #fca5a5;
}

.pill-warn {
  border-color: rgba(245, 158, 11, 0.45);
  background: rgba(245, 158, 11, 0.15);
  color: #fcd34d;
}

.pill-idle {
  color: var(--muted);
}

/* Workspace Layout */
.workspace {
  display: grid;
  grid-template-columns: 370px 1fr;
  gap: 16px;
  padding: 16px 20px 24px;
  flex: 1;
  align-items: start;
}

@media (max-width: 1120px) {
  .workspace {
    grid-template-columns: 1fr;
  }
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.stage {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.card-header h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.muted-text {
  color: var(--muted);
  font-size: 12px;
}

/* Form Controls */
.field-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin: 10px 0 6px;
}

.field-label:first-child {
  margin-top: 0;
}

textarea,
input[type="text"],
input[type="password"],
input[type="number"],
select {
  width: 100%;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 11px;
  font-family: inherit;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s ease;
}

textarea:focus,
input:focus,
select:focus {
  border-color: var(--primary);
}

textarea {
  resize: vertical;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.input-with-unit {
  display: flex;
  align-items: center;
  gap: 6px;
}

.input-with-unit span {
  color: var(--muted);
  font-size: 12px;
  flex-shrink: 0;
}

.segmented {
  display: inline-flex;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2px;
}

.seg-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
}

.seg-btn.active {
  background: var(--surface-2);
  color: var(--text);
  font-weight: 600;
}

.file-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.file-upload-label {
  cursor: pointer;
}

.preset-row {
  margin-top: 10px;
}

.rubric-details {
  margin-top: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
}

.rubric-details summary {
  cursor: pointer;
  font-size: 12px;
  color: var(--muted);
  user-select: none;
}

.rubric-details textarea {
  margin-top: 8px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 8px 13px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

.btn-block {
  width: 100%;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), #6c63ff);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  filter: brightness(1.08);
}

.btn-secondary {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--text);
}

.btn-secondary:hover:not(:disabled) {
  border-color: var(--primary);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--surface-2);
  color: var(--text);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.5);
  color: #fecaca;
}

.control-buttons {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.manual-steps {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}

.step-btn-group {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: 6px;
}

/* Pipeline Banner & Log */
.pipeline-banner {
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
}

.pipeline-banner.running {
  border-color: rgba(56, 189, 248, 0.5);
  background: rgba(56, 189, 248, 0.12);
  color: #7dd3fc;
}

.pipeline-banner.done {
  border-color: rgba(34, 197, 94, 0.5);
  background: rgba(34, 197, 94, 0.12);
  color: #86efac;
}

.pipeline-banner.error {
  border-color: rgba(239, 68, 68, 0.5);
  background: rgba(239, 68, 68, 0.12);
  color: #fca5a5;
}

.event-log {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 220px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.event-log li {
  font-size: 12px;
  color: var(--muted);
  background: var(--bg);
  border-left: 3px solid var(--border);
  padding: 6px 8px;
  border-radius: 4px;
}

.event-log li.gemini {
  border-left-color: var(--accent-gemini);
}

.event-log li.gpt {
  border-left-color: var(--accent-gpt);
}

.event-log li.good {
  border-left-color: var(--good);
  color: #bbf7d0;
}

.event-log li.err {
  border-left-color: var(--danger);
  color: #fecaca;
}

/* Timeline Card */
.timeline-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.timeline-top h2 {
  margin: 0;
  font-size: 15px;
}

.score-chart-wrap {
  min-width: 240px;
  height: 54px;
}

.version-tabs {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.version-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
}

.version-tab.active {
  border-color: var(--primary);
  background: rgba(91, 140, 255, 0.14);
  color: var(--text);
}

.version-score-tag {
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 11px;
  background: var(--surface-2);
}

.version-score-tag.pass {
  background: rgba(34, 197, 94, 0.18);
  color: #86efac;
}

/* Split View */
.split-grid {
  display: grid;
  grid-template-columns: 1.08fr 0.92fr;
  gap: 14px;
  align-items: stretch;
}

@media (max-width: 1280px) {
  .split-grid {
    grid-template-columns: 1fr;
  }
}

.pane {
  display: flex;
  flex-direction: column;
  min-height: 560px;
}

.pane-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.note-box {
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 10px;
  font-size: 12px;
}

.note-box p {
  margin: 4px 0 0;
  color: #bae6fd;
  white-space: pre-wrap;
}

.draft-editor {
  flex: 1;
  min-height: 440px;
  line-height: 1.75;
  font-size: 14px;
  padding: 14px;
}

.diff-view {
  flex: 1;
  min-height: 440px;
  max-height: 640px;
  overflow-y: auto;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  font-size: 13px;
  line-height: 1.7;
  white-space: pre-wrap;
}

.diff-line-add {
  background: rgba(34, 197, 94, 0.16);
  color: #bbf7d0;
  padding: 1px 4px;
  border-radius: 3px;
}

.diff-line-del {
  background: rgba(239, 68, 68, 0.16);
  color: #fecaca;
  text-decoration: line-through;
  padding: 1px 4px;
  border-radius: 3px;
}

/* Review Pane */
.empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 30px;
  gap: 6px;
}

.empty-icon {
  font-size: 32px;
}

.review-content {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.score-hero {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
}

.score-circle {
  width: 82px;
  height: 82px;
  border-radius: 50%;
  border: 3px solid var(--accent-gpt);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: rgba(167, 139, 250, 0.1);
}

.score-circle span {
  font-size: 26px;
  font-weight: 800;
  line-height: 1;
}

.score-circle small {
  font-size: 11px;
  color: var(--muted);
}

.score-verdict {
  flex: 1;
}

.review-summary {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--text);
}

.section-block h3 {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--muted);
}

.dimension-bars {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dim-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
}

.dim-head {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 5px;
}

.dim-track {
  height: 6px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
}

.dim-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-gpt), var(--primary));
  border-radius: 999px;
}

.dim-comment {
  margin: 5px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.bullet-list {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 13px;
}

.bullet-list.good li::marker {
  color: var(--good);
}

.bullet-list.warn li::marker {
  color: var(--warn);
}

.instructions-box {
  background: rgba(167, 139, 250, 0.08);
  border: 1px solid rgba(167, 139, 250, 0.32);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  white-space: pre-wrap;
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
}

.modal-panel {
  position: relative;
  width: min(820px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.modal-header, .modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

.modal-footer {
  border-top: 1px solid var(--border);
  border-bottom: 0;
  justify-content: flex-end;
}

.modal-header h2 {
  margin: 0;
  font-size: 16px;
}

.modal-body {
  padding: 16px 18px;
}

.config-notice {
  background: rgba(91, 140, 255, 0.1);
  border: 1px solid rgba(91, 140, 255, 0.35);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 12px;
  margin-bottom: 14px;
}

.config-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 720px) {
  .config-grid {
    grid-template-columns: 1fr;
  }
}

.config-section {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  display: flex;
  flex-direction: column;
}

.config-section h3 {
  margin: 0 0 6px;
  font-size: 14px;
}

.config-section .btn {
  margin-top: 12px;
  align-self: flex-start;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
}


/* Top View Switcher */
.view-switcher {
  display: inline-flex;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 3px;
  gap: 4px;
}

.nav-tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.nav-tab.active {
  background: linear-gradient(135deg, var(--primary), #6c63ff);
  color: #fff;
}

.mt-8 {
  margin-top: 8px;
}

/* Chat Workspace */
.chat-workspace {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 16px;
  padding: 16px 20px 20px;
  flex: 1;
  align-items: stretch;
  min-height: calc(100vh - 76px);
}

@media (max-width: 1080px) {
  .chat-workspace {
    grid-template-columns: 1fr;
  }
}

.chat-sidebar {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.path-input-row {
  display: flex;
  gap: 6px;
}

.path-input-row input {
  flex: 1;
}

.doc-btn-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.scanned-list {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 150px;
  overflow-y: auto;
}

.scanned-item {
  text-align: left;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 10px;
  color: var(--text);
  cursor: pointer;
  font-size: 12px;
}

.scanned-item:hover {
  border-color: var(--primary);
}

.scanned-item small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  word-break: break-all;
}

.doc-preview-box {
  margin-top: 10px;
  background: var(--bg);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 8px;
  padding: 9px 11px;
}

.doc-preview-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
}

.doc-snippet {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--muted);
  max-height: 90px;
  overflow-y: auto;
  white-space: pre-wrap;
}

.chat-util-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
}

/* Chat Stage */
.chat-stage {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 112px);
  max-height: calc(100vh - 112px);
  padding: 0;
  overflow: hidden;
}

.chat-stage-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.chat-stage-header h2 {
  margin: 0;
  font-size: 15px;
}

.chat-stage-header p {
  margin: 2px 0 0;
}

.role-legend {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pill-gemini {
  border-color: rgba(56, 189, 248, 0.45);
  background: rgba(56, 189, 248, 0.14);
  color: #7dd3fc;
}

.pill-gpt {
  border-color: rgba(167, 139, 250, 0.45);
  background: rgba(167, 139, 250, 0.14);
  color: #ddd6fe;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: rgba(11, 15, 23, 0.55);
}

.chat-empty-hint {
  margin: auto;
  max-width: 520px;
  text-align: center;
  color: var(--muted);
  padding: 24px;
  border: 1px dashed var(--border);
  border-radius: 12px;
}

.chat-empty-hint h3 {
  margin: 0 0 8px;
  color: var(--text);
}

.msg-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  max-width: 92%;
}

.msg-row.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.msg-row.system {
  align-self: center;
  max-width: 100%;
}

.msg-avatar {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 16px;
  flex-shrink: 0;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.msg-row.gemini .msg-avatar {
  border-color: rgba(56, 189, 248, 0.5);
  background: rgba(56, 189, 248, 0.14);
}

.msg-row.gpt .msg-avatar {
  border-color: rgba(167, 139, 250, 0.5);
  background: rgba(167, 139, 250, 0.14);
}

.msg-row.user .msg-avatar {
  border-color: rgba(91, 140, 255, 0.5);
  background: rgba(91, 140, 255, 0.18);
}

.msg-bubble {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 14px;
  min-width: 220px;
}

.msg-row.gemini .msg-bubble {
  border-color: rgba(56, 189, 248, 0.35);
}

.msg-row.gpt .msg-bubble {
  border-color: rgba(167, 139, 250, 0.35);
}

.msg-row.user .msg-bubble {
  background: rgba(91, 140, 255, 0.16);
  border-color: rgba(91, 140, 255, 0.45);
}

.msg-row.system .msg-bubble {
  background: var(--surface-2);
  font-size: 12px;
  color: var(--muted);
  padding: 6px 12px;
}

.msg-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
  font-size: 12px;
}

.msg-sender {
  font-weight: 700;
}

.msg-row.gemini .msg-sender { color: #7dd3fc; }
.msg-row.gpt .msg-sender { color: #ddd6fe; }
.msg-row.user .msg-sender { color: #93c5fd; }

.msg-time {
  color: var(--muted);
  font-size: 11px;
}

.msg-body {
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.65;
  font-size: 13.5px;
}

.msg-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px dashed rgba(255, 255, 255, 0.08);
  flex-wrap: wrap;
}

.msg-action-btn {
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--muted);
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 6px;
  cursor: pointer;
}

.msg-action-btn:hover {
  border-color: var(--primary);
  color: var(--text);
}

/* Chat Composer */
.chat-composer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.composer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.composer-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-gemini {
  background: rgba(56, 189, 248, 0.16);
  border-color: rgba(56, 189, 248, 0.45);
  color: #bae6fd;
}

.btn-gemini:hover:not(:disabled) {
  background: rgba(56, 189, 248, 0.25);
}

.btn-gpt {
  background: rgba(167, 139, 250, 0.16);
  border-color: rgba(167, 139, 250, 0.45);
  color: #e9d5ff;
}

.btn-gpt:hover:not(:disabled) {
  background: rgba(167, 139, 250, 0.25);
}

.doc-jump-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.doc-jump-link {
  display: block;
  margin-top: 7px;
  font-size: 12px;
  color: var(--accent-gemini);
  text-decoration: underline;
  word-break: break-all;
}

/* In-page PC File Browser */
.browser-shortcuts {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.browser-path-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}

.browser-path-bar input {
  flex: 1;
  font-size: 12px;
  color: var(--muted);
}

.browser-entries {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 380px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  background: var(--bg);
}

.browser-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
}

.browser-row:hover {
  border-color: var(--primary);
  background: var(--surface-2);
}

.browser-row.file-item {
  border-color: rgba(56, 189, 248, 0.25);
}

/* Mode Switcher & Free Web Relay */
.mode-switcher {
  display: inline-flex;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 3px;
  gap: 4px;
}

.mode-tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.mode-tab.active {
  background: rgba(34, 197, 94, 0.18);
  border: 1px solid rgba(34, 197, 94, 0.45);
  color: #86efac;
}

.web-launch-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.web-launch-links a,
.web-launch-row a {
  text-decoration: none;
}

.web-launch-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}

.web-loop-panel {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}

.web-loop-buttons {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

/* Commander Role & Quick Chips */
.pill-commander {
  border-color: rgba(34, 197, 94, 0.45);
  background: rgba(34, 197, 94, 0.14);
  color: #86efac;
}

.msg-row.commander .msg-avatar {
  border-color: rgba(34, 197, 94, 0.5);
  background: rgba(34, 197, 94, 0.14);
}

.msg-row.commander .msg-bubble {
  border-color: rgba(34, 197, 94, 0.4);
  background: rgba(34, 197, 94, 0.07);
}

.msg-row.commander .msg-sender {
  color: #86efac;
}

.quick-prompts {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.quick-chip {
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--muted);
  font-size: 11.5px;
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s ease;
}

.quick-chip:hover {
  border-color: var(--primary);
  color: var(--text);
}

.composer-sub-actions {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

/* Admin Audit Console */
.modal-panel-wide {
  width: min(1060px, 100%);
}

.admin-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.admin-gate-form {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.admin-grid {
  display: grid;
  grid-template-columns: 310px 1fr;
  gap: 14px;
}

@media (max-width: 820px) {
  .admin-grid {
    grid-template-columns: 1fr;
  }
}

.admin-users-pane,
.admin-detail-pane {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  min-height: 440px;
  display: flex;
  flex-direction: column;
}

.admin-users-pane h3,
.admin-detail-head h3 {
  margin: 0 0 8px;
  font-size: 14px;
}

.admin-users-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  max-height: 400px;
}

.admin-user-card {
  text-align: left;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 11px;
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
}

.admin-user-card.active,
.admin-user-card:hover {
  border-color: var(--primary);
  background: var(--surface-2);
}

.admin-user-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  font-weight: 700;
}

.admin-user-meta {
  margin-top: 4px;
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.5;
}

.admin-detail-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.admin-detail-body {
  flex: 1;
  overflow-y: auto;
  max-height: 360px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.admin-record-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 11px;
  font-size: 12.5px;
  white-space: pre-wrap;
  word-break: break-word;
}

.admin-record-item strong {
  display: block;
  margin-bottom: 4px;
  font-size: 12px;
  color: var(--accent-gemini);
}

.unified-key-box {
  background: rgba(91, 140, 255, 0.08);
  border: 1px solid rgba(91, 140, 255, 0.35);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 14px;
}

.unified-key-box h3 {
  margin: 0 0 4px;
  font-size: 13.5px;
  color: #93c5fd;
}

.unified-key-grid {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 8px;
  align-items: center;
}

@media (max-width: 720px) {
  .unified-key-grid {
    grid-template-columns: 1fr;
  }
}

.doc-files-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 7px;
  max-height: 92px;
  overflow-y: auto;
}

.doc-file-chip {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
}

.digest-ready-banner {
  margin-top: 8px;
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  background: rgba(34, 197, 94, 0.14);
  border: 1px solid rgba(34, 197, 94, 0.45);
  color: #86efac;
}

.dongdong-box {
  border-color: rgba(245, 158, 11, 0.35);
}

.dongdong-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.checkbox-inline {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
}

.dongdong-audit-box {
  margin: 0 14px 10px;
  padding: 10px 12px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--bg);
  font-size: 12.5px;
  line-height: 1.55;
  white-space: pre-wrap;
  max-height: 190px;
  overflow-y: auto;
}

.dongdong-audit-bad {
  border-color: rgba(239, 68, 68, 0.55);
  background: rgba(239, 68, 68, 0.08);
  color: #fecaca;
}

.dongdong-audit-ok {
  border-color: rgba(34, 197, 94, 0.45);
  background: rgba(34, 197, 94, 0.08);
  color: #bbf7d0;
}
