/* ============================================================
   Global Produce ERP — Portal CSS
   Mobile-first, responsive design system
   ============================================================ */

/* ── CSS Variables ─────────────────────────────────────────── */
:root {
  --gpe-primary:       #1a7a4a;
  --gpe-primary-dark:  #145e38;
  --gpe-primary-light: #e8f5ee;
  --gpe-accent:        #f0a500;
  --gpe-accent-dark:   #c8880a;
  --gpe-danger:        #e53e3e;
  --gpe-warning:       #dd6b20;
  --gpe-info:          #3182ce;
  --gpe-success:       #38a169;
  --gpe-text:          #1a202c;
  --gpe-text-muted:    #718096;
  --gpe-border:        #e2e8f0;
  --gpe-bg:            #f7fafc;
  --gpe-card-bg:       #ffffff;
  --gpe-topbar-h:      56px;
  --gpe-bottomnav-h:   64px;
  --gpe-sidenav-w:     260px;
  --gpe-radius:        10px;
  --gpe-shadow:        0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --gpe-shadow-md:     0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
  --gpe-transition:    .2s ease;
}

/* ── Reset & Base ──────────────────────────────────────────── */
.gpe-portal *, .gpe-portal *::before, .gpe-portal *::after { box-sizing: border-box; }
.gpe-portal {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  color: var(--gpe-text);
  background: var(--gpe-bg);
  min-height: 100vh;
  /* v1.10.40 — Break out of the theme's content container. The portal
   * is loaded as a [gpe_portal] shortcode inside a WordPress page,
   * which means the theme's typical max-width:1200px centered wrapper
   * was constraining .gpe-portal-main, leaving a huge empty band on
   * the left between the fixed-position sidebar and the content card.
   * These rules pull .gpe-portal out to full viewport width regardless
   * of the theme's container styling. */
  width: 100vw;
  position: relative;
  left: 50%;
  right: 50%;
  margin-left: -50vw;
  margin-right: -50vw;
}

/* ── Top Bar ───────────────────────────────────────────────── */
.gpe-portal-topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 200;
  height: var(--gpe-topbar-h);
  background: var(--gpe-primary);
  color: #fff;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px;
  box-shadow: var(--gpe-shadow-md);
}
/* v1.10.83 — When the WP admin bar is showing (logged-in WP user with
   admin-bar enabled), push the portal topbar AND sidenav below it so
   they don't overlap. The admin bar is 32px tall ≥ 783px viewport,
   46px tall on mobile (< 783px). The body.admin-bar class is added
   automatically by WordPress. */
body.admin-bar .gpe-portal-topbar { top: 32px; }
body.admin-bar .gpe-portal-sidenav { top: 32px; }
@media (max-width: 782px) {
  body.admin-bar .gpe-portal-topbar { top: 46px; }
  body.admin-bar .gpe-portal-sidenav { top: 46px; }
}
.gpe-portal-topbar__left { display: flex; align-items: center; gap: 12px; }
.gpe-portal-topbar__title { font-size: 17px; font-weight: 600; }
.gpe-portal-topbar__right { display: flex; align-items: center; gap: 14px; }

/* Hamburger */
.gpe-portal-menu-toggle {
  background: none; border: none; cursor: pointer; padding: 4px;
  display: flex; flex-direction: column; gap: 5px;
}
.gpe-portal-menu-toggle span {
  display: block; width: 22px; height: 2px; background: #fff; border-radius: 2px;
  transition: var(--gpe-transition);
}

/* Notification bell */
.gpe-portal-notif-btn {
  position: relative; color: #fff; display: flex; align-items: center;
}
.gpe-portal-notif-badge {
  position: absolute; top: -6px; right: -8px;
  background: var(--gpe-accent); color: #fff;
  font-size: 10px; font-weight: 700; border-radius: 10px;
  padding: 1px 5px; min-width: 18px; text-align: center;
}

/* Avatar */
.gpe-portal-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: rgba(255,255,255,.25);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px; color: #fff;
}

