/* tools_service Stage 5 — Security hardening + UX finalization */
.crm-route-admin-tools-service,
.crm-route-admin-tools-service-security,
.crm-route-admin-tools-service-foundation,
.crm-route-admin-tools-service-rentals,
.crm-route-admin-tools-service-repairs,
.crm-route-admin-tools-service-sales,
.crm-route-admin-tools-service-reports,
.crm-route-admin-tools-service-automation {
    --tools5-text: #172033;
    --tools5-muted: #77839a;
    --tools5-border: #e5eaf3;
    --tools5-soft: #f7f9fd;
    direction: rtl;
}

.tools-stage5-page { display:grid; gap:20px; direction:rtl; }
.tools-stage5-page > * { margin:0 !important; }
.tools-stage5-hero { display:flex; align-items:flex-start; justify-content:space-between; gap:22px; padding:26px !important; }
.tools-stage5-kicker { display:block; margin-bottom:6px; color:#6672d8; font-size:11px; font-weight:900; letter-spacing:.02em; }
.tools-stage5-hero h1 { margin:0; color:var(--tools5-text); font-size:30px; line-height:1.45; font-weight:900; }
.tools-stage5-hero p { max-width:820px; margin:8px 0 0; color:var(--tools5-muted); font-size:13px; line-height:1.95; }
.tools-stage5-hero-actions { display:flex; flex-wrap:wrap; gap:10px; align-items:center; justify-content:flex-end; }
.tools-stage5-hero-actions form { margin:0; }

.tools-stage5-kpis,
.tools-stage5-foundation-kpis { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:16px; }
.tools-stage5-kpi,
.tools-stage5-foundation-kpi { min-height:126px; display:grid; grid-template-columns:54px minmax(0,1fr); align-items:center; gap:14px; padding:18px; border:1px solid var(--tools5-border); border-radius:19px; background:#fff; box-shadow:0 12px 32px rgba(20,32,55,.045); }
.tools-stage5-kpi > span,
.tools-stage5-foundation-icon { width:54px; height:54px; display:grid; place-items:center; border-radius:17px; background:#eef2ff; color:#5564df; }
.tools-stage5-kpi > span.is-pass,
.tools-stage5-foundation-icon.is-success { background:#eaf8f1; color:#11835e; }
.tools-stage5-kpi svg,
.tools-stage5-foundation-icon svg { width:22px; height:22px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
.tools-stage5-kpi small,
.tools-stage5-foundation-kpi small { display:block; color:#7b879b; font-size:11.5px; font-weight:800; line-height:1.7; }
.tools-stage5-kpi strong,
.tools-stage5-foundation-kpi strong { display:block; margin-top:5px; color:var(--tools5-text); font-size:23px; line-height:1.35; font-weight:900; }
.tools-stage5-kpi em,
.tools-stage5-foundation-kpi span { display:block; margin-top:4px; color:#9aa4b4; font-size:10.5px; font-style:normal; line-height:1.7; }
.tools-stage5-foundation-kpi strong a { color:#4e5ddb; text-decoration:none; font-size:14px; }

.tools-stage5-section { padding:24px !important; }
.tools-stage5-section-head { display:flex; justify-content:space-between; align-items:flex-start; gap:16px; margin-bottom:18px; }
.tools-stage5-section-head h2 { margin:0; color:var(--tools5-text); font-size:21px; line-height:1.5; font-weight:900; }
.tools-stage5-section-head p { margin:6px 0 0; color:var(--tools5-muted); font-size:12.5px; line-height:1.9; }
.tools-stage5-warning { display:flex; align-items:center; justify-content:space-between; gap:18px; padding:22px !important; border-color:#f6dba7 !important; background:#fffaf0 !important; }
.tools-stage5-warning strong { color:#8b5c09; }
.tools-stage5-warning p { margin:4px 0 0; color:#9a7430; font-size:12px; }

.tools-stage5-table-wrap { border:1px solid #edf0f6; border-radius:16px; overflow:hidden; }
.tools-stage5-table { margin:0 !important; }
.tools-stage5-table thead th { padding:14px 16px !important; background:#fafbfe; color:#617087; font-size:11px; font-weight:900; white-space:nowrap; }
.tools-stage5-table tbody td { padding:15px 16px !important; color:#354157; font-size:12px; vertical-align:middle; }
.tools-stage5-table td > strong { color:var(--tools5-text); font-weight:850; }
.tools-stage5-table td > small { display:block; margin-top:4px; color:#98a3b5; font-size:10.5px; }
.tools-stage5-core-role { display:inline-flex; align-items:center; min-height:30px; padding:5px 10px; border-radius:999px; background:#f1f4f9; color:#57657b; font-weight:800; }
.tools-stage5-preset-badge { display:inline-flex; align-items:center; min-height:30px; padding:5px 11px; border-radius:999px; background:#eef2ff; color:#5060dd; font-weight:900; }
.tools-stage5-preset-form { display:grid; grid-template-columns:minmax(160px,1fr) auto; gap:8px; min-width:280px; }
.tools-stage5-preset-form .crm-input { min-height:39px; }

.tools-stage5-preset-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; }
.tools-stage5-preset-card { padding:16px; border:1px solid var(--tools5-border); border-radius:16px; background:#fbfcff; }
.tools-stage5-preset-card > div { display:flex; align-items:center; justify-content:space-between; gap:10px; }
.tools-stage5-preset-card strong { color:var(--tools5-text); font-size:13px; font-weight:900; }
.tools-stage5-preset-card code { color:#6b76ca; font-size:10px; }
.tools-stage5-preset-card small { display:block; margin-top:8px; color:#7e899c; font-size:10.5px; }
.tools-stage5-preset-card > span { display:inline-flex; margin-top:10px; padding:5px 9px; border-radius:999px; background:#fff; border:1px solid var(--tools5-border); color:#78849a; font-size:10px; font-weight:800; }

.tools-stage5-result { display:inline-flex; min-width:54px; justify-content:center; padding:6px 9px; border-radius:999px; font-size:10px; font-weight:900; }
.tools-stage5-result.is-pass,.tools-stage5-pass { background:#e9f8f0; color:#11825e; }
.tools-stage5-result.is-fail { background:#fff0f1; color:#ce3856; }
.tools-stage5-pass { display:inline-flex; align-items:center; justify-content:center; min-height:34px; padding:6px 13px; border-radius:999px; font-size:11px; font-weight:900; }
.tools-stage5-empty { min-height:100px; display:grid; place-items:center; border:1px dashed #dce4f0; border-radius:16px; background:#fafcff; color:#8d98aa; font-size:12px; text-align:center; }

.tools-stage5-quick-actions { display:grid; grid-template-columns:repeat(7,minmax(0,1fr)); gap:10px; margin:0 0 18px; }
.tools-stage5-quick-actions a { min-height:72px; display:flex; flex-direction:column; justify-content:center; padding:12px 14px; border:1px solid var(--tools5-border); border-radius:15px; background:#fff; text-decoration:none; transition:transform .15s ease,border-color .15s ease,box-shadow .15s ease; }
.tools-stage5-quick-actions a:hover { transform:translateY(-1px); border-color:#cfd6fb; box-shadow:0 10px 24px rgba(36,48,84,.06); }
.tools-stage5-quick-actions strong { color:var(--tools5-text); font-size:11.5px; font-weight:900; }
.tools-stage5-quick-actions small { margin-top:4px; color:#8c98aa; font-size:9.5px; }

/* Module-scoped polish: predictable spacing, centered icons, readable labels. */
.crm-route-admin-tools-service .crm-panel,
[class*="crm-route-admin-tools-service-"] .crm-panel { margin-bottom:0; }
.crm-route-admin-tools-service .crm-page-shell,
[class*="crm-route-admin-tools-service-"] .crm-page-shell { gap:18px; }
[class*="crm-route-admin-tools-service-"] [class*="icon"] svg,
[class*="crm-route-admin-tools-service-"] [class*="-icon"] svg { display:block; margin:auto; }
[class*="crm-route-admin-tools-service-"] .crm-form-label { margin-bottom:7px; color:#556277; font-size:11.5px; font-weight:800; }
[class*="crm-route-admin-tools-service-"] .crm-input { min-height:43px; }
[class*="crm-route-admin-tools-service-"] .tools-stage2-transition-actions { gap:9px; padding-top:8px; }
[class*="crm-route-admin-tools-service-"] .tools-stage2-transition-actions .crm-btn { min-width:112px; }
.tools-stage5-gate-panel { border-color:#dfe5fb !important; }

@media (max-width:1199.98px) {
    .tools-stage5-kpis,.tools-stage5-foundation-kpis { grid-template-columns:repeat(2,minmax(0,1fr)); }
    .tools-stage5-preset-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
    .tools-stage5-quick-actions { grid-template-columns:repeat(4,minmax(0,1fr)); }
}

@media (max-width:767.98px) {
    .tools-stage5-page { gap:14px; }
    .tools-stage5-hero,.tools-stage5-warning,.tools-stage5-section { padding:18px !important; }
    .tools-stage5-hero,.tools-stage5-warning,.tools-stage5-section-head { flex-direction:column; align-items:stretch; }
    .tools-stage5-hero h1 { font-size:24px; }
    .tools-stage5-hero-actions,.tools-stage5-hero-actions form,.tools-stage5-hero-actions .crm-btn { width:100%; }
    .tools-stage5-kpis,.tools-stage5-foundation-kpis { grid-template-columns:1fr 1fr; gap:10px; }
    .tools-stage5-kpi,.tools-stage5-foundation-kpi { min-height:110px; grid-template-columns:44px minmax(0,1fr); padding:14px; gap:10px; }
    .tools-stage5-kpi > span,.tools-stage5-foundation-icon { width:44px; height:44px; border-radius:14px; }
    .tools-stage5-kpi strong,.tools-stage5-foundation-kpi strong { font-size:18px; }
    .tools-stage5-preset-grid { grid-template-columns:1fr; }
    .tools-stage5-quick-actions { grid-template-columns:1fr 1fr; gap:9px; }
    .tools-stage5-preset-form { grid-template-columns:1fr; min-width:210px; }
    .tools-stage5-table-wrap { overflow-x:auto; }
    .tools-stage5-table { min-width:760px; }
}
