:root{--bg:#f5f7fb;--surface:#fff;--ink:#152033;--muted:#6d7788;--line:#e3e8f0;--accent:#2563eb;--accent-soft:#eaf2ff;--sidebar:#101827;--sidebar-muted:#9aa7bb;--success:#16835b;--shadow:0 12px 35px rgba(17,32,58,.07)}*{box-sizing:border-box}body{margin:0;font:14px/1.5 Poppins,Vazir,Tahoma,Arial,sans-serif;background:var(--bg);color:var(--ink)}a{text-decoration:none;color:inherit}.app-shell{display:flex;min-height:100vh}.sidebar{width:244px;background:var(--sidebar);color:white;padding:24px 16px;display:flex;flex-direction:column;gap:28px}.brand{display:flex;gap:12px;align-items:center;padding:4px 8px}.brand-mark{display:grid;place-items:center;width:36px;height:36px;border-radius:10px;background:var(--accent);font-weight:800}.brand strong{display:block;font-size:15px}.brand small{display:block;color:var(--sidebar-muted);font-size:11px;margin-top:2px}.brand.large{padding:0}.sidebar nav{display:flex;flex-direction:column;gap:5px}.sidebar nav a{padding:10px 12px;border-radius:9px;color:#d8e0ed}.sidebar nav a:hover,.sidebar nav a.active{background:#1d2a40;color:#fff}.nav-label{text-transform:uppercase;font-size:10px;letter-spacing:.13em;color:#66758c;margin:14px 12px 4px}.sidebar-footer{margin-top:auto;color:#66758c;font-size:11px;padding:0 8px}.main{flex:1;min-width:0}.topbar{height:84px;background:rgba(255,255,255,.85);backdrop-filter:blur(10px);border-bottom:1px solid var(--line);display:flex;align-items:center;justify-content:space-between;padding:0 34px;position:sticky;top:0;z-index:2}.topbar h1{font-size:22px;margin:2px 0 0}.eyebrow{font-size:10px;letter-spacing:.14em;color:var(--muted);font-weight:700;margin:0}.user-chip{display:flex;align-items:center;gap:10px}.user-chip>span{width:38px;height:38px;border-radius:50%;background:var(--accent-soft);color:var(--accent);display:grid;place-items:center;font-weight:800}.user-chip strong,.user-chip small{display:block}.user-chip strong{font-size:13px}.user-chip small{color:var(--muted);font-size:11px}.content{padding:34px;max-width:1280px;margin:auto}.hero{display:flex;justify-content:space-between;gap:20px;align-items:end;padding:28px 30px;border-radius:18px;background:linear-gradient(120deg,#132033,#263a5a);color:white;box-shadow:var(--shadow);margin-bottom:22px}.hero h2{font-size:28px;margin:8px 0}.hero p{margin:0;color:#c5d0df;max-width:690px}.badge{font-size:10px;letter-spacing:.13em;font-weight:800;color:#9fc2ff}.stats{display:grid;grid-template-columns:repeat(4,1fr);gap:16px;margin-bottom:22px}.stat,.panel:where(:not(.dashboard-shell *)){background:var(--surface);border:1px solid var(--line);border-radius:16px;box-shadow:var(--shadow)}.stat{padding:20px}.stat span,.stat small{display:block;color:var(--muted)}.stat strong{display:block;font-size:30px;margin:4px 0}.panel:where(:not(.dashboard-shell *)){overflow:hidden}.panel-head:where(:not(.dashboard-shell *)){display:flex;justify-content:space-between;align-items:center;padding:20px 22px;border-bottom:1px solid var(--line)}.panel-head h3:where(:not(.dashboard-shell *)){margin:0;font-size:16px}.panel-head p:where(:not(.dashboard-shell *)){margin:3px 0 0;color:var(--muted);font-size:12px}.panel-head a:where(:not(.dashboard-shell *)){color:var(--accent);font-size:12px;font-weight:700}.bar-row{display:grid;grid-template-columns:130px 1fr 30px;gap:12px;align-items:center;padding:12px 22px}.bar{height:8px;background:#edf0f5;border-radius:99px;overflow:hidden}.bar i{display:block;height:100%;background:var(--accent);border-radius:inherit}table{width:100%;border-collapse:collapse}th:where(:not(.dashboard-shell *)),td:where(:not(.dashboard-shell *)){padding:13px 20px;text-align:left;border-bottom:1px solid var(--line);font-size:13px}th:where(:not(.dashboard-shell *)){background:#fafbfc;font-size:11px;text-transform:uppercase;letter-spacing:.06em;color:var(--muted)}tr:last-child td:where(:not(.dashboard-shell *)){border-bottom:0}.muted:where(:not(.dashboard-shell *)){color:var(--muted)}code:where(:not(.dashboard-shell *)){background:#f2f4f7;padding:3px 6px;border-radius:6px;font-size:11px}.status{display:inline-flex;align-items:center;border-radius:99px;padding:4px 8px;font-size:11px;font-weight:700}.status{background:#f2f3f5;color:#7a8392}.status.on{background:#eaf8f1;color:var(--success)}.empty:where(:not(.dashboard-shell *)){text-align:center;color:var(--muted);padding:32px!important}.primary,.secondary{display:inline-flex;align-items:center;justify-content:center;border:0;border-radius:9px;padding:10px 15px;font-weight:700;cursor:pointer;font-size:13px}.primary{background:var(--accent);color:#fff}.secondary{background:#fff;border:1px solid var(--line);color:var(--ink)}.field:where(:not(.dashboard-shell *)){margin-bottom:18px}.field label:where(:not(.dashboard-shell *)){display:block;font-weight:700;margin-bottom:7px}.field input:where(:not(.dashboard-shell *)),.field select:where(:not(.dashboard-shell *)),.field textarea:where(:not(.dashboard-shell *)){width:100%;font:inherit;border:1px solid #ccd4e1;border-radius:9px;padding:10px 11px;background:#fff}.field select[multiple]:where(:not(.dashboard-shell *)){min-height:180px}.field input:focus:where(:not(.dashboard-shell *)),.field select:focus:where(:not(.dashboard-shell *)),.field textarea:focus:where(:not(.dashboard-shell *)){outline:2px solid #cfe0ff;border-color:#8eb5ff}.field small:where(:not(.dashboard-shell *)){display:block;color:var(--muted);margin-top:6px}.error:where(:not(.dashboard-shell *)){color:#b42318;font-size:12px;margin-top:5px}.form-footer:where(:not(.dashboard-shell *)){display:flex;justify-content:flex-end;gap:10px;padding-top:12px;border-top:1px solid var(--line)}.full{width:100%;margin-top:4px}.login-page{min-height:100vh;display:grid;place-items:center;background:linear-gradient(140deg,#eef4ff,#f7f9fc)}.login-card{width:min(420px,calc(100% - 32px));padding:32px;background:white;border:1px solid var(--line);border-radius:18px;box-shadow:var(--shadow)}.login-card h1{margin:28px 0 4px;font-size:26px}.login-card>p{color:var(--muted);margin-top:0;margin-bottom:24px}@media(max-width:1000px){.stats{grid-template-columns:1fr 1fr}.sidebar{width:210px}}@media(max-width:720px){.sidebar{display:none}.content{padding:20px}.topbar{padding:0 20px}.stats{grid-template-columns:1fr 1fr}.hero{align-items:start;flex-direction:column}.user-chip{display:none}th:where(:not(.dashboard-shell *)),td:where(:not(.dashboard-shell *)){padding:10px 12px}.panel:where(:not(.dashboard-shell *)){overflow:auto}.panel-head:where(:not(.dashboard-shell *)){min-width:650px}}

.flash-stack{display:grid;gap:8px;margin-bottom:16px}.flash{padding:11px 14px;border-radius:10px;border:1px solid var(--line);background:#fff;font-weight:600}.flash.success{background:#eefbf4;color:#12643f;border-color:#c9efd9}.flash.error:where(:not(.dashboard-shell *)){background:#fff1f0;color:#a5271d;border-color:#f4c5c0}.hero.compact{padding:22px 26px;margin-bottom:18px}.actions{white-space:nowrap}.inline-form{display:inline}.field-grid{display:grid;grid-template-columns:1fr 1.2fr 1fr auto;gap:14px}.checkbox-field{display:flex;align-items:end}.checkbox-field label{font-weight:700}.checkbox-field input{width:auto}.alert-panel{padding:18px 22px;margin-bottom:16px;background:#fff8f7;border-color:#f0c7c2}.alert-panel ul{margin:8px 0 0;padding-left:18px}.form-runtime{max-width:920px;padding:28px}.runtime-field{padding:16px;border:1px solid var(--line);border-radius:12px;background:#fff}.runtime-field label{display:block;font-weight:700;margin-bottom:7px}.runtime-field input,.runtime-field select,.runtime-field textarea{width:100%;font:inherit;border:1px solid #ccd4e1;border-radius:9px;padding:10px 11px;background:#fff}.runtime-field input[type=file]{padding:8px}.runtime-field small{display:block;color:var(--muted);margin-top:6px}.required{color:#b42318}.checkbox-label{font-weight:500!important}.checkbox-label input{width:auto}.success-meta{display:flex;justify-content:center;gap:10px;align-items:center;margin:22px auto;padding:13px 16px;border:1px solid var(--line);border-radius:10px;width:max-content;background:#fafbfc}.success-meta span{color:var(--muted)}@media(max-width:900px){.field-grid{grid-template-columns:1fr}}
/* Form Designer v1 */
.designer-preview{padding:18px}.drag-handle{color:#9aa6b7;cursor:grab}.designer-empty{padding:24px 10px;text-align:center;color:var(--muted)}.designer-preview{margin-top:18px}.preview-runtime{max-width:none;padding:4px;border:0;box-shadow:none}.runtime-page{margin-bottom:24px}.runtime-page-heading{border-bottom:1px solid var(--line);margin-bottom:16px;padding-bottom:10px}.runtime-page-heading span{font-size:10px;color:var(--muted);text-transform:uppercase;letter-spacing:.1em}.runtime-page-heading h3{margin:3px 0}.runtime-section{margin-bottom:18px}.runtime-section>h4{margin:0 0 10px}.runtime-row{display:flex;gap:16px;margin-bottom:16px}.runtime-column{min-width:0}.runtime-field{margin-bottom:12px}@media(max-width:850px){.runtime-row{flex-direction:column}}

/* Form Designer OSS Spike: Formeo is isolated to the authoring screen only. */
.formeo-designer-page{max-width:1500px;margin:0 auto}.formeo-designer-toolbar{display:flex;justify-content:space-between;align-items:flex-start;gap:24px;margin-bottom:16px}.formeo-designer-toolbar h2{margin:4px 0 6px}.formeo-designer-toolbar p{margin:0}.formeo-toolbar-actions{display:flex;gap:8px;flex-wrap:wrap}.formeo-form-meta{display:grid;grid-template-columns:minmax(220px,.8fr) minmax(320px,1.6fr) minmax(200px,.7fr);gap:14px;padding:16px 18px;background:#fff;border:1px solid var(--line);border-radius:14px 14px 0 0}.formeo-form-meta .field:where(:not(.dashboard-shell *)){margin:0}.formeo-workspace{padding:0;margin-top:12px;overflow:hidden;border-radius:14px}.formeo-workspace-head{display:flex;justify-content:space-between;align-items:center;gap:20px;padding:12px 16px;border-bottom:1px solid var(--line);background:#f8fafc}.formeo-workspace-head>div:first-child{display:flex;align-items:center;gap:9px}.formeo-workspace-head small{color:var(--muted)}.formeo-badge{display:inline-flex;align-items:center;padding:4px 8px;border-radius:999px;background:#eaf8f1;color:#12643f;font-size:11px;font-weight:800;text-transform:uppercase;letter-spacing:.04em}.formeo-workspace-help{font-size:12px;color:var(--muted);text-align:right}.isf-formeo-editor{min-height:640px;background:#f3f5f8}.isf-formeo-editor .formeo-wrap{min-height:640px}.formeo-load-error{padding:38px;text-align:center;background:#fff8f7;color:#8f2119}.formeo-load-error p{color:#6f443f}.formeo-license-note{margin-right:auto;color:var(--muted);font-size:12px}.formeo-designer-page .designer-preview{padding:18px}.formeo-designer-page .alert-panel{border:1px solid #f0c7c2;border-radius:10px;padding:14px;background:#fff8f7}.formeo-designer-page .formeo-wrap button,.formeo-designer-page .formeo-wrap input,.formeo-designer-page .formeo-wrap select,.formeo-designer-page .formeo-wrap textarea{font-family:inherit}.formeo-designer-page .formeo-wrap{font-family:inherit;color:var(--ink)}
@media(max-width:900px){.formeo-designer-toolbar,.formeo-workspace-head{flex-direction:column}.formeo-form-meta{grid-template-columns:1fr}.formeo-workspace-help{text-align:left}.isf-formeo-editor{min-height:760px}}

/* Form Designer v2 — professional workspace. Formeo stays isolated as the OSS drag/drop surface. */
.professional-designer-page{margin:-24px -28px -28px;min-height:calc(100vh - 84px);background:#eef2f7}.professional-errors{margin:16px 20px}.designer-commandbar{height:68px;display:flex;align-items:center;justify-content:space-between;gap:18px;padding:0 20px;background:#fff;border-bottom:1px solid #dfe5ee;position:sticky;top:84px;z-index:8;box-shadow:0 2px 10px rgba(20,35,60,.04)}.designer-title-cluster,.designer-title-row,.designer-command-actions,.canvas-toolbar,.canvas-toolbar-left,.device-switch,.settings-dialog-head,.settings-dialog-actions{display:flex;align-items:center}.designer-title-cluster{gap:12px;min-width:0}.designer-back{width:34px;height:34px;border:1px solid #dbe2ec;border-radius:9px;display:grid;place-items:center;font-size:18px;background:#fff}.designer-title-row{gap:8px}.designer-title-row h2{font-size:17px;margin:0;max-width:430px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.designer-title-cluster p{font-size:11px;color:#778399;margin:2px 0 0}.designer-version{font-size:10px;padding:2px 6px;border-radius:999px;background:#eef3fb;color:#53627a}.designer-oss-pill{font-size:9px;text-transform:uppercase;letter-spacing:.08em;font-weight:800;color:#19704b;background:#e9f8f1;border-radius:999px;padding:4px 7px}.designer-command-actions{gap:8px}.icon-action{min-width:34px;height:34px;border:1px solid #dbe2ec;background:#fff;border-radius:9px;display:grid;place-items:center;font-size:18px;cursor:pointer;color:#43516a}.icon-action:disabled{opacity:.35;cursor:not-allowed}.icon-action:hover:not(:disabled),.designer-back:hover{background:#f4f7fb}.command-divider{height:24px;width:1px;background:#dfe5ee;margin:0 2px}.designer-workspace{display:grid;grid-template-columns:248px minmax(520px,1fr) 310px;height:calc(100vh - 152px);min-height:610px;overflow:hidden}.designer-left-panel,.designer-right-panel{background:#fff;min-width:0;overflow:hidden}.designer-left-panel{border-right:1px solid #dfe5ee}.designer-right-panel{border-left:1px solid #dfe5ee}.designer-panel-tabs{height:48px;display:flex;border-bottom:1px solid #e2e7ef;background:#fbfcfe}.designer-panel-tabs button{flex:1;border:0;border-bottom:2px solid transparent;background:transparent;color:#68758b;font:inherit;font-size:12px;font-weight:700;cursor:pointer}.designer-panel-tabs button.active{color:#1f63d5;border-bottom-color:#2d78ed;background:#fff}.designer-left-tabs button{display:flex;align-items:center;justify-content:center;gap:6px}.designer-left-content{height:calc(100% - 48px);overflow:auto;padding:14px}.component-search{height:38px;border:1px solid #d8e0eb;border-radius:9px;display:flex;align-items:center;gap:8px;padding:0 10px;background:#fff}.component-search:focus-within{border-color:#7ea8ef;box-shadow:0 0 0 3px #eaf1ff}.component-search span{color:#7f8b9d;font-size:17px}.component-search input{border:0;outline:0;min-width:0;width:100%;font:inherit;background:transparent}.component-help{font-size:10px;color:#8b96a7;margin:9px 2px 12px}.component-host{min-height:300px}.component-loading{color:#8b96a7;font-size:12px;padding:14px 4px}.component-host .formeo-controls,.component-host .isf-relocated-controls{width:100%!important;max-width:none!important;min-width:0!important;position:static!important;float:none!important;box-shadow:none!important;background:transparent!important;border:0!important}.component-host .formeo-controls>*{max-width:100%}.panel-section-heading{font-size:10px;text-transform:uppercase;letter-spacing:.12em;font-weight:800;color:#8a96a8;margin-bottom:10px}.structure-tree{display:flex;flex-direction:column;gap:8px}.tree-stage{border:1px solid #e3e8f0;border-radius:9px;padding:9px}.tree-stage>strong{display:block;font-size:11px;color:#53627a;margin-bottom:6px}.tree-row{display:flex;flex-direction:column;gap:4px}.tree-field{border:0;background:#f5f7fa;border-radius:7px;padding:7px 8px;text-align:left;font:inherit;font-size:11px;color:#526076;cursor:pointer}.tree-field:hover,.tree-field.active{background:#eaf2ff;color:#1f63d5}.tree-empty{font-size:11px;color:#9aa4b2}.designer-center-panel{min-width:0;background:#e9edf3;display:flex;flex-direction:column}.canvas-toolbar{height:48px;justify-content:space-between;padding:0 14px;background:#f9fafc;border-bottom:1px solid #dfe5ee}.canvas-toolbar-left{gap:8px;font-size:12px}.canvas-status-dot{width:7px;height:7px;border-radius:50%;background:#27a76f}.canvas-count{color:#8a96a8;font-size:10px}.device-switch{border:1px solid #d8e0eb;border-radius:8px;overflow:hidden;background:#fff}.device-switch button{width:34px;height:30px;border:0;border-right:1px solid #e1e6ee;background:#fff;color:#758197;cursor:pointer}.device-switch button:last-child{border-right:0}.device-switch button.active{background:#eaf2ff;color:#1d66db}.designer-canvas-scroll{flex:1;overflow:auto;padding:24px}.designer-canvas-frame{width:min(900px,100%);min-height:100%;margin:0 auto;background:#fff;border:1px solid #d5dce7;border-radius:12px;box-shadow:0 16px 45px rgba(30,45,70,.09);transition:width .2s}.designer-canvas-frame[data-device="tablet"]{width:min(720px,100%)}.designer-canvas-frame[data-device="mobile"]{width:min(410px,100%)}.canvas-paper-heading{padding:24px 28px 15px;border-bottom:1px solid #edf0f4}.canvas-paper-heading h3{font-size:22px;margin:0 0 5px}.canvas-paper-heading p{margin:0;color:#8290a3;font-size:11px}.isf-formeo-editor{min-height:520px;background:#fff!important;padding:14px}.isf-formeo-editor .formeo-wrap{min-height:500px!important;font-family:inherit!important;color:var(--ink)!important}.isf-formeo-editor .formeo-controls{display:none!important}.isf-formeo-editor .formeo-stage{background:#fff!important}.formeo-load-error{padding:32px;text-align:center;background:#fff8f7;color:#8f2119}.designer-right-panel{display:flex;flex-direction:column}.inspector-body{overflow:auto;padding:14px 16px 24px}.inspector-field-picker{padding-bottom:12px;border-bottom:1px solid #e7ebf1}.inspector-section{padding-top:4px}.inspector-empty{text-align:center;color:#7c889b;padding:42px 10px}.inspector-empty-icon{width:42px;height:42px;border-radius:12px;display:grid;place-items:center;background:#eef4ff;color:#2d72dc;font-size:20px;margin:0 auto 10px}.inspector-empty strong{display:block;color:#4a5870;margin-bottom:4px}.inspector-empty p{font-size:11px;margin:0}.inspector-right-panel .field:where(:not(.dashboard-shell *)),.inspector-body .field:where(:not(.dashboard-shell *)){margin-bottom:13px}.inspector-body label{font-size:11px;font-weight:700;color:#526078}.inspector-body input,.inspector-body select,.inspector-body textarea{width:100%;border:1px solid #d8e0eb;border-radius:8px;padding:8px 9px;background:#fff;font:inherit;font-size:12px}.inspector-body input:focus,.inspector-body select:focus,.inspector-body textarea:focus{outline:0;border-color:#80aaf0;box-shadow:0 0 0 3px #edf3ff}.inspector-body small{display:block;font-size:9px;color:#929dad;margin-top:4px}.inspector-toggle{display:flex!important;align-items:center;gap:8px;padding:10px;border:1px solid #e0e6ee;border-radius:9px;background:#fafbfd}.inspector-toggle input{width:auto!important}.inspector-section-title{padding:8px 0 12px}.inspector-section-title strong{font-size:12px}.inspector-section-title p{font-size:10px;color:#8d98a8;margin:3px 0 0}.inspector-two-col{display:grid;grid-template-columns:1fr 1fr;gap:8px}.inspector-note{font-size:10px;color:#8d98a8;background:#f6f8fb;border-radius:8px;padding:8px}.professional-preview{position:fixed;inset:0;z-index:30;background:rgba(12,22,38,.58);backdrop-filter:blur(4px);padding:28px;overflow:auto}.preview-modal-card{max-width:1050px;margin:0 auto;background:#fff;border-radius:14px;box-shadow:0 30px 80px rgba(0,0,0,.25);min-height:400px}.preview-modal-head{display:flex;justify-content:space-between;align-items:flex-start;padding:18px 20px;border-bottom:1px solid #e3e8ef}.preview-modal-head h3{margin:2px 0}.preview-modal-head p{margin:2px 0;color:#7c8899;font-size:11px}.professional-preview .preview-runtime{padding:22px}.form-settings-dialog{border:0;border-radius:14px;padding:0;width:min(520px,calc(100vw - 30px));box-shadow:0 30px 90px rgba(0,0,0,.25)}.form-settings-dialog::backdrop{background:rgba(12,22,38,.5);backdrop-filter:blur(3px)}.settings-dialog-card{padding:20px}.settings-dialog-head{justify-content:space-between;border-bottom:1px solid #e5e9ef;padding-bottom:12px;margin-bottom:16px}.settings-dialog-head h3{margin:2px 0}.settings-dialog-card .field:where(:not(.dashboard-shell *)){margin-bottom:14px}.settings-dialog-card input{width:100%;border:1px solid #d8e0eb;border-radius:8px;padding:9px 10px;font:inherit}.settings-dialog-card small{display:block;color:#8f99a8;font-size:10px;margin-top:4px}.settings-dialog-actions{justify-content:flex-end;gap:8px;border-top:1px solid #e5e9ef;padding-top:14px;margin-top:18px}
@media(max-width:1250px){.designer-workspace{grid-template-columns:215px minmax(460px,1fr) 270px}.designer-command-actions .secondary{padding-left:9px;padding-right:9px}.designer-oss-pill{display:none}}@media(max-width:980px){.professional-designer-page{margin:-24px -20px -20px}.designer-workspace{grid-template-columns:200px 1fr}.designer-right-panel{position:fixed;right:0;top:152px;bottom:0;width:290px;z-index:12;box-shadow:-10px 0 30px rgba(20,30,50,.12)}.designer-commandbar{top:84px}.designer-title-cluster p{display:none}}@media(max-width:760px){.designer-commandbar{height:auto;min-height:68px;padding:10px;align-items:flex-start}.designer-command-actions{flex-wrap:wrap;justify-content:flex-end}.designer-workspace{grid-template-columns:1fr;height:auto;min-height:0}.designer-left-panel,.designer-right-panel{position:static;width:auto;border:0;border-bottom:1px solid #dfe5ee}.designer-left-panel{max-height:350px}.designer-right-panel{box-shadow:none}.designer-canvas-scroll{padding:12px}.professional-designer-page{margin:-24px -16px -16px}.command-divider{display:none}}

/* Bilingual/RTL foundation. Logical properties keep new UI direction-safe. */
.topbar-actions { display:flex; align-items:center; gap:12px; }
.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; }
html[dir="rtl"] body { text-align:right; }
html[dir="rtl"] .app-shell { direction:rtl; }
html[dir="rtl"] .sidebar,
html[dir="rtl"] #app-sidebar { border-right:0; border-left:1px solid var(--border, #e6e9ef); }
html[dir="rtl"] .panel-head:where(:not(.dashboard-shell *)),
html[dir="rtl"] .topbar,
html[dir="rtl"] .designer-commandbar,
html[dir="rtl"] .canvas-toolbar,
html[dir="rtl"] .runtime-wizard-actions { direction:rtl; }
html[dir="rtl"] input,
html[dir="rtl"] textarea,
html[dir="rtl"] select { text-align:right; }
html[dir="rtl"] code,
html[dir="rtl"] input[type="email"],
html[dir="rtl"] input[type="url"] { direction:ltr; text-align:left; font-family: Poppins, sans-serif !important; }
html[dir="rtl"] .designer-back { transform:scaleX(-1); }
@media (max-width: 860px) { .topbar-actions { gap:8px; }}

/* Global application typography. Vazir and Poppins are loaded in the base templates. */
html, body, button, input, select, textarea, option, table, th, td, a, label, small, code, pre, dialog {
  font-family: Poppins, Vazir, Tahoma, Arial, sans-serif !important;
}
.formeo-wrap, .formeo-wrap *, .component-host, .component-host * {
  font-family: Poppins, Vazir, Tahoma, Arial, sans-serif !important;
}

/* English text and LTR typography */
html[lang="en"],
html[dir="ltr"],
body.is-ltr,
:lang(en),
[lang="en"],
[dir="ltr"],
.ltr {
  font-family: Poppins, Vazir, Tahoma, Arial, sans-serif !important;
}

/* Persian runtime date fields: Jalali text, calendar from core/datepicker.js. */
.bpms-jalali-date {
  direction: rtl;
  text-align: right;
}

.user-account {
  display: flex;
  align-items: center;
  gap: 10px;
}

@media (max-width: 700px) {
  .topbar-actions,
  .user-account {
    flex-wrap: wrap;
  }

  .user-chip small {
    display: none;
  }

}

/* Global table alignment and action layout.
   Logical alignment keeps Persian RTL and English LTR tables consistent. */
table th:where(:not(.dashboard-shell *)),
table td:where(:not(.dashboard-shell *)),
.data-table th,
.data-table td {
  text-align: start;
  vertical-align: middle;
}

table th:where(:not(.dashboard-shell *)),
.data-table th {
  white-space: nowrap;
}

table td:where(:not(.dashboard-shell *)),
.data-table td {
  overflow-wrap: normal;
  word-break: normal;
}

table .actions,
.data-table .actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: .45rem .7rem;
  white-space: normal;
}

table .actions > *,
.data-table .actions > * {
  margin: 0 !important;
}

table .actions .inline-form,
.data-table .actions .inline-form {
  display: inline-flex;
  align-items: center;
}

html[dir="rtl"] table,
html[dir="rtl"] .data-table,
body.is-rtl table,
body.is-rtl .data-table {
  direction: rtl;
}

html[dir="ltr"] table,
html[dir="ltr"] .data-table,
body.is-ltr table,
body.is-ltr .data-table {
  direction: ltr;
}

@media (max-width: 760px) {
  table th:where(:not(.dashboard-shell *)),
  table td:where(:not(.dashboard-shell *)),
  .data-table th,
  .data-table td {
    padding-inline: 12px;
  }

  table .actions,
  .data-table .actions {
    min-width: 10rem;
  }
}

/* Unified management tables -------------------------------------------------
   Desktop management tables favor readable rows and consistent controls.
   Horizontal scrolling is preferable to character-by-character wrapping. */

/* Management data-grid separators -----------------------------------------
   Subtle column boundaries improve scanning without making tables heavy. */
.data-table th:where(:not(.dashboard-shell *)),
.data-table td:where(:not(.dashboard-shell *)) {
  border-inline-end: 1px solid #e3e8ef;
}

.data-table th:last-child:where(:not(.dashboard-shell *)),
.data-table td:last-child:where(:not(.dashboard-shell *)) {
  border-inline-end: 0;
}

/* Current-location navigation ------------------------------------------------ */
.sidebar nav a.active {
  position: relative;
  background: #243653;
  color: #fff;
  font-weight: 800;
  box-shadow: inset 3px 0 0 #60a5fa;
}

html[dir="rtl"] .sidebar nav a.active,
body.is-rtl .sidebar nav a.active {
  box-shadow: inset -3px 0 0 #60a5fa;
}

.sidebar nav a.active::after {
  content: "";
  position: absolute;
  inset-block: 9px;
  inset-inline-end: 9px;
  width: 6px;
  border-radius: 99px;
  background: #60a5fa;
}

/* Process instance table ---------------------------------------------------- */

/* Make management-grid column boundaries visible enough for presentation. */

/* Presentation polish: stable table text, stronger active navigation, inline booleans. */
.sidebar nav a.active,
.sidebar nav a[aria-current="page"] {
  background: #2563eb;
  color: #fff;
  font-weight: 800;
  box-shadow: 0 8px 20px rgba(37, 99, 235, .28);
}

.sidebar nav a.active:hover,
.sidebar nav a[aria-current="page"]:hover {
  background: #1d4ed8;
}

.sidebar nav a.active::before,
.sidebar nav a[aria-current="page"]::before {
  content: "";
  position: absolute;
  inset-block: 8px;
  inset-inline-start: 5px;
  width: 4px;
  border-radius: 99px;
  background: #bfdbfe;
}

.sidebar nav a.active::after,
.sidebar nav a[aria-current="page"]::after {
  display: none;
}

/* Never let compact runtime values break character-by-character. */
.table-nowrap {
  display: inline-block;
  white-space: nowrap !important;
  overflow-wrap: normal !important;
  word-break: keep-all !important;
}

/* Checkboxes are inline controls, not full-width text inputs. */
.field.checkbox-field:where(:not(.dashboard-shell *)) {
  display: flex;
  align-items: center;
  gap: .65rem;
  min-height: 2.75rem;
}

.field.checkbox-field input[type="checkbox"]:where(:not(.dashboard-shell *)) {
  flex: 0 0 auto;
  width: 1.15rem;
  height: 1.15rem;
  margin: 0;
  accent-color: var(--accent);
}

.field.checkbox-field label:where(:not(.dashboard-shell *)) {
  display: inline-block;
  margin: 0;
  font-weight: 700;
  line-height: 1.5;
}

html[dir="rtl"] .field.checkbox-field:where(:not(.dashboard-shell *)),
body.is-rtl .field.checkbox-field:where(:not(.dashboard-shell *)) {
  justify-content: flex-start;
}

/* Process instance table rebalance -----------------------------------------
   Keep the full runtime list visible on normal desktop widths. */

/* Draw each interior column boundary once so lines remain continuous. */

/* Process instance table content-aware layout ------------------------------
   Do not allocate fixed percentages to columns. The browser sizes from content
   and only genuinely compact columns are constrained. */

/* Draw one separator per boundary, continuously through header and body. */

/* Compact columns: constrain only what is intrinsically small. */

/* Content columns size naturally. */

/* Only genuinely narrow screens should scroll horizontally. */

/* Independent application scroll regions ----------------------------------
   Desktop keeps navigation stationary while main content scrolls separately. */
@media (min-width: 761px) {
  html,
  body {
    height: 100%;
    overflow: hidden;
  }

  .app-shell {
    height: 100vh;
    min-height: 0;
    overflow: hidden;
  }

  .sidebar {
    flex: 0 0 244px;
    width: 244px;
    height: 100vh;
    min-height: 0;
    box-sizing: border-box;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
  }

  .main {
    flex: 1 1 auto;
    height: 100vh;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior-y: contain;
    scrollbar-gutter: stable;
  }

  .topbar {
    position: sticky;
    top: 0;
  }
}

/* On small screens retain normal document flow. */
@media (max-width: 760px) {
  html,
  body {
    height: auto;
    overflow: auto;
  }

  .app-shell {
    min-height: 100vh;
    height: auto;
    overflow: visible;
  }

  .sidebar,
  .main {
    height: auto;
    overflow: visible;
  }
}

/* Final runtime table containment ------------------------------------------
   Runtime tables must never widen the desktop content pane. Long identifiers
   wrap inside their cell; horizontal scrolling is reserved for genuinely
   narrow viewports. */
.main,
.content {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

/* Process instances: compact technical columns, more room for business text. */

/* Work queue: keep the action and state columns compact. */

/* At truly narrow widths preserve readable columns and expose a real
   horizontal scrollbar inside the card instead of clipping either edge. */

/* Rule Engine -------------------------------------------------------------- */

.stacked-form textarea {
  box-sizing: border-box;
  width: 100%;
  min-height: 10rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  direction: ltr;
  text-align: left;
}

/* Business-readable Rule Engine ------------------------------------------- */

/* Rule cards use full-bleed tables, so the panel itself intentionally has no
   padding. Inset the direct heading content to keep RTL text clear of the
   rounded card edge without changing the table geometry. */

.rule-field,
.rule-value {
  overflow-wrap: anywhere;
}

.rule-operator {
  color: #667085;
  font-weight: 700;
}

@media (max-width: 900px) {

  .rule-operator,
  .rule-value {
    grid-column: 2;
  }
}

/* Rule Engine responsive layout fixes ------------------------------------ */

@media (max-width: 760px) {
  html,
  body,
  .main,
  .content {
    max-width: 100%;
    overflow-x: hidden;
  }
}

/* Advanced Rule Builder ---------------------------------------------------- */
.advanced-rule-builder {
  min-width: 0;
}

.rule-builder-score-settings,
.rule-score-band-fields,
.rule-score-term,
.rule-builder-condition {
  display: grid;
  gap: .8rem;
}

.rule-builder-score-settings {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 1rem;
}

.rule-builder-score-settings label,
.rule-builder-condition label,
.rule-score-term label,
.rule-score-band-fields label,
.rule-decision-row-header label {
  display: grid;
  gap: .35rem;
  min-width: 0;
  font-weight: 700;
}

.advanced-rule-builder {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
}

.rule-builder-kind-bar {
  display: flex;
  justify-content: flex-start;
}

.rule-builder-kind-bar select {
  width: min(100%, 24rem);
  font-weight: 800;
}

.rule-builder-body,
.rule-builder-group,
.rule-builder-children,
.rule-builder-subsection,
.rule-score-terms {
  display: grid;
  gap: .85rem;
}

.rule-builder-node {
  min-width: 0;
  padding: .85rem;
  border: 1px solid #dce3ec;
  border-radius: .85rem;
  background: #fff;
}

.rule-builder-node.depth-1,
.rule-builder-node.depth-3,
.rule-builder-node.depth-5 {
  background: #f8fafc;
}

.rule-builder-node-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: .65rem;
}

.rule-builder-group > .rb-logic {
  width: min(100%, 18rem);
  font-weight: 800;
}

.rule-builder-child {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: .55rem;
  align-items: start;
}

.rule-builder-condition {
  grid-template-columns:
    minmax(8rem, 1fr)
    minmax(9rem, 1.2fr)
    minmax(11rem, 1.35fr)
    minmax(7rem, .8fr)
    minmax(9rem, 1fr);
  align-items: end;
}

.rule-builder-condition input,
.rule-builder-condition select,
.rule-builder-condition textarea,
.rule-score-term input,
.rule-score-band-fields input,
.rule-builder-score-settings input,
.rule-decision-row-header input {
  box-sizing: border-box;
  width: 100%;
}

.rb-range {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: .4rem;
}

.rule-builder-subsection {
  padding: 1rem;
  border: 1px solid #e4e7ec;
  border-radius: .9rem;
  background: #fbfcfe;
}

.rule-builder-subsection > h4,
.rule-builder-subsection > h5 {
  margin: 0;
}

.rule-score-term {
  grid-template-columns:
    minmax(8rem, 1fr)
    minmax(9rem, 1.1fr)
    minmax(6rem, .65fr)
    minmax(7rem, .75fr)
    minmax(7rem, .75fr)
    auto;
  align-items: end;
  padding: .8rem;
  border: 1px solid #e4e7ec;
  border-radius: .75rem;
  background: #fff;
}

.rule-score-band,
.rule-decision-row {
  display: grid;
  gap: .8rem;
  padding: 1rem;
  border: 1px solid #dce3ec;
  border-radius: .85rem;
  background: #fff;
}

.rule-score-band-fields {
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  align-items: end;
}

.rule-decision-row-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: .65rem;
  align-items: end;
}

.rule-output-editor,
.rule-output-list {
  display: grid;
  gap: .5rem;
}

.rule-output-row {
  display: grid;
  grid-template-columns: minmax(8rem, 1fr) minmax(8rem, 1fr) auto;
  gap: .5rem;
  align-items: center;
}

.danger-lite {
  border-color: #fecdca !important;
  color: #b42318 !important;
}

@media (max-width: 1100px) {
  .rule-builder-condition {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .rb-value-label {
    grid-column: span 2;
  }

  .rule-score-term {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .rule-score-term > button {
    justify-self: start;
  }
}

@media (max-width: 760px) {
  .rule-builder-score-settings,
.rule-builder-condition,
.rule-score-band-fields,
.rule-score-term,
.rule-output-row {
    grid-template-columns: 1fr;
  }

  .rb-value-label {
    grid-column: auto;
  }

  .rule-builder-child {
    grid-template-columns: 1fr;
  }
}
.required-marker{color:#b42318!important;font-weight:800;margin-inline-start:.18rem}

/* Shared UX consistency ------------------------------------------------------ */
.stats { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type="number"] {
  appearance: textfield;
  -moz-appearance: textfield;
}