/* ── Side Nav ──────────────────────────────────────────────── */
.gpe-portal-sidenav {
  position: fixed; top: 0; left: -280px; bottom: 0; z-index: 300;
  width: var(--gpe-sidenav-w);
  background: #fff;
  display: flex; flex-direction: column;
  box-shadow: var(--gpe-shadow-md);
  transition: left var(--gpe-transition);
  overflow-y: auto;
}
.gpe-portal-sidenav.open { left: 0; }

.gpe-portal-sidenav__header {
  background: var(--gpe-primary);
  color: #fff;
  padding: 24px 20px 20px;
}
.gpe-portal-sidenav__logo { font-size: 22px; font-weight: 800; margin-bottom: 6px; }
.gpe-portal-sidenav__role { font-size: 12px; opacity: .8; text-transform: uppercase; letter-spacing: .05em; }
.gpe-portal-sidenav__user { font-size: 14px; font-weight: 600; margin-top: 4px; }

.gpe-portal-sidenav__list { list-style: none; margin: 8px 0; padding: 0; flex: 1; }
.gpe-portal-sidenav__item a {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 20px;
  color: var(--gpe-text); text-decoration: none;
  font-size: 14px; font-weight: 500;
  transition: background var(--gpe-transition), color var(--gpe-transition);
  border-radius: 0;
}
.gpe-portal-sidenav__item a:hover { background: var(--gpe-primary-light); color: var(--gpe-primary); }
.gpe-portal-sidenav__item.active a {
  background: var(--gpe-primary-light); color: var(--gpe-primary);
  border-right: 3px solid var(--gpe-primary);
}
.gpe-portal-sidenav__icon { font-size: 18px; width: 24px; text-align: center; }
.gpe-portal-sidenav__badge {
  margin-left: auto; background: var(--gpe-danger); color: #fff;
  font-size: 11px; font-weight: 700; border-radius: 10px; padding: 1px 6px;
}

.gpe-portal-sidenav__footer { padding: 16px 20px; border-top: 1px solid var(--gpe-border); }
.gpe-portal-logout-btn {
  display: flex; align-items: center; gap: 8px;
  color: var(--gpe-text-muted); text-decoration: none; font-size: 14px;
  transition: color var(--gpe-transition);
}
.gpe-portal-logout-btn:hover { color: var(--gpe-danger); }

/* Overlay */
.gpe-portal-overlay {
  display: none; position: fixed; inset: 0; z-index: 250;
  background: rgba(0,0,0,.45);
}
.gpe-portal-overlay.show { display: block; }

/* ── Main Content ──────────────────────────────────────────── */
.gpe-portal-main {
  padding-top: calc(var(--gpe-topbar-h) + 16px);
  padding-bottom: calc(var(--gpe-bottomnav-h) + 16px);
  padding-left: 16px; padding-right: 16px;
  max-width: 1200px; margin: 0 auto;
}
/* v1.10.83 — When the admin bar is visible, account for its height too */
body.admin-bar .gpe-portal-main {
  padding-top: calc(var(--gpe-topbar-h) + 16px + 32px);
}
@media (max-width: 782px) {
  body.admin-bar .gpe-portal-main {
    padding-top: calc(var(--gpe-topbar-h) + 16px + 46px);
  }
}

/* ── Bottom Nav (mobile only) ──────────────────────────────── */
.gpe-portal-bottomnav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 200;
  height: var(--gpe-bottomnav-h);
  background: #fff;
  border-top: 1px solid var(--gpe-border);
  display: flex; align-items: stretch;
  box-shadow: 0 -2px 8px rgba(0,0,0,.08);
}
.gpe-portal-bottomnav__item {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px;
  color: var(--gpe-text-muted); text-decoration: none;
  font-size: 10px; font-weight: 500;
  transition: color var(--gpe-transition), background var(--gpe-transition);
  padding: 6px 4px;
}
.gpe-portal-bottomnav__item.active {
  color: var(--gpe-primary);
  background: var(--gpe-primary-light);
}
.gpe-portal-bottomnav__icon { font-size: 20px; line-height: 1; }
.gpe-portal-bottomnav__label { font-size: 10px; }

