/* IST ERP v2.2: responsive navigation, marketing pages and workspace polish. */
:root { --erp-nav-height: 84px; }
html { scroll-behavior: smooth; scroll-padding-top: 106px; }
body { overflow-x: clip; }
img, svg { max-width: 100%; }

/* Desktop header always occupies one row. The legacy nav rule was making every
   anchor width:100%, which caused links to wrap unpredictably. */
.site-nav {
  width: 100%; min-height: var(--erp-nav-height); padding: 12px clamp(20px, 3.2vw, 54px);
  display: flex; flex-wrap: nowrap; gap: clamp(16px, 2.1vw, 32px);
  align-items: center; justify-content: space-between; background: rgba(255,255,255,.98);
}
.site-nav .site-brand { flex: 0 0 auto; gap: 11px; min-width: 0; max-width: none; }
.site-nav .site-brand img { width: clamp(165px, 19vw, 235px); height: 57px; max-width: 100%; object-fit: contain; }
.site-nav .site-brand span { display: none; }
.site-nav > nav.site-nav-links {
  flex: 0 1 auto; min-width: 0; display: flex; flex-direction: row;
  flex-wrap: nowrap; gap: clamp(8px, 1.2vw, 22px); align-items: center;
  padding: 0; margin: 0; white-space: nowrap;
}
.site-nav > nav.site-nav-links a {
  flex: 0 0 auto; width: auto; min-width: 0; min-height: 42px;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 7px 5px; margin: 0; white-space: nowrap; line-height: 1.25;
  font-size: clamp(12px, 1vw, 14px); border-radius: 8px;
}
.site-nav > nav.site-nav-links a.button {
  min-height: 44px; padding: 10px 16px; background: var(--primary);
  color: #fff; border-color: var(--primary); font-size: 13px;
}
.site-nav > nav.site-nav-links a.button:hover { color: #fff; background: #005caa; text-decoration: none; }
.site-nav > nav.site-nav-links a[aria-current="page"]:not(.button) { background: #eef6ff; color: #005ca5; }
.site-nav > nav.site-nav-links form { display: flex; margin: 0; padding: 0; flex: 0 0 auto; }
.site-nav > nav.site-nav-links form button { margin: 0; white-space: nowrap; min-height: 42px; }
.site-nav .mobile-site-menu { display: none; }

/* Sticky navigation does not hide anchor headings and never wraps into a second row. */
.workspace.public main { width: 100%; max-width: 1370px; padding: 0 clamp(18px, 4vw, 64px); }
.marketing-hero { grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: clamp(25px, 4vw, 60px); }
.hero-copy, .hero-product, .feature-tile, .operational-card { min-width: 0; }
.hero-copy h1 { font-size: clamp(34px, 4vw, 60px); overflow-wrap: break-word; }
.hero-lede { max-width: 690px; }
.hero-product { overflow: hidden; }
.hero-product-head { flex-wrap: wrap; }
.preview-grid { min-width: 0; }
.preview-grid > div { min-width: 0; overflow-wrap: break-word; }
.trust-strip { justify-content: center; gap: 12px; }
.trust-strip span { display: inline-flex; align-items: center; padding: 7px 11px; border-radius: 8px; background: #fff; text-align: center; }
.marketing-section { padding-top: clamp(45px, 6vw, 82px); }
.section-intro h2, .workflow-panel h2 { text-wrap: balance; }
.feature-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.feature-tile { height: 100%; }
.workflow-panel { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.workflow-steps, .workflow-steps p { min-width: 0; }
.operational-section { padding-top: 65px; }
.operational-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.operational-card { background: #fff; border: 1px solid #dce6ef; border-radius: 17px; padding: clamp(20px, 2.8vw, 32px); }
.operational-card h3 { margin: 20px 0 10px; color: #153657; font-size: 20px; }
.operational-card p { color: #52657a; line-height: 1.75; font-size: 14px; }
.operational-card a { display: inline-flex; align-items: center; margin-top: 8px; font-weight: 700; }
.operational-icon { width: 43px; height: 43px; display: grid; place-items: center; font-size: 13px; font-weight: 800; color: #0068b9; background: #eaf5ff; border-radius: 12px; }
.marketing-cta { min-width: 0; }
.marketing-cta > div { min-width: 0; }
.faq-stack summary { padding-right: 10px; }

/* Footer remains visible on all public marketing pages. */
.workspace.public .public-footer {
  display: grid; grid-template-columns: minmax(0, 1.65fr) repeat(3, minmax(0, 1fr));
  column-gap: clamp(18px, 3vw, 45px); row-gap: 35px; padding: 52px clamp(22px, 4.3vw, 68px) 22px;
}
.public-footer > div { min-width: 0; overflow-wrap: anywhere; }
.public-footer .footer-brand img { width: min(225px, 100%); height: auto; object-fit: contain; padding: 6px 9px; background: #fff; border-radius: 8px; }
.public-footer .footer-brand p { max-width: 330px; }
.public-footer .footer-bottom { grid-column: 1 / -1; display: flex; flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; padding-top: 22px; border-top: 1px solid #355470; color: #c9ddec; gap: 12px; }
.master-footer { display: flex; gap: 18px; flex-wrap: wrap; justify-content: space-between; border-top: 1px solid var(--border); }

/* Signed-in ERP pages: keep navigation labels legible on one line without
   pushing the left navigation drawer wider than the workspace. */
#sidebar nav a, #sidebar nav .nav-signout { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#sidebar nav small { white-space: nowrap; }
.topbar { min-width: 0; }
.topbar .top-left { min-width: 0; flex: 1 1 auto; }
.topbar .top-left > span { max-width: min(50vw, 620px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account { flex: 0 0 auto; min-width: 0; }
.card, .table-wrap { max-width: 100%; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* Switch to a true one-row mobile header before desktop links run out of space. */
@media (max-width: 1130px) {
  .site-nav { min-height: 74px; padding: 10px clamp(16px, 3vw, 32px); }
  .site-nav .site-brand img { width: clamp(165px, 28vw, 217px); height: 53px; }
  .site-nav > nav.site-nav-links { display: none; }
  .site-nav .mobile-site-menu { display: block; position: relative; flex: 0 0 auto; margin-left: auto; }
  .site-nav .mobile-site-menu summary { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 9px 15px; cursor: pointer; background: white; border: 1px solid #d3e3f4; border-radius: 10px; color: #153a60; font-weight: 700; list-style: none; }
  .site-nav .mobile-site-menu summary::-webkit-details-marker { display: none; }
  .site-nav .mobile-site-menu summary span { font-size: 19px; line-height: 1; }
  .site-nav .mobile-site-menu[open] summary { background: #eaf4ff; border-color: #a3cdf3; }
  .site-nav .mobile-site-menu > .mobile-site-menu-panel {
    display: flex; flex-direction: column; gap: 4px; position: absolute; top: calc(100% + 11px); right: 0;
    z-index: 60; width: min(290px, calc(100vw - 28px)); min-width: 0; padding: 12px;
    border: 1px solid #dce6ef; border-radius: 14px; background: #fff;
    box-shadow: 0 20px 60px rgba(13,42,76,.17);
  }
  .site-nav .mobile-site-menu a { display: block; width: 100%; min-height: 42px; padding: 10px 12px; border-radius: 8px; line-height: 1.5; color: #26486d; white-space: nowrap; }
  .site-nav .mobile-site-menu a:hover, .site-nav .mobile-site-menu a:focus-visible { color: #0067b6; background: #f0f7ff; text-decoration: none; }
  .site-nav .mobile-site-menu form { margin: 3px 0 0; padding: 5px 0 0; border-top: 1px solid var(--border); }
  .site-nav .mobile-site-menu form button { width: 100%; min-height: 42px; }
  .feature-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .operational-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .workspace.public .public-footer { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .workspace.public .public-footer .footer-brand { grid-column: 1 / -1; }
}
@media (max-width: 768px) {
  :root { --erp-nav-height: 72px; }
  .workspace.public main { padding: 0 20px; }
  .marketing-hero { grid-template-columns: minmax(0, 1fr); padding: 46px 0 34px; gap: 32px; }
  .hero-copy h1 { font-size: clamp(33px, 6.4vw, 45px); letter-spacing: -1.1px; }
  .hero-product { max-width: 100%; }
  .marketing-section { padding: 55px 0 25px; }
  .workflow-panel { grid-template-columns: minmax(0, 1fr); gap: 25px; margin-top: 34px; padding: 24px; }
  .operational-section { padding-top: 45px; }
  .marketing-cta { flex-direction: column; align-items: flex-start; margin-bottom: 56px; padding: 26px; }
  .master-overview { margin: 26px auto; }
  .topbar .top-left > span { max-width: 44vw; }
  .site-nav .site-brand img { width: min(205px, 48vw); }
}
@media (max-width: 560px) {
  .workspace.public main { padding: 0 16px; }
  .feature-grid, .operational-grid { grid-template-columns: minmax(0, 1fr); }
  .marketing-hero { padding-top: 30px; }
  .hero-copy h1 { font-size: clamp(30px, 8.5vw, 38px); }
  .hero-actions { align-items: stretch; }
  .hero-actions .button { width: 100%; }
  .hero-product { padding: 16px; }
  .preview-grid > div { padding: 15px 12px; min-height: 122px; }
  .preview-grid strong { font-size: 14px; }
  .hero-product-head strong { width: 100%; margin: 2px 0 0 18px; }
  .trust-strip { justify-content: flex-start; }
  .workflow-panel { padding: 18px; }
  .workflow-steps { padding: 8px 14px; }
  .workflow-steps p { gap: 12px; }
  .marketing-cta .button { width: 100%; white-space: normal; }
  .workspace.public .public-footer { grid-template-columns: minmax(0, 1fr); gap: 26px; padding: 38px 22px 22px; }
  .workspace.public .public-footer .footer-brand { grid-column: auto; }
  .public-footer .footer-bottom { flex-direction: column; align-items: flex-start; }
  .site-nav .site-brand img { width: min(188px, 51vw); height: 49px; }
  .site-nav .mobile-site-menu summary { padding: 8px 10px; gap: 6px; }
  .master-heading .button, .form-actions .button { max-width: 100%; }
  .master-login { margin: 25px auto 50px; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
