/*
 * Agent V3.1
 * Directly derived from the proven V2 layout. This file changes only the
 * visual palette and surface contrast; layout and interaction stay in V2.
 */

html.ui-v31 {
  --forest: #2b2c2c;
  --forest-2: #202121;
  --green: #555756;
  --lime: #a9abaa;
  --ink: #343535;
  --muted: #7d7f7e;
  --line: #e2e3e2;
  --paper: #f4f4f3;
  --panel: #ffffff;
  color: var(--ink);
  background: var(--paper);
}

html.ui-v31 body {
  color: #343535;
  background: #f4f4f3;
}

/* Sign-in: keep V2 composition, move the color language to soft charcoal. */
html.ui-v31 .auth-gate { background: #f3f3f2; }
html.ui-v31 .auth-visual {
  color: #ededec;
  background:
    radial-gradient(circle at 15% 0%, rgba(255,255,255,.08), transparent 34%),
    radial-gradient(circle at 90% 100%, rgba(255,255,255,.055), transparent 38%),
    linear-gradient(145deg, #323333, #202121);
}
html.ui-v31 .auth-visual::after { border-color: rgba(255,255,255,.07); }
html.ui-v31 .auth-brand small,
html.ui-v31 .auth-copy li small { color: #a3a5a4; }
html.ui-v31 .auth-copy > p,
html.ui-v31 .auth-copy li > i { color: #d0d1d0; }
html.ui-v31 .auth-copy li > i {
  border-color: rgba(255,255,255,.12);
  background: rgba(255,255,255,.04);
}
html.ui-v31 .auth-card {
  border-color: #dedfdd;
  background: rgba(255,255,255,.96);
  box-shadow: 0 24px 70px rgba(28,29,29,.09);
}
html.ui-v31 .auth-kicker,
html.ui-v31 .auth-card label,
html.ui-v31 .member-create label { color: #676968; }
html.ui-v31 .auth-card input,
html.ui-v31 .member-create input {
  border-color: #dedfdd;
  color: #343535;
  background: #fafafa;
}
html.ui-v31 .auth-card input:focus,
html.ui-v31 .member-create input:focus {
  border-color: #8e908f;
  box-shadow: 0 0 0 3px rgba(45,46,46,.07);
}
html.ui-v31 .auth-card > button {
  background: linear-gradient(135deg, #575958, #414342);
  box-shadow: 0 8px 22px rgba(30,31,31,.16);
}

/* The V2 sidebar remains dark; only its green undertone is removed. */
html.ui-v31 .sidebar {
  color: #dedfdf;
  background: linear-gradient(180deg, #2c2d2d, #202121);
}
html.ui-v31 .sidebar::before { background: rgba(255,255,255,.04); }
html.ui-v31 .brand-mark {
  border-color: rgba(255,255,255,.16);
  color: #343535;
  background: linear-gradient(145deg, #efefee, #bfc1c0);
}
html.ui-v31 .brand small,
html.ui-v31 .sidebar nav button,
html.ui-v31 .sidebar-note small { color: #9b9d9c; }
html.ui-v31 .sidebar nav button.active {
  color: #fff;
  background: rgba(255,255,255,.10);
  box-shadow: inset 3px 0 #afb1b0;
}
html.ui-v31 .sidebar nav button > i,
html.ui-v31 .online-dot,
html.ui-v31 .live-badge i,
html.ui-v31 .agent-avatar i {
  background: #a3a5a4;
  box-shadow: 0 0 0 4px rgba(255,255,255,.08);
}

/* Neutral controls, menus and badges. */
html.ui-v31 .hy-select-trigger,
html.ui-v31 .shop-picker select {
  border-color: #dcdedc;
  color: #3e403f;
  background: linear-gradient(180deg, #fff, #f7f7f6);
  box-shadow: 0 1px 2px rgba(25,26,26,.04);
}
html.ui-v31 .hy-select-trigger > i,
html.ui-v31 .hy-select.open .hy-select-trigger > i { background: #eeeeed; }
html.ui-v31 .hy-select-trigger > i::before {
  border-right-color: #656766;
  border-bottom-color: #656766;
}
html.ui-v31 .hy-select.open .hy-select-trigger {
  border-color: #959796;
  box-shadow: 0 0 0 3px rgba(45,46,46,.07);
}
html.ui-v31 .hy-select-menu {
  border-color: #dedfdd;
  box-shadow: 0 16px 38px rgba(22,23,23,.14), 0 3px 10px rgba(22,23,23,.05);
}
html.ui-v31 .hy-select-menu button { color: #464847; }
html.ui-v31 .hy-select-menu button:hover {
  color: #292a2a;
  background: #f1f1f0;
}
html.ui-v31 .hy-select-menu button[aria-selected="true"] {
  color: #303131;
  background: #e9e9e8;
}
html.ui-v31 .live-badge {
  color: #5d5f5e;
  background: #eeeeed;
  border-color: #dfdfde;
}
html.ui-v31 .member-menu-button span,
html.ui-v31 .agent-avatar {
  background: linear-gradient(145deg, #5c5e5d, #454746);
  box-shadow: 0 6px 16px rgba(30,31,31,.14);
}

/* Chat: V2 density and geometry, lower-contrast surfaces for long sessions. */
html.ui-v31 .agent-meta > span { color: #737574; background: #f1f1f0; }
html.ui-v31 .agent-meta button {
  border-color: #dedfdd;
  color: #565857;
  background: #f8f8f7;
}
html.ui-v31 .agent-meta button b { background: #777978; }
html.ui-v31 .notification-toolbar > div { background: #ececeb; }
html.ui-v31 .notification-toolbar > div button.active,
html.ui-v31 .notification-toolbar > button,
html.ui-v31 .notification-row aside button {
  border-color: #dedfdd;
  color: #565857;
  background: #f9f9f8;
}
html.ui-v31 .notification-row.unread {
  border-color: #bfc1bf;
  box-shadow: inset 3px 0 0 #646665;
}
html.ui-v31 .notification-row.success > i { background: #696b6a; }
html.ui-v31 .notification-row.warning > i { background: #8a8c8b; }
html.ui-v31 .notification-row.error > i { background: #4d4f4e; }
html.ui-v31 .notification-row header span { color: #656766; }
html.ui-v31 .empty-orbit {
  border-color: #dedfdd;
  color: #555756;
  background: linear-gradient(145deg, #f1f1f0, #dddddc);
  box-shadow: 0 12px 28px rgba(35,36,36,.07);
}
html.ui-v31 .eyebrow,
html.ui-v31 .starter-grid button span { color: #737574 !important; }
html.ui-v31 .starter-grid button {
  border-color: #e2e3e2;
  color: #4c4e4d;
  background: #fafaf9;
}
html.ui-v31 .starter-grid button:hover {
  border-color: #bfc1bf;
  background: #fff;
  box-shadow: 0 8px 20px rgba(32,33,33,.06);
}
html.ui-v31 .message.user .bubble {
  color: #f5f5f4;
  background: linear-gradient(145deg, #585a59, #464847);
  box-shadow: 0 7px 18px rgba(26,27,27,.12);
}
html.ui-v31 .message.assistant .bubble {
  color: #363837;
  background: #f8f8f7;
  border-color: #e3e4e3;
}
html.ui-v31 .bubble blockquote {
  border-left-color: #929493;
  color: #5f6160;
  background: #efefee;
}
html.ui-v31 .bubble code,
html.ui-v31 .md-code-label {
  color: #555756;
  background: #ebebea;
}
html.ui-v31 .md-code { border-color: #dedfdd; background: #f2f2f1; }
html.ui-v31 .md-code-label { border-bottom-color: #dedfdd; }
html.ui-v31 .bubble .md-code pre { color: #414342; }
html.ui-v31 .suggestions button {
  border-color: #d9dad9;
  color: #515352;
  background: #fff;
}
html.ui-v31 .suggestions button:hover {
  border-color: #aeb0af;
  background: #f3f3f2;
}
html.ui-v31 .suggestions button em { color: #6f7170; background: #eeeeed; }
html.ui-v31 .dots i,
html.ui-v31 .typing-caret::after { background: #858786; }
html.ui-v31 .composer-box {
  border-color: #dbdcdb;
  background: #fbfbfa;
  box-shadow: 0 6px 20px rgba(27,28,28,.045);
}
html.ui-v31 .composer-box:focus-within {
  border-color: #989a99;
  box-shadow: 0 8px 24px rgba(25,26,26,.07);
}
html.ui-v31 .composer-foot button {
  color: #f5f5f4;
  background: linear-gradient(135deg, #595b5a, #444645);
  box-shadow: 0 5px 13px rgba(27,28,28,.14);
}
html.ui-v31 .resize-handle:hover span,
html.ui-v31 .resizing .resize-handle span { background: #8d8f8e; }

/* Workbench cards and quick actions. */
html.ui-v31 .welcome-card { background: linear-gradient(145deg, #fff, #f7f7f6); }
html.ui-v31 .workspace-settings-button,
html.ui-v31 .quick-action-group button {
  border-color: #dedfdd;
  color: #535554;
  background: #fafaf9;
}
html.ui-v31 .quick-action-tabs button.active {
  color: #fff;
  background: #5a5c5b;
}
html.ui-v31 .quick-action-tabs { border-color: #e1e2e1; background: #f2f2f1; }
html.ui-v31 .quick-action-tabs button { color: #777978; }
html.ui-v31 .quick-action-group > header { color: #5f6160; }
html.ui-v31 .quick-action-group > header i {
  color: #5c5e5d;
  background: #eeeeed;
}
html.ui-v31 .quick-action-group button:hover {
  border-color: #aaaead;
  background: #f1f1f0;
  box-shadow: 0 6px 15px rgba(28,29,29,.055);
}
html.ui-v31 .cli-maintenance {
  border-color: #dedfdd;
  background:
    radial-gradient(circle at 100% 0, rgba(255,255,255,.8), transparent 36%),
    linear-gradient(145deg, #fafaf9, #f1f1f0);
}
html.ui-v31 .cli-maintenance > header span,
html.ui-v31 .cli-update-message,
html.ui-v31 .cli-auto-row small,
html.ui-v31 .cli-admin-note { color: #858786; }
html.ui-v31 .cli-maintenance > header strong,
html.ui-v31 .cli-auto-row strong { color: #4e504f; }
html.ui-v31 .cli-maintenance > header i {
  color: #5b5d5c;
  background: #e9e9e8;
}
html.ui-v31 .cli-version-row p strong,
html.ui-v31 .runtime-flow li > b,
html.ui-v31 .memory-status-grid strong { color: #555756; }
html.ui-v31 .runtime-flow li > b,
html.ui-v31 .memory-row > i,
html.ui-v31 .identity-row > i { background: #eeeeed; }
html.ui-v31 .switch input:checked + span { background: #666867; }
html.ui-v31 .switch span { background: #c9cbca; }
html.ui-v31 .cli-update-actions button,
html.ui-v31 .cli-update-dialog footer button {
  border-color: #d9dad9;
  color: #555756;
}
html.ui-v31 .cli-update-actions button.primary,
html.ui-v31 .cli-update-dialog footer button.primary {
  border-color: #505251;
  background: linear-gradient(135deg, #5d5f5e, #474948);
}
html.ui-v31 .check {
  color: #555756;
  background: #e9e9e8;
}

/* Tables, diagrams and dialogs keep their V2 behavior with neutral chrome. */
html.ui-v31 .md-table { border-color: #e0e1e0; }
html.ui-v31 .md-table th { color: #666867; background: #f1f1f0; border-bottom-color: #dedfdd; }
html.ui-v31 .md-table td { border-bottom-color: #ededec; }
html.ui-v31 .table-pager { color: #7d7f7e; background: #fafaf9; }
html.ui-v31 .table-pager button { color: #5f6160; }
html.ui-v31 .artifact-selector { border-color: #dedfdd; background: #fafaf9; }
html.ui-v31 .artifact-selector > summary::before,
html.ui-v31 .artifact-selector > summary strong { color: #555756; }
html.ui-v31 .artifact-selector > summary span,
html.ui-v31 .artifact-selector td span {
  color: #5f6160;
  background: #e9e9e8;
}
html.ui-v31 .artifact-selector-filter,
html.ui-v31 .artifact-selector-action,
html.ui-v31 .artifact-selector-pager {
  border-color: #e2e3e2;
  background: #f5f5f4;
}
html.ui-v31 .artifact-selector th { color: #666867; background: #f1f1f0; }
html.ui-v31 .artifact-selector-filter input:focus,
html.ui-v31 .artifact-selector-action input:focus {
  border-color: #a8aaa8;
  box-shadow: 0 0 0 2px rgba(60,61,61,.07);
}
html.ui-v31 .artifact-selector input[type="checkbox"] { accent-color: #5d5f5e; }
html.ui-v31 .artifact-selector-action button {
  border-color: #555756;
  background: #555756;
}
html.ui-v31 .logic-diagram {
  border-color: #dedfdd;
  background:
    radial-gradient(circle at 95% 0%, rgba(255,255,255,.78), transparent 32%),
    linear-gradient(145deg, #fafaf9, #f1f1f0);
  box-shadow: 0 8px 22px rgba(28,29,29,.045);
}
html.ui-v31 .logic-node,
html.ui-v31 .structure-card,
html.ui-v31 .logic-lane { border-color: #dedfdd; }
html.ui-v31 .structure-track,
html.ui-v31 .structure-bar-track,
html.ui-v31 .structure-bar,
html.ui-v31 .metric-bar-track { background: #e7e7e6; }
html.ui-v31 .structure-bar-fill,
html.ui-v31 .structure-track > i,
html.ui-v31 .metric-bar-fill { background: linear-gradient(90deg, #6e706f, #aeb0af); }
html.ui-v31 .logic-lane header i { background: #929493; box-shadow: 0 0 0 4px rgba(70,72,71,.08); }
html.ui-v31 .tree-node.tone-neutral,
html.ui-v31 .tone-positive .logic-node {
  border-color: #dedfdd;
  color: #4b4d4c;
  background: #f7f7f6;
}
html.ui-v31 dialog:not(.fatal) {
  border-color: #dedfdd;
  color: #353736;
  background: #f7f7f6;
  box-shadow: 0 28px 90px rgba(18,19,19,.22);
}
html.ui-v31 dialog::backdrop { background: rgba(17,18,18,.46); }
html.ui-v31 .dialog-head span { color: #777978; }
html.ui-v31 .member-row > i,
html.ui-v31 .workspace-editor-group > header i,
html.ui-v31 .member-form-actions button,
html.ui-v31 .memory-create button,
html.ui-v31 .quick-input-dialog form > footer button {
  background: #5b5d5c;
}
html.ui-v31 .member-security {
  border-color: #dedfdd;
  background: #fafaf9;
}
html.ui-v31 .member-security > header {
  border-color: #e2e3e2;
  background: #f1f1f0;
}
html.ui-v31 .member-security > header span,
html.ui-v31 .member-security-event strong { color: #555756; }
html.ui-v31 .member-security-event > i,
html.ui-v31 .member-security-event > em {
  color: #5f6160;
  background: #e9e9e8;
}
html.ui-v31 .identity-row.default,
html.ui-v31 .history-row.active {
  border-color: #9b9d9c;
  background: #f0f0ef;
  box-shadow: inset 3px 0 0 #696b6a;
}
html.ui-v31 .memory-status-grid p { border-color: #e4e5e4; background: #fafaf9; }
html.ui-v31 .memory-status-grid span { color: #7b7d7c; }
html.ui-v31 .workspace-config-dialog form > footer button.primary,
html.ui-v31 .agent-update-dialog > footer button.primary {
  border-color: #505251;
  background: #505251;
}

html.ui-v31 .job-statuses {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}
html.ui-v31 .job-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 10px;
  border: 1px solid #dedfdd;
  border-radius: 10px;
  color: #686a69;
  background: #fafaf9;
  font-size: 12px;
}
html.ui-v31 .job-status strong {
  color: #4d4f4e;
  font-weight: 650;
}
html.ui-v31 .job-status.succeed {
  border-color: #c9d9cd;
  background: #f3f8f4;
}
html.ui-v31 .job-status.failed,
html.ui-v31 .job-status.cancelled {
  border-color: #dfceca;
  background: #faf5f3;
}
html.ui-v31 .job-status.running,
html.ui-v31 .job-status.scheduled {
  border-color: #d8d5c5;
  background: #faf9f1;
}
html.ui-v31 .schedule-row,
html.ui-v31 .schedule-run {
  border-color: #dedfdd;
  background: #fafaf9;
}
html.ui-v31 .schedule-row > header span,
html.ui-v31 .created-schedule-card > span {
  color: #5f6160;
  background: #e9e9e8;
}
html.ui-v31 .schedule-row > header i {
  color: #565857;
  background: #ececeb;
}
html.ui-v31 .schedule-row dl div,
html.ui-v31 .schedule-run pre {
  background: #f1f1f0;
}
html.ui-v31 .schedule-actions button,
html.ui-v31 .created-schedule-card button {
  border-color: #d9dad9;
  color: #555756;
  background: #f8f8f7;
}
html.ui-v31 .created-schedule-card {
  border-color: #dedfdd;
  background: #f5f5f4;
}

@media (prefers-reduced-motion: reduce) {
  html.ui-v31 *,
  html.ui-v31 *::before,
  html.ui-v31 *::after {
    scroll-behavior: auto !important;
  }
}
