.fnd-macro-config, .fnd-macro-config * { box-sizing: border-box; }
  .fnd-macro-config {
    --bg: #f3f4f6; --surface: #fff; --muted-surface: #f9fafb; --line: #e5e7eb;
    --text: #374151; --muted: #6b7280; --accent: #0397d5; --accent-hover: #026fa0;
    color: var(--text); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, Arial, sans-serif; font-size: 14px;
    line-height: 1.45; padding: 24px 20px 40px; background: var(--bg);
}
.fnd-macro-inner { max-width: none; margin: 0 auto; }
  .fnd-macro-config h1 { margin: 0 0 8px; font-size: 20px; line-height: 1.2; font-weight: 700; color: #111b2e; letter-spacing: 0; }
  .fnd-macro-config h2 { margin: 0 0 12px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
  .fnd-macro-config h3 { margin: 0 0 10px; font-size: 16px; }
  .fnd-macro-sub { margin: 0; max-width: 720px; font-size: 13px; line-height: 1.55; color: #5c6370; }
  .fnd-hero {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    padding: 24px 28px;
    margin-bottom: 20px;
  }
  .fnd-hero-copy { min-width: 0; }
  .fnd-hero-copy h2 {
    margin: 0 0 4px;
    font-size: 22px;
    line-height: 1.2;
    font-weight: 700;
    color: #111827;
    text-transform: none;
    letter-spacing: -0.3px;
  }
  .fnd-hero-copy p {
    margin: 0;
    max-width: 720px;
    font-size: 13px;
    line-height: 1.55;
    color: #6b7280;
  }
  .fnd-hero-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: flex-end; flex-shrink: 0; }
  .fnd-macro-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 16px 0 28px; }
  .fnd-macro-panel { background: var(--surface); border: 1px solid var(--line); border-radius: 0; padding: 16px; box-shadow: none; }
.fnd-macro-stage-list {
  overflow-x: auto; border-radius: 10px; background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06); margin-top: 0;
}
  .fnd-macro-stage-table { width: 100%; border-collapse: separate; border-spacing: 0; table-layout: fixed; }
  .fnd-macro-stage-table thead { display: table-header-group !important; }
  .fnd-macro-stage-table tbody { display: table-row-group !important; }
  .fnd-macro-stage-table tr { display: table-row !important; }
  .fnd-macro-stage-table th,
  .fnd-macro-stage-table td { display: table-cell !important; height: auto !important; }
  .fnd-macro-stage-table th {
    padding: 11px 14px; background: #f9fafb; border-bottom: 1px solid #e5e7eb;
    color: #6b7280; font-size: 11px; font-weight: 700; letter-spacing: .05em; text-align: left; text-transform: uppercase; white-space: nowrap;
  }
  .fnd-macro-stage-table td {
    padding: 11px 14px; border-bottom: 1px solid #f3f4f6; color: #374151; font-size: 14px; line-height: 1.45; vertical-align: middle;
  }
  .fnd-macro-stage-table tbody tr:hover td { background: #f9fafb; }
  .fnd-macro-stage-table tbody tr:last-child td { border-bottom: none; }
  .fnd-macro-stage-table tbody tr.fnd-macro-stage-row.is-selected,
  .fnd-macro-stage-table tbody tr.fnd-macro-stage-row.is-selected td { background: #fff !important; }
  .fnd-macro-stage-table tbody tr.fnd-macro-stage-row.is-selected:hover,
  .fnd-macro-stage-table tbody tr.fnd-macro-stage-row.is-selected:hover td { background: #f9fafb !important; }
  .fnd-macro-stage-drag { color: var(--muted); font-size: 16px; line-height: 1; text-align: center; white-space: nowrap; }
  .fnd-macro-stage-code-col { width: 86px; }
  .fnd-macro-stage-name-col { width: auto; }
  .fnd-macro-stage-order-col { width: 96px; }
  .fnd-macro-stage-weight-col { width: 96px; }
  .fnd-macro-stage-docs-col { width: 96px; }
  .fnd-macro-stage-order-col,
  .fnd-macro-stage-weight-col,
  .fnd-macro-stage-docs-col,
  .fnd-macro-stage-table td:nth-child(3),
  .fnd-macro-stage-table td:nth-child(4),
  .fnd-macro-stage-table td:nth-child(5) { text-align: center !important; }
  .fnd-macro-stage-question-col { width: 180px; text-align: center !important; }
  .fnd-macro-stage-title {
    display: inline-block; color: #004563; font-weight: 600; text-decoration: none !important;
    max-width: 100%; overflow-wrap: anywhere;
  }
  .fnd-macro-stage-title:hover,
  .fnd-macro-stage-title:focus,
  .fnd-macro-stage-title:active,
  .fnd-macro-stage-title:visited { color: #004563; text-decoration: none !important; }
  .fnd-macro-stage-cell { color: #374151; font-size: 14px; line-height: 1.45; white-space: nowrap; }
  .fnd-macro-actions { display: flex; gap: 8px; justify-content: flex-end; }
  .fnd-macro-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; }
  .fnd-macro-grid.etapa-fields { grid-template-columns: minmax(280px, 1fr) 110px 120px 110px; }
  .fnd-macro-grid.two { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .fnd-macro-form { display: grid; grid-template-columns: minmax(0, 1fr) 92px 92px; column-gap: 12px; row-gap: 8px; align-items: start; }
  .fnd-macro-form > div { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
  .fnd-macro-form-main { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
  .fnd-macro-form-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; }
  .fnd-macro-form-narrow { width: auto; min-width: 92px; }
  .fnd-macro-form-hidden { display: none; }
  .fnd-macro-label {
    display: block;
    margin: 0;
    font-size: 12px;
    color: #4f5a6e;
    font-weight: 600;
  }
  .fnd-macro-config input[type="text"], .fnd-macro-config textarea, .fnd-macro-config select {
    width: 100%; border: 1px solid var(--line); border-radius: 6px; padding: 6px 9px;
    min-height: 34px; font: inherit; background: #fff;
  }
  .fnd-macro-config input[type="checkbox"] { vertical-align: middle; cursor: pointer; }
  .fnd-macro-config textarea { min-height: 72px; resize: vertical; }
  .fnd-macro-checks {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: flex-start;
    margin: 4px 0 0;
    padding: 0;
  }
  .fnd-macro-check-inline {
    display: inline-flex !important;
    align-items: center;
    gap: 6px;
    font-weight: 500;
    color: #1a2233;
    line-height: 1.2;
  }
  .fnd-macro-check-inline input[type="checkbox"] {
    appearance: none; -webkit-appearance: none;
    width: 16px; height: 16px; min-width: 16px; flex-shrink: 0;
    border: 2px solid #c5d0dc; border-radius: 4px; background: #fff;
    cursor: pointer; position: relative; margin: 0;
    transition: background .12s, border-color .12s;
  }
  .fnd-macro-check-inline input[type="checkbox"]:checked {
    background: #0397d5; border-color: #0397d5;
  }
  .fnd-macro-check-inline input[type="checkbox"]:checked::after {
    content: ''; position: absolute; left: 3px; top: -1px;
    width: 6px; height: 10px;
    border: 2px solid #fff; border-top: none; border-left: none;
    transform: rotate(43deg);
  }
  .fnd-macro-check-inline input[type="checkbox"]:disabled { opacity: 0.38; cursor: not-allowed; }
  .fnd-macro-check-inline label {
    display: inline-block !important;
    font-weight: 600;
    margin: 0 0 0 6px !important;
    padding: 0 !important;
    color: #1a2233;
    cursor: pointer;
  }
  .fnd-macro-check-inline > input[type="checkbox"] + label {
    margin-left: 6px !important;
  }
  .fnd-macro-config fieldset { margin: 0; border: 1px solid var(--line); border-radius: 6px; padding: 9px 10px; background: #fbfcfd; }
  .fnd-macro-config legend { padding: 0 4px; font-weight: 600; }
  .fnd-macro-lookup { max-height: none; overflow: visible; }
  .fnd-macro-lookup table { width: 100%; max-width: 100%; table-layout: fixed; border-collapse: collapse; }
  .fnd-macro-lookup td { width: 50%; padding: 4px 7px 4px 0; vertical-align: middle; line-height: 1.25; }
  .fnd-macro-lookup label { display: inline; font-weight: 400; margin-left: 0; overflow-wrap: anywhere; }
  .fnd-macro-lookup.fnd-macro-lookup-scroll {
    max-height: 220px;
    overflow-y: auto;
    overflow-x: hidden;
  }
  .fnd-macro-doc-types-field table { width: 100%; table-layout: fixed; }
  .fnd-macro-doc-types-field td { width: 50%; padding: 6px 10px 6px 0; vertical-align: middle; }
	  .fnd-macro-hint { margin: 6px 0 10px; color: var(--muted); font-size: 13px; }
	  .fnd-btn,
	  .fnd-macro-btn {
    display: inline-flex !important; align-items: center !important; justify-content: center !important;
    min-height: 40px !important; padding: 0 18px !important; white-space: nowrap !important;
    border: 1px solid #e0e6ef !important; border-radius: 8px !important; background: #fff !important; color: #33405a !important;
    font-size: 13px !important; font-weight: 600 !important; cursor: pointer; text-decoration: none;
    box-shadow: none !important; transition: background-color .15s ease, border-color .15s ease, color .15s ease !important;
  }
  .fnd-btn:hover,
  .fnd-macro-btn:hover { background: #eef2f8 !important; border-color: #c5d3e2 !important; }
  .fnd-btn-neutral,
  .fnd-macro-btn-neutral { background: #fff !important; border-color: #cfd9e6 !important; color: #1f2b3d !important; }
  .fnd-btn-primary,
  .fnd-macro-btn-primary {
    background: #0397d5 !important;
    border-color: #0397d5 !important;
    color: #fff !important;
    box-shadow: 0 1px 2px rgba(3, 151, 213, 0.24) !important;
  }
  .fnd-btn-primary:hover,
  .fnd-macro-btn-primary:hover {
    background: #026fa0 !important;
    border-color: #026fa0 !important;
    color: #fff !important;
  }
  .fnd-macro-btn-danger {
    border-color: #fecaca !important;
    background: #fff5f5 !important;
    color: #c1121f !important;
  }
  .fnd-macro-btn-danger:hover {
    border-color: #fca5a5 !important;
    background: #ffe9e9 !important;
    color: #a80f1a !important;
  }
  .fnd-macro-btn-sm { min-height: 34px; padding: 0 14px; font-size: 12px; }
  .fnd-macro-icon-btn { width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; padding: 0; border-radius: 8px; }
.fnd-macro-msg { display: block; color: #157347; font-weight: 700; margin: 4px 0 10px; min-height: 0; }
.fnd-macro-msg:empty { display: none; margin: 0; }
  .fnd-macro-section { margin-top: 16px; }
  .fnd-macro-divider { border-top: 1px solid var(--line); margin: 18px 0; }
  .fnd-macro-doc-section-title { background: #eef0f3; color: #344256; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; font-size: 12px; padding: 10px 12px; margin: 16px 0 10px; }
  .fnd-macro-doc-list { display: grid; gap: 8px; }
  .fnd-macro-doc-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
  .fnd-macro-doc-info { flex: 1; min-width: 0; }
  .fnd-macro-doc-tools { display: flex; gap: 6px; align-items: flex-start; flex-shrink: 0; }
  .fnd-macro-doc-tools svg { width: 16px; height: 16px; display: block; }
  .fnd-macro-doc-title { font-weight: 700; color: #111827; font-size: 14px; line-height: 1.3; }
  .fnd-macro-doc-meta { color: var(--muted); margin-top: 4px; font-size: 13px; }
  .fnd-macro-doc-detail { display: none; margin-top: 10px; border: 1px solid var(--line); border-radius: 8px; background: #fbfcfd; padding: 12px; }
  .fnd-macro-doc-row.is-open .fnd-macro-doc-detail { display: block; }
  .fnd-macro-doc-detail p { margin: 4px 0; }
  .fnd-macro-doc-modal {
    position: fixed; inset: 0; z-index: 10000; overflow: auto; padding: 96px 16px 32px;
    display: flex; flex-direction: column; align-items: center;
    background: rgba(0, 0, 0, .55);
  }
  .fnd-macro-doc-shell {
    width: min(800px, calc(100vw - 48px));
    margin: 0 auto;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 18px 45px rgba(15, 23, 42, .22);
    display: flex;
    flex-direction: column;
    flex: 1;
    max-height: calc(100vh - 128px);
  }
  .fnd-macro-doc-empty {
    padding: 24px 22px;
    border-top: 1px solid #eef1f5;
    color: #5f6980;
    font-size: 13px;
  }
  .fnd-macro-doc-modal .fnd-macro-doc-form-stack, .fnd-macro-doc-modal .fnd-macro-doc-list {
    width: 100%; margin: 0; border: 0;
    border-top: 1px solid #eef1f5; border-radius: 0; background: #fff; padding: 18px 22px;
    box-shadow: none;
  }
  .fnd-macro-doc-modal .fnd-macro-doc-list {
    flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain;    
    align-content: start;
  }
  .fnd-macro-doc-modal > .fnd-macro-toolbar {
    width: 100%; margin: 0 auto; border: 1px solid var(--line);
    border-top: 0; border-radius: 0 0 8px 8px; background: #fff; padding: 12px 14px;
  }
  .fnd-macro-doc-list-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 14px 22px;
    border-top: 1px solid #e5e7eb;
    background: #fff;
    flex-shrink: 0;
  }
  .fnd-macro-doc-form-card { margin-top: 12px; border: 1px solid var(--line); border-radius: 8px; background: #fbfcfd; padding: 12px; }
  .fnd-macro-doc-form-footer { display: flex; gap: 8px; justify-content: flex-end; padding: 14px 22px; border-top: 1px solid #e5e7eb; background: #fff; flex-shrink: 0; }
  .fnd-macro-doc-form-stack { display: grid; gap: 12px; max-width: none; overflow-y: auto; flex: 1; min-height: 0; padding: 18px 22px; }
  .fnd-macro-doc-form-narrow { max-width: 200px; }
  .fnd-macro-doc-form-hidden { display: none; }
  .fnd-macro-doc-form-card .fnd-macro-lookup { border: 0; padding: 0; background: transparent; }
  .fnd-macro-doc-form-card .fnd-macro-lookup legend { display: block; width: 100%; padding: 0; margin-bottom: 6px; color: #526079; font-size: 12px; font-weight: 600; }
  .fnd-macro-doc-form-card .fnd-macro-lookup table { width: auto; }
  .fnd-macro-doc-form-card .fnd-macro-lookup td { width: auto; display: block; padding: 2px 0; }
  .fnd-macro-selected-panel { margin-top: 0; border-top-left-radius: 0; border-top-right-radius: 0; }
  .fnd-macro-stage-modal {
    position: fixed; inset: 0; z-index: 9000; overflow: auto; padding: 96px 16px 32px;
    display: flex; align-items: flex-start; justify-content: center;
    background: rgba(0, 0, 0, .24);
  }
  .fnd-macro-stage-modal-inner {
    width: min(800px, calc(100vw - 48px)); margin: 0 auto; background: #fff; border: 0;
    border-radius: 6px; padding: 0; box-shadow: 0 18px 45px rgba(15, 23, 42, .22);
  }
  .fnd-macro-modal-header {
    width: min(800px, calc(100vw - 48px)); min-height: 44px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between;
    gap: 12px; border: 0; border-radius: 6px 6px 0 0; background: #fff; padding: 10px 22px;
    box-shadow: 0 18px 45px rgba(15, 23, 42, .18); flex-shrink: 0;
  }
  .fnd-macro-modal-header-actions { display: flex; gap: 8px; align-items: center; margin-left: auto; }
  .fnd-macro-stage-modal-inner > .fnd-macro-modal-header {
    width: auto; min-height: 44px; margin: 0; border-width: 0; border-radius: 6px 6px 0 0; padding: 10px 22px;
    box-shadow: none;
  }
  .fnd-macro-modal-title { margin: 0; color: #142033; font-size: 16px; font-weight: 700; }
  .fnd-macro-modal-header .fnd-macro-modal-title {
    font-size: 16px !important; font-weight: 700 !important; color: #142033 !important;
    text-transform: none !important; letter-spacing: 0 !important; margin: 0 !important;
  }
  .fnd-macro-modal-close,
  input.fnd-macro-modal-close {
    width: 34px !important; height: 34px !important; min-height: 34px !important; padding: 0 !important;
    border: 0 !important; border-radius: 0 !important; background: transparent !important; color: #5b6b82 !important;
    font-size: 22px !important; font-weight: 400 !important; line-height: 1 !important; text-align: center !important;
    box-shadow: none !important;
  }
  .fnd-macro-modal-close:hover,
  input.fnd-macro-modal-close:hover { background: transparent !important; color: #142033 !important; }
  .fnd-macro-sign-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
  }
  .fnd-macro-sign-wrap input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
  }
  .fnd-macro-sign-wrap label {
    margin: 0 !important;
    font-weight: 500;
    color: #33405a;
    line-height: 1.3;
  }
  .fnd-macro-stage-modal .fnd-macro-selected-panel { border: 0; border-top: 1px solid #eef1f5; padding: 20px 22px; }
  .fnd-macro-stage-modal .fnd-macro-toolbar { margin: 0; }
  .fnd-macro-modal-actions {
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
    margin-top: 18px; padding-top: 14px; border-top: 1px solid #eef1f5;
  }
  .fnd-macro-modal-action-group { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
  .fnd-macro-modal-action-group--right { justify-content: flex-end; }
  @media (max-width: 920px) {
    .fnd-macro-grid, .fnd-macro-grid.etapa-fields, .fnd-macro-grid.two, .fnd-macro-doc-row { grid-template-columns: 1fr; }
    .fnd-hero { flex-direction: column; }
    .fnd-hero-actions { width: 100%; justify-content: flex-start; }
	    .fnd-macro-config { padding: 14px 10px; }
	  }
