.yz-upscale-wires {
  position: absolute;
  inset: 0;
  width: 1px;
  height: 1px;
  overflow: visible;
  pointer-events: none;
  z-index: 0;
}

.yz-upscale-wires path {
  fill: none;
  stroke: #d97706;
  stroke-width: 1.5;
  stroke-dasharray: 6 5;
  opacity: 0.68;
}

.yz-upscale-result-card {
  z-index: 3;
}

.result-card .yz-result-drag-area,
.result-card .yz-result-drag-area[title] {
  cursor: grab;
  touch-action: none;
}

.result-card .yz-result-drag-area:active {
  cursor: grabbing;
}

.result-card footer,
.result-card footer:active {
  cursor: default;
}

.graph-node.is-node-dragging {
  will-change: transform;
}

.yz-node-context-menu {
  z-index: 10020;
}

.yz-upscale-result-card footer > span {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.yz-upscale-result-card footer b {
  font-size: 12px;
  font-weight: 650;
}

.yz-upscale-result-card footer i {
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 5px;
  border: 1px solid #f59e0b;
  border-radius: 4px;
  color: #92400e;
  background: #fffbeb;
  font-size: 9px;
  font-style: normal;
}

.result-card footer .yz-upscale-button {
  flex: 0 0 auto;
  min-width: 0;
  padding: 0 7px;
  border-color: #f3d7a4;
  color: #8a4b08;
  background: #fffaf0;
}

.result-card footer .yz-upscale-button:hover:not(:disabled) {
  border-color: #d97706;
  color: #713f12;
  background: #fff7e2;
}

.result-card footer .yz-upscale-button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.yz-upscale-result-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 218px;
  padding: 22px;
  color: #991b1b;
  text-align: center;
  background: #fff7f7;
}

.yz-upscale-result-error strong {
  margin-bottom: 7px;
  font-size: 13px;
}

.yz-upscale-result-error span {
  max-width: 210px;
  color: #7f1d1d;
  font-size: 11px;
  line-height: 1.55;
}

.yz-upscale-result-error button {
  margin-top: 12px;
  min-height: 30px;
  padding: 0 11px;
  border: 1px solid #dc9b9b;
  border-radius: 5px;
  color: #8f1d1d;
  background: #fff;
  font-size: 11px;
}

.yz-upscale-result-error button:hover {
  border-color: #b91c1c;
  background: #fff1f1;
}

.yz-upscale-modal {
  position: fixed;
  inset: 0;
  z-index: 10040;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(20, 20, 18, 0.28);
  backdrop-filter: blur(2px);
}

.yz-upscale-modal[hidden] {
  display: none;
}

.yz-upscale-dialog {
  width: min(420px, calc(100vw - 32px));
  overflow: hidden;
  border: 1px solid #deddd8;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(28, 25, 20, 0.2);
}

.yz-upscale-dialog > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 17px 18px 14px;
  border-bottom: 1px solid #ecebe7;
}

.yz-upscale-dialog > header div {
  display: flex;
  align-items: baseline;
  gap: 9px;
}

.yz-upscale-dialog > header strong {
  color: #1f1f1d;
  font-size: 16px;
}

.yz-upscale-dialog > header span {
  color: #8b8881;
  font-size: 11px;
}

.yz-upscale-dialog > header button {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  color: #77736b;
  background: transparent;
  font-size: 20px;
}

.yz-upscale-targets {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 18px 18px 10px;
}

.yz-upscale-targets button {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-height: 70px;
  padding: 13px 14px;
  border: 1px solid #deddd8;
  border-radius: 6px;
  color: #292824;
  background: #fff;
  text-align: left;
}

.yz-upscale-targets button.selected {
  border-color: #d97706;
  box-shadow: inset 0 0 0 1px #d97706;
  background: #fffbeb;
}

.yz-upscale-targets button:disabled {
  opacity: 0.42;
}

.yz-upscale-targets b {
  font-size: 18px;
}

.yz-upscale-targets span {
  margin-top: 4px;
  color: #77736b;
  font-size: 11px;
}

.yz-upscale-dialog > p {
  margin: 4px 18px 17px;
  padding: 10px 11px;
  border-left: 3px solid #eab308;
  color: #635a45;
  background: #fffbea;
  font-size: 11px;
  line-height: 1.55;
}

.yz-upscale-dialog > footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 13px 18px;
  border-top: 1px solid #ecebe7;
  background: #fafaf8;
}

.yz-upscale-dialog > footer button {
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid #d8d6d0;
  border-radius: 5px;
  color: #34332f;
  background: #fff;
}

.yz-upscale-dialog > footer button.primary {
  border-color: #24231f;
  color: #fff;
  background: #24231f;
}

.yz-upscale-toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 10060;
  max-width: min(480px, calc(100vw - 32px));
  padding: 10px 14px;
  border: 1px solid #d9d7d1;
  border-radius: 6px;
  color: #292824;
  background: #fff;
  box-shadow: 0 12px 40px rgba(20, 20, 18, 0.16);
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  translate: -50% 12px;
  transition: opacity 160ms ease, translate 160ms ease;
}

.yz-upscale-toast.is-visible {
  opacity: 1;
  translate: -50% 0;
}

.yz-upscale-toast[data-kind="error"] {
  border-color: #fecaca;
  color: #991b1b;
  background: #fff7f7;
}

.yz-setup-upscale,
.yz-provider-settings {
  display: grid;
  gap: 11px;
  min-width: 0;
  margin: 4px 0 2px;
  padding: 14px;
  border: 1px solid #e2e0da;
  border-radius: 7px;
  background: #fafaf8;
}

