/* HENORA card form design (shared). Used by every converted form page. */
.sp2-page { max-width: none; width: 100%; margin: 0 auto; padding-bottom: 60px; }
.sp2-stack { display: flex; flex-direction: column; gap: 20px; }
.sp2-card { box-sizing: border-box; padding: 22px 24px 24px; background: #fff; border: 1px solid #e5e7eb; border-radius: 24px; box-shadow: 0 2px 10px rgba(16, 24, 40, .05); }
.sp2-sub { padding: 20px; background: #fbfcfd; border: 1px solid #e5e7eb; border-radius: 18px; box-shadow: 0 1px 3px rgba(16, 24, 40, .05); }
.sp2-subh { display: flex; align-items: center; gap: 8px; margin: 0 0 16px; font-size: 12.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: #0f766e; }
.sp2-subh svg { width: 15px; height: 15px; flex: none; }
.sp2-grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.sp2-grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 16px; }
.sp2-grid4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px 16px; }
.sp2-span { grid-column: 1 / -1; }
.sp2-span2 { grid-column: span 2; }
.sp2-lab { display: block; margin: 0 0 6px; font-size: 12px; font-weight: 600; color: #4b5563; }
.sp2-in { display: block; width: 100%; min-height: 42px; box-sizing: border-box; margin: 0; padding: 10px 12px; font-family: inherit; font-size: 14px; color: #1f2937; background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; outline: none; }
.sp2-in:focus { border-color: #14b8a6; box-shadow: 0 0 0 3px rgba(20, 184, 166, .15); }
textarea.sp2-in { resize: none; overflow: hidden; line-height: 1.5; }
.sp2-check { display: flex; align-items: center; gap: 10px; font-size: 13px; color: #374151; }
.sp2-check input { width: 16px; height: 16px; accent-color: #134e4a; }
.sp2-hint { margin: 0 0 14px; font-size: 12px; color: #6b7280; }
.sp2-err { margin: 4px 0 0; font-size: 12px; color: #b91c1c; }
.sp2-actions { display: flex; justify-content: flex-start; margin-top: 4px; }
.sp2-btn { display: inline-flex; align-items: center; justify-content: center; min-width: 240px; box-sizing: border-box; padding: 12px 24px; font-size: 14px; font-weight: 600; color: #fff; background: #134e4a; border: 0; border-radius: 12px; cursor: pointer; transition: background .15s; }
.sp2-btn:hover { background: #0f172a; }
@media (max-width: 1023px) { .sp2-grid3, .sp2-grid4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 639px) {
    .sp2-grid2, .sp2-grid3, .sp2-grid4 { grid-template-columns: minmax(0, 1fr); }
    .sp2-span2 { grid-column: auto; }
    .sp2-card { padding: 16px; }
    .sp2-sub { padding: 16px; }
    .sp2-actions .sp2-btn { width: 100%; }
}
/* sp2 items */
.sp2-itemwrap { display: flex; flex-direction: column; gap: 10px; }
.sp2-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: #fff; border: 1px solid #e5e7eb; border-radius: 14px; }
.sp2-item-lab { align-items: flex-end; }
.sp2-item-lab .sp2-itemno { padding-bottom: 12px; }
.sp2-item-lab .sp2-remove { margin-bottom: 3px; }
.sp2-itemno { flex: none; min-width: 52px; font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: #9ca3af; white-space: nowrap; }
.sp2-item-main { flex: 1 1 0%; min-width: 0; }
.sp2-item-fld { flex: none; width: 150px; }
.sp2-item-end { display: flex; align-items: center; gap: 12px; flex: none; }
.sp2-qty { width: 110px; text-align: right; }
.sp2-unit { display: block; margin-top: 2px; font-size: 11px; color: #9ca3af; text-align: right; }
.sp2-itemnote { display: block; margin-top: 4px; font-size: 12px; color: #6b7280; }
.sp2-remove { flex: none; padding: 8px 14px; font-size: 13px; font-weight: 600; color: #b91c1c; background: #fef2f2; border: 1px solid #fecaca; border-radius: 10px; cursor: pointer; white-space: nowrap; }
.sp2-remove:hover { background: #fee2e2; }
.sp2-add { margin-top: 12px; padding: 0; font-size: 13px; font-weight: 600; color: #0f766e; background: none; border: 0; cursor: pointer; }
.sp2-add:hover { text-decoration: underline; }
.sp2-sum { display: flex; flex-direction: column; justify-content: center; padding: 12px 14px; font-size: 13px; color: #374151; text-align: right; background: #f0fdfa; border: 1px solid #99f6e4; border-radius: 12px; }
.sp2-sum .sp2-total { margin-top: 2px; font-size: 16px; font-weight: 700; color: #134e4a; }
.sp2-note { margin: 0 0 14px; padding: 12px 14px; font-size: 13px; color: #1e40af; background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 12px; }
@media (max-width: 639px) {
    .sp2-item, .sp2-item-lab { flex-direction: column; align-items: stretch; }
    .sp2-item-fld { width: 100%; }
    .sp2-item-end { justify-content: space-between; }
    .sp2-item-lab .sp2-itemno { padding-bottom: 0; }
    .sp2-item-lab .sp2-remove { margin-bottom: 0; align-self: flex-start; }
}
/* sp2 alert */
.sp2-alert { margin: 0 0 16px; padding: 12px 16px; font-size: 13px; color: #991b1b; background: #fef2f2; border: 1px solid #fecaca; border-radius: 12px; }
.sp2-alert p { margin: 0; }
.sp2-alert p + p { margin-top: 4px; }
/* sp2 extras */
.sp2-in[readonly], .sp2-in:disabled { background: #f1f5f9; color: #475569; font-weight: 600; cursor: not-allowed; }
.sp2-warn { padding: 12px 16px; font-size: 13px; color: #78350f; background: #fffbeb; border: 1px solid #fde68a; border-radius: 12px; }
.sp2-btn-alt { color: #134e4a; background: #fff; border: 1px solid #134e4a; }
.sp2-btn-alt:hover { color: #134e4a; background: #f0fdfa; }
.sp2-btn-danger { background: #dc2626; }
.sp2-btn-danger:hover { background: #b91c1c; }
.sp2-badge { display: inline-block; margin-left: 6px; padding: 2px 8px; font-size: 10.5px; font-weight: 700; letter-spacing: 0; text-transform: none; border-radius: 9999px; }
.sp2-badge-ok { color: #166534; background: #dcfce7; }
.sp2-badge-no { color: #991b1b; background: #fee2e2; }
.sp2-mono { font-family: monospace; font-size: 12px; }
.sp2-inline { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.sp2-inline > div { flex: 1 1 260px; min-width: 0; }
.sp2-rowhead { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.sp2-email { margin: 0; font-size: 15px; font-weight: 700; color: #111827; overflow-wrap: anywhere; }
.sp2-pill { display: inline-block; padding: 4px 12px; font-size: 11px; font-weight: 700; border-radius: 9999px; }
.sp2-pill-grey { color: #374151; background: #e5e7eb; }
.sp2-pill-green { color: #166534; background: #dcfce7; }
.sp2-pill-amber { color: #92400e; background: #fef3c7; }
@media (max-width: 639px) { .sp2-inline .sp2-btn { width: 100%; } }
/* sp2 mobile swap v2: the original page is untouched on phones, the card design shows on wider screens */
@media (min-width: 768px) { .sp2-mob-only { display: none !important; } }
@media (max-width: 767px) { .sp2-desk-only { display: none !important; } }
@media (min-width: 1024px) { .sp2-bkwide { width: 100% !important; } }
/* sp2 add-form cards: desktop and tablet only, phones unchanged */
@media (min-width: 768px) {
    .sp2-addcard { width: 100% !important; max-width: none !important; margin: 0 !important; padding: 0 !important; border-radius: 20px !important; border: 1px solid #e5eceb !important; box-shadow: 0 1px 3px rgba(15,23,42,.06), 0 8px 24px rgba(15,23,42,.04) !important; overflow: hidden; }
    .sp2-addcard > h3 { margin: 0 !important; padding: 22px 28px !important; font-size: 18px !important; font-weight: 700 !important; border-bottom: 1px solid #eef2f1; background: #fafcfb; }
    .sp2-addcard > form { padding: 24px 28px 28px !important; }
    .sp2-addcard form.space-y-3 > * + * { margin-top: 16px !important; }
    .sp2-addcard .grid { gap: 16px !important; }
    .sp2-addcard input:not([type="hidden"]):not([type="checkbox"]),
    .sp2-addcard select,
    .sp2-addcard textarea { border-radius: 12px !important; padding: 12px 14px !important; font-size: 14px !important; background: #fff; }
    .sp2-addcard button[type="submit"] { min-width: 160px; border-radius: 12px !important; padding: 12px 22px !important; font-weight: 600 !important; }
}
/* territories: count badge left of the search bar, desktop and tablet only */
.tr-count { display: none; }
@media (min-width: 768px) {
    .tr-count { display: inline-flex; align-items: center; gap: 8px; margin-right: auto; padding: 8px 16px; font-size: 13px; font-weight: 600; color: #134e4a; background: #f0fdfa; border: 1px solid #99f6e4; border-radius: 9999px; white-space: nowrap; }
    .tr-count svg { width: 16px; height: 16px; flex: none; }
}
/* territories one-line fix: badge and search on the same row, 768px and wider only */
@media (min-width: 768px) {
    div:has(> .tr-count) { display: flex !important; flex-direction: row !important; flex-wrap: nowrap !important; align-items: center !important; justify-content: space-between !important; gap: 16px; }
    div:has(> .tr-count) > .tr-count { margin: 0 !important; flex: none; }
    div:has(> .tr-count) > form { width: auto !important; flex: 0 1 auto !important; margin-left: auto !important; }
}
/* sp2 add-form bigger text: desktop and tablet only, phones unchanged */
@media (min-width: 768px) {
    .sp2-bigtext { padding: 28px 32px 32px; }
    .sp2-bigtext .sp2-subh { font-size: 15px; margin-bottom: 20px; }
    .sp2-bigtext .sp2-subh svg { width: 18px; height: 18px; }
    .sp2-bigtext .sp2-lab { font-size: 14px; margin-bottom: 8px; }
    .sp2-bigtext .sp2-in { font-size: 16px; min-height: 50px; padding: 12px 16px; }
    .sp2-bigtext select.sp2-in { font-size: 16px; }
    .sp2-bigtext .sp2-grid2 { gap: 18px 20px; }
    .sp2-bigtext .sp2-btn { font-size: 16px; padding: 14px 28px; min-width: 200px; }
    .sp2-bigtext .sp2-err, .sp2-bigtext .sp2-warn { font-size: 14px; }
}
/* global form text size: desktop and tablet only, phones unchanged */
@media (min-width: 768px) {
    /* every converted card form */
    .sp2-card { padding: 28px 32px 32px; }
    .sp2-card .sp2-subh { font-size: 15px; margin-bottom: 20px; }
    .sp2-card .sp2-subh svg { width: 18px; height: 18px; }
    .sp2-card .sp2-lab { font-size: 14px; margin-bottom: 8px; }
    .sp2-card .sp2-in, .sp2-card select.sp2-in { font-size: 16px; min-height: 50px; padding: 12px 16px; }
    .sp2-card .sp2-grid2, .sp2-card .sp2-grid3, .sp2-card .sp2-grid4 { gap: 18px 20px; }
    .sp2-card .sp2-btn { font-size: 16px; padding: 14px 28px; }
    .sp2-card .sp2-check { font-size: 15px; }
    .sp2-card .sp2-hint, .sp2-card .sp2-err, .sp2-card .sp2-warn, .sp2-card .sp2-note { font-size: 14px; }

    /* older forms elsewhere (not chat/AI, not table cells, not search bars) */
    form:not([class*="chat" i]):not([id*="chat" i]):not([class*="henora" i]):not([id*="henora" i]):not([class*="search" i]):not([id*="search" i]) :is(input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]):not([type="color"]):not([type="submit"]):not([type="button"]):not([name="q"]), select, textarea):not(table *):not([id*="chat" i] *):not([class*="chat" i] *):not([id*="henora" i] *):not([class*="henora" i] *) { font-size: 16px !important; }
    form:not([class*="chat" i]):not([id*="chat" i]):not([class*="henora" i]):not([id*="henora" i]):not([class*="search" i]):not([id*="search" i]) label:not(table *):not([class*="chat" i] *):not([class*="henora" i] *) { font-size: 14px; }
}
/* sp2 detail-card text size: desktop and tablet only, phones unchanged */
@media (min-width: 768px) {
    .sp2-sub .sp2-subh { font-size: 15px; }
    .sp2-sub .sp2-lab { font-size: 14px; margin-bottom: 8px; }
    .sp2-sub .sp2-in, .sp2-sub select.sp2-in { font-size: 16px; min-height: 50px; padding: 12px 16px; }
    .sp2-sub .sp2-grid2, .sp2-sub .sp2-grid3, .sp2-sub .sp2-grid4 { gap: 18px 20px; }
    .sp2-sub .sp2-btn { font-size: 16px; padding: 14px 28px; }
    .sp2-sub .sp2-hint, .sp2-sub .sp2-note, .sp2-sub .sp2-warn, .sp2-sub .sp2-err { font-size: 14px; }
}
/* po2 detail pages text size and full width: desktop and tablet only, phones unchanged */
@media (min-width: 768px) {
    .po2-page { max-width: none !important; width: 100% !important; margin-left: 0 !important; margin-right: 0 !important; }
    .po2-card { max-width: none !important; width: 100% !important; padding: 28px 32px 32px !important; }
    .po2-who h2 { font-size: 24px !important; }
    .po2-pill { font-size: 14px !important; padding: 7px 16px !important; }
    .po2-subh { font-size: 15px !important; margin-bottom: 20px !important; }
    .po2-grid { gap: 18px 20px !important; }
    .po2-lab { font-size: 14px !important; margin-bottom: 8px !important; }
    .po2-val { font-size: 16px !important; min-height: 50px !important; padding: 12px 16px !important; }
    .po2-table th { font-size: 14px !important; padding-top: 14px !important; padding-bottom: 14px !important; }
    .po2-table td { font-size: 16px !important; padding-top: 14px !important; padding-bottom: 14px !important; }
    .po2-note { font-size: 14px !important; }
    .po2-sent-t { font-size: 17px !important; }
    .po2-sent-s { font-size: 14px !important; }
}