/* 5Kaizen agent transaction workspace.
   Namespaced to .agent-tx-* so the existing Studio remains unchanged. */

.agent-tx-shell {
  max-width: 1240px !important;
  color: var(--text);
}

.agent-tx-topbar-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 220px;
  max-width: 360px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--panel);
  color: var(--text-mid);
  font-size: 12.5px;
  text-align: left;
}

.agent-tx-topbar-button:hover,
.agent-tx-topbar-button:focus-visible {
  border-color: var(--brass);
  outline: none;
}

.agent-tx-topbar-button .agent-tx-search-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-tx-kbd {
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--bg);
  color: var(--text-dim);
  font-size: 10px;
}

.agent-tx-pagehead,
.agent-tx-detailhead {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.agent-tx-pagehead h1,
.agent-tx-detailhead h1 {
  margin: 0 0 4px;
  color: var(--text);
  font-size: 25px;
  line-height: 1.15;
  letter-spacing: -0.025em;
}

.agent-tx-sub {
  color: var(--text-mid);
  font-size: 13px;
}

.agent-tx-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.agent-tx-btn {
  min-height: 38px;
  padding: 8px 13px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 650;
}

.agent-tx-btn:hover,
.agent-tx-btn:focus-visible {
  border-color: var(--brass);
  outline: none;
}

.agent-tx-btn.primary {
  border-color: #0071e3;
  background: #0071e3;
  color: #fff;
}

.agent-tx-btn.primary:hover { background: #0058b0; }

.agent-tx-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 16px;
  padding: 11px 14px;
  border: 1px solid #b9d8fb;
  border-radius: 10px;
  background: #f0f7ff;
  color: #16385f;
  font-size: 12.5px;
  line-height: 1.45;
}

.agent-tx-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) repeat(2, minmax(130px, 180px));
  gap: 9px;
  margin-bottom: 14px;
}

.agent-tx-toolbar input,
.agent-tx-toolbar select,
.agent-tx-switcher input {
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--input-bg, var(--panel));
  color: var(--text);
  font-size: 13px;
}

.agent-tx-toolbar input:focus,
.agent-tx-toolbar select:focus,
.agent-tx-switcher input:focus {
  border-color: #0071e3;
  outline: 2px solid rgba(0, 113, 227, 0.18);
}

.agent-tx-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.agent-tx-card,
.agent-tx-panel,
.agent-tx-now {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: var(--shadow-1);
}

.agent-tx-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 15px;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}

.agent-tx-card:hover,
.agent-tx-card:focus-visible {
  border-color: #0071e3;
  outline: none;
  transform: translateY(-1px);
  box-shadow: var(--shadow-card);
}

.agent-tx-cardtop,
.agent-tx-cardbottom,
.agent-tx-meta,
.agent-tx-personrow,
.agent-tx-docrow,
.agent-tx-timeline-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.agent-tx-cardtop { align-items: flex-start; }
.agent-tx-cardtop > div:first-child { flex: 1; min-width: 0; }

.agent-tx-card h2 {
  margin: 0;
  color: var(--text);
  font-size: 16px;
  line-height: 1.25;
}

.agent-tx-address,
.agent-tx-muted {
  color: var(--text-mid);
  font-size: 12px;
}

.agent-tx-meta {
  flex-wrap: wrap;
  color: var(--text-mid);
  font-size: 11.5px;
}

.agent-tx-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--bg);
  color: var(--text-mid);
  font-size: 10.5px;
  font-weight: 700;
  white-space: nowrap;
}

.agent-tx-pill.buyer { background: #eaf4ff; color: #0058b0; }
.agent-tx-pill.seller { background: #f2ecff; color: #5e38a5; }
.agent-tx-pill.action { background: #fff1df; color: #8a4b00; }
.agent-tx-pill.ok { background: #eaf8ee; color: #206a36; }

.agent-tx-progress {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--bg);
}

.agent-tx-progress > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #0071e3;
}

.agent-tx-cardbottom {
  justify-content: space-between;
  color: var(--text-mid);
  font-size: 11.5px;
}

.agent-tx-pin {
  min-width: 34px;
  min-height: 34px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-dim);
  font-size: 17px;
}

.agent-tx-pin.on { color: #0071e3; background: #f0f7ff; }

.agent-tx-empty {
  padding: 34px 20px;
  border: 1px dashed var(--border);
  border-radius: 12px;
  background: var(--panel);
  text-align: center;
}

.agent-tx-empty h2 { margin: 8px 0 5px; font-size: 18px; }
.agent-tx-empty p { max-width: 580px; margin: 0 auto; color: var(--text-mid); font-size: 13px; }

.agent-tx-detailhead { margin-bottom: 12px; }
.agent-tx-detailhead .agent-tx-back { margin-bottom: 9px; }

.agent-tx-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 14px;
  padding: 4px;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
}

.agent-tx-tab {
  flex: 0 0 auto;
  padding: 8px 12px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text-mid);
  font-size: 12px;
  font-weight: 650;
}

