.isp-wrap {
  max-width: 640px;
}

/* Prince WA conditional notice -- same light-red palette as the portal's
   existing .flash-msg--danger (app_v2.css), just scoped/sized for an
   inline under-field notice instead of a page-level banner. */
.isp-prince-notice {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: -6px 0 14px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #fef2f2;
  border: 1px solid rgba(220, 38, 38, 0.35);
  color: #7f1d1d;
  font-size: 13px;
  line-height: 1.4;
  max-width: 100%;
  box-sizing: border-box;
}

.isp-prince-notice-icon {
  flex: 0 0 auto;
  margin-top: 1px;
  color: #b42318;
}

.isp-toolbar-row {
  gap: 8px;
}

.isp-new-btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 42px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 90, 0, 0.22);
  background: rgba(255, 90, 0, 0.07);
  color: #ff5a00;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.isp-new-btn:hover {
  background: rgba(255, 90, 0, 0.12);
  border-color: rgba(255, 90, 0, 0.28);
}

.isp-status-group {
  margin-bottom: 12px;
}

.isp-status-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border: 1px solid transparent;
  border-radius: 16px;
  padding: 13px 16px;
  cursor: pointer;
  text-align: left;
}

.isp-status-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.isp-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.isp-status-name {
  font-weight: 700;
  font-size: 14px;
}

.isp-count {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.55);
}

.isp-status-body {
  display: grid;
  gap: 10px;
  padding: 10px 0 4px;
}

.isp-card-pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 12px;
}

.isp-pill {
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border: 1px solid rgba(17, 17, 17, 0.1);
  border-radius: 999px;
  background: #f2f2f2;
}

.isp-pill--accent {
  color: #ff5a00;
  background: rgba(255, 90, 0, 0.07);
  border-color: rgba(255, 90, 0, 0.14);
}

.isp-details-panel {
  background: #ffffff;
  border: 1px solid rgba(255, 90, 0, 0.22);
}

.isp-details-head {
  border-bottom-color: rgba(255, 90, 0, 0.18);
}

.isp-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.isp-detail-box {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(255, 90, 0, 0.14);
  border-radius: 14px;
  padding: 12px;
}

.isp-table-wrap {
  overflow-x: auto;
  margin-top: 14px;
  border: 1px solid rgba(255, 90, 0, 0.18);
  border-radius: 14px;
  background: #fff;
}

.isp-subitem-group {
  margin-top: 14px;
}

.isp-subitem-group:first-child {
  margin-top: 0;
}

.isp-subitem-group-title {
  font-size: 13px;
  font-weight: 700;
  color: rgba(120, 53, 15, 0.75);
  margin-bottom: 6px;
}

.isp-subitem-group .isp-table-wrap {
  margin-top: 0;
}

.isp-table {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
  font-size: 13px;
}

.isp-table th,
.isp-table td {
  text-align: left;
  padding: 9px;
  border-bottom: 1px solid rgba(255, 90, 0, 0.12);
  vertical-align: top;
}

.isp-table th {
  color: rgba(22, 53, 96, 0.55);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 10px;
}

/* New ISP Report modal: uniform vertical rhythm. Every direct field/
   section of .isp-form (Email, Customer, Date, Production codes,
   Photos/files) uses the same bottom margin as .locates-field's own
   14px -- .isp-codes-section and .isp-files-section didn't have this
   before, so they sat flush against whatever came before/after them.
   The Submit button gets extra breathing room so it never looks stuck
   to the file-upload block right above it. */
.isp-form > .isp-codes-section,
.isp-form > .isp-files-section {
  margin-bottom: 14px;
}

.isp-report-type-field {
  margin: 0 0 14px;
  padding: 0;
  border: 0;
}

.isp-report-type-field legend {
  margin-bottom: 7px;
  font-size: 13px;
  font-weight: 700;
}

.isp-report-type-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border: 1px solid rgba(17, 17, 17, 0.1);
  border-radius: 13px;
  background: #f2f2f3;
}

.isp-report-type-option {
  cursor: pointer;
}

.isp-report-type-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.isp-report-type-option span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 12px;
  border-radius: 10px;
  color: rgba(17, 17, 17, 0.58);
  font-size: 13px;
  font-weight: 700;
  transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.isp-report-type-option input:checked + span {
  color: #ff5a00;
  background: #fff;
  box-shadow: 0 1px 3px rgba(17, 17, 17, 0.12);
}

