/* PlanApprovalCard — approval overlay aligned with permission-card shell */

.overlay-card.overlay-card--plan-approval {
  --plan-accent: var(--island-warning);
  --plan-panel: var(--island-bg);
  --plan-surface: color-mix(in srgb, var(--island-card) 88%, var(--plan-accent) 5%);
  --plan-surface-strong: color-mix(in srgb, var(--island-card) 82%, var(--plan-accent) 8%);
  --plan-border: color-mix(in srgb, var(--island-border) 78%, var(--plan-accent) 22%);
  --plan-text: var(--island-text);
  --plan-text-muted: var(--island-text-secondary);
  --approval-context-font-size: 12px;
  --approval-context-line-height: 1.18;
  --approval-meta-font-size: 11px;
  --approval-meta-line-height: 1.28;
  --approval-title-font-size: 13px;
  --approval-title-line-height: 1.18;
  --approval-body-font-size: 12px;
  --approval-body-line-height: 1.4;
  --approval-caption-font-size: 11px;
  --approval-control-font-size: 12px;
  gap: 9px;
  width: 100%;
  padding: 12px 16px 14px;
  border: 0;
  border-radius: 0 0 26px 26px;
  background: var(--plan-panel);
  box-shadow: none;
}

.overlay-card--plan-approval .overlay-card__header {
  align-items: flex-start;
  min-height: 34px;
}

.overlay-card--plan-approval .overlay-card__close {
  width: 24px;
  height: 24px;
  color: var(--island-text-secondary);
  background: var(--island-subtle);
}

.overlay-card--plan-approval .overlay-ctx {
  gap: 2px;
}

.overlay-card--plan-approval .overlay-ctx__row1 {
  gap: 7px;
  font-size: var(--approval-context-font-size);
  font-weight: 800;
  line-height: var(--approval-context-line-height);
  color: var(--plan-text);
}

.overlay-card--plan-approval .overlay-ctx__row1 .pixel-indicator {
  margin-right: 3px;
  transform: scale(1.45);
  transform-origin: center;
}

.overlay-card--plan-approval .overlay-ctx__title {
  max-width: 300px;
}

.overlay-card--plan-approval .overlay-ctx__sep,
.overlay-card--plan-approval .overlay-ctx__agent {
  color: var(--island-text-secondary);
  opacity: 1;
}

.overlay-card--plan-approval .overlay-ctx__row2 {
  gap: 4px;
  font-size: var(--approval-meta-font-size);
  font-weight: 700;
  line-height: var(--approval-meta-line-height);
  color: var(--island-text-muted);
}

.overlay-card--plan-approval .overlay-ctx__you {
  color: var(--island-text-secondary);
  font-weight: 800;
}

.overlay-card--plan-approval .overlay-ctx__msg {
  max-width: 430px;
}

.overlay-card--plan-approval .overlay-card__body {
  overflow: auto;
}

.plan-approval {
  display: flex;
  min-height: 0;
  flex-direction: column;
  gap: 6px;
}

.plan-approval__subagents {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  gap: 7px;
  max-height: 178px;
  overflow-y: auto;
  padding: 8px 10px;
  border: 1px solid var(--plan-border);
  border-radius: 10px;
  background: var(--plan-surface);
}

.plan-approval__subagents::-webkit-scrollbar {
  width: 4px;
}

.plan-approval__subagents::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: var(--island-scrollbar);
}

.plan-approval__subagents-header {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--plan-text-muted);
  font-size: var(--approval-context-font-size);
  font-weight: 800;
  line-height: 1.1;
}

.plan-approval__subagents-icon {
  color: var(--island-text-muted);
  font-size: 14px;
}

.plan-approval__subagents-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.plan-approval__subagent {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
  color: var(--plan-text-muted);
  font-size: var(--approval-caption-font-size);
  font-weight: 650;
  line-height: 1.24;
}

.plan-approval__subagent-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  flex-shrink: 0;
  background: var(--island-danger);
}

.plan-approval__subagent-dot--running {
  background: var(--island-warning);
}

