/* Codex OAuth & SMS Workbench — Native AI Tools Compact Workbench Style */

body.public-workbench.product-redesign.compact-tools #codexView {
  border: 1px solid var(--tool-line, #e1e8e4);
  border-radius: 8px;
  background: var(--tool-paper, #fff);
  box-shadow: 0 2px 4px #163b2603;
  padding: 0;
  margin: 0;
  min-width: 0;
  overflow: visible;
}

.codex-workbench-wrap {
  min-width: 0;
}

/* Widen left entry column for Codex so a full email----password----2FA line fits on 1 line */
body.public-workbench.product-redesign.compact-tools .codex-workbench-wrap .detection-layout {
  display: grid;
  grid-template-columns: clamp(460px, 40%, 540px) minmax(0, 1fr);
  gap: 0;
  align-items: stretch;
}

@media (max-width: 1180px) {
  body.public-workbench.product-redesign.compact-tools .codex-workbench-wrap .detection-layout {
    grid-template-columns: 420px minmax(0, 1fr);
  }
}

@media (max-width: 920px) {
  body.public-workbench.product-redesign.compact-tools .codex-workbench-wrap .detection-layout {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Fix CDK activation box layout (override product-layout.css horizontal flex on .detection-access) */
body.public-workbench.product-redesign.compact-tools #codexAccessBox.detection-access {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  margin: 0 0 18px;
  padding: 12px 14px;
  border: 1px solid var(--tool-line, #e1e8e4);
  border-radius: 6px;
  background: var(--tool-soft, #f6f8f7);
}

body.public-workbench.product-redesign.compact-tools #codexAccessBox .compact-section-heading {
  margin-bottom: 0;
}

body.public-workbench.product-redesign.compact-tools #codexCdkFormRow.verification-cdk-row {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  max-width: none;
  width: 100%;
  margin: 0;
}

body.public-workbench.product-redesign.compact-tools #codexCdkFormRow.verification-cdk-row input {
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
  height: 36px;
  min-height: 36px;
  padding: 6px 11px;
  font: 12.5px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: var(--tool-paper, #fff);
}

body.public-workbench.product-redesign.compact-tools #codexCdkFormRow.verification-cdk-row button {
  flex: 0 0 auto;
  width: auto;
  height: 36px;
  min-height: 36px;
  padding: 0 13px;
  font-size: 12px;
  white-space: nowrap;
  background: var(--tool-paper, #fff);
}

/* Ensure 1 account per line never wraps into multiple lines */
body.public-workbench.product-redesign.compact-tools #codexAccountsInput.verification-codes {
  display: block;
  width: 100%;
  min-height: 156px;
  height: 176px;
  padding: 10px 12px;
  font: 12px/1.85 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre;
  overflow-wrap: normal;
  word-break: normal;
  overflow-x: auto;
  background: var(--tool-soft, #f6f8f7);
  resize: vertical;
}

.codex-banner {
  margin: 12px 19px 0;
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.6;
  border: 1px solid var(--tool-line, #e1e8e4);
  background: var(--tool-green-soft, #eaf5ef);
  color: var(--tool-green, #078265);
}

.codex-banner.error {
  background: #fbefed;
  border-color: #f3d1cc;
  color: #b85850;
}

/* Segmented control for Workspace Preference (no radio inputs -> no giant circles) */
.codex-pref-block {
  margin: 0 0 16px;
}

.codex-pref-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 7px;
  font-size: 12px;
  font-weight: 500;
  color: var(--tool-ink, #1e302a);
}

.codex-pref-seg {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: 3px;
  gap: 3px;
  border: 1px solid var(--tool-line, #e1e8e4);
  border-radius: 6px;
  background: var(--tool-soft, #f6f8f7);
}

.codex-pref-seg button {
  min-height: 31px;
  height: 31px;
  padding: 4px 6px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--tool-muted, #697b72);
  font-size: 12px;
  font-weight: 400;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
  white-space: nowrap;
}

.codex-pref-seg button.active {
  background: var(--tool-paper, #fff);
  color: var(--tool-green, #078265);
  font-weight: 600;
  box-shadow: 0 1px 4px #183c2012;
}

.codex-pref-note {
  margin: 6px 0 0;
  font-size: 11px;
  line-height: 1.65;
  color: var(--tool-muted, #697b72);
}

/* Left entry helpers */
.codex-side-desc {
  margin: 0 0 16px;
  font-size: 12px;
  line-height: 1.75;
  color: var(--tool-muted, #697b72);
}

.codex-side-btn-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.codex-cdk-Active-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 11px;
  margin-bottom: 16px;
  border-radius: 6px;
  background: var(--tool-green-soft, #eaf5ef);
  color: var(--tool-ink, #1e302a);
  font-size: 12px;
}

.codex-cdk-active-bar strong {
  color: var(--tool-green, #078265);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* Right results toolbar & stats */
.codex-stat-pills {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 0 0 12px;
  border-bottom: 1px solid var(--tool-line, #e1e8e4);
  margin: 0;
}

.codex-stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 4px;
  background: var(--tool-soft, #f6f8f7);
  color: var(--tool-muted, #697b72);
  font-size: 11px;
}

.codex-stat-pill strong {
  font-size: 12px;
  font-weight: 600;
  color: var(--tool-ink, #1e302a);
}

.codex-stat-pill.highlight {
  background: var(--tool-green-soft, #eaf5ef);
  color: var(--tool-green, #078265);
}

.codex-stat-pill.highlight strong {
  color: var(--tool-green, #078265);
}

.codex-export-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 0;
}

.codex-export-left,
.codex-export-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.codex-export-right .secondary-button,
.codex-export-right .primary-button {
  min-height: 32px;
  padding: 5px 11px;
  font-size: 12px;
}

/* Compact 1-line table layout for Codex tasks (override product-layout.css 5-column widths) */
body.public-workbench.product-redesign.compact-tools #codexRightAuto .verification-table,
#codexRightAuto .verification-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
}

body.public-workbench.product-redesign.compact-tools #codexRightAuto .verification-table th,
body.public-workbench.product-redesign.compact-tools #codexRightAuto .verification-table td,
#codexRightAuto .verification-table th,
#codexRightAuto .verification-table td {
  padding: 10px 8px;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}

body.public-workbench.product-redesign.compact-tools #codexRightAuto .verification-table th:nth-child(1),
body.public-workbench.product-redesign.compact-tools #codexRightAuto .verification-table td:nth-child(1),
#codexRightAuto .verification-table th:nth-child(1),
#codexRightAuto .verification-table td:nth-child(1) {
  width: 23%;
}

body.public-workbench.product-redesign.compact-tools #codexRightAuto .verification-table th:nth-child(2),
body.public-workbench.product-redesign.compact-tools #codexRightAuto .verification-table td:nth-child(2),
#codexRightAuto .verification-table th:nth-child(2),
#codexRightAuto .verification-table td:nth-child(2) {
  width: 78px;
}

body.public-workbench.product-redesign.compact-tools #codexRightAuto .verification-table th:nth-child(3),
body.public-workbench.product-redesign.compact-tools #codexRightAuto .verification-table td:nth-child(3),
#codexRightAuto .verification-table th:nth-child(3),
#codexRightAuto .verification-table td:nth-child(3) {
  width: 176px;
}

body.public-workbench.product-redesign.compact-tools #codexRightAuto .verification-table th:nth-child(4),
body.public-workbench.product-redesign.compact-tools #codexRightAuto .verification-table td:nth-child(4),
#codexRightAuto .verification-table th:nth-child(4),
#codexRightAuto .verification-table td:nth-child(4) {
  width: 100px;
}

body.public-workbench.product-redesign.compact-tools #codexRightAuto .verification-table th:nth-child(5),
body.public-workbench.product-redesign.compact-tools #codexRightAuto .verification-table td:nth-child(5),
#codexRightAuto .verification-table th:nth-child(5),
#codexRightAuto .verification-table td:nth-child(5) {
  width: auto;
}

body.public-workbench.product-redesign.compact-tools #codexRightAuto .verification-table th:nth-child(6),
body.public-workbench.product-redesign.compact-tools #codexRightAuto .verification-table td:nth-child(6),
#codexRightAuto .verification-table th:nth-child(6),
#codexRightAuto .verification-table td:nth-child(6) {
  width: 148px;
  overflow: visible;
}

/* Status badges inside verification-table */
.codex-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 11px;
  line-height: 1.6;
  white-space: nowrap;
}

.codex-badge-queued {
  background: var(--tool-soft, #f6f8f7);
  color: var(--tool-muted, #697b72);
}

.codex-badge-running {
  background: #edf5fb;
  color: #2267a8;
}

.codex-badge-awaiting {
  background: #fbf4e7;
  color: #996111;
  font-weight: 600;
}

.codex-badge-succeeded {
  background: var(--tool-green-soft, #eaf5ef);
  color: var(--tool-green, #078265);
}

.codex-badge-failed,
.codex-badge-cancelled {
  background: #fbefed;
  color: #b85850;
}

/* Manual SMS readout cards */
.codex-manual-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 0 0 18px;
}

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

.codex-manual-box {
  padding: 16px 18px;
  border: 1px solid var(--tool-line, #e1e8e4);
  border-radius: 6px;
  background: var(--tool-soft, #f6f8f7);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
}

.codex-manual-label {
  font-size: 11px;
  color: var(--tool-muted, #697b72);
}

.codex-manual-value {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 22px;
  font-weight: 600;
  color: var(--tool-ink, #1e302a);
  letter-spacing: 0.02em;
  min-height: 32px;
  display: flex;
  align-items: center;
}

.codex-manual-value.is-code {
  color: var(--tool-green, #078265);
  font-size: 24px;
}

.codex-manual-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.codex-manual-actions button {
  min-height: 32px;
  padding: 5px 11px;
  font-size: 12px;
}

/* Workspace Choice Modal & Log Modal */
.codex-row-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: nowrap;
}

.codex-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 26px;
  padding: 0 9px;
  border: 1px solid var(--tool-line, #d5dfda);
  border-radius: 5px;
  background: #fff;
  color: var(--tool-ink, #1e302a);
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.codex-action-btn:hover {
  border-color: var(--tool-green, #078265);
  color: var(--tool-green, #078265);
  background: var(--tool-green-soft, #eaf5ef);
}

.codex-action-btn.primary {
  border-color: var(--tool-green, #078265);
  background: var(--tool-green-soft, #eaf5ef);
  color: var(--tool-green, #078265);
  font-weight: 600;
}

.codex-action-btn.primary:hover {
  background: var(--tool-green, #078265);
  color: #fff;
}

.codex-action-btn.danger {
  border-color: #ebcbc7;
  background: #fdf6f5;
  color: #b85850;
}

.codex-action-btn.danger:hover {
  border-color: #b85850;
  background: #fbefed;
  color: #9e3f37;
}

.codex-modal-header {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--tool-line, #e1e8e4);
}

.codex-modal-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.codex-modal-title-wrap h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--tool-ink, #1e302a);
}

.codex-modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--tool-line, #d5dfda);
  border-radius: 6px;
  background: var(--tool-soft, #f6f8f7);
  color: var(--tool-muted, #5c6f66);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  flex-shrink: 0;
}

.codex-modal-close:hover {
  border-color: var(--tool-ink, #1e302a);
  color: var(--tool-ink, #1e302a);
  background: #eef3f0;
}

.codex-modal-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 10px;
  border-bottom: 1px dashed var(--tool-line, #e1e8e4);
}

.codex-modal-tabs[hidden] {
  display: none !important;
}

.codex-modal-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid var(--tool-line, #dfe7e3);
  border-radius: 6px;
  background: var(--tool-soft, #f6f8f7);
  color: var(--tool-ink, #1e302a);
  font-size: 12px;
  white-space: nowrap;
  cursor: pointer;
  flex-shrink: 0;
}

.codex-modal-tab:hover {
  border-color: var(--tool-green, #078265);
}

.codex-modal-tab.active {
  border-color: var(--tool-green, #078265);
  background: var(--tool-green-soft, #eaf5ef);
  color: var(--tool-green, #078265);
  font-weight: 600;
}

.codex-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.codex-dot.queued {
  background: #8fa199;
}

.codex-dot.running {
  background: #2267a8;
  box-shadow: 0 0 0 2px rgba(34, 103, 168, 0.2);
}

.codex-dot.awaiting_workspace {
  background: #d48817;
}

.codex-dot.succeeded {
  background: #078265;
}

.codex-dot.failed,
.codex-dot.cancelled {
  background: #b85850;
}

.codex-modal-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  padding: 9px 12px;
  border-radius: 6px;
  background: var(--tool-soft, #f6f8f7);
  border: 1px solid var(--tool-line, #e1e8e4);
  font-size: 12px;
  color: var(--tool-muted, #5c6f66);
  margin-bottom: 10px;
}

.codex-modal-meta strong {
  color: var(--tool-ink, #1e302a);
}

.codex-ws-choice-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 0;
}

.codex-ws-choice-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 14px;
  border: 1px solid var(--tool-line, #e1e8e4);
  border-radius: 6px;
  background: var(--tool-paper, #fff);
  cursor: pointer;
}

.codex-ws-choice-item:hover,
.codex-ws-choice-item.selected {
  border-color: var(--tool-green, #078265);
  background: var(--tool-green-soft, #eaf5ef);
}

.codex-log-pre {
  background: #14221d;
  color: #d7e8e0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.65;
  padding: 12px 14px;
  border-radius: 6px;
  min-height: 200px;
  max-height: 360px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
}

.codex-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}
