:root {
  color-scheme: light;
  --ink: #172033;
  --muted: #718096;
  --line: #dce4ec;
  --soft: #f5f8fb;
  --blue: #2076d2;
  --blue-deep: #155da9;
  --cyan: #19bde2;
  --green: #168768;
  --green-soft: #e8f7f1;
  --red: #d24b56;
  --shadow: 0 14px 42px rgba(39, 64, 91, .11);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: #fff; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .65; }
[hidden] { display: none !important; }

.preview-page { min-height: 100vh; background: #eef3f7; }
.preview-topbar {
  height: 66px; display: flex; align-items: center; gap: 28px; padding: 0 28px;
  color: #fff; background: linear-gradient(112deg, #1aafda, #1684cf);
}
.brand-mark { font-size: 22px; font-weight: 800; letter-spacing: -.6px; }
.preview-search { width: min(520px, 48vw); padding: 11px 18px; color: rgba(255,255,255,.8); background: rgba(255,255,255,.15); border-radius: 20px; font-size: 13px; }
.preview-user { margin-left: auto; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; color: #1379b4; background: #fff; font-weight: 700; }
.preview-layout { display: grid; grid-template-columns: 70px 1fr; min-height: calc(100vh - 66px); }
.preview-sidebar { display: flex; flex-direction: column; align-items: center; gap: 24px; padding-top: 28px; background: #283447; }
.nav-dot { width: 20px; height: 20px; border: 2px solid #718096; border-radius: 6px; }
.nav-dot.active { border-color: #2dc1e6; background: #2dc1e6; box-shadow: 0 0 0 5px rgba(45,193,230,.14); }
.deal-shell { padding: 22px 28px 50px; overflow: hidden; }
.breadcrumbs { color: #7b8998; font-size: 12px; }
.deal-heading { display: flex; align-items: flex-end; justify-content: space-between; margin: 20px 0; }
.eyebrow { color: #8493a3; font-size: 11px; font-weight: 700; letter-spacing: .08em; }
.deal-heading h1 { margin: 6px 0 0; font-size: 25px; font-weight: 600; }
.deal-stage { padding: 9px 15px; color: #127058; background: #dff5ed; border-radius: 5px; font-size: 12px; font-weight: 700; }
.deal-grid { display: grid; grid-template-columns: minmax(650px, 1fr) 290px; gap: 18px; align-items: start; }
.deal-card { background: #fff; border-radius: 9px; box-shadow: 0 1px 2px rgba(22,43,66,.08); }
.primary-card { padding: 0 24px 24px; }
.card-tabs { height: 55px; display: flex; align-items: center; gap: 28px; border-bottom: 1px solid #e7edf2; color: #6f7f8e; font-size: 13px; }
.card-tabs b { align-self: stretch; display: flex; align-items: center; color: #168ac8; border-bottom: 2px solid #20b7dd; }
.fake-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; margin: 20px 0 22px; padding-bottom: 18px; border-bottom: 1px solid #edf1f4; }
.fake-fields div { display: flex; flex-direction: column; gap: 6px; }
.fake-fields span, .iframe-label small { color: #8997a5; font-size: 11px; }
.fake-fields strong { font-size: 13px; font-weight: 500; }
.iframe-label { display: flex; align-items: center; justify-content: space-between; margin-bottom: 9px; font-size: 12px; font-weight: 600; }
.integration-frame { display: block; width: 100%; height: 625px; border: 1px solid #dbe4eb; border-radius: 10px; background: #f9fbfc; }
.timeline-card { padding: 20px; }
.timeline-card h2 { margin: 0 0 14px; font-size: 18px; }
.fake-action { width: 100%; padding: 10px; color: #188fc7; background: #edfaff; border: 1px solid #c7eaf6; border-radius: 4px; }
.timeline-item { display: flex; gap: 12px; padding: 21px 0 0 2px; font-size: 12px; }
.timeline-item i { width: 10px; height: 10px; margin-top: 4px; border-radius: 50%; background: #31b8dc; box-shadow: 0 0 0 4px #e4f7fb; }
.timeline-item p { margin: 5px 0 0; color: #708090; }
.timeline-item.muted i { background: #aab5c0; box-shadow: 0 0 0 4px #eef1f4; }

.widget-page { min-height: 100%; background: #f7f9fb; }
.widget { min-height: 100%; padding: 20px 22px 14px; }
.widget-header { display: flex; align-items: center; padding-bottom: 17px; border-bottom: 1px solid var(--line); }
.service-logo { width: 42px; height: 42px; display: grid; place-items: center; margin-right: 12px; border-radius: 12px 12px 12px 3px; color: #fff; background: linear-gradient(145deg, #18c0dd, #1f72d0); box-shadow: 0 7px 18px rgba(31,114,208,.24); }
.service-logo span { font-size: 23px; font-weight: 800; }
.widget-kicker { margin: 0 0 3px; color: #8a98a8; font-size: 9px; font-weight: 800; letter-spacing: .13em; }
.widget-header h1 { margin: 0; font-size: 18px; line-height: 1.1; }
.demo-badge { margin-left: auto; padding: 5px 9px; color: #08749b; background: #dff7fd; border-radius: 999px; font-size: 10px; font-weight: 700; }
.summary-row { display: grid; grid-template-columns: 1.2fr 1fr; gap: 20px; padding: 16px 3px; }
.summary-row > div { display: flex; min-width: 0; flex-direction: column; gap: 4px; }
.summary-row strong { overflow: hidden; font-size: 12px; white-space: nowrap; text-overflow: ellipsis; }
.meta-label { color: #8996a4; font-size: 10px; }
.client-block { padding-left: 20px; border-left: 1px solid var(--line); }
.client-block a { color: var(--blue); font-size: 11px; text-decoration: none; }
.address-card, .request-card { padding: 16px; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 3px 12px rgba(36,59,82,.035); }
.request-card { margin-top: 12px; }
.section-title, .section-title > div { display: flex; align-items: center; }
.section-title { justify-content: space-between; margin-bottom: 13px; }
.step-number { width: 22px; height: 22px; display: grid; place-items: center; margin-right: 8px; color: #fff; background: #2d7ecb; border-radius: 7px; font-size: 10px; font-weight: 800; }
.section-title h2 { margin: 0; font-size: 13px; }
.quality-badge { padding: 4px 7px; color: #8996a3; background: #f2f5f7; border-radius: 5px; font-size: 9px; font-weight: 700; }
.quality-badge.verified { color: #0f7b5e; background: var(--green-soft); }
.address-control { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.address-control input, textarea { width: 100%; color: var(--ink); background: #fbfcfd; border: 1px solid #cfd9e3; border-radius: 6px; outline: none; }
.address-control input { height: 36px; padding: 0 11px; font-size: 11px; }
.address-control input:focus, textarea:focus { border-color: #63a9e7; box-shadow: 0 0 0 3px rgba(32,118,210,.09); }
.button { min-height: 34px; padding: 0 14px; border: 0; border-radius: 6px; font-size: 10px; font-weight: 700; transition: transform .15s, background .15s; }
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button.primary { color: #fff; background: var(--blue); }
.button.primary:hover:not(:disabled) { background: var(--blue-deep); }
.button.secondary { color: var(--blue); background: #eaf4fd; border: 1px solid #cce2f6; }
.button.danger-ghost { color: var(--red); background: #fff; border: 1px solid #f0cbd0; }
.button.wide { width: 100%; margin-top: 10px; }
.clean-result { display: flex; align-items: center; gap: 8px; margin-top: 9px; padding: 8px 10px; color: #17644f; background: #eef9f5; border-radius: 6px; }
.check-icon { width: 20px; height: 20px; display: grid; place-items: center; border-radius: 50%; color: #fff; background: var(--green); font-size: 10px; }
.clean-result div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.clean-result small { color: #629083; font-size: 8px; }
.clean-result strong { overflow: hidden; font-size: 10px; white-space: nowrap; text-overflow: ellipsis; }
.address-meta { display: flex; gap: 16px; margin-top: 10px; color: #8a98a7; font-size: 9px; }
.address-meta b { color: #566575; font-weight: 600; }
.address-meta .fias { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.icon-button { width: 28px; height: 28px; padding: 0; color: #6f7e8d; background: #f3f6f8; border: 0; border-radius: 50%; font-size: 17px; }
.status-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.request-id { color: #2480ca; font-size: 9px; font-weight: 800; letter-spacing: .07em; }
.status-heading h3 { margin: 3px 0 0; font-size: 12px; }
.status-pill { flex: none; padding: 6px 9px; color: #117058; background: #e2f6ef; border-radius: 999px; font-size: 9px; font-weight: 800; }
.status-pill.cancelled { color: #9b3842; background: #fbe9eb; }
.request-details { display: grid; grid-template-columns: 1.25fr 1fr .7fr; gap: 8px; margin-top: 13px; padding: 10px 11px; background: var(--soft); border-radius: 7px; }
.request-details div { display: flex; flex-direction: column; gap: 4px; }
.request-details span { color: #8996a3; font-size: 8px; }
.request-details b { font-size: 9px; }
.status-note { margin: 10px 0; padding-left: 9px; color: #647384; border-left: 2px solid #70bddc; font-size: 9px; }
.button-row { display: flex; justify-content: flex-end; gap: 8px; }
.empty-state { display: flex; align-items: center; gap: 11px; padding: 10px; background: var(--soft); border-radius: 8px; }
.empty-icon { width: 32px; height: 32px; display: grid; flex: none; place-items: center; border-radius: 50%; color: var(--blue); background: #e2f1fd; }
.empty-state h3 { margin: 0 0 3px; font-size: 11px; }
.empty-state p { margin: 0; color: #7b8998; font-size: 9px; }
#request-create label { display: block; margin: 10px 0 5px; color: #697888; font-size: 9px; font-weight: 600; }
textarea { padding: 8px 10px; resize: vertical; font-size: 10px; }
.widget-footer { display: flex; align-items: center; justify-content: center; gap: 6px; padding-top: 11px; color: #8b98a5; font-size: 8px; }
.secure-dot { width: 6px; height: 6px; border-radius: 50%; background: #26a47f; }
.notice { position: sticky; top: 7px; z-index: 10; margin: 8px 0; padding: 9px 11px; color: #17644f; background: #e7f7f1; border: 1px solid #c2eadc; border-radius: 7px; font-size: 10px; box-shadow: 0 8px 20px rgba(43,64,83,.12); }
.notice.error { color: #923842; background: #fcecee; border-color: #f2ced2; }
.loading-panel { display: grid; gap: 10px; padding-top: 20px; }
.skeleton { display: block; height: 12px; border-radius: 5px; background: linear-gradient(90deg, #edf1f4 25%, #f7f9fb 45%, #edf1f4 65%); background-size: 220% 100%; animation: shimmer 1.2s infinite; }
.line-wide { width: 72%; }.line-medium { width: 48%; }.skeleton.block { width: 100%; height: 160px; margin-top: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
@keyframes shimmer { to { background-position-x: -220%; } }

@media (max-width: 920px) {
  .deal-grid { grid-template-columns: 1fr; }
  .timeline-card { display: none; }
  .deal-shell { padding: 18px 14px 30px; }
  .preview-sidebar { display: none; }
  .preview-layout { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .integration-frame { height: 790px; }
  .widget { padding: 14px 12px; }
  .summary-row { grid-template-columns: 1fr; gap: 9px; }
  .client-block { padding: 8px 0 0; border: 0; border-top: 1px solid var(--line); }
  .address-meta { flex-wrap: wrap; gap: 8px; }
  .request-details { grid-template-columns: 1fr 1fr; }
  .button-row { flex-direction: column-reverse; }
}

/* Совместимый вид старого deal_field_handler_jsnative.php. */
.legacy-widget-page {
  --legacy-background: #fff;
  --legacy-text: #42484e;
  --legacy-text-subdued: #42484eb8;
  --legacy-panel-subdued: #42484e14;
  --legacy-panel-grey: #42484e14;
  --legacy-green: #3cb46e;
  --legacy-green-hover: #38a365;
  --legacy-green-pressed: #33945b;
  --legacy-green-soft: #3cb46e1f;
  margin: 0;
  padding: 0;
  color: var(--legacy-text);
  background: var(--legacy-background);
  font-family: Roboto, Arial, sans-serif;
  font-size: 13px;
  line-height: 1.5;
}
.legacy-widget-page #content-wrapper { position: relative; z-index: 1; min-height: 50px; }
.legacy-app-container { padding: 12px 14px; }
.legacy-app-title { margin-bottom: 8px; color: var(--legacy-text); font-size: 14px; font-weight: 600; }
.legacy-btn-primary,
.legacy-btn-cancel {
  position: relative;
  z-index: 10;
  margin-bottom: 12px;
  padding: 8px 14px;
  color: #fff;
  border: 0;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 500;
}
.legacy-btn-primary { background: var(--legacy-green); }
.legacy-btn-primary:hover { background: var(--legacy-green-hover); }
.legacy-btn-primary:active { background: var(--legacy-green-pressed); }
.legacy-btn-cancel { background: #e74c3c; }
.legacy-btn-cancel:hover { background: #c0392b; }
.legacy-btn-cancel:active { background: #a93226; }
.legacy-notice,
.legacy-token-box {
  margin-bottom: 12px;
  padding: 10px 12px;
  background: var(--legacy-green-soft);
  border-left: 3px solid var(--legacy-green);
  border-radius: 4px;
}
.legacy-notice-warning { color: #92400e; background: #fff8e6; border-left-color: #f59e0b; }
.legacy-token-box { margin-top: 8px; }
.legacy-token-box .value { color: var(--legacy-green); font-weight: 600; }
.legacy-section-title { margin-bottom: 8px; color: var(--legacy-text); font-size: 13px; font-weight: 600; }
.legacy-status-container { margin-top: 12px; }
.legacy-status-loading {
  padding: 12px;
  color: var(--legacy-text-subdued);
  background: var(--legacy-panel-subdued);
  border-radius: 4px;
  font-size: 13px;
}
.legacy-status-error {
  margin-top: 8px;
  padding: 10px 12px;
  color: #b91c1c;
  background: #fef2f2;
  border-left: 3px solid #dc2626;
  border-radius: 4px;
}
.legacy-table-container { margin: 12px 0; }
.legacy-data-table {
  width: 100%;
  overflow: hidden;
  border: 1px solid var(--legacy-panel-grey);
  border-collapse: collapse;
  border-radius: 4px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.1);
}
.legacy-data-table thead tr { background: var(--legacy-panel-subdued); }
.legacy-data-table th {
  padding: 10px 12px;
  color: var(--legacy-text);
  border-bottom: 1px solid var(--legacy-panel-grey);
  text-align: left;
  font-size: 13px;
  font-weight: 600;
}
.legacy-data-table td {
  padding: 5px 12px;
  color: var(--legacy-text);
  border-bottom: 1px solid var(--legacy-panel-grey);
  font-size: 13px;
}
.legacy-data-table tbody tr:nth-child(odd) td:first-child { background: var(--legacy-panel-subdued); font-weight: 500; }
.legacy-data-table tbody tr:last-child td { border-bottom: 0; }
.legacy-row-hidden { display: none; }
.legacy-status-card { padding: 12px; border: 1px solid var(--legacy-panel-grey); border-radius: 4px; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.1); }
.legacy-status-header { margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--legacy-panel-grey); }
.legacy-status-name { margin-bottom: 4px; color: var(--legacy-green); font-size: 16px; font-weight: 600; }
.legacy-status-badge { display: inline-block; padding: 4px 8px; color: var(--legacy-green); background: var(--legacy-green-soft); border-radius: 4px; font-size: 12px; font-weight: 500; }
.legacy-status-note { margin-top: 4px; color: var(--legacy-text-subdued); font-size: 12px; }
.legacy-status-table { box-shadow: none; }
.legacy-status-table td { padding: 10px 12px; }
.legacy-status-table td:first-child { width: 40%; background: var(--legacy-panel-subdued); font-weight: 500; }
.legacy-status-table .legacy-price { color: var(--legacy-green); font-weight: 600; }
.legacy-edit-input { width: 90%; margin: 0; padding: 8px 12px; color: var(--legacy-text); border: 1px solid var(--legacy-panel-grey); border-radius: 4px; font-family: Roboto, Arial, sans-serif; font-size: 13px; }
