:root {
  font-family: Inter, "Noto Sans Arabic", "Segoe UI", Tahoma, system-ui, sans-serif;
  color: #17231e;
  background: #f4f6f5;
  font-synthesis: none;
  --brand: #176b50;
  --brand-dark: #0f4e3a;
  --brand-soft: #e0f1ea;
  --amber: #d99828;
  --border: #dbe3df;
  --muted: #63736b;
  --danger: #a63232;
  --surface: #fff;
  --shadow: 0 8px 30px rgba(19, 61, 45, .07);
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
a { color: var(--brand-dark); }
button, input, select { font: inherit; }
button, input, select { min-height: 42px; border-radius: 9px; }
input, select { width: 100%; padding: 9px 11px; color: #17231e; background: #fff; border: 1px solid #bfcac4; }
input:focus, select:focus, button:focus-visible, summary:focus-visible, a:focus-visible { outline: 3px solid rgba(23, 107, 80, .24); outline-offset: 2px; }
button { padding: 9px 15px; color: #fff; background: var(--brand); border: 1px solid var(--brand); font-weight: 720; cursor: pointer; }
button:hover { background: var(--brand-dark); }
button.secondary { color: var(--brand-dark); background: #fff; border-color: #b9c8c1; }
button.secondary:hover { background: #f0f6f3; }
button.danger { color: var(--danger); border-color: #e0b9b9; }
button.text-button { min-height: 32px; padding: 4px 0; color: var(--brand); background: transparent; border: 0; text-align: left; }
[dir="rtl"] button.text-button, [dir="rtl"] th, [dir="rtl"] td { text-align: right; }

.app-header { height: 68px; padding: 0 max(24px, calc((100vw - 1440px) / 2)); display: flex; align-items: center; justify-content: space-between; color: #fff; background: var(--brand-dark); border-bottom: 3px solid var(--amber); }
.brand { display: flex; align-items: center; gap: 11px; color: #fff; text-decoration: none; }
.brand-mark { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 11px; color: var(--brand-dark); background: #fff7e6; font-size: 25px; font-weight: 900; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 17px; }
.brand small { margin: 1px 0 0; color: #cfe0d9; font-size: 11px; }
.app-header nav { display: flex; align-items: center; gap: 10px; }
.app-header nav a { padding: 8px 11px; color: #e9f2ee; text-decoration: none; border-radius: 8px; }
.app-header nav a:hover { background: rgba(255,255,255,.1); }
.app-header nav .sign-out { border: 1px solid rgba(255,255,255,.28); }
.app-header nav .language-switch { color: #2b2417; background: #fff1d4; font-weight: 800; }
.page-shell { width: min(1440px, calc(100% - 48px)); margin: 0 auto; padding: 34px 0 56px; }
.page-heading { margin-bottom: 23px; display: flex; align-items: flex-end; justify-content: space-between; gap: 22px; }
.page-heading h1 { margin: 1px 0 6px; font-size: clamp(28px, 4vw, 40px); line-height: 1.12; letter-spacing: -.035em; }
.page-heading p { margin: 0; color: var(--muted); }
.eyebrow { color: var(--brand) !important; font-size: 12px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.breadcrumbs { margin-bottom: 19px; display: flex; gap: 8px; color: var(--muted); font-size: 14px; }
.breadcrumbs a { text-decoration: none; }

.stat-grid { margin-bottom: 23px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.stat-card { min-height: 105px; padding: 18px 20px; display: flex; flex-direction: column; justify-content: space-between; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); }
.stat-card span { color: var(--muted); font-size: 13px; font-weight: 650; }
.stat-card strong { font-size: 29px; line-height: 1; }
.stat-card.positive { border-top: 3px solid #2a9668; }
.stat-card.warning { border-top: 3px solid var(--amber); }
.stat-card.muted { border-top: 3px solid #7c8983; }

.panel, .card { margin-bottom: 20px; padding: 22px; background: var(--surface); border: 1px solid var(--border); border-radius: 15px; box-shadow: var(--shadow); min-width: 0; }
.card h2 { margin: 0 0 14px; font-size: 19px; }
.card > label { margin-bottom: 14px; }
.card button + button { margin-inline-start: 10px; margin-block-start: 8px; }
.card dd, .card p { overflow-wrap: anywhere; }
.filter-bar { display: flex; flex-wrap: wrap; gap: 14px; align-items: end; margin-bottom: 20px; }
.filter-bar label { flex: 1 1 180px; min-width: 0; }
.list-panel { padding: 0; overflow: hidden; }
.panel-heading { padding-bottom: 17px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.list-panel > .panel-heading { padding: 21px 22px 17px; }
.panel h2, .form-dialog h2 { margin: 0 0 4px; font-size: 19px; letter-spacing: -.015em; }
.panel-heading p, .dialog-heading p { margin: 0; color: var(--muted); font-size: 13px; }
.content-grid { display: grid; grid-template-columns: minmax(320px, .82fr) minmax(480px, 1.18fr); gap: 20px; }

.filters { display: flex; align-items: center; gap: 8px; }
.filters input { width: 230px; }
.filters select { width: 145px; }
.table-wrap { overflow-x: auto; border-top: 1px solid var(--border); }
table { width: 100%; min-width: 980px; border-collapse: collapse; }
th, td { padding: 15px 17px; text-align: left; vertical-align: top; border-bottom: 1px solid #e6ebe8; }
th { color: #53635b; background: #f8faf9; font-size: 11px; letter-spacing: .065em; text-transform: uppercase; }
tbody tr:hover { background: #fbfdfc; }
tbody tr:last-child td { border-bottom: 0; }
.shop-link { color: #153e2f; font-weight: 780; text-decoration: none; }
small { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; font-weight: 500; }
.technical { max-width: 280px; overflow: hidden; text-overflow: ellipsis; font-family: "Cascadia Mono", Consolas, monospace; }
.status, .meta-pill { width: fit-content; display: inline-flex; align-items: center; padding: 5px 9px; border-radius: 999px; font-size: 12px; font-weight: 750; text-transform: capitalize; }
.status { color: #42534b; background: #e9eeeb; }
.status.active { color: #14613f; background: #d9f2e5; }
.status.suspended, .status.expired { color: #952d2d; background: #fae3e3; }
.meta-pill { color: #315447; background: #ecf3f0; white-space: nowrap; }
.date-editor { min-width: 335px; display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.date-editor label { color: var(--muted); font-size: 10px; }
.date-editor input { min-height: 36px; padding: 6px 7px; font-size: 12px; }
.date-editor .text-button { grid-column: 1 / -1; }
.account-control { min-width: 190px; display: grid; gap: 7px; }
.empty-state { padding: 44px !important; color: var(--muted); text-align: center !important; }
.empty-state strong, .empty-state span { display: block; }

label { display: grid; gap: 6px; color: #33433b; font-size: 13px; font-weight: 700; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; align-items: end; }
.stacked-form { display: grid; gap: 17px; }
.form-section { padding: 19px 0; border-bottom: 1px solid var(--border); }
.form-section h3 { margin: 0 0 13px; font-size: 14px; }
fieldset { margin: 0; padding: 13px; border: 1px solid var(--border); border-radius: 10px; }
legend { padding: 0 6px; color: #33433b; font-size: 12px; font-weight: 750; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 7px 12px; }
.check { display: flex; flex-direction: row; align-items: center; gap: 8px; font-weight: 570; }
.check input { width: 17px; min-height: 17px; margin: 0; accent-color: var(--brand); }
.form-actions { display: flex; justify-content: flex-end; }
.password-field { display: flex; }
.password-field input { border-radius: 9px 0 0 9px; }
.password-field button { min-height: 42px; padding: 7px 10px; color: var(--brand-dark); background: #edf4f1; border: 1px solid #bfcac4; border-left: 0; border-radius: 0 9px 9px 0; }
[dir="rtl"] .password-field input { border-radius: 0 9px 9px 0; }
[dir="rtl"] .password-field button { border-right: 0; border-left: 1px solid #bfcac4; border-radius: 9px 0 0 9px; }
.clean-list { margin: 0; padding: 0; list-style: none; }
.clean-list li { padding: 13px 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid #e5ebe8; }
.inline-creator { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.inline-creator summary, .action-menu summary { color: var(--brand); font-weight: 750; cursor: pointer; }
.inline-creator form { margin-top: 14px; }
.action-menu { position: relative; min-width: 270px; }
.action-menu[open] { padding: 13px; background: #f7faf8; border: 1px solid var(--border); border-radius: 10px; }
.reset-form { margin: 13px 0; padding-bottom: 13px; display: grid; gap: 10px; border-bottom: 1px solid var(--border); }
.full-width { width: 100%; }

.form-dialog { width: min(760px, calc(100% - 28px)); max-height: calc(100vh - 40px); padding: 0; color: inherit; background: #fff; border: 0; border-radius: 17px; box-shadow: 0 24px 90px rgba(9, 38, 27, .28); }
.form-dialog::backdrop { background: rgba(14, 36, 28, .54); backdrop-filter: blur(2px); }
.form-dialog > form { padding: 25px 28px; }
.form-dialog .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.wide { grid-column: 1 / -1; }
.configuration-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 430px), 1fr)); gap: 18px; }
.configuration-grid .panel { min-width: 0; }
.compact-scroll { max-height: 360px; margin-top: 16px; overflow: auto; border-top: 1px solid var(--border); }
.configuration-row { min-height: 46px; display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 10px; border-bottom: 1px solid var(--border); }
.map-picker { display: grid; gap: 10px; }
.map-search { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.map-results { display: grid; gap: 5px; }
.map-result { padding: 9px 11px; color: var(--text); background: #f4f7f5; border: 1px solid var(--border); text-align: start; }
.map-canvas { min-height: 280px; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.coordinate-row { display: grid; grid-template-columns: 1fr 1fr auto; align-items: end; gap: 8px; }
.branch-config { margin-top: 12px; padding: 12px; background: #f8faf9; border: 1px solid var(--border); border-radius: 12px; }
.branch-config > summary { color: var(--brand-dark); font-weight: 750; cursor: pointer; }
.branch-config > form, .branch-config > .table-wrap { margin-top: 16px; }
.config-divider { padding-top: 16px; border-top: 1px solid var(--border); }
.dialog-heading { display: flex; justify-content: space-between; gap: 20px; }
.icon-button { width: 38px; min-height: 38px; height: 38px; padding: 0; color: #53635b; background: #f2f5f3; border: 0; border-radius: 50%; font-size: 24px; }
.dialog-actions { padding-top: 19px; display: flex; justify-content: flex-end; gap: 9px; }

.flash { margin-bottom: 18px; padding: 14px 16px; color: #254438; background: #e3f1eb; border: 1px solid #bbd9cc; border-radius: 11px; font-weight: 650; }
.flash.error { color: #852828; background: #fbe6e6; border-color: #e6b9b9; }
.flash.credential { color: #744d0c; background: #fff2d7; border-color: #e7c57c; }
.login-page { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(circle at 20% 15%, #e0f2ea, #f4f7f5 55%); }
.login-card { width: min(420px, calc(100% - 30px)); padding: 35px; background: #fff; border: 1px solid var(--border); border-radius: 20px; box-shadow: 0 22px 70px rgba(15,78,58,.14); }
.login-card { position: relative; }
.login-language { position: absolute; inset-block-start: 18px; inset-inline-end: 18px; padding: 6px 10px; color: var(--brand-dark); background: var(--brand-soft); border-radius: 999px; font-size: 12px; font-weight: 800; text-decoration: none; }
.login-card .mark { width: 52px; height: 52px; display: grid; place-items: center; color: #fff; background: var(--brand); border-radius: 14px; font-size: 30px; font-weight: 900; }
.login-card form { display: grid; gap: 14px; }
.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; }

.guide { color: #17231e; }
.guide-hero { margin-bottom: 24px; padding: 30px; display: flex; align-items: center; justify-content: space-between; gap: 24px; color: #fff; background: linear-gradient(130deg, var(--brand-dark), #197354); border-radius: 18px; box-shadow: var(--shadow); }
.guide-hero h1 { margin: 3px 0 7px; font-size: clamp(27px, 4vw, 42px); }
.guide-hero p { margin: 0; color: #d8ebe3; }
.guide-hero .eyebrow { color: #f0b44d !important; }
.guide-layout { display: grid; grid-template-columns: 230px minmax(0, 820px); justify-content: center; gap: 24px; align-items: start; }
.guide-toc { position: sticky; top: 20px; padding: 18px; background: #fff; border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); }
.guide-toc strong { display: block; margin-bottom: 9px; }
.guide-toc nav { display: grid; }
.guide-toc a { padding: 8px 7px; color: #41534b; text-decoration: none; border-bottom: 1px solid #edf1ef; font-size: 13px; }
.guide-toc a:hover { color: var(--brand); background: #f1f7f4; }
.guide-content { display: grid; gap: 16px; }
.guide-content section { scroll-margin-top: 20px; padding: 25px 28px; background: #fff; border: 1px solid var(--border); border-radius: 15px; box-shadow: var(--shadow); }
.guide-content h2 { margin: -31px 48px 16px 0; font-size: 21px; }
.guide-content h3 { margin: 19px 0 7px; color: var(--brand-dark); font-size: 15px; }
.guide-content p, .guide-content li, .guide-content dd { color: #35463e; line-height: 1.9; }
.guide-content ol, .guide-content ul { margin: 0; padding-right: 22px; }
.guide-content li + li { margin-top: 5px; }
.step-number { width: 37px; height: 37px; display: grid; place-items: center; color: #fff; background: var(--brand); border-radius: 11px; font-weight: 900; }
.guide-note { margin-top: 16px; padding: 13px 15px; color: #694a15; background: #fff4dd; border-right: 4px solid var(--amber); border-radius: 9px; line-height: 1.7; }
.guide[dir="ltr"] .guide-content h2 { margin: -31px 0 16px 48px; }
.guide[dir="ltr"] .guide-content ol, .guide[dir="ltr"] .guide-content ul { padding-left: 22px; padding-right: 0; }
.guide[dir="ltr"] .guide-note { border-right: 0; border-left: 4px solid var(--amber); }
.guide-content dl { margin: 0; }
.guide-content dt { margin-top: 13px; color: var(--brand-dark); font-weight: 800; }
.guide-content dd { margin: 3px 0 0; }

.catalog-review { overflow: visible; }
.bulk-review-bar { position: sticky; top: 76px; z-index: 5; display: flex; align-items: center; gap: 18px; justify-content: space-between; padding: 14px 18px; background: #fff8e8; border-block: 1px solid #ead6a6; }
.bulk-review-bar > span { color: var(--muted); flex: 1; }
.bulk-review-bar > div { display: flex; gap: 8px; }
.catalog-shop-group { margin: 18px; border: 1px solid var(--border); border-radius: 16px; overflow: hidden; background: #fff; }
.catalog-shop-group > header { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; padding: 16px 18px; background: #f5f9f7; border-bottom: 1px solid var(--border); }
.catalog-shop-group h3, .catalog-shop-group p { margin: 0; }
.catalog-shop-group p { color: var(--muted); margin-top: 3px; }
.catalog-select-store { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; }
.catalog-clickable-row { cursor: pointer; }
.catalog-clickable-row:hover, .catalog-clickable-row:focus-visible { background: #f1faf6; outline: 2px solid #75bda0; outline-offset: -2px; }
.check-column { width: 44px; text-align: center; }
.catalog-detail-dialog { width: min(1000px, calc(100vw - 28px)); max-height: calc(100vh - 28px); border: 0; border-radius: 22px; padding: 0; overflow: auto; box-shadow: 0 28px 80px rgb(0 43 31 / 26%); }
.catalog-detail-dialog::backdrop { background: rgb(0 31 23 / 55%); }
.dialog-heading { position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; align-items: flex-start; padding: 20px 24px; background: #fff; border-bottom: 1px solid var(--border); }
.dialog-heading h2, .dialog-heading p { margin: 0; }
.icon-button { min-width: 42px; min-height: 42px; padding: 4px; font-size: 24px; }
.catalog-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; padding: 22px 24px; }
.catalog-detail-grid section { min-width: 0; }
.catalog-detail-grid dl { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.catalog-detail-grid dl div { padding: 10px 12px; background: #f6f8f7; border-radius: 10px; min-width: 0; }
.catalog-detail-grid dl .wide { grid-column: 1 / -1; }
.catalog-detail-grid dt { color: var(--muted); font-size: .8rem; }
.catalog-detail-grid dd { margin: 4px 0 0; overflow-wrap: anywhere; }
.catalog-detail-grid pre { max-height: 240px; overflow: auto; padding: 12px; border-radius: 10px; background: #10231d; color: #e9fff6; text-align: left; }
.catalog-product-image { display: block; max-width: 220px; max-height: 220px; object-fit: contain; margin-top: 14px; border-radius: 12px; border: 1px solid var(--border); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 24px; border-top: 1px solid var(--border); }

@media (max-width: 1200px) {
  .app-header { gap: 16px; }
  .app-header .brand { flex: 0 0 auto; }
  .app-header nav { flex: 1 1 0; min-width: 0; overflow-x: auto; overscroll-behavior-x: contain; }
  .app-header nav a { flex: 0 0 auto; white-space: nowrap; }
}
@media (max-width: 980px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .content-grid { grid-template-columns: 1fr; }
  .panel-heading { align-items: flex-start; flex-direction: column; }
  .filters { width: 100%; }
  .filters input { flex: 1; width: auto; }
  .guide-layout { grid-template-columns: 1fr; }
  .guide-toc { position: static; }
  .guide-toc nav { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 620px) {
  .app-header { padding: 0 15px; gap: 12px; }
  .app-header nav { max-width: calc(100vw - 86px); overflow-x: auto; scrollbar-width: none; }
  .app-header nav::-webkit-scrollbar { display: none; }
  .app-header nav a { white-space: nowrap; }
  .brand small, .app-header nav > a:first-child { display: none; }
  .page-shell { width: min(100% - 24px, 1440px); padding-top: 23px; }
  .page-heading { align-items: stretch; flex-direction: column; }
  .primary-action { width: 100%; }
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
  .stat-card { min-height: 90px; padding: 14px; }
  .filters { display: grid; grid-template-columns: 1fr; }
  .filters input, .filters select { width: 100%; }
  .panel { padding: 17px; }
  .list-panel { padding: 0; }
  .form-dialog > form { padding: 21px 18px; }
  .dialog-actions button { flex: 1; }
  .form-dialog .form-grid { grid-template-columns: 1fr; }
  .table-wrap:has(.mobile-cards) { overflow: visible; border-top: 0; }
  .mobile-cards { min-width: 0; display: block; }
  .mobile-cards thead { display: none; }
  .mobile-cards tbody { padding: 0 12px 12px; display: grid; gap: 12px; }
  .mobile-cards tr { padding: 14px; display: grid; gap: 11px; background: #fff; border: 1px solid var(--border); border-radius: 12px; }
  .mobile-cards td { padding: 0; display: grid; grid-template-columns: minmax(95px, .38fr) 1fr; gap: 11px; align-items: start; border: 0; }
  .mobile-cards td::before { content: attr(data-label); color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .045em; text-transform: uppercase; }
  .mobile-cards .date-editor, .mobile-cards .account-control { min-width: 0; }
  .mobile-cards .date-editor { grid-template-columns: minmax(0, 1fr); }
  .mobile-cards .date-editor label,
  .mobile-cards .date-editor input { min-width: 0; width: 100%; }
  .mobile-cards .empty-state { display: block; }
  .guide-hero { padding: 22px; align-items: stretch; flex-direction: column; }
  .print-button { width: 100%; }
  .guide-toc nav { grid-template-columns: 1fr; }
  .guide-content section { padding: 21px 18px; }
  .bulk-review-bar { position: static; align-items: stretch; flex-direction: column; }
  .bulk-review-bar > div { display: grid; grid-template-columns: 1fr 1fr; }
  .catalog-shop-group { margin: 10px; }
  .catalog-shop-group > header { grid-template-columns: 1fr auto; }
  .catalog-select-store { grid-column: 1 / -1; }
  .catalog-detail-grid { grid-template-columns: 1fr; padding: 16px; }
}
@media print {
  body { background: #fff; }
  .app-header, .guide-toc, .print-button { display: none !important; }
  .page-shell { width: 100%; padding: 0; }
  .guide-hero { padding: 16px 0; color: #17231e; background: none; box-shadow: none; }
  .guide-hero p { color: #35463e; }
  .guide-layout { display: block; }
  .guide-content section { break-inside: avoid; box-shadow: none; }
}