.plan-approval__subagent-dot--completed {
  background: var(--island-success);
}

.plan-approval__subagent-title,
.plan-approval__subagent-detail {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.plan-approval__subagent-title {
  flex-shrink: 0;
  color: var(--plan-text);
}

.plan-approval__subagent-detail {
  min-width: 0;
}

.plan-approval__subagent-status {
  flex-shrink: 0;
  color: var(--island-text-muted);
}

.plan-approval__subagent-status--completed {
  color: var(--island-text-secondary);
}

.plan-approval__subagent-status--running {
  color: var(--island-warning-text);
}

.plan-approval__subagent-status--error {
  color: var(--island-danger-text);
}

.plan-approval__header {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
  border-left: 3px solid var(--plan-accent);
  padding-left: 10px;
}

.plan-approval__title {
  flex: 1;
  overflow: hidden;
  color: var(--plan-text);
  font-size: var(--approval-title-font-size);
  font-weight: 800;
  line-height: var(--approval-title-line-height);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.plan-approval__tag {
  flex-shrink: 0;
  padding: 3px 8px;
  border-radius: 8px;
  color: var(--island-text-secondary);
  background: var(--island-subtle);
  font-size: var(--approval-caption-font-size);
  font-weight: 800;
  line-height: 1.1;
}

.plan-approval__content {
  flex: 1 1 230px;
  min-height: 150px;
  max-height: none;
  overflow-y: auto;
  padding: 12px 14px;
  border: 1px solid var(--plan-border);
  border-radius: 12px;
  background: var(--plan-surface-strong);
  color: var(--plan-text);
  font-size: var(--approval-body-font-size);
  font-weight: 560;
  line-height: var(--approval-body-line-height);
}

.plan-approval__content::-webkit-scrollbar {
  width: 4px;
}

.plan-approval__content::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: var(--island-scrollbar);
}

.plan-approval__content h1,
.plan-approval__content h2,
.plan-approval__content h3 {
  margin: 8px 0 4px;
  color: var(--plan-text);
  font-size: var(--approval-body-font-size);
  font-weight: 780;
  line-height: 1.25;
}

.plan-approval__content h1:first-child,
.plan-approval__content h2:first-child,
.plan-approval__content h3:first-child,
.plan-approval__content p:first-child {
  margin-top: 0;
}

.plan-approval__content p {
  margin: 5px 0;
}

.plan-approval__content ul,
.plan-approval__content ol {
  padding-left: 18px;
  margin: 5px 0;
}

.plan-approval__content li + li {
  margin-top: 3px;
}

.plan-approval__content code {
  padding: 1px 6px;
  border-radius: 6px;
  color: var(--island-inline-code-text);
  background: var(--island-inline-code-bg);
  font-family: var(--font-mono, monospace);
  font-size: 0.92em;
}

.plan-approval__content pre {
  overflow-x: auto;
  margin: 12px 0;
  padding: 12px;
  border-radius: 8px;
  background: var(--island-code-block-bg, var(--island-code-bg));
  border: 1px solid var(--island-code-border);
}

.plan-approval__content pre code {
  padding: 0;
  background: none;
  color: var(--island-code-text);
}

.plan-approval__perms {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  align-items: stretch;
  gap: 7px;
  max-height: 92px;
  overflow-y: auto;
  padding: 10px 12px 11px;
  border: 1px solid color-mix(in srgb, var(--plan-border) 82%, transparent);
  border-radius: 10px;
  background: color-mix(in srgb, var(--island-card) 92%, #000 12%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.plan-approval__perms-label {
  display: block;
  margin: 0;
  color: var(--island-text-muted);
  font-size: 10.5px;
  font-weight: 750;
  line-height: 1.2;
}

.plan-approval__perms-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
  padding-left: 16px;
  list-style: disc;
}

.plan-approval__perm-item {
  margin: 0;
  color: var(--plan-text-muted);
  font-size: 10px;
  font-weight: 620;
  line-height: 1.35;
}

.plan-approval__perm-item::marker {
  color: color-mix(in srgb, var(--plan-text-muted) 84%, transparent);
  font-size: 10px;
}

.plan-approval__perm-copy {
  min-width: 0;
  overflow-wrap: anywhere;
}

.plan-approval__perm-tool {
  color: color-mix(in srgb, var(--plan-accent) 82%, #ff8a1c);
  font-weight: 760;
}

.plan-approval__perm-prompt {
  color: var(--plan-text-muted);
}

.plan-approval__input-row {
  flex: 0 0 auto;
  padding-top: 4px;
  border-top: 1px solid var(--plan-border);
}

.plan-approval__input {
  width: 100%;
  box-sizing: border-box;
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--plan-border);
  border-radius: 12px;
  outline: none;
  color: var(--plan-text);
  background: var(--plan-surface-strong);
  font-family: var(--font-sans, system-ui);
  font-size: var(--approval-control-font-size);
  font-weight: 650;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.plan-approval__input::placeholder {
  color: var(--island-text-muted);
}

.plan-approval__input:focus {
  border-color: color-mix(in srgb, var(--plan-accent) 45%, var(--plan-border));
}

.plan-approval__input[data-has-draft="true"] {
  border-color: color-mix(in srgb, var(--plan-accent) 68%, var(--plan-border));
  background:
    linear-gradient(90deg, var(--plan-accent) 0 3px, transparent 3px),
    var(--plan-surface-strong);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--plan-accent) 20%, transparent);
}

