/* Shared field workspace and corrections for existing portal layouts. */
#routes { --fr-accent: var(--blue, #1358d8); color: var(--text, #14213a); min-width: 0; padding: clamp(16px, 2.4vw, 36px); }
#routes *, .fr-dialog * { box-sizing: border-box; }
.fr-heading { display:flex; align-items:center; gap:16px; flex-wrap:wrap; margin-bottom:20px; }
.fr-heading > div { flex:1; min-width:180px; }
.fr-heading h2 { font-size:clamp(24px,2.2vw,34px); margin:0 0 6px; letter-spacing:-.035em; }
.fr-heading p { margin:0; color:var(--muted,#5c6d84); font-size:15px; }
.fr-button { display:inline-flex; align-items:center; justify-content:center; gap:8px; border:1px solid var(--line,#d6deea); background:var(--surface,#fff); color:var(--text,#14213a); min-height:44px; border-radius:10px; padding:10px 14px; font:600 14px/1.3 inherit; font-size:14px; text-decoration:none; cursor:pointer; white-space:normal; }
.fr-button svg { width:19px; height:19px; flex:none; }
.fr-button.primary { background:var(--fr-accent,var(--blue,#1358d8)); color:#fff; border-color:transparent; }
.fr-button:disabled { opacity:.55; cursor:wait; }
.fr-button:hover { filter:brightness(.96); }
.fr-button:focus-visible,.fr-tabs button:focus-visible { outline:3px solid var(--blue,#1358d8); outline-offset:3px; }
.fr-statusbar { display:flex; align-items:center; justify-content:space-between; gap:12px; color:var(--muted,#5c6d84); font-size:14px; margin-bottom:22px; flex-wrap:wrap; }
.fr-statusbar .pending { color:#b66b15; }
.fr-summary { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:14px; margin-bottom:26px; }
.fr-summary > div { display:grid; gap:10px; padding:20px; border:1px solid var(--line,#d6deea); border-radius:14px; background:var(--surface,#fff); }
.fr-summary span { color:var(--muted,#5c6d84); font-size:14px; }
.fr-summary strong { font-size:32px; line-height:1; letter-spacing:-.04em; }
.fr-toolbar,.fr-tools,.fr-tabs,.fr-row-actions,.fr-map-links { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.fr-toolbar { justify-content:space-between; margin-bottom:18px; }
.fr-tabs { border-bottom:1px solid var(--line,#d6deea); gap:0; }
.fr-tabs button { background:transparent; color:var(--muted,#5c6d84); border:0; border-bottom:3px solid transparent; padding:14px; font-size:15px; cursor:pointer; }
.fr-tabs button[aria-selected=true] { color:var(--blue,#1358d8); border-bottom-color:currentColor; font-weight:700; }
.fr-search { position:relative; margin-bottom:20px; }
.fr-search svg { width:20px; position:absolute; left:14px; top:14px; }
.fr-search input { width:100%; padding:13px 14px 13px 44px; font-size:16px; border:1px solid var(--line,#d6deea); border-radius:10px; background:var(--surface,#fff); color:inherit; }
.fr-list { display:grid; gap:10px; }
.fr-row { display:flex; align-items:center; gap:16px; padding:20px; border:1px solid var(--line,#d6deea); border-radius:12px; background:var(--surface,#fff); min-width:0; }
.fr-copy { display:grid; gap:6px; min-width:0; flex:1; overflow-wrap:anywhere; }
.fr-copy strong { font-size:17px; }
.fr-copy span,.fr-copy small,.fr-copy p { font-size:14px; line-height:1.5; color:var(--muted,#5c6d84); margin:0; }
.fr-route-mark { width:46px; height:46px; display:grid; place-items:center; background:color-mix(in srgb,var(--blue,#1358d8) 9%,transparent); color:var(--blue,#1358d8); border-radius:12px; flex:none; }
.fr-route-mark svg { width:23px; height:23px; }
.fr-empty { padding:40px 20px; text-align:center; border:1px dashed var(--line,#d6deea); border-radius:14px; color:var(--muted,#5c6d84); }
.fr-recording { display:flex; justify-content:space-between; flex-wrap:wrap; gap:12px; padding:16px; background:#fff2de; color:#7d4500; border:1px solid #f3cc8f; border-radius:12px; margin-bottom:20px; }
.fr-badge { display:inline-block; padding:6px 9px; background:var(--surface-soft,#edf2f8); border-radius:6px; font-size:13px; font-weight:700; }
.fr-badge.completed { color:#096c4b; background:#dcf5e9; }.fr-badge.in_progress { color:#8b5400; background:#fff0cf; }.fr-badge.canceled { color:#a02f3e; background:#ffe5e9; }
.fr-dialog { width:min(720px,calc(100vw - 24px)); max-height:calc(100dvh - 32px); margin:auto; padding:0; border:1px solid var(--line,#d6deea); border-radius:16px; background:var(--surface,#fff); color:var(--text,#14213a); overflow-y:auto; box-shadow:0 30px 90px #07152c40; }
.fr-dialog::backdrop { background:#07152ca3; backdrop-filter:blur(4px); }
.fr-dialog header { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:20px; border-bottom:1px solid var(--line,#d6deea); }
.fr-dialog h3 { margin:0; font-size:22px; }
.fr-fields { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); padding:22px; gap:18px; }
.fr-fields label { display:grid; gap:8px; font-size:14px; font-weight:600; min-width:0; }
.fr-fields input,.fr-fields select,.fr-fields textarea { width:100%; min-width:0; border:1px solid var(--line,#d6deea); background:var(--surface-soft,#f6f8fb); color:inherit; font-family:inherit; font-size:16px; border-radius:8px; padding:11px 12px; }
.fr-fields p { line-height:1.6; font-size:15px; margin:0; }
.fr-wide,.fr-gps { grid-column:1/-1; }.fr-gps { display:flex; align-items:center; flex-wrap:wrap; gap:12px; font-size:14px; }
.fr-dialog footer { display:flex; justify-content:flex-end; padding:16px 22px; border-top:1px solid var(--line,#d6deea); }
.fr-dialog [data-fr-form-status] { padding:0 22px; color:#b53c38; }
.fr-track-map canvas { width:100%; height:auto; background:var(--surface-soft,#f1f5fa); border-radius:10px; }
.portal.open .home-action.field-route-entry { order:7; }
.portal.open .home-action.field-route-entry strong { font-size:inherit; }
#videoModal .video-frame img,#videoModal .video-frame video,#videoModal.modal-landscape-media .video-frame img,#videoModal.modal-landscape-media .video-frame video,#marketingModal img,#marketingModal video { object-fit:contain!important; max-height:calc(100dvh - 140px); }
.portal.open .tabs { max-height:calc(100dvh - 120px); overflow-y:auto; }
@media(max-width:1199px) {
  .portal.open .rep-menu-wrap { position:relative; grid-column:1; grid-row:1; justify-self:start; width:auto; margin:0; }
  .portal.open .rep-menu-toggle { display:grid; width:40px; height:40px; padding:10px; font-size:0; place-items:center; }
  .portal.open .rep-menu-toggle svg { width:20px; height:20px; }
  .portal.open .tabs { position:absolute; top:calc(100% + 8px); left:0; right:auto; display:none; width:min(350px,calc(100vw - 28px)); grid-template-columns:repeat(2,minmax(0,1fr)); padding:10px; background:var(--surface,#fff); z-index:65; }
  .portal.open .tabs.open { display:grid; }
  .portal.open .tabs .tab { min-height:44px; font-size:14px; }
}
@media(min-width:961px) and (max-width:1199px) {
  .portal.open .topbar-inner { display:grid; grid-template-columns:40px minmax(0,1fr) auto; gap:14px; }
  .portal.open .topbar-inner>.brand { grid-column:2; }.portal.open .top-actions { grid-column:3; grid-row:1; }.portal.open .market-strip { grid-column:1/-1; }
}
@media(min-width:1200px) {
  .portal.open .home-actions { grid-template-columns:repeat(4,minmax(0,1fr)); }
  #routes { width:100%; max-width:1680px; margin-inline:auto; }
}
@media(max-width:650px) {
  #routes { padding:16px 12px; }.fr-heading { gap:12px; }.fr-heading > div { min-width:150px; }
  .fr-summary { grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }.fr-summary>div { padding:15px; }
  .fr-row { flex-wrap:wrap; padding:15px; gap:12px; }.fr-row-actions { width:100%; padding-top:5px; }.fr-row-actions .fr-button { flex:1; }
  .fr-toolbar { align-items:stretch; }.fr-tools { width:100%; }.fr-tools .primary { flex:1; }
  .fr-fields { grid-template-columns:minmax(0,1fr); padding:18px; }.fr-dialog header { padding:16px; }
  .fr-dialog h3 { font-size:20px; }.fr-heading>.fr-button:first-child span { display:none; }
  .portal.open .home-action.field-route-entry { grid-column:1/-1; min-height:84px; }
}
@media(prefers-reduced-motion:reduce) { .fr-button { transition:none; } }

/* The opened desktop menu must not inherit 100% of its 44px trigger. */
@media(min-width:1200px) {
  .portal.open .tabs,
  .portal.open .tabs.open {
    width:min(358px,calc(100vw - 64px));
    right:0;
    left:auto;
  }
}

/* The ADM home is a launcher, so there is no empty content column. */
.portal.is-open.home-section .main {
  display:flex;
  flex-direction:column;
  width:min(100%,1920px);
  gap:clamp(24px,3vw,48px);
}
.portal.is-open.home-section .topbar { width:100%; flex:none; }
.portal.is-open.home-section .sidebar {
  position:static;
  width:100%;
  margin:0;
  padding:clamp(16px,2vw,32px);
}
.portal.is-open.home-section #inicio { display:none; }
.portal.is-open.home-section .adm-launch-grid {
  width:100%;
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr))!important;
  grid-auto-rows:auto;
  gap:clamp(12px,1.5vw,24px)!important;
}
.portal.is-open.home-section .adm-launch-card {
  height:auto;
  min-height:116px!important;
  padding:clamp(16px,2vw,28px)!important;
  gap:16px!important;
}
.portal.is-open.home-section .adm-launch-card>span:not(.nav-icon):not(.submenu-chevron) {
  font-size:clamp(16px,1.2vw,22px)!important;
  line-height:1.3;
  white-space:normal;
}
.portal.is-open.home-section .adm-launch-card[data-section="routes"] {
  order:0;
  --launch-color:var(--blue,#1358d8);
}
@media(min-width:1200px) {
  .portal.is-open.home-section .adm-launch-grid { grid-template-columns:repeat(4,minmax(0,1fr))!important; }
  .portal.is-open.home-section .adm-launch-card { min-height:160px!important; }
}
@media(max-width:520px) {
  .portal.is-open.home-section .sidebar { padding:10px; }
  .portal.is-open.home-section .adm-launch-card { min-height:106px!important; padding:14px 10px!important; gap:8px!important; }
  .portal.is-open.home-section .adm-launch-card .nav-icon { width:28px!important; min-width:28px!important; }
  .portal.is-open.home-section .adm-launch-card>span:not(.nav-icon):not(.submenu-chevron) { font-size:14px!important; }
}