/* ── Cards ─────────────────────────────────────────────────── */
.gpe-card {
  background: var(--gpe-card-bg); border-radius: var(--gpe-radius);
  box-shadow: var(--gpe-shadow); padding: 20px; margin-bottom: 16px;
}
.gpe-card-title {
  font-size: 16px; font-weight: 700; margin: 0 0 14px;
  color: var(--gpe-text);
}
.gpe-card-subtitle {
  font-size: 13px; color: var(--gpe-text-muted); margin: -10px 0 14px;
}

/* ── Stat Grid ─────────────────────────────────────────────── */
.gpe-stat-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 16px;
}
.gpe-stat-card {
  background: var(--gpe-card-bg); border-radius: var(--gpe-radius);
  box-shadow: var(--gpe-shadow); padding: 16px 14px;
  display: flex; flex-direction: column; gap: 4px;
}
.gpe-stat-card__label { font-size: 12px; color: var(--gpe-text-muted); font-weight: 500; }
.gpe-stat-card__value { font-size: 26px; font-weight: 800; color: var(--gpe-primary); line-height: 1; }
.gpe-stat-card__sub   { font-size: 12px; color: var(--gpe-text-muted); }
.gpe-stat-card.accent .gpe-stat-card__value { color: var(--gpe-accent-dark); }
.gpe-stat-card.danger .gpe-stat-card__value { color: var(--gpe-danger); }
.gpe-stat-card.info   .gpe-stat-card__value { color: var(--gpe-info); }

/* ── Tables ────────────────────────────────────────────────── */
.gpe-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.gpe-table {
  width: 100%; border-collapse: collapse; font-size: 14px;
}
.gpe-table th {
  background: var(--gpe-bg); text-align: left;
  padding: 10px 12px; font-size: 12px; font-weight: 600;
  color: var(--gpe-text-muted); text-transform: uppercase; letter-spacing: .04em;
  border-bottom: 2px solid var(--gpe-border);
}
.gpe-table td {
  padding: 12px; border-bottom: 1px solid var(--gpe-border);
  vertical-align: middle;
}
.gpe-table tr:last-child td { border-bottom: none; }
.gpe-table tr:hover td { background: var(--gpe-primary-light); }