.agent-tx-tab.on { background: #0071e3; color: #fff; }

.agent-tx-overview {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(270px, 0.75fr);
  gap: 12px;
}

.agent-tx-stack { display: flex; flex-direction: column; gap: 12px; }

.agent-tx-now,
.agent-tx-panel { padding: 16px; }

.agent-tx-eyebrow {
  margin-bottom: 5px;
  color: #0071e3;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.agent-tx-now h2,
.agent-tx-panel h2 { margin: 0 0 5px; color: var(--text); font-size: 17px; }

.agent-tx-sectionhead {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.agent-tx-home-summary {
  display: flex;
  gap: 8px;
  white-space: nowrap;
}

.agent-tx-home-summary span {
  padding: 7px 10px;
  border-radius: 8px;
  background: var(--bg);
  color: var(--text-mid);
  font-size: 11px;
}

.agent-tx-privacy {
  margin-bottom: 14px;
  padding: 10px 12px;
  border: 1px solid #b9d8fb;
  border-radius: 9px;
  background: #f0f7ff;
  color: #16385f;
  font-size: 11.5px;
  line-height: 1.45;
}

.agent-tx-home-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.agent-tx-home-card {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--panel);
}

.agent-tx-home-photo {
  display: grid;
  place-items: center;
  min-height: 142px;
  background: linear-gradient(145deg, #dcecff, #f0f7ff);
  color: #0071e3;
  font-size: 30px;
}

.agent-tx-home-body { min-width: 0; padding: 12px; }
.agent-tx-home-body h3 { margin: 7px 0 4px; font-size: 14px; line-height: 1.3; }
.agent-tx-home-body p { margin: 4px 0 10px; color: var(--text-mid); font-size: 11.5px; }
.agent-tx-home-price { font-size: 14px; }
.agent-tx-home-body .agent-tx-cardbottom { align-items: center; }
.agent-tx-home-body .agent-tx-btn { min-height: 32px; padding: 5px 9px; font-size: 11px; }
.agent-tx-pill.home-love { background: #fff0f4; color: #a51d4a; }
.agent-tx-pill.home-maybe { background: #fff5df; color: #8a4b00; }

.agent-tx-next {
  margin-top: 12px;
  padding: 11px 12px;
  border-left: 3px solid #ff9f0a;
  border-radius: 0 8px 8px 0;
  background: #fff8ed;
  color: #593600;
  font-size: 12.5px;
}

.agent-tx-timeline-row,
.agent-tx-personrow,
.agent-tx-docrow {
  align-items: flex-start;
  padding: 10px 0;
  border-top: 1px solid var(--border);
}

.agent-tx-timeline-row:first-of-type,
.agent-tx-personrow:first-of-type,
.agent-tx-docrow:first-of-type { border-top: 0; }

.agent-tx-dot,
.agent-tx-avatar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: #f0f7ff;
  color: #0071e3;
  font-size: 11px;
  font-weight: 800;
}

.agent-tx-rowbody { flex: 1; min-width: 0; }
.agent-tx-rowbody b { color: var(--text); font-size: 12.5px; }
.agent-tx-rowbody p { margin: 2px 0 0; color: var(--text-mid); font-size: 11.5px; }
.agent-tx-rowmeta { color: var(--text-dim); font-size: 10.5px; white-space: nowrap; }

.agent-tx-switcher-backdrop {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 10vh 18px 20px;
  background: rgba(0, 0, 0, 0.48);
  backdrop-filter: blur(4px);
}

.agent-tx-switcher {
  width: min(680px, 100%);
  max-height: 72vh;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: 0 24px 80px rgba(0,0,0,0.35);
}

.agent-tx-switcher-head {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid var(--border);
}

.agent-tx-switcher-close {
  flex: 0 0 auto;
  width: 42px;
  border: 0;
  border-radius: 8px;
  background: var(--bg);
  color: var(--text-mid);
  font-size: 20px;
}

.agent-tx-switcher-results {
  max-height: calc(72vh - 67px);
  overflow-y: auto;
  padding: 8px;
}

.agent-tx-result {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.agent-tx-result:hover,
.agent-tx-result:focus-visible,
.agent-tx-result.active { background: var(--bg); outline: none; }
.agent-tx-result b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.agent-tx-result small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-mid); font-size: 11px; }

.agent-tx-switcher-section {
  padding: 7px 10px 4px;
  color: var(--text-dim);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

@media (max-width: 900px) {
  .agent-tx-grid,
  .agent-tx-overview { grid-template-columns: 1fr; }
  .agent-tx-toolbar { grid-template-columns: 1fr 1fr; }
  .agent-tx-toolbar input { grid-column: 1 / -1; }
  .agent-tx-topbar-button { min-width: 42px; width: 42px; padding: 8px; }
  .agent-tx-topbar-button .agent-tx-search-label,
  .agent-tx-topbar-button .agent-tx-kbd { display: none; }
}

@media (max-width: 620px) {
  .agent-tx-sectionhead { flex-direction: column; }
  .agent-tx-home-summary { white-space: normal; }
  .agent-tx-home-grid { grid-template-columns: 1fr; }
  .agent-tx-home-card { grid-template-columns: 72px minmax(0, 1fr); }
  .agent-tx-pagehead,
  .agent-tx-detailhead { flex-direction: column; }
  .agent-tx-actions { width: 100%; }
  .agent-tx-actions .agent-tx-btn { flex: 1; }
  .agent-tx-toolbar { grid-template-columns: 1fr; }
  .agent-tx-toolbar input { grid-column: auto; }
  .agent-tx-cardbottom { align-items: flex-start; flex-direction: column; }
  .agent-tx-rowmeta { white-space: normal; }
  .agent-tx-switcher-backdrop { padding-top: 5vh; }
}

/* Collapsible portal preview sections */
.agent-tx-portal-section {
  margin-bottom: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
  overflow: hidden;
}

.agent-tx-portal-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
}

.agent-tx-portal-summary::-webkit-details-marker {
  display: none;
}

.agent-tx-portal-summary::after {
  content: '▼';
  font-size: 10px;
  color: var(--text-mid);
  transition: transform 0.2s;
}

.agent-tx-portal-section[open] .agent-tx-portal-summary::after {
  transform: rotate(180deg);
}

.agent-tx-portal-content {
  padding: 16px;
  border-top: 1px solid var(--border);
}

.agent-tx-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 13000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
}

.agent-tx-modal {
  width: min(520px, 100%);
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

