.gre-modal{width:min(1040px,94vw);max-height:90vh;overflow:auto}
.gre-form{display:grid;gap:8px;padding-bottom:2px}
.gre-hero,.gre-section-head,.gre-review,.gre-source-summary{display:flex;align-items:center;justify-content:space-between;gap:10px}
.gre-hero{padding:2px 2px 8px;border-bottom:1px solid var(--line,#e6e9ef)}
.gre-hero>div,.gre-section-title,.gre-source-summary{display:flex;flex-direction:column;gap:2px}
.gre-hero>div>b{font-size:18px}
.gre-hero span,.gre-section-hint,.gre-section-summary,.gre-source-summary span,.gre-source-summary small,.gre-review small{color:var(--muted,#6b7280)}
.gre-section{border:1px solid var(--line,#e6e9ef);border-radius:14px;background:#fff;overflow:visible}
.gre-section-head{justify-content:flex-start;padding:9px 12px;cursor:pointer;user-select:none;min-height:50px}
.gre-section-head:focus-visible{outline:2px solid #2563eb;outline-offset:-2px}
.gre-step{width:28px;height:28px;border-radius:999px;background:#0f3f7a;color:#fff;display:grid;place-items:center;font-weight:800;flex:0 0 auto;font-size:14px}
.gre-section-title{min-width:0;flex:1}
.gre-section-title>b{font-size:16px;line-height:1.15}
.gre-section-hint,.gre-section-summary{font-size:12px;line-height:1.25}
.gre-section-summary{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:100%}
.gre-section.is-open .gre-section-summary{display:none}
.gre-section:not(.is-open) .gre-section-hint{display:none}
.gre-chevron{font-size:20px;color:#667085;transition:transform .15s ease;flex:0 0 auto}
.gre-section.is-open .gre-chevron{transform:rotate(180deg)}
.gre-section-body{display:none;padding:0 12px 10px;gap:8px}
.gre-section.is-open .gre-section-body{display:grid}
.gre-source-summary{align-items:flex-start;background:#f6f9fd;border:1px solid #dce7f5;border-radius:10px;padding:9px 10px}
.gre-form label{display:grid;gap:4px;font-size:13px}
.gre-form input,.gre-form select,.gre-form textarea{width:100%;min-height:42px}
.gre-compact-grid{gap:8px}
.gre-route-card{display:grid;gap:8px;padding:10px;border:1px solid #e6e9ef;border-radius:11px;background:#fafbfc}
.gre-route-card>b{font-size:13px;color:#344054}
.gre-route-arrow{text-align:center;color:#667085;font-size:16px;line-height:1}
.gre-item-row{display:grid;grid-template-columns:minmax(220px,1.6fr) 90px minmax(120px,.7fr) minmax(145px,.8fr) auto;gap:8px;align-items:end;margin-bottom:8px}
.gre-item-row .gre-remove-item{min-height:44px}
.gre-add-item{min-height:42px}
.gre-review{position:sticky;bottom:-1px;background:#fff;border-top:1px solid var(--line,#e6e9ef);padding:9px 2px calc(4px + env(safe-area-inset-bottom));z-index:5}
.gre-review-copy{display:flex;flex-direction:column;gap:1px;min-width:0}
.gre-review-copy>b{font-size:14px}
.gre-review .btn{min-height:42px;white-space:nowrap}.gre-review-actions{display:flex;align-items:center;justify-content:flex-end;gap:8px;flex-wrap:wrap}.check-option{display:flex!important;grid-template-columns:auto 1fr;align-items:center;justify-content:flex-start;gap:8px!important}.check-option input[type="checkbox"]{width:18px!important;height:18px!important;min-height:0!important;margin:0;flex:0 0 auto}
.ubigeo-picker{position:relative}
.ubigeo-picker>input[type="search"]{width:100%}
.ubigeo-results{position:absolute;z-index:80;left:0;right:0;top:calc(100% + 4px);max-height:240px;overflow:auto;background:#fff;border:1px solid #d0d5dd;border-radius:10px;box-shadow:0 12px 28px rgba(16,24,40,.16);padding:4px}
.ubigeo-option{display:flex;width:100%;flex-direction:column;align-items:flex-start;gap:2px;padding:9px 10px;border:0;border-radius:8px;background:#fff;text-align:left;cursor:pointer;color:#101828}
.ubigeo-option:hover,.ubigeo-option:focus{background:#eff8ff;outline:none}
.ubigeo-option b{font-size:13px}
.ubigeo-option small{font-size:11px;color:#667085}
.ubigeo-empty{padding:10px;color:#667085;font-size:12px}
@media(min-width:900px){.gre-section.is-open .gre-section-body>.form-grid:not(.gre-compact-grid){grid-template-columns:repeat(2,minmax(0,1fr))}.gre-route-card{grid-template-columns:1fr 28px 1fr;align-items:end}.gre-route-card>b{grid-column:1/-1}.gre-route-arrow{padding-bottom:12px}}
@media(max-width:640px){
  .gre-modal{width:100vw;max-width:none;height:100dvh;max-height:100dvh;border-radius:0}
  .gre-form{gap:8px}
  .gre-hero{padding:0 0 6px}
  .gre-hero>div>b{font-size:16px}
  .gre-hero>div>span{font-size:12px}
  .gre-section{border-radius:12px}
  .gre-section-head{padding:9px 10px;min-height:50px}
  .gre-step{width:26px;height:26px;font-size:13px}
  .gre-section-title>b{font-size:15px}
  .gre-section-body{padding:0 10px 10px;gap:8px}
  .gre-form input,.gre-form select{min-height:42px;padding-top:8px;padding-bottom:8px}
  .gre-compact-grid{grid-template-columns:1fr 1fr}
  .gre-route-card{padding:9px;gap:7px}
  .gre-item-row{grid-template-columns:minmax(0,1fr) 78px 42px;gap:6px}
  .gre-item-row label:nth-of-type(3),.gre-item-row label:nth-of-type(4){grid-column:span 1}
  .gre-review-actions{display:grid;grid-template-columns:1fr 1fr;width:100%}
  .gre-review{align-items:end}
  .gre-review-copy{max-width:38%}
  .gre-item-row .gre-remove-item{grid-column:auto;padding-left:10px;padding-right:10px;font-size:0}
  .gre-item-row .gre-remove-item::after{content:'×';font-size:21px;line-height:1}
  .gre-review{padding:7px 0 calc(7px + env(safe-area-inset-bottom));gap:8px}
  .gre-review-copy small{display:none}
  .gre-review-copy b{font-size:13px}
  .gre-review .btn{min-width:0;min-height:42px;padding-left:10px;padding-right:10px}
  .ubigeo-results{max-height:210px}
}
@media(max-width:390px){
  .gre-review-copy{display:none}
  .gre-review-actions{width:100%;grid-template-columns:1fr 1fr}
  .gre-review .btn{width:100%}
  .gre-item-row{grid-template-columns:minmax(0,1fr) 72px 42px}
}

.ubigeo-result-count{padding:7px 10px 5px;font-size:11px;font-weight:700;color:#667085;border-bottom:1px solid #eef2f6;background:#fafbfc;position:sticky;top:0;z-index:1}

/* GRE desktop layout correction */
@media(min-width:641px){
  .gre-modal{width:min(1120px,92vw)}
  .gre-section-body{padding:0 14px 12px}
  .gre-route-card{display:grid;grid-template-columns:minmax(220px,.85fr) minmax(250px,1fr) minmax(320px,1.35fr);column-gap:10px;row-gap:5px;align-items:end}
  .gre-route-card>b{grid-column:1/-1;margin-bottom:2px}
  .gre-route-card>label{min-width:0}
  .gre-route-card>label:nth-of-type(1){grid-column:1}
  .gre-route-card>label:nth-of-type(2){grid-column:2}
  .gre-route-card>label:nth-of-type(3){grid-column:3}
  .gre-route-arrow{grid-column:1/-1;padding:0;margin:-2px 0;text-align:center}
  .gre-route-card input,.gre-route-card select{min-width:0}
  .gre-route-card .ubigeo-picker{min-width:0;width:100%}
}
@media(min-width:641px) and (max-width:900px){
  .gre-route-card{grid-template-columns:1fr 1fr}
  .gre-route-card>label:nth-of-type(1){grid-column:1/-1}
  .gre-route-card>label:nth-of-type(2){grid-column:1}
  .gre-route-card>label:nth-of-type(3){grid-column:2}
}
@media(max-width:640px){
  .gre-route-card{display:grid;grid-template-columns:1fr!important}
  .gre-route-card>b,.gre-route-card>label,.gre-route-arrow{grid-column:1!important}
  .gre-review-actions{grid-template-columns:minmax(0,1fr) minmax(0,1fr)}
}

.gre-items-empty{padding:14px;border:1px dashed #d0d5dd;border-radius:10px;background:#fafbfc;color:#667085;text-align:center;font-size:12px}.gre-linked-item-row{display:grid;grid-template-columns:28px minmax(0,1fr) 90px;gap:10px;align-items:center;padding:9px 10px;border:1px solid #e6e9ef;border-radius:10px;margin-bottom:7px;background:#fff}.gre-linked-index{width:24px;height:24px;border-radius:999px;background:#eef4fb;color:#0f3f7a;display:grid;place-items:center;font-size:11px;font-weight:800}.gre-linked-product{display:flex;flex-direction:column;min-width:0}.gre-linked-product b,.gre-linked-product small{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.gre-linked-product small,.gre-linked-qty small{color:#667085;font-size:11px}.gre-linked-qty{display:flex;flex-direction:column;text-align:right}@media(max-width:640px){.gre-linked-item-row{grid-template-columns:26px minmax(0,1fr) 64px;padding:8px}.gre-items-empty{padding:12px 9px}}

/* GRE carrier search */
.gre-carrier-search{display:grid;gap:8px;padding:10px;border:1px solid #dce7f5;border-radius:11px;background:#f8fbff}
.gre-carrier-search-row{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px;align-items:end}
.gre-carrier-search-row label{margin:0}
.gre-carrier-search-row .btn{min-height:42px}
.gre-carrier-status{margin:0;min-height:18px;font-size:12px;color:#667085}
.gre-carrier-results{display:grid;gap:6px;max-height:230px;overflow:auto}
.gre-carrier-result{display:flex;align-items:center;justify-content:space-between;gap:10px;width:100%;padding:9px 10px;border:1px solid #d8e1ea;border-radius:9px;background:#fff;text-align:left;cursor:pointer}
.gre-carrier-result:hover,.gre-carrier-result:focus{background:#eff8ff;outline:none}
.gre-carrier-result>span:first-child{display:flex;flex-direction:column;min-width:0}
.gre-carrier-result b,.gre-carrier-result small{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.gre-carrier-result small{color:#667085;font-size:11px}
.gre-carrier-result>span:last-child{font-size:12px;font-weight:700;color:#0f3f7a}
.gre-carrier-selected-card{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;padding:10px;border:1px solid #d8e1ea;border-radius:10px;background:#fff}
.gre-carrier-selected-card>div{display:flex;flex-direction:column;gap:2px;min-width:0}
.gre-carrier-selected-card b{font-size:13px}
.gre-carrier-selected-card small{font-size:11px;color:#667085;overflow-wrap:anywhere}
.gre-carrier-fiscal{align-items:flex-end;text-align:right}
.gre-carrier-fiscal span{font-size:11px;font-weight:700;color:#344054}
.gre-carrier-selected-empty{padding:9px;border:1px dashed #d0d5dd;border-radius:9px;color:#667085;font-size:12px;text-align:center;background:#fff}
.gre-carrier-manual-toggle{justify-self:start}
.gre-carrier-manual{display:grid;gap:8px;padding-top:4px}
@media(max-width:640px){
  .gre-carrier-search-row{grid-template-columns:1fr}
  .gre-carrier-search-row .btn{width:100%}
  .gre-carrier-selected-card{display:grid}
  .gre-carrier-fiscal{align-items:flex-start;text-align:left}
}