.isp-report-type-option input:focus-visible + span {
  outline: 2px solid #ff5a00;
  outline-offset: 1px;
}

/* Author display rules on .locates-field and .isp-files-section would
   otherwise beat the user-agent [hidden] style and leave WSC-hidden
   blocks on screen. */
.isp-form [hidden] {
  display: none !important;
}

.isp-wsc-field {
  margin: 0 0 14px;
}

.isp-wsc-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  cursor: pointer;
}

.isp-wsc-name {
  font-size: 13px;
  font-weight: 700;
}

.isp-wsc-switch {
  position: relative;
  width: 51px;
  height: 31px;
  flex: 0 0 auto;
}

.isp-wsc-input {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 51px;
  height: 31px;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.isp-wsc-track {
  position: relative;
  display: block;
  width: 51px;
  height: 31px;
  border-radius: 31px;
  background: #e5e5ea;
  transition: background-color 0.2s ease;
}

.isp-wsc-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.22), 0 0 1px rgba(0, 0, 0, 0.12);
  transition: transform 0.2s ease;
}

.isp-wsc-input:checked + .isp-wsc-track {
  background: #ff5a00;
}

.isp-wsc-input:checked + .isp-wsc-track::after {
  transform: translateX(20px);
}

.isp-wsc-input:focus-visible + .isp-wsc-track {
  outline: 2px solid #ff5a00;
  outline-offset: 2px;
}

.isp-wsc-hint {
  margin: 8px 0 0;
  color: rgba(17, 17, 17, 0.58);
  font-size: 12px;
}

.isp-form > .locates-actions {
  margin-top: 18px;
}

.isp-codes-section {
  border: 1px solid rgba(17, 17, 17, 0.1);
  border-radius: 17px;
  padding: 12px;
  background: #fbfbfc;
}

.isp-codes-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.isp-codes-label {
  font-weight: 700;
  font-size: 14px;
}

.isp-codes-help {
  color: rgba(17, 17, 17, 0.45);
  font-size: 12px;
  line-height: 1.35;
}

.isp-mini-btn {
  border: 1px solid rgba(17, 17, 17, 0.1);
  border-radius: 999px;
  background: #fff;
  color: #ff5a00;
  padding: 9px 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.isp-code-rows {
  display: grid;
  gap: 9px;
}

.isp-code-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 110px;
  gap: 8px;
  align-items: end;
}

.isp-code-remove {
  height: 44px;
  border: 1px solid rgba(17, 17, 17, 0.1);
  border-radius: 12px;
  background: #fff;
  color: #b42318;
  font-weight: 900;
  cursor: pointer;
}

.isp-code-preview {
  grid-column: 1 / -1;
  color: rgba(17, 17, 17, 0.45);
  font-size: 12px;
  line-height: 1.35;
  padding: 0 2px;
}

.isp-form-state {
  margin-bottom: 12px;
}

/* SURF MI fixed checkbox codes -- same card language as .isp-codes-section
   (Prince's searchable rows), just a checkbox list instead of a select. */
.isp-surf-code-list {
  display: grid;
  gap: 6px;
}

.isp-surf-code-row {
  display: grid;
  grid-template-columns: auto 1fr 64px;
  align-items: center;
  gap: 10px;
  padding: 8px 4px;
  border-bottom: 1px solid rgba(17, 17, 17, 0.06);
  cursor: pointer;
}

.isp-surf-code-row:last-child {
  border-bottom: none;
}

.isp-surf-code-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.isp-surf-code-label {
  font-size: 13px;
}

.isp-surf-code-desc {
  font-size: 11px;
  color: rgba(17, 17, 17, 0.55);
}

.isp-surf-code-unit {
  width: max-content;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(255, 90, 0, 0.08);
  color: rgba(120, 53, 15, 0.78);
  font-size: 10px;
  font-weight: 700;
}

.surf-code-qty {
  width: 64px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid rgba(17, 17, 17, 0.12);
  padding: 0 8px;
  font-size: 13px;
}

.isp-files-section {
  border: 1px solid rgba(17, 17, 17, 0.1);
  border-radius: 17px;
  padding: 12px;
  background: #fbfbfc;
  display: grid;
  gap: 8px;
}

/* Styled upload area -- native input is visually hidden (never
   display:none, so it stays focusable/keyboard-operable); the visible
   "Upload files" button is its <label>, and the same zone doubles as a
   drag/drop target. Cumulative selection + per-file remove happen in JS
   against the same selectedFiles array/backend flow as before -- this is
   a styling layer only. */