.plan-approval__actions {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
  padding-top: 5px;
  border-top: 1px solid var(--plan-border);
}

.plan-approval__btn {
  flex: 1;
  height: 30px;
  min-width: 0;
  padding: 0 8px;
  border: 1px solid var(--island-action-neutral-border);
  border-radius: 8px;
  background: var(--island-action-neutral-bg);
  color: var(--island-action-neutral-text);
  font-family: var(--font-sans, system-ui);
  font-size: var(--approval-control-font-size);
  font-weight: 780;
  cursor: pointer;
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--island-card) 70%, transparent);
  transition: opacity 0.15s, filter 0.15s, transform 0.15s, border-color 0.15s, background 0.15s;
  white-space: nowrap;
}

.plan-approval__btn:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

.plan-approval__btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.plan-approval__btn:disabled:hover {
  transform: none;
}

.plan-approval__btn--feedback {
  border-color: var(--island-action-neutral-border);
  background: var(--island-action-neutral-bg);
  color: var(--island-action-neutral-text);
}

.plan-approval__btn--accept {
  border-color: var(--island-action-allow-border);
  background: var(--island-action-allow-bg);
  color: var(--island-action-allow-text);
}

.plan-approval__btn--auto {
  border-color: var(--island-action-auto-border);
  background: var(--island-action-auto-bg);
  color: var(--island-action-auto-text);
}

.plan-approval__btn--feedback:hover {
  background: var(--island-action-neutral-bg-hover);
}

.plan-approval__btn--accept:hover {
  background: var(--island-action-allow-bg-hover);
}

.plan-approval__btn--auto:hover {
  background: var(--island-action-auto-bg-hover);
}

@media (max-width: 760px) {
  .overlay-card.overlay-card--plan-approval {
    padding: 12px 14px 14px;
  }

  .overlay-card--plan-approval .overlay-ctx__row1 {
    font-size: 12px;
  }

  .plan-approval__title {
    font-size: 13px;
  }

  .overlay-card--plan-approval .overlay-ctx__row2,
  .plan-approval__subagents-header,
  .plan-approval__subagent,
  .plan-approval__perms-label,
  .plan-approval__perm-item,
  .plan-approval__input {
    font-size: 11px;
  }

  .plan-approval__content,
  .plan-approval__content h1,
  .plan-approval__content h2,
  .plan-approval__content h3 {
    font-size: 11px;
  }

  .plan-approval__content {
    min-height: 122px;
  }

  .plan-approval__actions {
    gap: 8px;
  }

  .plan-approval__btn {
    height: 30px;
    padding: 0 7px;
    border-radius: 8px;
    font-size: 11px;
  }
}
