:root { font-family: Arial, sans-serif; background:#f7f8fa; color:#17191c; }
* { box-sizing:border-box; }
body { margin:0; }
.hidden { display:none !important; }
.login-view { min-height:100vh; display:grid; place-items:center; padding:24px; }
.login-card { width:min(440px,100%); background:#fff; border:1px solid #e5e7eb; border-radius:18px; padding:28px; box-shadow:0 18px 55px rgba(0,0,0,.06); display:grid; gap:16px; }
.login-card h1 { margin:0; }
.login-card label { display:grid; gap:7px; font-weight:600; }
.login-card input { width:100%; padding:12px 13px; border:1px solid #d7dbe0; border-radius:10px; font:inherit; }
.login-card input:focus { outline:2px solid #cbd5e1; outline-offset:1px; }
.eyebrow { margin:10px 0 -8px; font-size:13px; }
.muted { color:#69707a; }
.form-status { min-height:22px; font-size:14px; color:#8a2b2b; }
.primary,.secondary { border:0; border-radius:10px; padding:11px 16px; cursor:pointer; font:inherit; }
.primary { background:#17191c; color:#fff; }
.secondary { background:#f1f3f5; color:#17191c; }
.primary:disabled { opacity:.6; cursor:wait; }
.app-shell { min-height:100vh; display:grid; grid-template-columns:240px 1fr; }
.sidebar { background:#fff; border-left:1px solid #e5e7eb; padding:24px 16px; }
.brand { font-size:22px; font-weight:700; margin-bottom:8px; }
.sidebar .brand { margin-bottom:28px; }
.brand span { font-size:14px; font-weight:500; }
nav { display:grid; gap:6px; }
nav button { border:0; background:transparent; padding:12px; text-align:right; border-radius:10px; cursor:pointer; }
nav button.active, nav button:hover { background:#f1f3f5; }
main { padding:32px; }
header { display:flex; align-items:center; justify-content:space-between; gap:20px; }
h1 { margin:4px 0 0; }
.header-actions { display:flex; align-items:center; gap:10px; }
select { min-width:220px; padding:10px; border:1px solid #d7dbe0; border-radius:10px; background:#fff; }
.notice { margin:24px 0; background:#fff; border:1px solid #e5e7eb; padding:14px 16px; border-radius:12px; }
.cards { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:16px; }
.cards article, .panel { background:#fff; border:1px solid #e5e7eb; border-radius:14px; padding:20px; }
.cards article { display:grid; gap:8px; }
.cards strong { font-size:28px; }
.panel { margin-top:20px; }
.store-row { padding:12px 0; border-bottom:1px solid #eee; }
.store-row:last-child { border-bottom:0; }
@media (max-width:800px){ .app-shell{grid-template-columns:1fr}.sidebar{display:none}.cards{grid-template-columns:1fr}main{padding:20px}header{align-items:flex-start;flex-direction:column}.header-actions{width:100%;flex-direction:column;align-items:stretch}select{width:100%} }

.panel-heading { display:flex; align-items:flex-start; justify-content:space-between; gap:20px; }
.panel-heading h2 { margin:0 0 5px; }
.panel-heading p { margin:0; }
.product-tabs { display:flex; gap:8px; flex-wrap:wrap; }
.product-tab { border:1px solid #d7dbe0; background:#fff; padding:9px 12px; border-radius:999px; cursor:pointer; font:inherit; }
.product-tab.active { background:#17191c; color:#fff; border-color:#17191c; }
.product-tab span { font-variant-numeric:tabular-nums; }
.products-status { min-height:22px; margin-top:12px; font-size:13px; }
.table-wrap { width:100%; overflow:auto; margin-top:8px; }
.products-table { width:100%; border-collapse:collapse; min-width:620px; }
.products-table th,.products-table td { padding:13px 10px; border-bottom:1px solid #eee; text-align:right; vertical-align:middle; }
.products-table th { font-size:13px; color:#69707a; font-weight:600; }
.product-name { font-weight:700; }
.product-list-main { display:flex; align-items:center; gap:12px; min-width:0; }
.product-list-thumb { width:56px; height:56px; flex:0 0 56px; border-radius:10px; object-fit:cover; border:1px solid #e5e7eb; background:#f4f5f6; }
.store-badge { display:inline-flex; align-items:center; border-radius:999px; padding:5px 9px; font-size:12px; background:#f1f3f5; }
.store-badge.included { background:#e9f7ef; color:#17633a; }
.store-badge.excluded { background:#fff0f0; color:#8a2b2b; }
.store-badge.unknown { background:#f1f3f5; color:#5c6470; }
.empty-state { text-align:center !important; padding:28px !important; color:#69707a; }
@media (max-width:800px){ .panel-heading{flex-direction:column}.product-tabs{width:100%}.product-tab{flex:1}.products-panel{padding:16px} }

/* Merchant Orders + Fulfillment */
.orders-table { min-width:980px; }
.order-id { font-family:ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.order-badge { display:inline-flex; align-items:center; border-radius:999px; padding:5px 9px; font-size:12px; white-space:nowrap; background:#f1f3f5; color:#5c6470; }
.order-badge.success { background:#e9f7ef; color:#17633a; }
.order-badge.warning { background:#fff7df; color:#7c5a00; }
.order-badge.neutral { background:#f1f3f5; color:#5c6470; }
.compact { padding:7px 10px; font-size:13px; }
.order-detail-card { margin-top:18px; padding:20px; border:1px solid #dfe3e8; border-radius:14px; background:#fbfcfd; }
.order-detail-heading { display:flex; justify-content:space-between; gap:18px; align-items:flex-start; }
.order-detail-heading h3 { margin:4px 0 6px; font-family:ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size:16px; overflow-wrap:anywhere; }
.order-summary-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:12px; margin:18px 0; }
.order-summary-grid > div { background:#fff; border:1px solid #e5e7eb; border-radius:10px; padding:12px; display:grid; gap:6px; }
.order-summary-grid span:first-child { font-size:12px; color:#69707a; }
.info-note { background:#f6f8fa; border:1px solid #e5e7eb; border-radius:10px; padding:12px 14px; line-height:1.6; }
.detail-section { margin-top:20px; }
.detail-section h4 { margin:0 0 10px; }
.fulfillment-history-row { background:#fff; border:1px solid #e5e7eb; border-radius:10px; padding:12px; margin-bottom:8px; display:grid; gap:5px; }
.fulfillment-form { background:#fff; border:1px solid #e5e7eb; border-radius:12px; padding:16px; display:grid; gap:14px; }
.form-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
.form-grid label { display:grid; gap:6px; font-weight:600; font-size:14px; }
.form-grid label.wide { grid-column:1/-1; }
.form-grid input,.qty-row input { width:100%; padding:10px 11px; border:1px solid #d7dbe0; border-radius:9px; font:inherit; }
.fulfillment-items-editor { display:grid; gap:8px; }
.fulfillment-items-editor h4 { margin:0 0 4px; }
.qty-row { display:grid; grid-template-columns:1fr 110px; align-items:center; gap:14px; padding:9px 0; border-bottom:1px solid #eee; }
.qty-row:last-child { border-bottom:0; }
.check-row { display:flex; gap:8px; align-items:flex-start; font-size:14px; }
.check-row input { margin-top:3px; }
.confirmation { background:#fff8e8; border:1px solid #f0dfb5; border-radius:9px; padding:10px; }
.neutral-text { color:#5c6470; }
a { color:inherit; }
@media (max-width:1000px){ .order-summary-grid{grid-template-columns:repeat(2,minmax(0,1fr))} }
@media (max-width:800px){ .order-summary-grid{grid-template-columns:1fr}.form-grid{grid-template-columns:1fr}.qty-row{grid-template-columns:1fr}.order-detail-heading{flex-direction:column} }

/* E13 refund-request acceptance */
.fulfillment-form textarea { width:100%; min-height:96px; resize:vertical; padding:10px 11px; border:1px solid #d7dbe0; border-radius:9px; font:inherit; }
.refund-current { display:flex; gap:12px; align-items:flex-start; background:#fff; border:1px solid #e5e7eb; border-radius:10px; padding:12px; }
.refunds-panel .orders-table { min-width:900px; }

/* E13 Pilot catalog management */
.product-heading-actions { display:flex; align-items:center; gap:12px; flex-wrap:wrap; }
.product-editor-card { margin-top:18px; padding:20px; border:1px solid #dfe3e8; border-radius:14px; background:#fbfcfd; }
.product-editor-card h3 { margin:4px 0 6px; }
.catalog-form { margin-top:18px; display:grid; gap:14px; }
.catalog-form textarea { width:100%; min-height:110px; resize:vertical; padding:10px 11px; border:1px solid #d7dbe0; border-radius:9px; font:inherit; }
.catalog-form input,.catalog-form select { width:100%; min-width:0; padding:10px 11px; border:1px solid #d7dbe0; border-radius:9px; background:#fff; font:inherit; }
.catalog-form input:disabled,.catalog-form select:disabled,.catalog-form textarea:disabled { background:#f3f4f6; color:#6b7280; }
.catalog-actions { display:flex; gap:10px; flex-wrap:wrap; }
.danger { border:1px solid #f0caca; background:#fff0f0; color:#8a2b2b; border-radius:10px; padding:11px 16px; cursor:pointer; font:inherit; }
.danger:disabled,.secondary:disabled { opacity:.6; cursor:wait; }
.catalog-warning { margin-top:14px; background:#fff8e8; border:1px solid #f0dfb5; border-radius:10px; padding:12px 14px; line-height:1.6; }
.catalog-warning.protected { background:#eef5ff; border-color:#cddcf7; color:#234a75; }
.catalog-state-row { display:flex; gap:18px; flex-wrap:wrap; margin-top:14px; background:#fff; border:1px solid #e5e7eb; border-radius:10px; padding:12px 14px; }
.catalog-state-row span { color:#69707a; }
.catalog-state-row strong { color:#17191c; }
@media (max-width:800px){ .product-heading-actions{width:100%;align-items:stretch;flex-direction:column}.product-heading-actions .primary{width:100%}.catalog-actions{display:grid}.catalog-actions>*{width:100%} }

.collection-membership-card {
  margin-top: 18px;
  padding: 18px;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  background: #fafafa;
}
.collection-membership-card h3 { margin: 0 0 6px; }
.collection-membership-grid { align-items: end; }
.row-actions { min-width: 300px; white-space:nowrap; }
.row-actions .compact { margin-inline-start: 6px; }


.commerce-settings-card {
  margin: 18px 0;
  padding: 18px;
  border: 1px solid #e1e5ea;
  border-radius: 16px;
  background: #fbfcfd;
}
.commerce-settings-card h3 { margin: 0 0 6px; }
.commerce-currency-controls { display: flex; align-items: end; gap: 12px; flex-wrap: wrap; margin-top: 12px; }
.commerce-currency-controls label { min-width: 220px; }
.commerce-currency-controls select { width: 100%; }

/* E13 Coupons — RTL option controls + automatic Price-currency resolution */
.catalog-form input[type="checkbox"] {
  width:18px;
  min-width:18px;
  height:18px;
  padding:0;
  margin:2px 0 0;
  flex:0 0 18px;
  cursor:pointer;
}
.catalog-form input[type="checkbox"]:disabled { cursor:not-allowed; }
.coupon-check-options { display:grid; gap:10px; margin-top:2px; }
.coupon-check-card {
  direction:rtl;
  display:flex;
  flex-direction:row;
  align-items:flex-start;
  justify-content:flex-start;
  gap:10px;
  width:100%;
  padding:12px 14px;
  border:1px solid #e1e5ea;
  border-radius:11px;
  background:#fff;
  cursor:pointer;
  text-align:right;
}
.coupon-check-card:has(input:disabled) { background:#f6f7f8; cursor:not-allowed; }
.coupon-check-copy { display:grid; gap:3px; min-width:0; line-height:1.5; }
.coupon-check-copy strong { font-size:14px; font-weight:700; }
.coupon-check-copy small { color:#69707a; font-size:12px; font-weight:400; }
.coupon-currency-resolution { margin-top:12px; display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.coupon-currency-resolution p { margin:0; }

/* E13 Shipping — Arabic merchant operations */
.shipping-zones-list { display:grid; gap:14px; margin-top:14px; }
.shipping-zone-card { border:1px solid #e1e5ea; border-radius:16px; background:#fbfcfd; padding:16px; }
.shipping-zone-heading { display:flex; justify-content:space-between; align-items:flex-start; gap:16px; }
.shipping-zone-heading h3 { margin:0 0 5px; }
.shipping-zone-heading p { margin:0; }
.shipping-zone-actions { display:flex; flex-wrap:wrap; gap:8px; justify-content:flex-start; }
.shipping-rates-table { min-width:760px; }
.shipping-rates-table .danger.compact { margin-inline-start:6px; }
.shipping-empty { border:1px dashed #d7dbe0; border-radius:12px; background:#fbfcfd; }
.shipping-editor-card { margin-top:16px; }
.shipping-country-preview { align-self:end; min-height:43px; display:flex; flex-direction:column; justify-content:center; gap:3px; padding:8px 11px; border:1px solid #e1e5ea; border-radius:9px; background:#fff; }
.shipping-country-preview span { font-size:12px; }
@media (max-width:800px){ .shipping-zone-heading{flex-direction:column}.shipping-zone-actions{width:100%}.shipping-zone-actions button{flex:1}.shipping-country-preview{align-self:stretch} }

/* E13 Brand Kit — Arabic merchant operations */
.brand-kits-list { display:grid; gap:14px; margin-top:14px; }
.brand-kit-card { border:1px solid #e1e5ea; border-radius:16px; background:#fbfcfd; padding:16px; }
.brand-kit-heading { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; }
.brand-kit-heading h3 { margin:0; }
.brand-kit-heading p { margin:5px 0 0; font-family:ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; overflow-wrap:anywhere; }
.brand-kit-title-row { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.brand-kit-actions { display:flex; gap:8px; flex-wrap:wrap; }
.brand-kit-assets-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:14px; margin-top:14px; }
.brand-kit-assets-grid > section { border:1px solid #e5e7eb; border-radius:12px; background:#fff; padding:12px; min-width:0; }
.brand-kit-assets-grid h4 { margin:0 0 10px; }
.brand-logo-list,.brand-color-list,.brand-font-list { display:grid; gap:9px; }
.brand-logo-item { display:flex; align-items:center; gap:10px; min-width:0; }
.brand-logo-item img { width:52px; height:52px; object-fit:contain; border:1px solid #e5e7eb; border-radius:9px; background:#fff; }
.brand-logo-item small { overflow-wrap:anywhere; }
.brand-color-item { display:grid; grid-template-columns:24px minmax(0,1fr) auto; gap:8px; align-items:center; }
.brand-color-swatch { width:24px; height:24px; border-radius:7px; border:1px solid rgba(0,0,0,.12); }
.brand-color-item code { font-size:12px; direction:ltr; }
.brand-font-item { display:grid; gap:3px; padding-bottom:7px; border-bottom:1px solid #eee; }
.brand-font-item:last-child { border-bottom:0; padding-bottom:0; }
.brand-kit-empty { border:1px dashed #d7dbe0; border-radius:12px; background:#fbfcfd; }
.brand-kit-editor-card textarea { min-height:92px; direction:ltr; text-align:left; }
@media (max-width:1000px){ .brand-kit-assets-grid{grid-template-columns:1fr} }
@media (max-width:800px){ .brand-kit-heading{flex-direction:column}.brand-kit-actions{width:100%}.brand-kit-actions button{flex:1} }

/* E13 MerchantUser provisioning + activation */
.staff-layout { display:grid; grid-template-columns:minmax(0,1.4fr) minmax(320px,.8fr); gap:18px; margin-top:16px; align-items:start; }
.staff-layout h3 { margin:0 0 10px; }
.staff-invite-card { border:1px solid #e1e5ea; border-radius:14px; background:#fbfcfd; padding:16px; display:grid; gap:12px; }
.staff-invite-card label { display:grid; gap:6px; font-size:14px; font-weight:600; }
.staff-invite-card input,.staff-invite-card select { width:100%; min-width:0; padding:10px 11px; border:1px solid #d7dbe0; border-radius:9px; background:#fff; font:inherit; }
.staff-table { min-width:720px; }
.staff-user-meta { display:grid; gap:3px; }
.staff-role-select { min-width:170px; width:auto; }
.staff-row-actions { display:flex; gap:8px; flex-wrap:wrap; align-items:center; }
.invite-result { display:grid; gap:8px; border:1px solid #dbe7f5; background:#f5f9ff; border-radius:10px; padding:12px; }
.invite-result input { direction:ltr; text-align:left; font-family:ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size:12px; }
@media (max-width:1000px){ .staff-layout{grid-template-columns:1fr} }

/* E13 Product Editor reopen — fixed app shell + single active section */
.app-shell { height:100vh; min-height:0; overflow:hidden; }
.sidebar { position:sticky; top:0; height:100vh; overflow-y:auto; }
.app-shell main { min-width:0; height:100vh; overflow:auto; overscroll-behavior:contain; }
.app-view-panel { display:none; }
.app-view-panel.active-view { display:block; }
.dashboard-panel.active-view { display:block; }
.dashboard-panel .notice { margin-top:24px; }
.product-editor-view { margin-top:20px; }
.product-editor-view .product-editor-card { margin-top:0; }

/* Advanced Arabic Product Editor */
.editor-section { border:1px solid #e5e7eb; border-radius:13px; background:#fff; padding:16px; display:grid; gap:12px; }
.editor-section-heading { display:flex; align-items:flex-start; justify-content:space-between; gap:14px; }
.editor-section-heading h4 { margin:0; }
.editor-section-heading p { margin:4px 0 0; }
.editor-subgrid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
.editor-subgrid .wide { grid-column:1/-1; }
.editor-toggle-row { display:flex; align-items:flex-start; gap:10px; padding:10px 0; }
.editor-toggle-row input[type="checkbox"], .media-featured input[type="radio"] { width:18px; min-width:18px; height:18px; padding:0; margin:2px 0 0; }
.recurring-options[hidden], .label-options[hidden], .tax-options[hidden] { display:none !important; }
.price-selector-row { display:flex; align-items:end; gap:12px; flex-wrap:wrap; }
.price-selector-row label { flex:1; min-width:240px; }
.media-editor-list { display:grid; gap:12px; }
.media-editor-row { border:1px solid #e5e7eb; border-radius:12px; padding:12px; display:grid; grid-template-columns:110px minmax(0,1fr); gap:12px; background:#fbfcfd; }
.media-preview { width:110px; height:90px; border:1px solid #e5e7eb; border-radius:10px; overflow:hidden; background:#f4f5f6; display:grid; place-items:center; color:#69707a; font-size:12px; }
.media-preview img,.media-preview video { width:100%; height:100%; object-fit:cover; }
.media-fields { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; min-width:0; }
.media-fields .wide { grid-column:1/-1; }
.media-row-actions { display:flex; align-items:center; gap:10px; flex-wrap:wrap; grid-column:1/-1; }
.media-featured { display:flex !important; flex-direction:row !important; align-items:center; gap:7px !important; font-weight:600; }
.media-use-badge { border-radius:999px; padding:4px 8px; background:#eef5ff; color:#234a75; font-size:12px; }
.collection-choice-list { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
.collection-choice { display:flex !important; flex-direction:row !important; align-items:center; gap:8px !important; padding:9px 10px; border:1px solid #e5e7eb; border-radius:9px; background:#fbfcfd; font-weight:500 !important; }
.collection-choice input { width:17px !important; min-width:17px !important; height:17px; margin:0; padding:0; }
.collection-thumb { width:48px; height:48px; border-radius:9px; object-fit:cover; border:1px solid #e5e7eb; background:#f4f5f6; vertical-align:middle; margin-inline-end:8px; }
.tax-readonly-summary { padding:10px 12px; background:#f6f8fa; border-radius:9px; border:1px solid #e5e7eb; }

@media (max-width:800px){
  .app-shell{grid-template-columns:1fr;grid-template-rows:auto minmax(0,1fr);height:100vh;}
  .sidebar{display:block;position:sticky;top:0;z-index:10;height:auto;overflow:hidden;padding:10px 12px;border-left:0;border-bottom:1px solid #e5e7eb;}
  .sidebar .brand{display:none;}
  .sidebar nav{display:flex;gap:6px;overflow-x:auto;padding-bottom:2px;scrollbar-width:thin;}
  .sidebar nav button{white-space:nowrap;flex:0 0 auto;padding:9px 11px;}
  .app-shell main{height:100%;padding:16px;}
  .editor-subgrid,.media-fields,.collection-choice-list{grid-template-columns:1fr;}
  .media-editor-row{grid-template-columns:1fr;}
  .media-preview{width:100%;height:160px;}
  .price-selector-row{display:grid;}
}

.app-toast { position:fixed; top:20px; left:20px; z-index:9999; max-width:min(460px,calc(100vw - 40px)); padding:13px 16px; border-radius:12px; border:1px solid #d7dbe0; background:#fff; box-shadow:0 16px 40px rgba(0,0,0,.14); direction:rtl; text-align:right; font-size:14px; line-height:1.6; opacity:0; transform:translateY(-8px); pointer-events:none; transition:opacity .18s ease, transform .18s ease; }
.app-toast.show { opacity:1; transform:translateY(0); }
.app-toast.success { background:#e9f7ef; border-color:#bfe3cc; color:#17633a; }
.app-toast.warning { background:#fff8e8; border-color:#f0dfb5; color:#7c5a00; }
.app-toast.error { background:#fff0f0; border-color:#f0caca; color:#8a2b2b; }

/* Platform Expansion P1/P2 — Contacts read/search + inline detail/edit/delete */
.visually-hidden { position:absolute !important; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }
.contacts-toolbar { display:flex; gap:10px; align-items:end; margin-top:14px; flex-wrap:wrap; }
.contacts-search-label { flex:1 1 360px; min-width:240px; }
.contacts-search-label input { width:100%; padding:11px 12px; border:1px solid #d7dbe0; border-radius:9px; background:#fff; font:inherit; }
.contacts-table { min-width:920px; }
.contact-name { display:grid; gap:3px; min-width:160px; }
.ltr-cell { direction:ltr; text-align:left; unicode-bidi:plaintext; }
.contact-tags { display:flex; gap:5px; flex-wrap:wrap; align-items:center; }
.contact-tags span,.contact-tags small { display:inline-flex; align-items:center; min-height:24px; padding:3px 8px; border-radius:999px; background:#eef5ff; color:#234a75; font-size:12px; }
.contacts-pagination { display:flex; align-items:center; justify-content:center; gap:10px; margin-top:14px; }
.contact-detail-card { margin-top:18px; border:1px solid #e1e5ea; border-radius:16px; background:#fbfcfd; padding:16px; }
.contact-detail-heading { display:flex; align-items:flex-start; justify-content:space-between; gap:14px; }
.contact-detail-heading h3,.contact-detail-heading p { margin:0; }
.contact-detail-heading p { margin-top:4px; }
.contact-detail-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; margin-top:14px; }
.contact-detail-grid > div,.contact-custom-fields > div { display:grid; gap:4px; min-width:0; padding:10px 12px; border:1px solid #e5e7eb; border-radius:10px; background:#fff; }
.contact-detail-grid small,.contact-custom-fields small { color:#69707a; }
.contact-detail-grid strong,.contact-custom-fields strong { overflow-wrap:anywhere; }
.contact-custom-section { margin-top:16px; }
.contact-custom-section h4 { margin:0 0 10px; }
.contact-custom-fields { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }
.contact-row-actions { display:flex; gap:6px; flex-wrap:wrap; align-items:center; }
.contact-inline-detail-row > td { padding:0 8px 12px !important; border-top:0 !important; background:#fff; }
.contact-inline-panel { width:100%; }
.contact-detail-card.inline { margin-top:0; border-top-left-radius:0; border-top-right-radius:0; box-shadow:inset 0 3px 0 rgba(24,35,48,.04); }
.contact-edit-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; margin-top:14px; }
.contact-edit-grid label { display:grid; gap:6px; font-size:13px; color:#4a515a; }
.contact-edit-grid input[type="text"],.contact-edit-grid input[type="email"],.contact-edit-grid input:not([type]) { width:100%; box-sizing:border-box; padding:10px 11px; border:1px solid #d7dbe0; border-radius:9px; background:#fff; font:inherit; }
.contact-dnd-option { display:flex !important; align-items:center; gap:8px !important; min-height:42px; padding:8px 10px; border:1px solid #e5e7eb; border-radius:9px; background:#fff; }
.contact-dnd-option input { margin:0; }
@media (max-width:800px){ .contacts-toolbar{display:grid}.contacts-search-label{min-width:0}.contact-detail-heading{flex-direction:column}.contact-detail-grid,.contact-custom-fields,.contact-edit-grid{grid-template-columns:1fr} }
/* Platform Expansion P2-B — Contacts create */
.contacts-heading-actions { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
#contact-create-panel { margin-top:14px; }
.contact-create-card { border:1px solid #dfe5ea; border-radius:14px; padding:16px; background:#fbfcfd; }
@media (max-width:800px){ .contacts-heading-actions{width:100%} .contacts-heading-actions button{flex:1 1 auto} }

/* Platform Expansion P3-A — Contacts CSV local preview/validation (no writes) */
#contacts-csv-import-panel { margin-top:14px; }
.csv-import-card { border:1px solid #dfe5ea; border-radius:14px; padding:16px; background:#fbfcfd; }
.csv-drop-zone { display:grid; gap:7px; place-items:center; min-height:128px; margin-top:14px; padding:18px; border:2px dashed #cfd6dd; border-radius:12px; background:#fff; cursor:pointer; text-align:center; outline:none; }
.csv-drop-zone:hover,.csv-drop-zone:focus,.csv-drop-zone.dragging { border-style:solid; box-shadow:0 0 0 3px rgba(35,74,117,.08); }
.csv-import-actions { display:flex; gap:8px; align-items:center; flex-wrap:wrap; margin-top:12px; }
.csv-import-actions .form-status { flex:1 1 320px; }
.csv-preview-result { margin-top:16px; display:grid; gap:16px; }
.csv-preview-title { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; }
.csv-preview-title h3,.csv-preview-title p { margin:0; }
.csv-preview-title p { margin-top:4px; }
.csv-stats { display:grid; grid-template-columns:repeat(5,minmax(120px,1fr)); gap:9px; }
.csv-stats > div { display:grid; gap:5px; padding:11px 12px; border:1px solid #e2e7eb; border-radius:10px; background:#fff; }
.csv-stats small { color:#69707a; }
.csv-stats strong { font-size:20px; }
.csv-badge { display:inline-flex; width:max-content; align-items:center; min-height:25px; padding:3px 8px; border-radius:999px; font-size:12px; font-weight:700; white-space:nowrap; }
.csv-badge.success { background:#e9f7ef; color:#17633a; }
.csv-badge.warning { background:#fff6df; color:#7c5a00; }
.csv-badge.error { background:#fff0f0; color:#8a2b2b; }
.csv-badge.neutral { background:#eef1f4; color:#59616a; }
.csv-alert { padding:11px 13px; border-radius:10px; border:1px solid #e1e5ea; background:#fff; line-height:1.7; overflow-wrap:anywhere; }
.csv-alert.success { background:#eef9f2; border-color:#c9e8d4; color:#17633a; }
.csv-alert.warning { background:#fff9eb; border-color:#eedda9; color:#705800; }
.csv-alert.error { background:#fff1f1; border-color:#efcdcd; color:#842c2c; }
.csv-alert code,.csv-mapping-table code { direction:ltr; unicode-bidi:plaintext; }
.csv-mapping-section h4,.csv-data-section h4 { margin:0 0 6px; }
.csv-mapping-section p { margin:0 0 10px; }
.csv-mapping-table { min-width:620px; }
.csv-preview-table { min-width:980px; }
.csv-preview-table-wrap { max-height:520px; overflow:auto; border:1px solid #e3e7eb; border-radius:10px; }
.csv-preview-table-wrap thead th { position:sticky; top:0; z-index:1; background:#f7f8fa; }
.csv-row-issues { min-width:260px; max-width:420px; line-height:1.55; }
.csv-row-issues > div + div { margin-top:4px; }
.csv-preview-limit { margin:0 0 8px; }
@media (max-width:900px){ .csv-stats{grid-template-columns:repeat(2,minmax(0,1fr))}.csv-preview-title{flex-direction:column}.csv-import-actions{display:grid}.csv-import-actions .form-status{min-width:0} }

/* Platform Expansion P3-B — controlled Contacts CSV execution */
.csv-execution-section { display:grid; gap:14px; padding-top:4px; border-top:1px solid #e4e8ec; }
.csv-execution-section h4,.csv-execution-section p { margin:0; }
.csv-execution-section p { margin-top:5px; }
.csv-mode-options { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }
.csv-mode-option { display:flex; align-items:flex-start; gap:10px; padding:12px; border:1px solid #dfe4e8; border-radius:11px; background:#fff; cursor:pointer; }
.csv-mode-option input { width:auto; margin:4px 0 0; flex:0 0 auto; }
.csv-mode-option span { display:grid; gap:4px; }
.csv-mode-option small { color:#69707a; line-height:1.6; }
.csv-import-confirm { display:flex; align-items:flex-start; gap:9px; padding:11px 12px; border:1px solid #dfe4e8; border-radius:10px; background:#fff; }
.csv-import-confirm input { width:auto; margin:4px 0 0; flex:0 0 auto; }
.csv-execution-actions { display:flex; gap:10px; align-items:center; flex-wrap:wrap; }
.csv-execution-actions .form-status { flex:1 1 320px; }
.csv-import-progress { display:grid; gap:7px; }
.csv-progress-track { height:10px; overflow:hidden; border-radius:999px; background:#e8ecef; }
.csv-progress-track span { display:block; width:0; height:100%; background:currentColor; transition:width .2s ease; }
.csv-import-result-summary { display:grid; grid-template-columns:repeat(6,minmax(90px,1fr)); gap:8px; margin-top:2px; }
.csv-import-result-summary span { display:grid; gap:3px; padding:9px 10px; border:1px solid #e2e6ea; border-radius:9px; background:#fff; }
.csv-import-results-wrap { max-height:420px; overflow:auto; margin-top:10px; border:1px solid #e3e7eb; border-radius:10px; }
.csv-import-results-wrap table { min-width:760px; }
.csv-import-results-wrap thead th { position:sticky; top:0; z-index:1; background:#f7f8fa; }
.csv-alert ul { margin:8px 0 0; padding-inline-start:22px; }
.csv-alert li + li { margin-top:5px; }
@media (max-width:900px){ .csv-mode-options{grid-template-columns:1fr}.csv-import-result-summary{grid-template-columns:repeat(2,minmax(0,1fr))}.csv-execution-actions{display:grid}.csv-execution-actions .form-status{min-width:0} }


/* Platform Expansion P3-C — server-generated Contacts CSV export */
#contacts-csv-export-panel { margin-top:14px; }
.csv-export-card { display:grid; gap:14px; border:1px solid #dfe5ea; border-radius:14px; padding:16px; background:#fbfcfd; }
.csv-export-options { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }
.disabled-option { opacity:.58; cursor:not-allowed; }
.csv-export-card .csv-import-confirm span { display:grid; gap:4px; }
.csv-export-card .csv-import-confirm small { color:#69707a; line-height:1.6; }
@media (max-width:900px){ .csv-export-options{grid-template-columns:1fr} }

/* P3-C selection export */
.contacts-selection-bar { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:10px 12px; margin:10px 0; border:1px solid #dfe5ea; border-radius:12px; background:#fbfcfd; }
.contacts-selection-bar > div:first-child { display:grid; gap:3px; }
.contacts-selection-bar small { color:#69707a; }
.contacts-selection-actions { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.contact-select-cell { width:42px; min-width:42px; text-align:center !important; }
.contact-select-label { display:inline-flex; align-items:center; justify-content:center; margin:0; }
.contact-select-label input { width:18px !important; height:18px !important; min-width:18px; margin:0; cursor:pointer; accent-color:currentColor; }
@media (max-width:900px){ .contacts-selection-bar{align-items:stretch; flex-direction:column} .contacts-selection-actions{justify-content:flex-start} }


/* PLATFORM_P9C_INBOX_UI_REFRESH_20260914 — read-only Unified Inbox */
.inbox-layout { display:grid; grid-template-columns:minmax(260px, .9fr) minmax(0, 1.6fr); gap:14px; margin-top:12px; min-height:440px; }
.inbox-list-card,.inbox-thread-card { min-width:0; border:1px solid #e1e5ea; border-radius:14px; background:#fbfcfd; overflow:hidden; }
.inbox-section-heading { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:13px 14px; border-bottom:1px solid #e7eaee; background:#fff; }
.inbox-conversations { max-height:620px; overflow:auto; }
.inbox-conversation-row { width:100%; border:0; border-bottom:1px solid #edf0f2; background:#fff; padding:13px 14px; display:grid; gap:6px; text-align:right; font:inherit; color:inherit; cursor:default; }
.inbox-conversation-row:last-child { border-bottom:0; }
.inbox-conversation-row.selected { background:#f3f7fb; }
.inbox-conversation-top { display:flex; justify-content:space-between; gap:10px; align-items:center; }
.inbox-conversation-preview { color:#5f6770; font-size:13px; line-height:1.55; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.inbox-unread-badge { display:inline-flex; min-width:24px; height:24px; align-items:center; justify-content:center; border-radius:999px; padding:0 7px; background:#17191c; color:#fff; font-size:12px; }
.inbox-messages { min-height:380px; max-height:620px; overflow:auto; padding:14px; display:grid; gap:10px; align-content:start; }
.inbox-message { max-width:min(82%,720px); border:1px solid #e1e5ea; border-radius:14px; padding:10px 12px; background:#fff; display:grid; gap:6px; overflow-wrap:anywhere; }
.inbox-message.outbound { margin-inline-start:auto; background:#f2f6fb; border-color:#dbe6f1; }
.inbox-message.inbound { margin-inline-end:auto; }
.inbox-message-meta { display:flex; gap:8px; flex-wrap:wrap; color:#69707a; font-size:11px; }
.inbox-message-body { white-space:pre-wrap; line-height:1.65; font-size:14px; }
.inbox-message-attachment { font-size:12px; color:#69707a; }
@media (max-width:900px){
  .inbox-layout { grid-template-columns:1fr; min-height:0; }
  .inbox-conversations { max-height:300px; }
  .inbox-messages { max-height:520px; }
  .inbox-message { max-width:92%; }
}


/* PLATFORM_P10A_PWA_MOBILE_20260914 */
html,body { min-width:0; min-height:100%; overflow-x:hidden; }
body { min-height:100dvh; }
button,select,input,textarea { touch-action:manipulation; }
button,.primary,.secondary,.danger,select,input[type="text"],input[type="email"],input[type="password"],input[type="search"] { min-height:44px; }
.login-view {
  min-height:100dvh;
  padding-top:max(24px, env(safe-area-inset-top));
  padding-right:max(24px, env(safe-area-inset-right));
  padding-bottom:max(24px, env(safe-area-inset-bottom));
  padding-left:max(24px, env(safe-area-inset-left));
}
.app-shell { height:100dvh; min-height:0; }
.sidebar {
  height:100dvh;
  padding-top:max(24px, env(safe-area-inset-top));
  padding-right:max(16px, env(safe-area-inset-right));
  padding-bottom:max(16px, env(safe-area-inset-bottom));
  padding-left:max(16px, env(safe-area-inset-left));
}
.sidebar nav button { min-height:44px; }
.app-shell main {
  height:100dvh;
  padding-top:max(32px, env(safe-area-inset-top));
  padding-right:max(32px, env(safe-area-inset-right));
  padding-bottom:max(32px, env(safe-area-inset-bottom));
  padding-left:max(32px, env(safe-area-inset-left));
}
.network-status {
  position:fixed;
  z-index:10000;
  top:max(10px, env(safe-area-inset-top));
  left:max(10px, env(safe-area-inset-left));
  right:max(10px, env(safe-area-inset-right));
  margin:auto;
  width:min(720px, calc(100vw - 20px));
  padding:10px 14px;
  border:1px solid #eedda9;
  border-radius:12px;
  background:#fff9eb;
  color:#705800;
  text-align:center;
  line-height:1.6;
  box-shadow:0 10px 30px rgba(0,0,0,.08);
}
@media (max-width:800px){
  .app-shell {
    height:100dvh;
    grid-template-rows:auto minmax(0,1fr);
  }
  .sidebar {
    height:auto;
    padding-top:max(10px, env(safe-area-inset-top));
    padding-right:max(12px, env(safe-area-inset-right));
    padding-bottom:10px;
    padding-left:max(12px, env(safe-area-inset-left));
  }
  .sidebar nav button { min-height:44px; padding:10px 12px; }
  .app-shell main {
    height:100%;
    padding-top:16px;
    padding-right:max(16px, env(safe-area-inset-right));
    padding-bottom:max(16px, env(safe-area-inset-bottom));
    padding-left:max(16px, env(safe-area-inset-left));
  }
  header { gap:12px; }
  .header-actions { gap:8px; }
  .header-actions > * { width:100%; }
  .panel { padding:16px; }
  .table-wrap { -webkit-overflow-scrolling:touch; }
  .inbox-conversations,.inbox-messages,.sidebar nav { -webkit-overflow-scrolling:touch; }
}


/* PLATFORM_P10B_MOBILE_INTERACTIVE_20260914 */

/* Keep wide data sets inside their own scroll containers instead of widening the page. */
.table-wrap,
.csv-preview-table-wrap,
.csv-import-results-wrap {
  max-width:100%;
  overscroll-behavior-inline:contain;
  scrollbar-gutter:stable;
  touch-action:pan-x pan-y;
}

/* Standalone mode is UI-only awareness; backend/session behavior is unchanged. */
html.pwa-standalone .app-shell main,
html.pwa-standalone .sidebar {
  overscroll-behavior:contain;
}

/* Unified Inbox: bounded internal scrolling and readable message geometry on phones. */
@media (max-width:600px){
  .inbox-panel { padding:12px; }
  .inbox-panel .panel-heading { gap:10px; }
  .inbox-panel .panel-heading > div { min-width:0; }
  .inbox-panel #inbox-refresh { width:100%; }
  .inbox-layout { gap:10px; margin-top:10px; }
  .inbox-list-card,.inbox-thread-card { border-radius:12px; }
  .inbox-section-heading { padding:11px 12px; gap:8px; }
  .inbox-section-heading .muted { font-size:12px; }
  .inbox-conversations {
    max-height:min(32dvh,240px);
    overscroll-behavior:contain;
    scrollbar-gutter:stable;
  }
  .inbox-conversation-row {
    min-height:54px;
    padding:11px 12px;
    gap:5px;
    touch-action:pan-y;
  }
  .inbox-conversation-top { gap:8px; min-width:0; }
  .inbox-conversation-preview { min-width:0; }
  .inbox-messages {
    min-height:280px;
    max-height:min(50dvh,480px);
    padding:10px;
    gap:8px;
    overscroll-behavior:contain;
    scrollbar-gutter:stable;
  }
  .inbox-message {
    max-width:100%;
    padding:10px;
    border-radius:12px;
  }
  .inbox-message-meta { gap:6px; }
  .inbox-message-body { font-size:14px; line-height:1.6; }
  .inbox-panel > .info-note { margin-bottom:0; }

  /* Existing tables stay tables, but scrolling remains explicitly local and touch-friendly. */
  .table-wrap,
  .csv-preview-table-wrap,
  .csv-import-results-wrap {
    overflow-x:auto;
    -webkit-overflow-scrolling:touch;
  }

  /* Actions/forms that were still capable of forcing phone-width overflow. */
  .row-actions { min-width:0; white-space:normal; display:flex; flex-wrap:wrap; gap:6px; }
  .commerce-currency-controls label { min-width:0; width:100%; }
  .refund-current { flex-direction:column; }
  .staff-row-actions,
  .brand-kit-actions,
  .shipping-zone-actions,
  .contacts-selection-actions,
  .csv-execution-actions {
    width:100%;
    align-items:stretch;
  }
  .staff-row-actions > *,
  .brand-kit-actions > button,
  .shipping-zone-actions > button,
  .contacts-selection-actions > button,
  .csv-execution-actions > button {
    flex:1 1 100%;
    width:100%;
  }
  .csv-stats,
  .csv-import-result-summary {
    grid-template-columns:1fr;
  }
}

/* Very narrow installed/browser surfaces get slightly tighter shell spacing. */
@media (max-width:420px){
  .app-shell main { padding-inline:max(12px, env(safe-area-inset-left)); }
  .panel { padding:14px; }
  .inbox-panel { padding:10px; }
  .inbox-conversations { max-height:min(30dvh,220px); }
  .inbox-messages { min-height:260px; max-height:min(48dvh,440px); }
}