.isp-upload-zone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
  padding: 20px 14px;
  border: 1.5px dashed rgba(17, 17, 17, 0.16);
  border-radius: 14px;
  background: #fff;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.isp-upload-zone.is-dragover {
  border-color: #ff5a00;
  background: rgba(255, 90, 0, 0.05);
}

.isp-upload-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.isp-upload-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: 999px;
  background: rgba(255, 90, 0, 0.09);
  border: 1px solid rgba(255, 90, 0, 0.22);
  color: #ff5a00;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.isp-upload-btn:hover {
  background: rgba(255, 90, 0, 0.15);
}

.isp-upload-input:focus-visible + .isp-upload-btn {
  outline: 2px solid #ff5a00;
  outline-offset: 2px;
}

.isp-upload-hint {
  font-size: 12px;
  color: rgba(17, 17, 17, 0.4);
}

.isp-files-list {
  display: grid;
  gap: 6px;
}

.isp-file-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid rgba(17, 17, 17, 0.08);
  font-size: 12.5px;
}

.isp-file-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.isp-file-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.isp-file-size {
  font-size: 11px;
  color: rgba(17, 17, 17, 0.4);
}

.isp-file-remove {
  flex: 0 0 auto;
  border: 1px solid rgba(180, 35, 24, 0.2);
  border-radius: 999px;
  background: rgba(180, 35, 24, 0.06);
  color: #b42318;
  font-weight: 700;
  cursor: pointer;
  font-size: 12px;
  padding: 6px 12px;
}

.isp-file-remove:hover {
  background: rgba(180, 35, 24, 0.12);
}

@media (max-width: 520px) {
  .isp-new-btn {
    height: 40px;
    padding: 0 12px;
  }

  .isp-detail-grid,
  .isp-code-row {
    grid-template-columns: 1fr;
  }
}
/* New ISP report modal: bottom padding + no horizontal scroll */
.isp-new-modal {
  padding-bottom: 88px;
  overflow-x: hidden;
}

.isp-new-modal * {
  max-width: 100%;
  box-sizing: border-box;
}

.isp-new-wrap {
  overflow-x: hidden;
}
/* New ISP Report: fix date input width */
.isp-new-modal #reportDate {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

/* ISP modals: bottom space + prevent horizontal scrolling */
.isp-details-panel,
.isp-new-modal {
  padding-bottom: 88px;
  overflow-x: hidden;
}

.isp-details-wrap,
.isp-new-wrap {
  overflow-x: hidden;
}

.isp-details-panel *,
.isp-new-modal * {
  max-width: 100%;
  box-sizing: border-box;
}

.isp-details-panel #miDetailsBody {
  padding-bottom: 50px;
  overflow-x: hidden;
}

/* New ISP Report: keep date input inside modal */
.isp-new-modal #reportDate,
.isp-new-modal input[type="date"],
.isp-new-modal input[type="datetime-local"],
.isp-new-modal input[type="time"],
.isp-new-modal select,
.isp-new-modal textarea {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  display: block;
  box-sizing: border-box;
}

/* New report unit-code rows */
.isp-code-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 110px;
  gap: 8px;
  align-items: end;
}

.isp-code-preview {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  color: rgba(17, 17, 17, 0.45);
  font-size: 12px;
  line-height: 1.35;
  padding: 0 2px;
}

.isp-code-preview-text {
  min-width: 0;
}

.isp-code-preview-error {
  color: #b42318;
  font-weight: 600;
}

.isp-code-remove-text {
  appearance: none;
  border: 0;
  background: transparent;
  color: #b42318;
  padding: 0;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
  cursor: pointer;
}

.isp-code-remove-text:hover {
  text-decoration: underline;
}

.isp-report-total {
  margin: 4px 0 14px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(31, 143, 77, 0.10);
  border: 1px solid rgba(31, 143, 77, 0.22);
  color: #1f8f4d;
  font-size: 14px;
  font-weight: 800;
}

@media (max-width: 520px) {
  .isp-code-row {
    grid-template-columns: 1fr;
  }

  .isp-codes-head {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* Details modal tables must fit the panel (max-width: 640px) without horizontal
   scroll at any viewport width, not just under the 520px phone breakpoint. */
.isp-details-panel .isp-table-wrap {
  overflow-x: hidden;
}

.isp-details-panel .isp-table {
  min-width: 0;
  width: 100%;
  table-layout: fixed;
}

.isp-details-panel .isp-table th,
.isp-details-panel .isp-table td {
  word-break: break-word;
  overflow-wrap: anywhere;
}

/* Extra breathing room before the "Leave an update" block, which otherwise
   sits right under the last table/updates section. */
.isp-update-form {
  margin-top: 26px;
}

/* Styled vertical scrollbar for the report details panel. */
.isp-details-panel #miDetailsBody {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 90, 0, 0.35) transparent;
}

.isp-details-panel #miDetailsBody::-webkit-scrollbar {
  width: 8px;
}