.yz-modern-setup-note {
  display: grid;
  gap: 5px;
  padding: 14px 15px;
  border: 1px solid #dfddd7;
  border-radius: 8px;
  color: #3b3934;
  background: #fafaf8;
}

.yz-modern-setup-note strong {
  font-size: 12px;
}

.yz-modern-setup-note span {
  color: #77736b;
  font-size: 10px;
  line-height: 1.6;
}

.yz-settings-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.yz-settings-heading > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.yz-settings-heading strong {
  color: #282722;
  font-size: 12px;
}

.yz-settings-heading span,
.yz-settings-heading > i {
  color: #858179;
  font-size: 10px;
  font-style: normal;
}

.yz-settings-heading > button,
.yz-model-picker button,
.yz-provider-editor-actions button,
.yz-provider-row-actions button {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid #d5d2cb;
  border-radius: 5px;
  color: #33312c;
  background: #fff;
  font-size: 11px;
  white-space: nowrap;
}

.yz-settings-heading > button {
  margin-left: auto;
}

.yz-model-picker {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
}

.yz-model-picker select {
  min-width: 0;
  height: 32px;
  padding: 0 8px;
  border: 1px solid #d5d2cb;
  border-radius: 5px;
  color: #33312c;
  background: #fff;
  font-size: 11px;
}

.yz-provider-message {
  min-height: 15px;
  margin: 0;
  color: #6c6860;
  font-size: 10px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.yz-provider-message[data-kind="success"] {
  color: #166534;
}

.yz-provider-message[data-kind="error"] {
  color: #991b1b;
}

.yz-provider-list {
  display: grid;
  gap: 7px;
}

.yz-provider-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid #e2e0da;
  border-radius: 5px;
  background: #fff;
}

.yz-provider-row > div:first-child {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.yz-provider-row strong {
  color: #292824;
  font-size: 11px;
}

.yz-provider-row .yz-provider-summary {
  overflow: hidden;
  color: #858179;
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.yz-provider-title {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.yz-provider-status {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 50%;
  background: #22a447;
  box-shadow: 0 0 0 3px #22a4471f;
}

.yz-provider-row[data-health="disabled"] .yz-provider-status {
  background: #d64545;
  box-shadow: 0 0 0 3px #d645451f;
}

.yz-provider-row[data-health="quota_insufficient"] .yz-provider-status,
.yz-provider-row[data-health="upstream_error"] .yz-provider-status {
  background: #d69b16;
  box-shadow: 0 0 0 3px #d69b1626;
}

.yz-provider-row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 5px;
  flex: 0 0 auto;
}

.yz-provider-row-actions i {
  color: #5f5b53;
  font-size: 9px;
  font-style: normal;
}

.yz-provider-editor {
  display: grid;
  gap: 9px;
  padding-top: 11px;
  border-top: 1px solid #e2e0da;
}

.yz-provider-editor label,
.yz-provider-editor input,
.yz-provider-editor select {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.yz-provider-editor[hidden] {
  display: none;
}

.yz-provider-editor-actions {
  display: flex;
  justify-content: flex-end;
  gap: 7px;
}

.yz-provider-detection {
  padding: 8px 9px;
  border: 1px solid #bbdfc4;
  border-radius: 5px;
  color: #166534;
  background: #f2fbf4;
  font-size: 10px;
}

.yz-capability-picker,
.yz-guest-permissions-modal fieldset {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px 10px;
  padding: 10px;
  border: 1px solid #dedbd4;
  border-radius: 6px;
}

.yz-capability-picker legend,
.yz-guest-permissions-modal legend {
  padding: 0 5px;
  color: #77736b;
  font-size: 10px;
}

.yz-capability-picker label,
.yz-guest-permissions-modal fieldset label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #3f3d38;
  font-size: 10px;
}

.yz-capability-picker input,
.yz-guest-permissions-modal input {
  width: 14px;
  height: 14px;
}

.yz-guest-permissions-backdrop {
  position: fixed;
  z-index: 240;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: #17171759;
  backdrop-filter: blur(5px);
}

.yz-guest-permissions-modal {
  display: grid;
  gap: 14px;
  width: min(430px, 100%);
  padding: 18px;
  border: 1px solid #dedbd4;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 18px 60px #0003;
}

.yz-guest-permissions-modal header,
.yz-guest-permissions-modal footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.yz-guest-permissions-modal header > div {
  display: grid;
  gap: 2px;
}

.yz-guest-permissions-modal header strong { font-size: 13px; }
.yz-guest-permissions-modal header span,
.yz-guest-permissions-modal p { color: #77736b; font-size: 10px; }
.yz-guest-permissions-modal p[data-kind="success"] { color: #166534; }
.yz-guest-permissions-modal p[data-kind="error"] { color: #991b1b; }

.yz-guest-permissions-modal button,
.yz-guest-permissions-button {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid #d5d2cb;
  border-radius: 5px;
  background: #fff;
  font-size: 10px;
}

.yz-guest-permissions-modal footer button:last-child {
  color: #fff;
  background: #24231f;
  border-color: #24231f;
}

.portable-settings-panel {
  width: min(720px, calc(100vw - 40px));
  max-width: 720px;
  box-sizing: border-box;
  max-height: min(820px, calc(100vh - 40px));
  overflow-y: auto;
  overflow-x: hidden;
}

@media (max-width: 720px) {
  .yz-upscale-targets,
  .yz-model-picker {
    grid-template-columns: 1fr;
  }

  .yz-provider-row {
    align-items: flex-start;
    grid-template-columns: 1fr;
  }

  .yz-provider-row-actions {
    width: 100%;
  }
}