/* ── Badges / Status ───────────────────────────────────────── */
.gpe-badge {
  display: inline-block; padding: 3px 9px; border-radius: 20px;
  font-size: 11px; font-weight: 600; text-transform: capitalize;
}
.gpe-badge-green  { background: #c6f6d5; color: #276749; }
.gpe-badge-yellow { background: #fefcbf; color: #975a16; }
.gpe-badge-red    { background: #fed7d7; color: #9b2c2c; }
.gpe-badge-blue   { background: #bee3f8; color: #2a69ac; }
.gpe-badge-gray   { background: #edf2f7; color: #4a5568; }
.gpe-badge-orange { background: #feebc8; color: #9c4221; }

/* ── Buttons ───────────────────────────────────────────────── */
.gpe-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px; border-radius: 8px; font-size: 14px; font-weight: 600;
  cursor: pointer; border: none; text-decoration: none;
  transition: background var(--gpe-transition), transform .1s;
}
.gpe-btn:active { transform: scale(.97); }
.gpe-btn-primary { background: var(--gpe-primary); color: #fff; }
.gpe-btn-primary:hover { background: var(--gpe-primary-dark); color: #fff; }
.gpe-btn-accent  { background: var(--gpe-accent); color: #fff; }
.gpe-btn-accent:hover { background: var(--gpe-accent-dark); }
.gpe-btn-outline {
  background: transparent; color: var(--gpe-primary);
  border: 2px solid var(--gpe-primary);
}
.gpe-btn-outline:hover { background: var(--gpe-primary-light); }
.gpe-btn-danger  { background: var(--gpe-danger); color: #fff; }
.gpe-btn-sm { padding: 6px 12px; font-size: 13px; }
.gpe-btn-block { width: 100%; justify-content: center; }

/* v1.10.38 — Ghost button (Cancel/Back) — used heavily by the v1.10.33+
 * portal-native CRUD views. Looks like a quiet outlined button. */
.gpe-btn-ghost {
  background: transparent; color: var(--gpe-text-muted);
  border: 1px solid var(--gpe-border);
}
.gpe-btn-ghost:hover { background: #f3f4f6; color: var(--gpe-text); }

/* Link-style button — for row actions (View/Edit/Delete) inside lists.
 * Was undefined before, so action links rendered as plain body text and
 * users couldn't see them. Now they're clearly clickable, color-coded
 * (primary green, danger red), and have a subtle hover background. */
.gpe-btn-link {
  display: inline-block; padding: 4px 8px; border-radius: 4px;
  color: var(--gpe-primary); font-weight: 600; font-size: 13px;
  text-decoration: none; transition: background .15s;
}
.gpe-btn-link:hover { background: var(--gpe-primary-light); }
.gpe-btn-link.danger { color: var(--gpe-danger); }
.gpe-btn-link.danger:hover { background: #fef2f2; }

/* v1.10.39 — Row actions cell.
 * Desktop (≥768px): just a normal table cell aligned right with comfy
 * padding. No sticky, no shadow — the whole table fits in the viewport.
 * Mobile (<768px): sticky-right keeps actions visible when the table
 * scrolls horizontally inside its overflow-x wrapper. */
.gpe-row-actions {
  padding: 10px 8px;
  text-align: right;
  vertical-align: middle;
  white-space: nowrap;
}
.gpe-row-actions .gpe-btn-link {
  display: inline-block;
  margin-left: 4px;
}

@media (max-width: 767px) {
  .gpe-row-actions {
    position: sticky;
    right: 0;
    background: #fff;
    box-shadow: -8px 0 12px -8px rgba(0,0,0,.08);
    z-index: 1;
    white-space: normal;
    min-width: 120px;
  }
  .gpe-data-table th.gpe-row-actions-head {
    position: sticky;
    right: 0;
    background: #fff;
    z-index: 2;
    box-shadow: -8px 0 12px -8px rgba(0,0,0,.08);
  }
  .gpe-data-table tr:hover .gpe-row-actions { background: #fafafa; }
}

/* ── Forms ─────────────────────────────────────────────────── */
.gpe-form-group { margin-bottom: 16px; }
.gpe-form-label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--gpe-text); }
.gpe-form-control {
  width: 100%; padding: 10px 14px; border: 1px solid var(--gpe-border);
  border-radius: 8px; font-size: 14px; color: var(--gpe-text);
  background: #fff; transition: border-color var(--gpe-transition);
  -webkit-appearance: none;
}
.gpe-form-control:focus { outline: none; border-color: var(--gpe-primary); box-shadow: 0 0 0 3px rgba(26,122,74,.15); }
textarea.gpe-form-control { resize: vertical; min-height: 90px; }
select.gpe-form-control { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23718096' d='M6 8L0 0h12z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }

/* ── Chat / Negotiation Thread ─────────────────────────────── */
.gpe-thread { display: flex; flex-direction: column; gap: 12px; padding: 16px 0; }
.gpe-msg { display: flex; gap: 10px; max-width: 85%; }
.gpe-msg.mine { flex-direction: row-reverse; align-self: flex-end; }
.gpe-msg-avatar {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  background: var(--gpe-primary-light); color: var(--gpe-primary);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px;
}
.gpe-msg.mine .gpe-msg-avatar { background: var(--gpe-accent); color: #fff; }
.gpe-msg-bubble {
  background: #fff; border-radius: 12px; padding: 10px 14px;
  box-shadow: var(--gpe-shadow); font-size: 14px; line-height: 1.5;
}
.gpe-msg.mine .gpe-msg-bubble { background: var(--gpe-primary); color: #fff; }
.gpe-msg-meta { font-size: 11px; color: var(--gpe-text-muted); margin-top: 4px; }
.gpe-msg.mine .gpe-msg-meta { text-align: right; color: rgba(255,255,255,.7); }

.gpe-thread-input {
  position: sticky; bottom: calc(var(--gpe-bottomnav-h) + 8px);
  background: var(--gpe-bg); padding: 12px 0 4px;
  display: flex; gap: 8px;
}
.gpe-thread-input .gpe-form-control { flex: 1; }

/* ── List Items ────────────────────────────────────────────── */
.gpe-list { list-style: none; margin: 0; padding: 0; }
.gpe-list-item {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 0; border-bottom: 1px solid var(--gpe-border);
  text-decoration: none; color: var(--gpe-text);
  transition: background var(--gpe-transition);
}
.gpe-list-item:last-child { border-bottom: none; }
.gpe-list-item:hover { background: var(--gpe-primary-light); margin: 0 -20px; padding-left: 20px; padding-right: 20px; }
.gpe-list-item__icon { font-size: 22px; width: 36px; text-align: center; flex-shrink: 0; }
.gpe-list-item__body { flex: 1; min-width: 0; }
.gpe-list-item__title { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gpe-list-item__sub   { font-size: 12px; color: var(--gpe-text-muted); margin-top: 2px; }
.gpe-list-item__right { flex-shrink: 0; text-align: right; }
.gpe-list-item__arrow { color: var(--gpe-text-muted); font-size: 18px; }

/* ── Empty State ───────────────────────────────────────────── */
.gpe-empty {
  text-align: center; padding: 48px 20px; color: var(--gpe-text-muted);
}
.gpe-empty__icon { font-size: 48px; margin-bottom: 12px; }
.gpe-empty__title { font-size: 16px; font-weight: 600; margin-bottom: 6px; color: var(--gpe-text); }
.gpe-empty__text  { font-size: 14px; }

/* ── Alerts ────────────────────────────────────────────────── */
.gpe-alert {
  padding: 12px 16px; border-radius: 8px; font-size: 14px; margin-bottom: 12px;
  display: flex; align-items: flex-start; gap: 10px;
}
.gpe-alert-success { background: #c6f6d5; color: #276749; }
.gpe-alert-warning { background: #fefcbf; color: #975a16; }
.gpe-alert-danger  { background: #fed7d7; color: #9b2c2c; }
.gpe-alert-info    { background: #bee3f8; color: #2a69ac; }

/* ── Section Header ────────────────────────────────────────── */
.gpe-section-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  margin-bottom: 14px;
}
.gpe-section-title {
  font-size: 15px; font-weight: 700;
  min-width: 0; /* allow shrink when sibling button is wide */
  flex: 1 1 auto;
  overflow-wrap: break-word;
}

/* ── Login Page ────────────────────────────────────────────── */
.gpe-portal-login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--gpe-primary) 0%, var(--gpe-primary-dark) 100%);
  padding: 20px;
}
.gpe-portal-login-card {
  background: #fff; border-radius: 16px; padding: 36px 28px;
  width: 100%; max-width: 400px; box-shadow: 0 20px 60px rgba(0,0,0,.2);
}
.gpe-portal-login-logo { font-size: 48px; text-align: center; margin-bottom: 8px; }
.gpe-portal-login-title { font-size: 22px; font-weight: 800; text-align: center; margin: 0 0 6px; }
.gpe-portal-login-sub { font-size: 14px; color: var(--gpe-text-muted); text-align: center; margin: 0 0 24px; }
.gpe-portal-login-forgot { text-align: center; font-size: 13px; margin-top: 14px; }
.gpe-portal-login-card .login-submit .button-primary {
  width: 100%; padding: 12px; background: var(--gpe-primary); border: none;
  border-radius: 8px; font-size: 15px; font-weight: 700; color: #fff; cursor: pointer;
}
.gpe-portal-login-card input[type="text"],
.gpe-portal-login-card input[type="password"] {
  width: 100%; padding: 10px 14px; border: 1px solid var(--gpe-border);
  border-radius: 8px; font-size: 14px; margin-bottom: 12px;
}

/* ── Progress / Timeline ───────────────────────────────────── */
.gpe-timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.gpe-timeline::before { content: ''; position: absolute; left: 16px; top: 0; bottom: 0; width: 2px; background: var(--gpe-border); }
.gpe-timeline-item { display: flex; gap: 16px; padding: 0 0 20px 0; position: relative; }
.gpe-timeline-dot {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  background: var(--gpe-primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; z-index: 1;
}
.gpe-timeline-dot.pending { background: var(--gpe-border); color: var(--gpe-text-muted); }
.gpe-timeline-body { flex: 1; padding-top: 4px; }
.gpe-timeline-title { font-weight: 600; font-size: 14px; }
.gpe-timeline-sub   { font-size: 12px; color: var(--gpe-text-muted); margin-top: 2px; }

/* ── Dual Thread (Trade Manager) ───────────────────────────── */
.gpe-dual-thread { display: grid; grid-template-columns: 1fr; gap: 16px; }
.gpe-thread-panel { background: var(--gpe-card-bg); border-radius: var(--gpe-radius); padding: 16px; box-shadow: var(--gpe-shadow); }
.gpe-thread-panel-title {
  font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  padding: 6px 10px; border-radius: 6px; margin-bottom: 12px;
}
.gpe-thread-panel-title.supplier { background: #e8f5ee; color: var(--gpe-primary); }
.gpe-thread-panel-title.customer { background: #ebf8ff; color: var(--gpe-info); }

/* ── Shipment Tracker ──────────────────────────────────────── */
.gpe-tracker {
  display: flex; align-items: center; gap: 0; margin: 16px 0;
  overflow-x: auto; padding-bottom: 8px;
}
.gpe-tracker-step {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  min-width: 80px; position: relative;
}
.gpe-tracker-step:not(:last-child)::after {
  content: ''; position: absolute; top: 16px; left: calc(50% + 16px);
  right: calc(-50% + 16px); height: 2px; background: var(--gpe-border); z-index: 0;
}
.gpe-tracker-step.done::after { background: var(--gpe-primary); }
.gpe-tracker-dot {
  width: 32px; height: 32px; border-radius: 50%; z-index: 1;
  background: var(--gpe-border); color: var(--gpe-text-muted);
  display: flex; align-items: center; justify-content: center; font-size: 14px;
}
.gpe-tracker-step.done .gpe-tracker-dot { background: var(--gpe-primary); color: #fff; }
.gpe-tracker-step.current .gpe-tracker-dot { background: var(--gpe-accent); color: #fff; box-shadow: 0 0 0 4px rgba(240,165,0,.25); }
.gpe-tracker-label { font-size: 11px; color: var(--gpe-text-muted); text-align: center; }
.gpe-tracker-step.done .gpe-tracker-label,
.gpe-tracker-step.current .gpe-tracker-label { color: var(--gpe-text); font-weight: 600; }

/* ── Responsive: Tablet/Desktop ──────────────────────────────
 * v1.10.36 — Comprehensive responsive overhaul. Was: sidebar pinned at
 * left:0 from 768px and main content max-width:1200px, which on wide
 * monitors created a cramped column hugging the left edge with empty
 * space on the right. Now: sidebar stays pinned, main content gets a
 * sensible max-width and centers within the available area, tables
 * scroll horizontally, and form grids collapse on narrow viewports.
 * ─────────────────────────────────────────────────────────── */

/* Force any oversized content inside the main area to behave */
.gpe-portal-main { min-width: 0; }
.gpe-portal-main > * { max-width: 100%; }
.gpe-card { overflow: visible; }
.gpe-data-table { width: 100%; border-collapse: separate; border-spacing: 0; }
/* v1.10.39 — Table wrapper. Desktop: no scroll, table fits naturally
 * in the available width. Mobile: horizontal scroll if needed. */
.gpe-table-wrap { width: 100%; }
@media (max-width: 767px) {
  .gpe-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
}
/* Wrap any table that might be wider than the container */
.gpe-portal-main table { max-width: 100%; }

/* Form grids: any inline grid-template-columns inside .gpe-portal-main
 * collapses to a single column below 720px. The .gpe-form-grid class
 * is the canonical version; the inline-style fallbacks below catch
 * the existing inline grids in views that weren't refactored. */
.gpe-form-grid { display: grid; gap: 14px; grid-template-columns: 1fr; }

/* v1.10.36 — Link-product form: collapses on tablet+phone */
.gpe-link-product-grid {
  display: grid;
  grid-template-columns: 2fr 1.2fr 1fr 100px auto;
  gap: 10px;
  align-items: end;
}
@media (max-width: 900px) {
  .gpe-link-product-grid {
    grid-template-columns: 1fr 1fr !important;
  }
  .gpe-link-product-grid > :last-child { grid-column: 1 / -1; }
}
@media (max-width: 480px) {
  .gpe-link-product-grid {
    grid-template-columns: 1fr !important;
  }
  .gpe-link-product-grid > :last-child { grid-column: auto; }
}

@media (max-width: 720px) {
  /* Collapse inline 2-col grids in form views */
  .gpe-portal-main form > div[style*="grid-template-columns:1fr 1fr"],
  .gpe-portal-main form > div[style*="grid-template-columns:1fr 1fr 1fr"],
  .gpe-portal-main form > div[style*="grid-template-columns:2fr 1fr"],
  .gpe-portal-main div[style*="grid-template-columns:1fr 1fr"],
  .gpe-portal-main div[style*="grid-template-columns:2.5fr"] {
    grid-template-columns: 1fr !important;
  }
  /* 4-column summary grids (inquiry-detail / rfq-detail header)
   * collapse to 2 columns on tablet, 1 column on phone */
  .gpe-portal-main div[style*="grid-template-columns:repeat(4,1fr)"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  /* The 5-column inquiry quantity/unit/price/currency/incoterm row */
  .gpe-portal-main form > div[style*="grid-template-columns:1fr 100px"] {
    grid-template-columns: 1fr 1fr !important;
  }
  /* Header/section header should stack action button below title */
  .gpe-section-header {
    flex-direction: column; align-items: flex-start; gap: 8px;
  }
  /* Stat grid: single col on narrow phones */
  .gpe-stat-grid { grid-template-columns: 1fr !important; }
}

@media (max-width: 480px) {
  .gpe-portal-main div[style*="grid-template-columns:repeat(4,1fr)"] {
    grid-template-columns: 1fr !important;
  }
}

@media (min-width: 768px) {
  .gpe-portal-sidenav { left: 0; }
  .gpe-portal-menu-toggle { display: none; }
  /* Sidebar is now persistent — push main content past it. Removed
   * max-width:1200px so content fills the screen on wide monitors. */
  .gpe-portal-main {
    padding-left: calc(var(--gpe-sidenav-w) + 24px);
    padding-right: 24px;
    padding-bottom: 24px;
    max-width: 100%; /* override base max-width:1200px */
    margin: 0;
  }
  .gpe-portal-bottomnav { display: none; }
  /* No bottomnav on desktop, so the sticky thread input doesn't need
   * to leave room for it */
  .gpe-thread-input { bottom: 8px; }
  .gpe-stat-grid { grid-template-columns: repeat(3, 1fr); }
  .gpe-dual-thread { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 1024px) {
  .gpe-stat-grid { grid-template-columns: repeat(4, 1fr); }
}

/* Very wide monitors (≥1600px) — content naturally fills the screen
 * after the sidebar; the .gpe-card cards inside it self-cap nicely. */

/* ── Utility ───────────────────────────────────────────────── */
.gpe-mt-0 { margin-top: 0 !important; }
.gpe-mb-0 { margin-bottom: 0 !important; }
.gpe-text-muted { color: var(--gpe-text-muted); }
.gpe-text-right { text-align: right; }
.gpe-text-center { text-align: center; }
.gpe-fw-bold { font-weight: 700; }
.gpe-d-flex { display: flex; }
.gpe-align-center { align-items: center; }
.gpe-gap-8 { gap: 8px; }
.gpe-w-100 { width: 100%; }
.gpe-hidden { display: none !important; }