.isp-details-panel #miDetailsBody::-webkit-scrollbar-track {
  background: transparent;
}

.isp-details-panel #miDetailsBody::-webkit-scrollbar-thumb {
  background-color: rgba(255, 90, 0, 0.35);
  border-radius: 999px;
}

.isp-details-panel #miDetailsBody::-webkit-scrollbar-thumb:hover {
  background-color: rgba(255, 90, 0, 0.55);
}

/* ================= New Report submission overlay =================
   Ported 1:1 from OSP Reporting's loading screen (app-v2's
   app_v2/static/new_report.css ".pr-overlay*" rules + app_v2/templates/
   production/new_report.html markup) -- same structure, colors, timing,
   and animations, just renamed to the isp- prefix. app_v2 and app_v3 are
   separate Flask apps with separate static roots, so this is a faithful
   copy rather than a shared stylesheet; OSP's own files are untouched.
   Sits above the New Report modal (.locates-modal-wrap is z-index:10000).
   Deliberately non-dismissible while active, matching OSP's own overlay
   -- no close icon, no backdrop click-through (position:fixed + this
   z-index already blocks pointer events to everything beneath it,
   including the modal's own backdrop-click-to-close and Close button).
   .isp-overlay-close only ever appears on a terminal failure/timeout. */
.isp-overlay {
  position: fixed;
  inset: 0;
  z-index: 10001;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(10, 10, 10, 0.72);
  backdrop-filter: blur(4px);
}

.isp-overlay.is-visible {
  display: flex;
}

.isp-overlay-content {
  width: min(92vw, 360px);
  text-align: center;
  color: #fff;
  padding: 28px 22px;
}

.isp-overlay-spinner {
  width: 44px;
  height: 44px;
  margin: 0 auto 16px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--accent, #ff5a00);
  animation: ispOverlaySpin 0.9s linear infinite;
}

.isp-overlay-title {
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 8px;
}

.isp-overlay-note {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.72);
  margin-bottom: 14px;
}

.isp-overlay-note.is-error {
  color: #ffb4a3;
  font-weight: 600;
}

.isp-overlay-progress {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
  margin: 0 auto;
}

.isp-overlay-progress-bar {
  height: 100%;
  width: 40%;
  background: var(--accent, #ff5a00);
  border-radius: 999px;
  transition: width 240ms linear;
}

/* Indeterminate state (ISP's submission is an async queue + background
   worker, not a single streamed upload like OSP's -- there is no real
   byte-progress number to show once the initial request is accepted, so
   the bar animates instead of claiming a precise percentage). */
.isp-overlay-progress-bar.is-indeterminate {
  width: 40%;
  animation: ispOverlayIndeterminate 1.1s ease-in-out infinite;
}

.isp-overlay-progress-bar.is-done {
  width: 100%;
  background: #35c47a;
  animation: none;
}

.isp-overlay-progress-bar.is-failed {
  width: 100%;
  background: #e5533d;
  animation: none;
}

.isp-overlay-close {
  margin-top: 14px;
}

/* .locates-submit sets its own `display`, which (equal selector
   specificity, later in the cascade) would otherwise win over the
   browser's default [hidden] -> display:none -- without this, toggling
   the `hidden` attribute wouldn't actually hide the button. */
.isp-overlay-close[hidden] {
  display: none;
}

.isp-overlay-dots::after {
  content: "";
  display: inline-block;
  width: 18px;
  text-align: left;
  animation: ispOverlayDots 1.2s steps(4, end) infinite;
}

@keyframes ispOverlayDots {
  0% { content: ""; }
  25% { content: "."; }
  50% { content: ".."; }
  75% { content: "..."; }
  100% { content: ""; }
}

@keyframes ispOverlaySpin {
  to { transform: rotate(360deg); }
}

@keyframes ispOverlayIndeterminate {
  0% { margin-left: 0%; width: 30%; }
  50% { margin-left: 70%; width: 30%; }
  100% { margin-left: 0%; width: 30%; }
}
