.sp-page {
  max-width: 1280px;
  margin: auto;
}
.sp-page .card,
.sp-public .card {
  padding: 24px;
  margin-bottom: 18px;
}
.sp-page h2,
.sp-public h2 {
  margin: 0 0 16px;
  font-size: 21px;
}
.sp-page h3,
.sp-public h3 {
  margin: 22px 0 12px;
  font-size: 16px;
}
.sp-heading,
.sp-toolbar,
.sp-file-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.sp-toolbar {
  justify-content: flex-start;
  margin: 18px 0;
}
.sp-page label,
.sp-public label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 14px 0;
  flex: 1;
  min-width: 150px;
}
.sp-page textarea,
.sp-page input,
.sp-page select,
.sp-public input,
.sp-public textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #dce2e8;
  border-radius: 8px;
  background: #fff;
  font: inherit;
  box-sizing: border-box;
}
.sp-page textarea,
.sp-public textarea {
  resize: vertical;
}
.sp-copy {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: inherit;
  line-height: 1.8;
  background: #f7f9fc;
  padding: 18px;
  border-radius: 10px;
}
.sp-badge {
  padding: 5px 12px;
  border-radius: 20px;
  background: #e8f1ff;
  color: #245bb3;
  font-size: 13px;
  white-space: nowrap;
}
.sp-images {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
}
.sp-asset {
  margin: 0;
  min-width: 0;
}
.sp-asset img {
  width: 100%;
  max-height: 260px;
  object-fit: contain;
  background: #f6f8fb;
  border-radius: 10px;
}
.sp-asset figcaption {
  font-size: 12px;
  color: #6b7588;
  margin-top: 8px;
  overflow-wrap: anywhere;
}
.sp-image-placeholder {
  min-height: 120px;
  display: grid;
  place-items: center;
  background: #f5f7fa;
  border-radius: 10px;
  font-size: 13px;
}
.sp-notice {
  border-left: 4px solid #5288da !important;
}
.sp-url {
  overflow-wrap: anywhere;
}
.sp-money {
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -1px;
  color: #1756a5;
}
.sp-table {
  overflow: auto;
}
.sp-table table {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
}
.sp-table th,
.sp-table td {
  padding: 14px 12px;
  text-align: left;
  border-bottom: 1px solid #edf0f5;
}
.sp-table th {
  font-size: 12px;
  color: #788397;
  background: #f8faff;
}
.sp-table td.sp-title {
  max-width: 300px;
  white-space: normal;
  min-width: 180px;
}
.sp-form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0 20px;
}
.sp-error {
  color: #b53131;
  white-space: pre-wrap;
}
.sp-file-row {
  padding: 8px 0;
  border-bottom: 1px solid #eee;
}
.sp-page small,
.sp-public small {
  font-weight: 400;
  color: #6d788b;
}
.sp-public {
  background: #f4f7fb;
  margin: 0;
  color: #263347;
}
.sp-public > header {
  max-width: 900px;
  margin: auto;
  padding: 24px;
  display: flex;
  justify-content: space-between;
}
.sp-public > main {
  max-width: 900px;
  margin: auto;
  padding: 0 20px 40px;
}
.sp-public .card {
  background: white;
  border: 1px solid #e6ebf2;
  border-radius: 14px;
}
.sp-public .btn {
  cursor: pointer;
}
.sp-page [role='status'],
.sp-public [role='status'] {
  min-height: 20px;
}
.sp-credentials {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: #f0f6ff;
  padding: 16px;
  border-radius: 8px;
}
.sp-pagination {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: flex-end;
  margin: 20px 0;
}
@media (max-width: 700px) {
  .sp-form-grid {
    grid-template-columns: 1fr;
  }
  .sp-page .card,
  .sp-public .card {
    padding: 16px;
  }
  .sp-images {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .sp-public > main {
    padding: 0 10px 30px;
  }
  .sp-copy {
    padding: 12px;
  }
  .sp-money {
    font-size: 28px;
  }
}

.sp-tabs { display: flex; flex-wrap: wrap; gap: 8px; border-bottom: 1px solid #e2e8f0; margin: 16px 0; }
.sp-tab { padding: 10px 18px; text-decoration: none; color: inherit; border-bottom: 3px solid transparent; }
.sp-tab.active { color: #2563eb; border-bottom-color: #2563eb; font-weight: 600; }
.sp-tab:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }

.sidebar .nav-group[hidden], .sidebar [data-route][hidden] { display: none; }

.sp-tabs .sp-tab { background: none; box-shadow: none; border-radius: 0; }
.sp-tabs .sp-tab.active { background: #eff6ff; }

.sp-assignment-filter { display: flex !important; align-items: center; gap: 12px; max-width: 320px; margin: 16px 0; }
.sp-batch-panel { padding: 18px; border: 1px solid #dbeafe; background: #f8fbff; border-radius: 10px; margin: 18px 0; }
.sp-batch-panel .sp-toolbar { margin: 16px 0 0; }
.sp-page .sp-select-cell { width: 44px; text-align: center; }
.sp-page .sp-select-cell input[type=checkbox] { width: 18px; height: 18px; margin: 0; padding: 0; cursor: pointer; }

.sp-withdraw-dialog { border: 1px solid #dbe4f0; border-radius: 16px; padding: 28px; color: #172840; width: min(520px, calc(100vw - 40px)); max-height: 90vh; overflow: auto; box-sizing: border-box; }
.sp-withdraw-dialog::backdrop { background: rgb(20 35 60 / 40%); }
.sp-withdraw-dialog label { display: flex; flex-direction: column; gap: 8px; margin: 16px 0; }
.sp-withdraw-dialog input, .sp-withdraw-dialog select, .sp-withdraw-dialog textarea { font: inherit; padding: 12px; border: 1px solid #dbe4f0; border-radius: 8px; min-width: 0; }
.sp-withdraw-dialog p { overflow-wrap: anywhere; }
.sp-dialog-actions { display: flex; gap: 12px; justify-content: flex-end; }
.sp-withdraw-dialog [role=status] { color: #b42318; }

/* Mobile workspace keeps the supplier's main actions within the screen. */
.mobile-menu-toggle, .supplier-mobile-nav { display: none; }
.sp-page, .sp-page .card, .sp-page .sp-toolbar > * { min-width: 0; }
.sp-page a.btn, .sp-public a.btn, .sp-handoff-dialog a.btn { display: inline-flex; align-items: center; justify-content: center; color: inherit; text-decoration: none; }
.sp-page .btn, .sp-public .btn, .sp-handoff-dialog .btn { min-height: 44px; }
.sp-page .btn:disabled, .sp-public .btn:disabled { opacity: .55; cursor: not-allowed; }
.sp-page :is(button, a, input, select, textarea):focus-visible, .sp-handoff-dialog :focus-visible { outline: 2px solid #1072e8; outline-offset: 2px; }
.sp-task-actions .btn { margin: 3px; }
.sp-selection-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 12px 0; }
.sp-page .sp-selection-toolbar label, .sp-page .sp-task-select { flex-direction: row; align-items: center; gap: 10px; min-height: 44px; margin: 0; cursor: pointer; }
.sp-page .sp-task-select { justify-content: center; min-width: 44px; }
.sp-task-select span { display: none; }
.sp-page .sp-selection-toolbar input { width: 20px; height: 20px; flex: none; }
.sp-handoff-dialog h2 { margin: 0; font-size: 21px; }
.sp-handoff-dialog .sp-heading { flex-wrap: nowrap; }
.sp-handoff-dialog .sp-heading .btn { flex: none; }
.sp-handoff-dialog input { width: 100%; box-sizing: border-box; }
.sp-handoff-notice { padding: 12px; border-radius: 10px; background: #f0f6ff; color: #49627e; }
.sp-handoff-dialog .sp-dialog-actions { flex-wrap: wrap; }
.sp-handoff-dialog [data-generate] { width: 100%; }
@media (max-width: 700px) {
  body.supplier-mobile-workspace #app-shell { display: block; }
  body.supplier-mobile-workspace #app-shell > main { min-width: 0; }
  body.supplier-mobile-workspace .sidebar { display: none; }
  body.supplier-mobile-workspace .view { padding: 16px 12px 24px; }
  body.supplier-mobile-workspace .topbar { gap: 10px; height: auto; min-height: 64px; padding: 12px; }
  body.supplier-mobile-workspace .topbar > div:first-of-type { flex: 1; min-width: 0; }
  body.supplier-mobile-workspace .topbar strong { font-size: 17px; }
  body.supplier-mobile-workspace .hero { align-items: flex-start; gap: 12px; }
  body.supplier-mobile-workspace .hero h1 { font-size: 24px; }
  body.supplier-mobile-workspace input, body.supplier-mobile-workspace select, body.supplier-mobile-workspace textarea, .sp-public input, .sp-public textarea, .sp-handoff-dialog input { font-size: 16px; }
  body.supplier-mobile-workspace .account-card .btn { min-height: 44px; width: 100%; }
  body.supplier-mobile-workspace .user-menu summary { min-height: 44px; min-width: 44px; display: grid; place-items: center; }
  body.supplier-mobile-workspace .user-menu-popover > * { min-height: 44px; }
  body[data-account-type=supplier] .view { padding-bottom: calc(88px + env(safe-area-inset-bottom)); }
  body[data-account-type=supplier] .supplier-mobile-nav { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; padding: 8px 8px max(8px, env(safe-area-inset-bottom)); border-top: 1px solid #dfe6ef; background: #fff; box-shadow: 0 -4px 20px #17345b0a; gap: 6px; }
  .supplier-mobile-nav a { flex: 1; min-width: 0; min-height: 48px; justify-content: center; color: #52647b; padding: 10px 4px; font-size: 14px; }
  .supplier-mobile-nav a.active { background: #e9f2ff; color: #1769c3; box-shadow: none; }
  body[data-account-type=supplier] #toast { bottom: calc(82px + env(safe-area-inset-bottom)); left: 12px; right: 12px; z-index: 40; }
  body.supplier-mobile-workspace[data-account-type=internal] .mobile-menu-toggle { display: block; min-height: 44px; }
  body.supplier-mobile-workspace.mobile-nav-open .sidebar { display: flex; max-height: 55dvh; overflow: auto; padding: 12px; }
  body.supplier-mobile-workspace .sidebar nav span { display: inline; }
  body.supplier-mobile-workspace .sidebar .brand, body.supplier-mobile-workspace .sidebar-foot { display: none; }
  .sp-page .card { padding: 16px 12px; }
  .sp-page .sp-heading { gap: 10px; }
  .sp-page .sp-heading h2 { margin-bottom: 0; }
  .sp-page .sp-heading h2, .sp-public .sp-heading h2 { overflow-wrap: anywhere; }
  .sp-page label { min-width: 0; }
  .sp-page .sp-toolbar { align-items: stretch; }
  .sp-page .sp-assignment-filter { flex: 1 1 100%; max-width: none; margin: 0; align-items: stretch; }
  .sp-page .sp-tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; }
  .sp-page .sp-tab { justify-content: center; padding: 12px 2px; min-height: 48px; font-size: 14px; }
  .sp-task-list { display: flex; flex-direction: column; }
  .sp-task-table { overflow: visible; }
  .sp-task-table table, .sp-task-table tbody { display: block; white-space: normal; }
  .sp-task-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .sp-task-table tr { display: flex; flex-direction: column; padding: 14px; margin: 0 0 14px; border: 1px solid #dfe6ef; border-radius: 12px; background: #fff; }
  .sp-task-table td { display: block; padding: 6px 0; border: 0; min-width: 0; overflow-wrap: anywhere; }
  .sp-task-table td[data-label] { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
  .sp-task-table td[data-label]::before { content: attr(data-label); color: #708096; flex-shrink: 0; }
  .sp-task-table td.sp-title { max-width: none; min-width: 0; font-size: 17px; font-weight: 600; margin-bottom: 8px; }
  .sp-task-table td.sp-title small { font-size: 12px; }
  .sp-task-table td.sp-select-cell { width: auto; padding: 0; }
  .sp-task-table .sp-select-cell:empty { display: none; }
  .sp-page .sp-task-select { justify-content: flex-start; }
  .sp-task-select span { display: inline; }
  .sp-task-table td.sp-task-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; margin-top: 10px; padding-top: 12px; border-top: 1px solid #edf0f5; }
  .sp-task-actions .btn { margin: 0; padding: 10px 6px; text-align: center; }
  .sp-task-actions a.btn { background: #1072e8; color: white; border-color: #1072e8; }
  .sp-batch-panel { order: 2; padding: 14px; margin: 12px 0; scroll-margin-top: 16px; }
  .sp-batch-panel h3 { margin-top: 0; }
  .sp-batch-panel .sp-toolbar { flex-direction: column; }
  .sp-task-list > .sp-pagination { order: 3; }
  .sp-selection-toolbar { position: sticky; top: 0; z-index: 5; background: #fff; padding: 8px 0; border-bottom: 1px solid #edf0f5; }
  .sp-page .sp-selection-toolbar label { font-size: 13px; }
  .sp-selection-toolbar .btn { flex-shrink: 0; }
  .sp-pagination { justify-content: center; flex-wrap: wrap; gap: 8px; }
  .sp-page #sp-assign > .btn, .sp-page #sp-submit > .btn, .sp-public #sp-submit > .btn { width: 100%; }
  .sp-public > header { padding: 18px 14px; gap: 12px; flex-wrap: wrap; }
  .sp-file-row span { overflow-wrap: anywhere; min-width: 0; flex: 1; }
  .sp-withdraw-dialog { width: calc(100vw - 24px); max-height: calc(100dvh - 24px); padding: 20px 16px max(20px, env(safe-area-inset-bottom)); }
  .sp-dialog-actions .btn { flex: 1 1 100px; }
}

.sp-task-list > .sp-toolbar:empty,
.sp-task-list > [role=status]:empty,
#sp-link-result:empty { display: none; }
.supplier-mobile-workspace #app-shell > main { min-width: 0; }
@media (max-width: 700px) {
  .sp-task-list > .muted { margin: 0 0 16px; }
  .sp-task-list .sp-tabs { margin-bottom: 14px; }
  .sp-task-list .sp-badge { white-space: normal; }
}
