/* RescriptAI Platform — management dashboard */

/* ---- wp-admin integration: give the app the whole content area ---- */
.rsp-admin-page #wpcontent { padding-left: 0; }
.rsp-admin-page #wpbody-content { padding-bottom: 0; }
.rsp-admin-page #wpbody-content > .notice,
.rsp-admin-page #wpbody-content > .update-nag,
.rsp-admin-page #wpbody-content > .error,
.rsp-admin-page #wpbody-content > .updated { margin: 12px 24px; }
.rsp-admin-page #wpfooter { display: none; }

.rsp-a {
	--brand: #0B5D4B;
	--ink: #10201B;
	--muted: #5A6B65;
	--line: #E1E9E6;
	--soft: #F4F7F6;
	--side: #0F1F1A;
	--crane: #F2A33A;
	--warn: #A34A00;
	--good: #135C33;
	font-family: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
	font-size: 14px;
	line-height: 1.45;
	color: var(--ink);
	background: var(--soft);
	min-height: calc(100vh - 32px);
}
.rsp-a *, .rsp-a *::before, .rsp-a *::after { box-sizing: border-box; }
.rsp-a h1, .rsp-a h2, .rsp-a h3, .rsp-a p { margin: 0; color: inherit; }
.rsp-a button { font-family: inherit; }
.rsp-a :focus-visible { outline: 3px solid var(--crane); outline-offset: 2px; }
.rsp-a__loading { padding: 48px; color: var(--muted); font-size: 15px; }
.rsp-a-standalone { margin: 0; background: #F4F7F6; }
.rsp-a-standalone .rsp-a { min-height: 100vh; }

.rsp-sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.rsp-muted { color: var(--muted); }
.rsp-small { font-size: 12px; }
.rsp-block { display: block; }
.good { color: var(--good); }
.warn { color: var(--warn); }
.rsp-crane { color: #F2C17A; }

.rsp-demobar { background: var(--crane); color: #3A2400; font-weight: 700; padding: 10px 20px; text-align: center; font-size: 13px; }

/* ---- shell ---- */
.rsp-shell { display: flex; flex-wrap: wrap; align-items: stretch; min-height: inherit; }
.rsp-side {
	flex: 1 1 232px; max-width: 256px; background: var(--side); color: #DCE7E3;
	padding: 22px 14px; display: flex; flex-direction: column; gap: 22px;
}
.rsp-side__brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; }
.rsp-side__brand span:last-child { display: flex; flex-direction: column; min-width: 0; }
.rsp-side__brand strong { color: #fff; font-size: 16px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rsp-side__brand small { color: #93A8A0; font-size: 12px; }
.rsp-side__logo { width: 38px; height: 38px; flex: none; border-radius: 12px; background: var(--brand); color: #fff; font-weight: 800; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.rsp-side__logo img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.rsp-side__new { width: 100%; }
.rsp-side__nav { display: flex; flex-direction: column; gap: 2px; }
.rsp-side__nav button {
	display: flex; justify-content: space-between; align-items: center; width: 100%;
	border: 0; border-radius: 10px; padding: 11px 12px; font-size: 14px; font-weight: 600; text-align: left;
	cursor: pointer; min-height: 44px; background: transparent; color: #B9C8C2;
}
.rsp-side__nav button:hover { color: #fff; background: #17291F; }
.rsp-side__nav button.is-on { background: #1C3029; color: #fff; }
.rsp-side__count { font-size: 12px; font-weight: 700; background: #24372F; color: #F2C17A; border-radius: 99px; padding: 2px 8px; }
.rsp-side__foot { margin-top: auto; padding: 12px 8px 0; border-top: 1px solid #24372F; font-size: 12px; color: #93A8A0; }

.rsp-main { flex: 999 1 640px; min-width: 0; padding: 26px 32px 48px; display: flex; flex-direction: column; gap: 22px; }

/* ---- top bar ---- */
.rsp-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; }
.rsp-top h1 { font-size: 26px; font-weight: 800; letter-spacing: -0.01em; line-height: 1.2; padding: 0; }
.rsp-top p { color: var(--muted); }
.rsp-search { display: flex; align-items: center; gap: 8px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 0 12px; width: 280px; max-width: 100%; color: var(--muted); }
.rsp-search input { flex: 1 1 auto; min-width: 0; border: 0 !important; box-shadow: none !important; outline: none; padding: 10px 0 !important; font: inherit; background: transparent; color: var(--ink); }

/* ---- buttons & links ---- */
.rsp-btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 8px;
	background: var(--brand); color: #fff !important; border: 1px solid var(--brand); border-radius: 12px;
	padding: 11px 18px; font-size: 14px; font-weight: 800; cursor: pointer; min-height: 44px; text-decoration: none !important;
}
.rsp-btn:hover { filter: brightness(1.08); }
.rsp-btn:disabled { opacity: 0.55; cursor: progress; }
.rsp-btn--crane { background: var(--crane); border-color: var(--crane); color: #3A2400 !important; }
.rsp-btn--ghost { background: #fff; color: var(--ink) !important; border-color: #D5DFDB; font-weight: 700; }
.rsp-btn--sm { min-height: 34px; padding: 6px 12px; font-size: 13px; border-radius: 10px; }
.rsp-btn--block { width: 100%; }
.rsp-link { background: none; border: 0; padding: 0; color: var(--brand); font-weight: 700; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; font-size: inherit; min-height: 24px; }
.rsp-link--danger { color: #A3262A; }
.rsp-iconbtn { width: 36px; height: 36px; flex: none; border-radius: 10px; border: 1px solid #D5DFDB; background: #fff; cursor: pointer; font-size: 18px; color: var(--muted); }
.rsp-actions-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }

/* ---- toast ---- */
.rsp-toast { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-radius: 14px; padding: 12px 16px; font-weight: 600; }
.rsp-toast--ok { background: var(--side); color: #fff; }
.rsp-toast--error { background: #FBE7E4; color: #8B2C1F; border: 1px solid #F1C3BB; }
.rsp-toast button { background: transparent; border: 0; color: inherit; font-size: 20px; cursor: pointer; width: 36px; height: 36px; }

/* ---- cards & layout ---- */
.rsp-card { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 20px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.rsp-card h2 { font-size: 16px; font-weight: 800; }
.rsp-card__head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.rsp-flush { padding: 0; gap: 0; overflow: hidden; }
.rsp-pad { padding: 16px 20px; }
.rsp-row { display: flex; flex-wrap: wrap; gap: 16px; }
.rsp-row--top { align-items: flex-start; }
.rsp-grow1 { flex: 1 1 300px; }
.rsp-grow2 { flex: 2 1 420px; }
.rsp-grow3 { flex: 999 1 520px; }
.rsp-stack { display: flex; flex-direction: column; gap: 10px; }
.rsp-grid { display: flex; flex-wrap: wrap; gap: 16px; }
.rsp-grid > * { flex: 1 1 260px; }
.rsp-info { background: color-mix(in srgb, var(--brand) 12%, #fff); color: var(--ink); border-radius: 14px; padding: 14px 16px; font-weight: 600; }
.rsp-empty { align-items: flex-start; padding: 40px; }
.rsp-empty h2 { font-size: 22px; }
.rsp-empty p { color: var(--muted); max-width: 46em; }

/* ---- KPIs ---- */
.rsp-kpis { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; }
.rsp-kpi { flex: 1 1 200px; gap: 6px; }
.rsp-kpi__label { color: var(--muted); font-weight: 600; }
.rsp-kpi__value { font-size: 28px; font-weight: 800; letter-spacing: -0.01em; line-height: 1.2; }
.rsp-kpi__note { font-size: 12px; font-weight: 600; color: var(--muted); }
.rsp-kpi__note.warn { color: var(--warn); }
.rsp-kpi__note.good { color: var(--good); }
.rsp-kpis__action { flex: none; }

/* ---- chart ---- */
.rsp-chart { display: flex; align-items: flex-end; gap: 14px; height: 200px; padding-top: 6px; }
.rsp-chart__col { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; height: 100%; }
.rsp-chart__val { font-size: 11px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.rsp-chart__bar { display: block; width: 100%; max-width: 54px; border-radius: 10px 10px 4px 4px; background: color-mix(in srgb, var(--brand) 28%, #fff); }
.rsp-chart__bar.is-current { background: var(--brand); }
.rsp-chart__label { font-size: 12px; color: var(--muted); }

/* ---- attention list ---- */
.rsp-attn { display: flex; gap: 12px; align-items: flex-start; width: 100%; background: #F7FAF9; border: 1px solid #E8EFEC; border-radius: 14px; padding: 12px; color: var(--ink); text-align: left; cursor: pointer; font-size: 14px; }
.rsp-attn:hover { border-color: #CFDCD7; }
.rsp-attn span:last-child { display: flex; flex-direction: column; }
.rsp-attn small { color: var(--muted); font-size: 12px; }
.rsp-dot { width: 10px; height: 10px; border-radius: 99px; flex: none; margin-top: 5px; background: var(--brand); }
.rsp-dot--warn { background: #E8833A; }
.rsp-dot--violet { background: #6B4BC4; }

/* ---- table ---- */
.rsp-table-wrap { overflow-x: auto; }
.rsp-table { width: 100%; min-width: 640px; border-collapse: collapse; }
.rsp-table th { white-space: nowrap; text-align: left; font-size: 12px; font-weight: 700; color: var(--muted); padding: 10px 20px; border-bottom: 1px solid #EEF3F1; }
.rsp-table td { padding: 12px 16px; border-top: 1px solid #EEF3F1; vertical-align: middle; }
.rsp-table .num { text-align: right; }
.rsp-table tr.is-sel td { background: color-mix(in srgb, var(--brand) 7%, #fff); }
.rsp-table tr.is-sel td:first-child { box-shadow: inset 3px 0 0 var(--brand); }
.rsp-rowlink { white-space: nowrap; background: none; border: 0; padding: 4px 0; font: inherit; font-weight: 800; color: var(--ink); cursor: pointer; text-align: left; }
.rsp-rowlink:hover { color: var(--brand); text-decoration: underline; }
.rsp-actions { white-space: nowrap; }
.rsp-actions .rsp-btn + .rsp-btn { margin-left: 8px; }

.rsp-badge { display: inline-block; font-size: 12px; font-weight: 700; border-radius: 99px; padding: 4px 10px; white-space: nowrap; }
.rsp-badge--warehouse { background: #E6EEFB; color: #1E4B94; }
.rsp-badge--departed, .rsp-badge--in_transit { background: #FFF1DE; color: #7A4700; }
.rsp-badge--arrived, .rsp-badge--ready { background: #EFE8FB; color: #4E2E8F; }
.rsp-badge--delivered { background: #DDF5E6; color: #135C33; }

.rsp-chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 16px 20px; border-bottom: 1px solid #EEF3F1; }
.rsp-chips button { border-radius: 99px; padding: 7px 14px; font-size: 13px; font-weight: 700; cursor: pointer; min-height: 36px; background: #fff; color: var(--ink); border: 1px solid #D5DFDB; }
.rsp-chips button span { color: var(--muted); font-weight: 600; margin-left: 2px; }
.rsp-chips button[aria-pressed="true"] { background: var(--side); color: #fff; border-color: var(--side); }
.rsp-chips button[aria-pressed="true"] span { color: #B9C8C2; }
.rsp-searchnote { border-bottom: 1px solid #EEF3F1; }

/* ---- detail panel ---- */
.rsp-detail { position: sticky; top: 46px; }
.rsp-detail__head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.rsp-detail__head h2 { font-size: 20px; }
.rsp-dl { margin: 0; display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.rsp-dl div { display: flex; justify-content: space-between; gap: 12px; }
.rsp-dl dt { color: var(--muted); }
.rsp-dl dd { margin: 0; font-weight: 600; text-align: right; }
.rsp-done { font-weight: 700; color: var(--good); }
.rsp-detail__more { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--muted); }
.rsp-detail__more select { max-width: 60%; }
.rsp-notes { background: var(--soft); border-radius: 12px; padding: 12px; font-size: 13px; }
.rsp-history { border-top: 1px solid #EEF3F1; padding-top: 14px; }
.rsp-history h3 { font-size: 14px; font-weight: 800; margin-bottom: 10px; }
.rsp-history ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.rsp-history li { display: flex; gap: 10px; }
.rsp-history li .rsp-dot { width: 8px; height: 8px; margin-top: 6px; }
.rsp-history li span:last-child { display: flex; flex-direction: column; }
.rsp-history small { color: var(--muted); font-size: 12px; }

/* ---- forms ---- */
.rsp-form { gap: 16px; }
.rsp-fields { display: flex; flex-wrap: wrap; gap: 16px; }
.rsp-field { flex: none; display: flex; flex-direction: column; gap: 6px; min-width: 0; border: 0; padding: 0; margin: 0; }
.rsp-fields > .rsp-field { flex: 1 1 200px; }
.rsp-fields > .rsp-field--wide { flex: 2 1 320px; }
.rsp-field label, .rsp-field legend { font-weight: 700; font-size: 13px; padding: 0; }
.rsp-field label .rsp-muted { font-weight: 500; }
.rsp-a input[type="text"], .rsp-a input:not([type]), .rsp-a input[type="email"], .rsp-a input[type="tel"], .rsp-a input[type="number"], .rsp-a input[type="search"], .rsp-a select, .rsp-a textarea {
	border: 1px solid #D5DFDB; border-radius: 12px; padding: 10px 12px; font: inherit; font-size: 14px;
	background: #fff; color: var(--ink); min-height: 44px; width: 100%; max-width: none; box-shadow: none; line-height: 1.4;
}
.rsp-a select { padding-right: 30px; }
.rsp-a textarea { resize: vertical; min-height: 90px; }
.rsp-a input:focus, .rsp-a select:focus, .rsp-a textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); outline: none; }
.rsp-check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; font-weight: 600; cursor: pointer; }
.rsp-check input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--brand); }
.rsp-seg { display: flex; gap: 8px; }
.rsp-seg button { flex: 1 1 0; border-radius: 12px; padding: 11px; font-size: 14px; font-weight: 700; cursor: pointer; min-height: 44px; background: #fff; color: var(--ink); border: 1px solid #D5DFDB; }
.rsp-seg button[aria-pressed="true"] { background: var(--brand); color: #fff; border-color: var(--brand); }
.rsp-seg button:disabled { opacity: 0.4; cursor: not-allowed; }

.rsp-dark { background: var(--side); border-color: var(--side); color: #fff; }
.rsp-dark__muted { color: #B9C8C2; }
.rsp-dark__list { border-top: 1px solid #24372F; padding-top: 12px; display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: #B9C8C2; }
.rsp-costcard { position: sticky; top: 46px; }
.rsp-costcard__amount { font-size: 32px; font-weight: 800; letter-spacing: -0.01em; }
.rsp-warnbox { background: #FFF1DE; color: #5C3700; border-radius: 10px; padding: 10px 12px; font-size: 13px; }
.rsp-warnbox .rsp-link { color: #5C3700; }

/* ---- customers ---- */
.rsp-cust__head { display: flex; gap: 12px; align-items: center; }
.rsp-cust__head > span:last-child { display: flex; flex-direction: column; min-width: 0; }
.rsp-cust__head small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.rsp-avatar { width: 42px; height: 42px; flex: none; border-radius: 14px; background: color-mix(in srgb, var(--brand) 14%, #fff); color: var(--brand); font-weight: 800; display: flex; align-items: center; justify-content: center; }
.rsp-cust__stats { display: flex; gap: 8px; }
.rsp-cust__stats div { flex: 1 1 0; background: #F7FAF9; border-radius: 12px; padding: 10px; display: flex; flex-direction: column; }
.rsp-cust__stats span { font-size: 11px; color: var(--muted); font-weight: 700; }

/* ---- rates ---- */
.rsp-ratelist { display: flex; flex-direction: column; gap: 10px; }
.rsp-rate { display: flex; align-items: center; gap: 8px; }
.rsp-a .rsp-rate__label { flex: 1 1 auto; }
.rsp-a .rsp-rate__value { width: 130px; flex: none; text-align: right; }
.rsp-rate__cur { color: var(--muted); font-weight: 700; }

/* ---- announcements ---- */
.rsp-ann { gap: 10px; }
.rsp-ann p { font-weight: 600; }
.rsp-ann__foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; }

/* ---- reports ---- */
.rsp-hbar { display: flex; flex-direction: column; gap: 6px; }
.rsp-hbar__top { display: flex; justify-content: space-between; gap: 12px; }
.rsp-hbar__track { display: block; height: 10px; background: #EEF3F1; border-radius: 99px; overflow: hidden; }
.rsp-hbar__track span { display: block; height: 100%; background: var(--brand); border-radius: 99px; }
.rsp-toplist { margin: 0; padding: 0 0 0 22px; display: flex; flex-direction: column; }
.rsp-toplist li { padding: 8px 0; border-bottom: 1px solid #EEF3F1; }
.rsp-toplist li::marker { color: var(--muted); font-weight: 700; }
.rsp-toplist li { display: list-item; }
.rsp-toplist li span { display: inline-block; min-width: 60%; }
.rsp-toplist li strong { float: right; }

/* ---- settings ---- */
.rsp-swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.rsp-swatch { width: 44px; height: 44px; border-radius: 12px; cursor: pointer; border: 3px solid #fff; box-shadow: 0 0 0 1px #D5DFDB; padding: 0; position: relative; overflow: hidden; }
.rsp-swatch[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--crane); }
.rsp-swatch--custom { background: conic-gradient(#E85D5D, #F2C14E, #5BC07A, #4A90D9, #9B6BD6, #E85D5D); }
.rsp-swatch--custom input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.rsp-preview { display: flex; align-items: center; gap: 12px; border: 1px dashed #C9D5D0; border-radius: 14px; padding: 14px; }
.rsp-preview__logo { width: 44px; height: 44px; border-radius: 12px; color: #fff; font-weight: 800; display: flex; align-items: center; justify-content: center; overflow: hidden; flex: none; }
.rsp-preview__logo img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.rsp-copy { display: flex; gap: 8px; }
.rsp-copy input { flex: 1 1 auto; }

@media (max-width: 782px) {
	.rsp-side { max-width: none; flex-basis: 100%; padding: 14px; gap: 12px; }
	.rsp-side__nav { flex-direction: row; flex-wrap: wrap; }
	.rsp-side__nav button { width: auto; flex: 1 1 auto; }
	.rsp-side__foot { display: none; }
	.rsp-main { padding: 18px 16px 40px; }
	.rsp-detail, .rsp-costcard { position: static; }
}
.rsp-field > .rsp-link { align-self: flex-start; }

/* ==========================================================================
   Motion: runs when you open a section, never while typing; off for reduced motion.
   ========================================================================== */
.rsp-main.is-enter > * { animation: rsp-a-rise 440ms cubic-bezier(.2,.8,.2,1) both; animation-delay: calc(var(--i, 0) * 50ms); }
.rsp-main.is-enter .rsp-kpi { animation: rsp-a-rise 460ms cubic-bezier(.2,.8,.2,1) both; }
.rsp-main.is-enter .rsp-kpi:nth-child(2) { animation-delay: 60ms; }
.rsp-main.is-enter .rsp-kpi:nth-child(3) { animation-delay: 120ms; }
.rsp-main.is-enter .rsp-kpi:nth-child(4) { animation-delay: 180ms; }
.rsp-main.is-enter .rsp-chart__bar { transform-origin: bottom; animation: rsp-a-grow 800ms cubic-bezier(.3,.7,.2,1) both; }
.rsp-main.is-enter .rsp-chart__col:nth-child(2) .rsp-chart__bar { animation-delay: 60ms; }
.rsp-main.is-enter .rsp-chart__col:nth-child(3) .rsp-chart__bar { animation-delay: 120ms; }
.rsp-main.is-enter .rsp-chart__col:nth-child(4) .rsp-chart__bar { animation-delay: 180ms; }
.rsp-main.is-enter .rsp-chart__col:nth-child(5) .rsp-chart__bar { animation-delay: 240ms; }
.rsp-main.is-enter .rsp-chart__col:nth-child(6) .rsp-chart__bar { animation-delay: 300ms; }
.rsp-main.is-enter .rsp-chart__val { animation: rsp-a-fade 400ms ease-out 700ms both; }
.rsp-main.is-enter .rsp-table tbody tr { animation: rsp-a-fade 380ms ease-out both; }
.rsp-main.is-enter .rsp-table tbody tr:nth-child(2) { animation-delay: 40ms; }
.rsp-main.is-enter .rsp-table tbody tr:nth-child(3) { animation-delay: 80ms; }
.rsp-main.is-enter .rsp-table tbody tr:nth-child(4) { animation-delay: 120ms; }
.rsp-main.is-enter .rsp-table tbody tr:nth-child(5) { animation-delay: 160ms; }
.rsp-main.is-enter .rsp-table tbody tr:nth-child(n+6) { animation-delay: 200ms; }
.rsp-chart__bar { transition: filter 160ms ease; }
.rsp-chart__col:hover .rsp-chart__bar { filter: brightness(0.92); }
.rsp-card, .rsp-attn, .rsp-btn, .rsp-table tbody tr { transition: transform 140ms ease, box-shadow 180ms ease, background-color 160ms ease; }
.rsp-kpi:hover { box-shadow: 0 10px 28px rgba(16,32,27,0.07); transform: translateY(-1px); }
.rsp-btn:active, .rsp-attn:active { transform: scale(0.97); }
.rsp-toast { animation: rsp-a-drop 300ms cubic-bezier(.2,.8,.2,1) both; }
@keyframes rsp-a-rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes rsp-a-grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes rsp-a-fade { from { opacity: 0; } }
@keyframes rsp-a-drop { from { opacity: 0; transform: translateY(-8px); } }
@media (prefers-reduced-motion: reduce) {
	#rsp-admin *, #rsp-admin *::before, #rsp-admin *::after { animation: none !important; transition: none !important; }
}
