/* ===================================================
   أنماط A.Y.H لإدارة العقارات (Word & PDF)
   بدون جداول | فقرات عادية مع علامات جدولة متناسقة
   النقاط الرأسية (:) متساوية وعمودية في كامل البرنامج
   الخط: Calibri (Body) | تباعد الأسطر: 1.5 | المحاذاة: Justify
   المسافة العرضية عريضة ومنظمة | التوقيع: على اليسار
   =================================================== */

/* الخط محلي بالكامل داخل المجلد (libs/fonts) - يعمل دون إنترنت على أي جهاز */
@font-face {
  font-family: 'Cairo';
  font-style: normal;
  font-weight: 200 1000;
  font-display: swap;
  src: url('libs/fonts/Cairo-Variable.ttf') format('truetype');
}
@font-face {
  font-family: 'Cairo';
  font-style: italic;
  font-weight: 200 1000;
  font-display: swap;
  src: url('libs/fonts/Cairo-Variable.ttf') format('truetype');
}

:root {
  --primary: #1e3a8a;
  --primary-hover: #172554;
  --primary-light: #eff6ff;
  --secondary: #0d9488;
  --secondary-hover: #0f766e;
  --accent: #d97706;
  --success: #16a34a;
  --danger: #dc2626;
  --bg-app: #f1f5f9;
  --card-bg: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border-color: #cbd5e1;
  --border-focus: #3b82f6;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  --radius: 12px;
}

/* تُحدَّث هذه المتغيرات من إعدادات هوية الشركة في app_v3.js. */
.app-topbar { background: linear-gradient(115deg, var(--text-main), var(--primary-hover) 52%, var(--primary)) !important; }
.home-hero-art:before { background: radial-gradient(circle at 30% 28%, var(--primary-light), var(--primary) 62%, var(--primary-hover)) !important; }
.theme-color-input { display:flex; gap:.45rem; align-items:center; direction:ltr; }
.theme-color-input input[type="color"] { width:42px; height:38px; padding:3px; cursor:pointer; flex:0 0 auto; }
.theme-color-input input[type="text"] { font-family:monospace; text-transform:uppercase; min-width:0; }
.public-landing{min-height:100vh;background:#f8fafc}.public-topbar,.public-section-title{display:flex;justify-content:space-between;align-items:center}.public-topbar{padding:1rem 5%;background:#fff}.public-brand{display:flex;gap:.7rem;align-items:center}.public-brand b,.public-brand small{display:block}.public-brand small,.public-offer-body span,.public-offer-body small{color:#64748b}.public-login-btn{background:var(--primary);color:#fff;border:0;border-radius:10px;padding:.65rem 1rem;font:inherit;font-weight:800}.public-main{max-width:1150px;margin:auto;padding:1.5rem}.public-hero{display:flex;justify-content:space-between;align-items:center;padding:2rem;border-radius:22px;background:linear-gradient(135deg,var(--primary),var(--primary-hover));color:#fff}.public-hero h1{margin:.3rem 0;font-size:2rem}.public-hero-icon{font-size:5rem}.public-filter{display:flex;gap:.8rem;background:#fff;padding:1rem;border-radius:15px;margin:1rem 0}.public-filter label{flex:1;font-weight:800}.public-filter select{width:100%;padding:.6rem;margin-top:.3rem}.public-section-title{margin:1.4rem 0 .8rem}.public-offers-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(245px,1fr));gap:1rem}.public-offer-card{overflow:hidden;background:#fff;border:1px solid #e2e8f0;border-radius:16px}.public-offer-card img,.public-offer-image{width:100%;height:175px;object-fit:cover;background:var(--primary-light);display:grid;place-items:center;font-size:3rem}.public-offer-body{padding:1rem}.public-offer-body h3{margin:.35rem 0}.public-offer-body p{font-size:.82rem;min-height:42px}.public-offer-body b{display:block;color:var(--secondary);margin:.5rem 0}.public-empty{text-align:center;padding:2rem;background:#fff}.public-footer{text-align:center;padding:2rem;color:#64748b}@media(max-width:600px){.public-main{padding:1rem}.public-hero{padding:1.3rem}.public-hero h1{font-size:1.45rem}.public-hero-icon{font-size:3rem}.public-filter{flex-direction:column}}

.offer-gallery{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:2px;background:#e2e8f0;min-height:156px}.offer-gallery img{display:block;width:100%;height:156px;object-fit:cover}.offer-gallery.one-image{display:block}.offer-gallery.one-image img{height:215px}.public-offer-card{display:flex;flex-direction:column;min-width:0}.public-offer-body{flex:1}.public-offer-body p{overflow-wrap:anywhere}@media(max-width:600px){.public-offers-grid{grid-template-columns:1fr}.offer-gallery img{height:140px}.offer-gallery.one-image img{height:205px}}
.public-topbar{background:linear-gradient(115deg,var(--primary-hover),var(--primary))!important;color:#fff;border-bottom:3px solid var(--secondary)}.public-brand small{color:color-mix(in srgb,#fff 78%,transparent)}.public-brand #public-brand-logo{width:46px;height:46px;border-radius:12px;background:rgba(255,255,255,.16);display:grid;place-items:center;overflow:hidden;font-size:1.55rem}.public-brand #public-brand-logo img{width:100%;height:100%;object-fit:contain;padding:3px}.public-login-btn{background:var(--secondary)!important;border:1px solid color-mix(in srgb,#fff 35%,transparent)!important;box-shadow:0 5px 14px rgba(0,0,0,.18)}.public-login-btn:hover{filter:brightness(1.08)}body.offers-mode .app-header{display:flex!important;position:fixed!important;top:0;left:0;right:0;z-index:1000}body.offers-mode #offers-full-page{margin:94px auto 2rem;max-width:1150px;padding:1.5rem;background:#f8fafc;min-height:calc(100vh - 110px)}@media(max-width:600px){body.offers-mode #offers-full-page{margin-top:132px;padding:.8rem}.public-topbar{padding:.75rem 1rem}.public-brand #public-brand-logo{width:40px;height:40px}}
.public-landing{background:#07152d;color:#eef5ff}.public-site-nav{position:sticky;top:0;z-index:200;min-height:68px;padding:0 5%;border-bottom:1px solid color-mix(in srgb,var(--secondary) 65%,transparent)}.public-site-nav nav{display:flex;align-items:center;gap:.35rem}.public-site-nav nav button{border:0;background:transparent;color:#fff;padding:.65rem .8rem;font:inherit;font-weight:700;cursor:pointer}.public-site-nav nav .public-login-btn{padding:.65rem 1rem}.public-hero-premium{position:relative;min-height:535px;isolation:isolate;overflow:hidden;border-radius:0;background:linear-gradient(118deg,color-mix(in srgb,var(--primary-hover) 94%,#050b16),color-mix(in srgb,var(--primary) 84%,#102747));display:grid;grid-template-columns:minmax(0,1.15fr) minmax(340px,.85fr);gap:3rem;align-items:center;padding:clamp(3rem,7vw,7rem) max(6vw,2rem)}.public-hero-premium:before,.public-hero-premium:after{content:"";position:absolute;inset:auto;z-index:-1;border-radius:999px;filter:blur(4px);opacity:.72;animation:publicFloat 13s ease-in-out infinite}.public-hero-premium:before{width:38vw;height:38vw;max-width:580px;max-height:580px;right:-12vw;top:-18vw;background:radial-gradient(circle,var(--secondary),transparent 67%)}.public-hero-premium:after{width:36vw;height:36vw;left:-15vw;bottom:-20vw;background:radial-gradient(circle,var(--accent),transparent 65%);animation-delay:-6s}.public-hero-glow{position:absolute;inset:0;z-index:-1;background:repeating-linear-gradient(125deg,transparent 0 70px,rgba(255,255,255,.035) 71px 72px);animation:publicShift 18s linear infinite}.public-hero-copy{max-width:670px}.public-hero-copy>span{color:var(--secondary);font-weight:900;letter-spacing:.12em}.public-hero-copy h1{font-size:clamp(2.6rem,5vw,5.2rem);line-height:1.05;margin:.6rem 0 1.1rem;color:#fff}.public-hero-copy p{font-size:1.12rem;line-height:1.9;max-width:570px;color:#dbeafe}.public-hero-actions{display:flex;gap:.7rem;margin-top:1.8rem}.public-hero-actions button,.public-contact-card button,.public-search-bar button{border:0;background:var(--secondary);color:#fff;padding:.85rem 1.1rem;border-radius:10px;font:inherit;font-weight:900;cursor:pointer}.public-hero-actions .hero-ghost{background:transparent;border:1px solid rgba(255,255,255,.45)}.public-contact-card{background:color-mix(in srgb,#fff 13%,transparent);border:1px solid rgba(255,255,255,.27);box-shadow:0 22px 60px rgba(0,0,0,.25);backdrop-filter:blur(13px);padding:1.5rem;border-radius:18px;color:#fff}.public-contact-card span{color:var(--secondary);font-size:.85rem}.public-contact-card h2{font-size:1.45rem;margin:.7rem 0}.public-contact-card p{font-size:.86rem;margin:0 0 1rem;color:#dbeafe}.public-contact-card input,.public-contact-card textarea{width:100%;box-sizing:border-box;margin:.32rem 0;padding:.75rem .8rem;border:1px solid rgba(255,255,255,.27);background:rgba(2,10,25,.24);border-radius:8px;color:#fff;font:inherit}.public-contact-card input::placeholder,.public-contact-card textarea::placeholder{color:#d1d9e8}.public-contact-card button{width:100%;margin-top:.45rem}.public-search-bar{position:relative;margin:-28px auto 1.5rem;max-width:1100px;box-shadow:0 15px 36px rgba(0,0,0,.18);align-items:end}.public-search-bar button{height:42px;white-space:nowrap}.public-landing .public-main{padding-bottom:3rem}.public-landing .public-section-title{color:#fff}.public-landing .public-section-title span{color:color-mix(in srgb,var(--secondary) 70%,#fff)}.public-landing .public-offer-card{box-shadow:0 14px 30px rgba(0,0,0,.16)}.public-settings-form{max-width:1000px;margin:0 auto;padding:1.4rem}.public-settings-form hr{border:0;border-top:1px solid #dbe4f0;margin:1.3rem 0}.public-settings-form h4{color:var(--primary);margin:.2rem 0 .8rem}@keyframes publicFloat{50%{transform:translate(-50px,70px) scale(1.12);opacity:.5}}@keyframes publicShift{to{transform:translateX(90px)}}@media(max-width:780px){.public-site-nav{padding:.55rem 1rem;align-items:center}.public-site-nav nav button:not(.public-login-btn){display:none}.public-hero-premium{grid-template-columns:1fr;padding:3rem 1.2rem;gap:2rem;min-height:auto}.public-hero-copy h1{font-size:2.55rem}.public-contact-card{max-width:none}.public-search-bar{margin:-12px 1rem 1.2rem}.public-search-bar button{width:100%}.public-search-bar{display:grid;grid-template-columns:1fr}.public-hero-actions{flex-wrap:wrap}}

body.offers-mode #public-site-settings-page{margin:94px auto 2rem;max-width:1150px;padding:1.5rem;background:#f8fafc;min-height:calc(100vh - 110px)}@media(max-width:600px){body.offers-mode #public-site-settings-page{margin-top:132px;padding:.8rem}}

/* الخلفية العامة امتداد من هوية النظام، وليس لوناً أزرق ثابتاً. */
.public-landing{background:linear-gradient(160deg,color-mix(in srgb,var(--primary-hover) 92%,#070b14),color-mix(in srgb,var(--primary) 88%,#111827) 46%,color-mix(in srgb,var(--secondary) 34%,var(--primary-hover)))!important}.public-landing .public-main{background:linear-gradient(180deg,transparent,color-mix(in srgb,var(--primary-hover) 22%,transparent))}
.public-hero-slides{position:absolute;inset:0;z-index:-3;overflow:hidden}.public-hero-slide{position:absolute;inset:-2%;background-position:center;background-size:cover;opacity:0;transform:scale(1.08);animation:publicHeroSlide 5s ease-in-out infinite}.public-hero-slides.has-images:after{content:"";position:absolute;inset:0;background:linear-gradient(90deg,color-mix(in srgb,var(--primary-hover) 80%,rgba(0,0,0,.7)),color-mix(in srgb,var(--primary) 48%,rgba(0,0,0,.35)) 52%,rgba(0,0,0,.28))}.public-hero-slides.has-images~.public-hero-glow{opacity:.35}@keyframes publicHeroSlide{0%,100%{opacity:0;transform:scale(1.08)}12%,78%{opacity:1}92%{opacity:0;transform:scale(1)}}
.public-hero-slides{z-index:0}.public-hero-glow{z-index:1}.public-hero-copy,.public-contact-card{position:relative;z-index:2}
.public-hero-images-list{display:flex;flex-wrap:wrap;gap:.7rem;margin-top:.9rem}.public-hero-images-list figure{position:relative;margin:0;width:132px;border:1px solid #d9e2ef;border-radius:10px;overflow:hidden;background:#fff}.public-hero-images-list img{display:block;width:132px;height:76px;object-fit:cover}.public-hero-images-list figcaption{font-size:.72rem;padding:.3rem;color:#475569}.public-hero-images-list button{position:absolute;top:4px;left:4px;width:25px;height:25px;border:0;border-radius:50%;background:#dc2626;color:#fff;font-size:1.15rem;line-height:1;cursor:pointer}.public-upload-status{font-size:.83rem;color:#475569;margin-top:.45rem}
.lang-en{font-family:Arial,Segoe UI,sans-serif}.lang-en .form-row,.lang-en .header-actions,.lang-en .public-site-nav{direction:ltr}.lang-en input,.lang-en textarea,.lang-en select{text-align:left}.lang-en .home-app-arrow{transform:scaleX(-1)}

/* تطبيق ألوان الهوية المختارة على الواجهة كاملة. */
body{background:var(--primary-light)}
.home-shell{background:radial-gradient(circle at 85% 5%,var(--primary-light),transparent 34%),linear-gradient(135deg,var(--primary-hover),var(--primary))!important}
.home-dashboard{border-color:color-mix(in srgb,var(--primary) 32%,white)!important}
.home-topbar,.app-topbar{background:linear-gradient(115deg,var(--primary-hover),var(--primary))!important;border-color:color-mix(in srgb,var(--primary) 45%,white)!important}
.home-app-tile{border-color:color-mix(in srgb,var(--primary) 18%,white)!important}
.home-app-tile:hover{border-color:var(--primary)!important;box-shadow:0 14px 30px color-mix(in srgb,var(--primary) 25%,transparent)!important}
.btn-primary,.btn-primary:hover,.btn-success,.btn-success:hover,.public-login-btn{background:var(--primary)!important;border-color:var(--primary)!important;color:#fff!important}
.btn-outline{border-color:color-mix(in srgb,var(--primary) 50%,white)!important;color:var(--primary)!important}
.btn-outline:hover{background:var(--primary-light)!important;border-color:var(--primary)!important}
input:focus,select:focus,textarea:focus{border-color:var(--primary)!important;box-shadow:0 0 0 3px color-mix(in srgb,var(--primary) 18%,transparent)!important}
.settings-box-highlight,.form-card,.preview-section,.public-offer-card{border-color:color-mix(in srgb,var(--primary) 24%,white)!important}
.modal-header,.section-header,.tenant-entry-hero{border-color:color-mix(in srgb,var(--primary) 35%,white)!important}
.home-app-icon{background:var(--primary-light)!important;color:var(--primary)!important}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Cairo', system-ui, -apple-system, sans-serif;
}

body {
  background-color: var(--bg-app);
  color: var(--text-main);
  direction: rtl;
  text-align: right;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* لا نعرض نموذج الإدخال لحظةً قبل أن يؤكد الخادم جلسة المستخدم. */
body.session-checking > .app-header,
body.session-checking > .app-container { visibility: hidden; }

/* Header */
.app-header {
  background: linear-gradient(135deg, #1e3a8a 0%, #0f172a 100%);
  color: #ffffff;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-title-box {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.header-icon {
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.header-title {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.header-subtitle {
  font-size: 0.85rem;
  color: #93c5fd;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Document Type Switcher Tabs */
.doc-type-tabs {
  display: flex;
  background: #e2e8f0;
  padding: 0.35rem;
  border-radius: 10px;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.tab-btn {
  flex: 1;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  border: none;
  background: transparent;
  font-size: 0.95rem;
  font-weight: 700;
  color: #475569;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
}

.tab-btn.active {
  background: #ffffff;
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.tab-btn:hover:not(.active) {
  background: rgba(255, 255, 255, 0.5);
  color: #1e293b;
}

/* Main Container Layout */
.app-container {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 1.5rem;
  padding: 1.5rem 2rem;
  max-width: 1750px;
  margin: 0 auto;
  width: 100%;
  flex: 1;
}

@media (max-width: 1250px) {
  .app-container {
    grid-template-columns: 1fr;
  }
}

/* Forms Section */
.form-section {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: all 0.2s ease;
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-header {
  padding: 0.9rem 1.25rem;
  background: #f8fafc;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-header-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-body {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.75rem;
}

.form-row-4 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 0.75rem;
}

@media (max-width: 600px) {
  .form-row, .form-row-3, .form-row-4 {
    grid-template-columns: 1fr;
  }
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

label {
  font-size: 0.88rem;
  font-weight: 700;
  color: #334155;
  display: flex;
  justify-content: space-between;
}

.label-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 400;
}

input, select, textarea {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: #ffffff;
  font-size: 0.95rem;
  color: var(--text-main);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

textarea {
  resize: vertical;
  line-height: 1.6;
  font-family: inherit;
}

/* Radio / Toggle Options */
.toggle-options {
  display: flex;
  gap: 1.5rem;
  background: #f8fafc;
  padding: 0.65rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.toggle-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.92rem;
  font-weight: 600;
  color: #334155;
}

.toggle-option input[type="radio"] {
  width: auto;
  cursor: pointer;
}

/* Auto Generator Tool Box */
.generator-tool-box {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  padding: 0.85rem 1rem;
  margin-bottom: 0.75rem;
}

.generator-tool-title {
  font-weight: 700;
  color: #1e40af;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* Installments List */
.installments-container {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background: #f8fafc;
  padding: 1rem;
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.installment-row {
  display: grid;
  grid-template-columns: 85px 120px 140px 1fr 40px;
  gap: 0.5rem;
  align-items: center;
  background: #ffffff;
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  transition: all 0.15s ease;
}

@media (max-width: 700px) {
  .installment-row {
    grid-template-columns: 1fr 1fr;
  }
}

.btn-remove-inst {
  background: #fee2e2;
  color: #dc2626;
  border: 1px solid #fecaca;
  border-radius: 6px;
  height: 36px;
  width: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-weight: 700;
  transition: background 0.2s;
}

.btn-remove-inst:hover {
  background: #fca5a5;
}

.tafqeet-box {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #166534;
  padding: 0.75rem;
  border-radius: 8px;
  font-size: 0.92rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.tafqeet-icon {
  font-size: 1.2rem;
}

/* Action Buttons */
.action-buttons-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.75rem;
}

.btn {
  padding: 0.75rem 1.25rem;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.92rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-primary {
  background: #2563eb;
  color: #ffffff;
}

.btn-primary:hover {
  background: #1d4ed8;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-word {
  background: #185abd;
  color: #ffffff;
}

.btn-word:hover {
  background: #104287;
  box-shadow: 0 4px 12px rgba(24, 90, 189, 0.3);
}

.btn-pdf {
  background: #e11d48;
  color: #ffffff;
}

.btn-pdf:hover {
  background: #be123c;
  box-shadow: 0 4px 12px rgba(225, 29, 72, 0.3);
}

.btn-batch-word {
  background: #0284c7;
  color: #ffffff;
}

.btn-batch-word:hover {
  background: #0369a1;
}

.btn-batch-pdf {
  background: #c026d3;
  color: #ffffff;
}

.btn-batch-pdf:hover {
  background: #a21caf;
}

.btn-combined-word {
  background: linear-gradient(135deg, #1e40af 0%, #1d4ed8 100%);
  color: #ffffff;
  border: 1px solid #1e3a8a;
  box-shadow: 0 4px 12px rgba(30, 64, 175, 0.25);
  font-size: 0.95rem;
}

.btn-combined-word:hover {
  background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(30, 64, 175, 0.35);
}

.btn-combined-pdf {
  background: linear-gradient(135deg, #be123c 0%, #e11d48 100%);
  color: #ffffff;
  border: 1px solid #9f1239;
  box-shadow: 0 4px 12px rgba(190, 18, 60, 0.25);
  font-size: 0.95rem;
}

.btn-combined-pdf:hover {
  background: linear-gradient(135deg, #9f1239 0%, #be123c 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(190, 18, 60, 0.35);
}

.btn-combined-print {
  background: linear-gradient(135deg, #0f766e 0%, #0d9488 100%);
  color: #ffffff;
  border: 1px solid #115e59;
  box-shadow: 0 4px 12px rgba(15, 118, 110, 0.25);
  font-size: 0.95rem;
}

.btn-combined-print:hover {
  background: linear-gradient(135deg, #115e59 0%, #0f766e 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(15, 118, 110, 0.35);
}

.btn-success {
  background: #16a34a;
  color: #ffffff;
}

.btn-success:hover {
  background: #15803d;
}

.btn-outline {
  background: #ffffff;
  color: #475569;
  border: 1px solid var(--border-color);
}

.btn-outline:hover {
  background: #f8fafc;
  border-color: #94a3b8;
}

.btn-sm {
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
  border-radius: 6px;
}

/* Document Live Preview Section */
.preview-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.preview-toolbar {
  background: #ffffff;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
  gap: 0.5rem;
}

.preview-title {
  font-weight: 700;
  color: #1e293b;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.page-navigator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: #f1f5f9;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 700;
}

.preview-wrapper {
  background: #64748b;
  padding: 2rem 1.5rem;
  border-radius: var(--radius);
  overflow-x: auto;
  display: flex;
  justify-content: center;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

/* =========================================================
   ورقة الطباعة الرسمية A4 - بدون جداول بنقاط رأسية متساوية
   ========================================================= */
.a4-paper {
  background: #ffffff;
  width: 210mm;
  min-height: 297mm;
  padding: 24mm 22mm 22mm 22mm;
  box-shadow: var(--shadow-xl);
  box-sizing: border-box;
  color: #000000;
  font-family: 'Calibri', 'Segoe UI', Tahoma, sans-serif;
  font-size: 14pt;
  line-height: 1.7;
  display: flex;
  flex-direction: column;
  position: relative;
}

.a4-paper * {
  font-family: 'Calibri', 'Segoe UI', Tahoma, sans-serif !important;
}

/* 1. العنوان في المنتصف تحته خط */
.doc-title {
  text-align: center;
  font-size: 20pt;
  font-weight: bold;
  text-decoration: underline;
  margin-top: 5px;
  margin-bottom: 45px;
}

/* 2. جدول ترويسة البيانات الرسمية بحدود كاملة 6 أعمدة */
.doc-header-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 22px;
  direction: rtl;
  font-size: 14pt;
  font-weight: bold;
  background-color: #ffffff !important;
  color: #000000 !important;
  border: none !important;
}

.doc-header-table td {
  border: none !important;
  padding: 4px 6px;
  text-align: right;
  vertical-align: middle;
  box-sizing: border-box;
  background-color: #ffffff !important;
  color: #000000 !important;
}

.doc-header-table tr:nth-child(2) td {
  padding-top: 10px;
}

.doc-header-table .col-lbl-name {
  width: 20%;
  font-weight: bold;
  text-align: right;
  color: #000000 !important;
}

.doc-header-table .col-colon {
  width: 4%;
  font-weight: bold;
  text-align: center;
  color: #000000 !important;
}

.doc-header-table .col-val-name {
  width: 38%;
  font-weight: bold;
  text-align: right;
  color: #000000 !important;
}

.doc-header-table .col-lbl-nat {
  width: 15%;
  font-weight: bold;
  text-align: right;
  color: #000000 !important;
}

.doc-header-table .col-val-nat {
  width: 19%;
  font-weight: bold;
  text-align: right;
  color: #000000 !important;
}

.doc-header-table .phone-val {
  direction: ltr;
  unicode-bidi: embed;
  text-align: right;
  color: #000000 !important;
}

.doc-header-grid {
  display: grid;
  grid-template-columns: 1fr 220px;
  column-gap: 20px;
  row-gap: 12px;
  margin-bottom: 20px;
  font-size: 14pt;
  direction: rtl;
  width: 100%;
}

.header-cell {
  display: flex;
  align-items: baseline;
  text-align: right;
}

.header-cell.cell-right {
  justify-content: flex-start;
}

.header-cell.cell-left {
  justify-content: flex-start;
}

.header-cell.cell-right .lbl-part {
  width: 130px;
  min-width: 130px;
  flex-shrink: 0;
  display: inline-block;
  font-weight: normal;
  text-align: right;
}

.header-cell.cell-left .lbl-part {
  width: 75px;
  min-width: 75px;
  flex-shrink: 0;
  display: inline-block;
  font-weight: normal;
  text-align: right;
}

.header-cell .col-part {
  width: 18px;
  min-width: 18px;
  flex-shrink: 0;
  text-align: center;
  display: inline-block;
  font-weight: normal;
}

.header-cell .val-part {
  font-weight: bold;
  display: inline-block;
  text-align: right;
}

/* ضبط وتوحيد doc-header-line مع نظام Grid */
.doc-header-line {
  display: grid;
  grid-template-columns: 1fr 240px;
  column-gap: 20px;
  align-items: baseline;
  margin-bottom: 12px;
  font-size: 15pt;
  font-weight: bold;
  direction: rtl;
  width: 100%;
}

.part-right {
  display: flex;
  align-items: baseline;
  text-align: right;
  min-width: 0;
}

.part-left {
  display: flex;
  align-items: baseline;
  text-align: right;
  min-width: 0;
  white-space: nowrap;
}

.part-right .lbl-part {
  width: 130px;
  min-width: 130px;
  flex-shrink: 0;
  display: inline-block;
  font-weight: bold;
  text-align: right;
}

.part-left .lbl-part {
  width: 75px;
  min-width: 75px;
  flex-shrink: 0;
  display: inline-block;
  font-weight: bold;
  text-align: right;
}

.col-part {
  width: 16px;
  min-width: 16px;
  flex-shrink: 0;
  text-align: center;
  display: inline-block;
  font-weight: bold;
}

.val-part {
  font-weight: bold;
  display: inline-block;
  text-align: right;
}

.val-part.phone-val {
  font-size: 13.5pt;
  white-space: nowrap;
}

/* 3. سطر تاريخ سداد المديونية في أقصى اليمين */
.doc-due-date {
  display: flex;
  align-items: baseline;
  justify-content: flex-start;
  margin-top: 20px;
  margin-bottom: 38px;
  font-size: 15pt;
  font-weight: bold;
  text-align: right;
  direction: rtl;
  white-space: nowrap;
  width: 100%;
}

.doc-due-date .lbl-part {
  width: auto;
  min-width: 0;
  flex-shrink: 0;
  display: inline-block;
  font-weight: bold;
  text-align: right;
  margin-left: 0;
}

/* 4. نص الإقرار القانوني - محاذاة Justify وتباعد أسطر 1.7 */
.doc-body-paragraph {
  text-align: justify;
  font-size: 14pt;
  line-height: 1.7;
  margin-bottom: 22px;
  text-justify: inter-word;
}

.doc-body-paragraph strong {
  font-weight: bold;
}

/* 5. الخاتمة */
.doc-conclusion {
  text-align: justify;
  font-size: 14pt;
  line-height: 1.7;
  margin-top: 18px;
  margin-bottom: 45px;
}

/* 6. التوقيع */
.doc-signature-block {
  margin-top: 25px;
  font-size: 14pt;
  font-weight: normal;
  text-align: right;
  padding-right: 20px;
  padding-left: 0;
}

/* History Database Section */
.history-search-bar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.5rem;
}

.history-table th, .history-table td {
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.88rem;
  text-align: right;
}

.history-table th {
  background: #f8fafc;
  font-weight: 700;
  color: #475569;
}

.badge-inst {
  background: #e0f2fe;
  color: #0369a1;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.78rem;
  font-weight: 700;
}

/* Modal Overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.modal-card {
  background: #ffffff;
  border-radius: var(--radius);
  max-width: 800px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border-color);
  overflow: hidden;
  animation: modalScale 0.25s ease-out;
}

@keyframes modalScale {
  from {
    transform: scale(0.95);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.modal-header {
  padding: 1rem 1.5rem;
  background: #f8fafc;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.btn-close-modal {
  background: #e2e8f0;
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  cursor: pointer;
  font-weight: 700;
  font-size: 1rem;
  color: #475569;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.btn-close-modal:hover {
  background: #fee2e2;
  color: #dc2626;
}

.modal-nav-tabs {
  display: flex;
  background: #f1f5f9;
  border-bottom: 1px solid var(--border-color);
  padding: 0.35rem 1rem 0 1rem;
  gap: 0.5rem;
}

.modal-tab-btn {
  padding: 0.65rem 1rem;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  background: transparent;
  font-weight: 700;
  font-size: 0.9rem;
  color: #64748b;
  cursor: pointer;
  transition: all 0.2s ease;
}

.modal-tab-btn.active {
  background: #ffffff;
  color: var(--primary);
  border-color: var(--border-color);
  border-bottom: 2px solid #ffffff;
  margin-bottom: -1px;
}

/* =========================================================
   نافذة الإعدادات الموسّعة (كبيرة ومرتبة أكثر)
   ========================================================= */
.settings-modal-card {
  max-width: 1180px !important;
  max-height: 96vh !important;
}

.settings-modal-card .modal-header {
  padding: 1.1rem 1.5rem;
}

.settings-modal-card .settings-nav-tabs {
  flex-wrap: wrap;
  padding: 0.6rem 1rem 0 1rem;
  gap: 0.45rem;
  border-bottom: 2px solid var(--border-color);
}

.settings-nav-tabs .modal-tab-btn {
  font-size: 0.92rem;
  padding: 0.7rem 1.1rem;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  border-bottom: none;
  white-space: nowrap;
}

.settings-nav-tabs .modal-tab-btn.active {
  background: #ffffff;
  border-bottom: 3px solid var(--primary);
  box-shadow: 0 -2px 6px rgba(0, 0, 0, 0.04);
}

.settings-modal-card .modal-body {
  padding: 1.5rem 1.75rem;
  gap: 1.25rem;
}

.settings-modal-card .form-group label {
  font-size: 0.9rem;
}

.settings-modal-card input[type="text"],
.settings-modal-card input[type="password"],
.settings-modal-card input[type="number"],
.settings-modal-card select,
.settings-modal-card textarea {
  font-size: 0.95rem;
}

.settings-box-highlight {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.bldg-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.5rem;
  background: #ffffff;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.bldg-table th, .bldg-table td {
  padding: 0.6rem 0.8rem;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.85rem;
  text-align: right;
}

.bldg-table th {
  background: #f1f5f9;
  font-weight: 700;
  color: #334155;
}

.modal-body {
  padding: 1.25rem 1.5rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.modal-footer {
  padding: 1rem 1.5rem;
  background: #f8fafc;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* =========================================================
   تنسيقات الطباعة الدقيقة (Print CSS)
   ========================================================= */
@media print {
  body {
    background: #ffffff !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .app-header,
  .form-section,
  .preview-toolbar,
  .history-section,
  .modal-overlay,
  .toast-container {
    display: none !important;
  }

  /* في حالة الطباعة المجمعة لكافة الأقساط (12 صفحة) */
  body.batch-printing .app-container {
    display: none !important;
  }

  body.batch-printing #batch-print-wrapper {
    display: block !important;
  }

  .batch-print-page {
    box-shadow: none !important;
    width: 100% !important;
    min-height: 290mm !important;
    padding: 24mm 22mm 22mm 22mm !important;
    page-break-after: always !important;
    break-after: page !important;
    box-sizing: border-box !important;
  }

  /* في حالة طباعة الصفحة الحالية فقط */
  body:not(.batch-printing) .app-container {
    display: block !important;
    padding: 0 !important;
    margin: 0 !important;
    max-width: none !important;
  }

  body:not(.batch-printing) .preview-wrapper {
    background: transparent !important;
    padding: 0 !important;
    box-shadow: none !important;
    border-radius: 0 !important;
  }

  body:not(.batch-printing) .a4-paper {
    box-shadow: none !important;
    width: 100% !important;
    min-height: auto !important;
    padding: 24mm 22mm 22mm 22mm !important;
    page-break-after: always;
  }

  /* محاذاة وتوسيع خانة الاسم وإزاحة الجنسية وهاتف رقم لليسار في الطباعة فقط */
  .doc-header-table {
    direction: rtl !important;
    width: 100% !important;
    table-layout: fixed !important;
    border-collapse: collapse !important;
    border: none !important;
  }

  .doc-header-table td {
    text-align: right !important;
    border: none !important;
    padding: 3px 2px !important;
    white-space: nowrap !important;
  }

  .doc-header-table .col-lbl-name {
    width: 17% !important;
    text-align: right !important;
    white-space: nowrap !important;
  }

  .doc-header-table .col-colon {
    width: 2% !important;
    text-align: center !important;
  }

  .doc-header-table .col-val-name {
    width: 48% !important;
    text-align: right !important;
    white-space: nowrap !important;
  }

  .doc-header-table .col-lbl-nat {
    width: 14% !important;
    text-align: right !important;
    padding-right: 15px !important;
    white-space: nowrap !important;
  }

  .doc-header-table .col-val-nat,
  .doc-header-table .phone-val {
    width: 17% !important;
    text-align: right !important;
    white-space: nowrap !important;
  }

  /* سطر تاريخ سداد المديونية في أقصى اليمين في الطباعة فقط */
  .doc-due-date {
    display: flex !important;
    align-items: baseline !important;
    justify-content: flex-start !important;
    text-align: right !important;
    direction: rtl !important;
    width: 100% !important;
  }

  /* توقيع المقر بما فيه على اليسار في الطباعة فقط */
  .doc-signature-block {
    text-align: left !important;
    padding-left: 20px !important;
    padding-right: 0 !important;
    direction: rtl !important;
    margin-top: 40px !important;
  }

  @page {
    size: A4 portrait;
    margin: 0;
  }
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 20px;
  left: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 1000;
}

.toast {
  background: #1e293b;
  color: #ffffff;
  padding: 0.85rem 1.25rem;
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
  font-weight: 600;
  animation: slideIn 0.3s ease;
}

.toast.toast-success {
  background: #15803d;
}

.toast.toast-error {
  background: #b91c1c;
}

@keyframes slideIn {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
  }
}

/* =========================================================
   مرفقات ومستندات السجلات (Attachments System)
   ========================================================= */
.badge-attachment-count {
  background: #f1f5f9;
  color: #475569;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 700;
  border: 1px solid var(--border-color);
}

.attachments-dropzone {
  border: 2px dashed #94a3b8;
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
  cursor: pointer;
}

.attachments-dropzone:hover, .attachments-dropzone.dragover {
  border-color: var(--primary);
  background: #eff6ff;
}

.dropzone-icon {
  font-size: 2rem;
  color: var(--primary);
}

.dropzone-content strong {
  display: block;
  font-size: 0.95rem;
  color: #1e293b;
}

.dropzone-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.attachments-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

.attachment-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  position: relative;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s, box-shadow 0.15s;
}

.attachment-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.attachment-thumb {
  width: 100%;
  height: 110px;
  border-radius: 6px;
  object-fit: cover;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
}

.attachment-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.2s;
}

.attachment-thumb img:hover {
  transform: scale(1.05);
}

.attachment-file-icon {
  font-size: 2.5rem;
}

.attachment-details {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.attachment-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.attachment-size {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.attachment-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.25rem;
  padding-top: 0.4rem;
  border-top: 1px dashed var(--border-color);
}

.btn-attachment-delete {
  background: #fee2e2;
  color: #dc2626;
  border: none;
  border-radius: 4px;
  padding: 0.2rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-attachment-delete:hover {
  background: #fca5a5;
}

.btn-attachment-view {
  background: #e0f2fe;
  color: #0369a1;
  border: none;
  border-radius: 4px;
  padding: 0.2rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
}

.btn-attachment-view:hover {
  background: #bae6fd;
}

.badge-attachments-btn {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  padding: 0.25rem 0.6rem;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  transition: background 0.15s;
}

.badge-attachments-btn:hover {
  background: #dbeafe;
}

.badge-no-attachments {
  color: #94a3b8;
  font-size: 0.8rem;
}

/* =========================================================
   تحسينات شاشات الجوال (Mobile Responsive)
   ========================================================= */
@media (max-width: 767px) {

  /* منع التجاوز الأفقي في كامل الصفحة */
  html, body {
    max-width: 100%;
    overflow-x: hidden;
  }

  /* تطبيق كامل العرض على الهاتف */
  .app-container {
    padding: 0.75rem 0.5rem;
  }

  /* الهيدر: تكديس عمودي وعدم الازدحام */
  .app-header {
    padding: 0.55rem 0.6rem;
    flex-wrap: wrap;
    gap: 0.35rem;
  }
  .header-title {
    font-size: 0.92rem;
    line-height: 1.2;
  }
  .header-subtitle {
    font-size: 0.68rem;
    line-height: 1.3;
    max-width: 100%;
  }
  .header-icon {
    width: 34px;
    height: 34px;
    font-size: 1.1rem;
  }
  .header-title-box {
    gap: 0.55rem;
    align-items: center;
  }
  .header-actions {
    flex-wrap: wrap;
    gap: 0.35rem;
    width: 100%;
  }
  .header-actions .btn {
    flex: 1 1 auto;
    padding: 0.55rem 0.5rem;
    font-size: 0.78rem;
    min-height: 40px;
    white-space: normal;
  }
  #user-profile-badge {
    flex: 1 1 100%;
    justify-content: space-between;
  }

  /* بطاقات وعناصر داخلية لا تتجاوز */
  .card-body, .card-header {
    padding: 0.75rem;
  }

  /* حقول النماذج: حجم مناسب ووضع مريح للمس */
  input, select, textarea {
    font-size: 16px !important;
    padding: 0.62rem 0.7rem;
  }

  /* صفوف الفورم: عمود واحد دائماً */
  .form-row, .form-row-3, .form-row-4 {
    grid-template-columns: 1fr !important;
    gap: 0.6rem !important;
  }

  /* التبويبات (نوع المستند): متناسقة */
  .doc-type-tabs {
    flex-wrap: wrap;
  }
  .tab-btn {
    padding: 0.6rem 0.5rem;
    font-size: 0.8rem;
    min-width: 0;
  }

  /* خيارات الراديو: لفّت عموديا */
  .toggle-options {
    flex-direction: column;
    align-items: stretch;
    gap: 0.45rem;
  }
  .toggle-option {
    font-size: 0.88rem;
  }

  /* شبكة أزرار الإجراءات: عمود كامل */
  .action-buttons-grid {
    grid-template-columns: 1fr !important;
  }
  .btn {
    padding: 0.7rem 1rem;
    font-size: 0.9rem;
    width: 100%;
  }
  .btn-sm {
    width: auto;
  }

  /* صفوف الأقساط: عمود واحد */
  .installment-row {
    grid-template-columns: 1fr !important;
  }

  /* حاويات الطباعة والمعاينة: لا تمتد خارج الشاشة */
  .preview-wrapper, .a4-paper {
    max-width: 100%;
    overflow-x: auto;
  }

  /* الـ tables: تمكين التمرير الأفقي بدل التمدد */
  table {
    display: block;
    width: 100%;
    overflow-x: auto;
    white-space: nowrap;
  }

  /* شاشة الرئيسية: تقليل الحشوات */
  #home-screen > div {
    padding: 1rem 0.5rem 2rem !important;
  }
  #home-screen h1 {
    font-size: 1.1rem !important;
  }

  /* شريط الروابط (network share / server status): المتعرجة */
  #network-share-badge, #server-status-badge {
    flex: 1 1 100%;
    justify-content: flex-start;
  }

  /* خطوط صغيرة قابلة للقراءة */
  .card-header-title {
    font-size: 0.95rem;
  }
  label {
    font-size: 0.84rem;
  }

  /* نافذة التعديل / النوافذ المنبثقة */
  .modal-card {
    margin: 0.5rem;
    max-height: 92vh;
    overflow-y: auto;
    max-width: 100% !important;
    width: 100% !important;
  }
  .modal-overlay {
    align-items: flex-start !important;
    padding: 0.5rem 0 !important;
  }
}

/* أجهزة صغيرة جداً (أقل من 380px) */
@media (max-width: 380px) {
  .header-title {
    font-size: 0.9rem;
  }
  .btn {
    padding: 0.65rem 0.75rem;
    font-size: 0.85rem;
  }
}

/* =========================================================
   تصحيح شبكات inline التي تتجاوز شاشة الجوال
   (يُطبَّق على عناصر display:grid المعرّفة inline داخل
   شاشات الإدخال، مع استثناء معاينة الطباعة والمستندات)
   ========================================================= */
@media (max-width: 767px) {
  /* القسم الهادف: نعيد بناء شبكات وصفوف الفورم داخل قسم الإدخال فقط
     بحيث لا نمسّ معاينة المستند (.preview-section) ولا الطباعة */
  .form-section [style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }
  .form-section [style*="width"] {
    max-width: 100% !important;
  }
  .form-section [style*="min-width"] {
    min-width: 0 !important;
  }
  .form-section [style*="display:flex"],
  .form-section [style*="display: flex"] {
    flex-wrap: wrap !important;
  }
  .form-section [style*="display:grid"],
  .form-section [style*="display: grid"] {
    width: 100% !important;
  }

  /* صفوف الفورم داخل الشاشات: عمود واحد وتباعد مريح */
  .form-section .form-row,
  .form-section .form-row-3,
  .form-section .form-row-4 {
    grid-template-columns: 1fr !important;
    gap: 0.6rem !important;
  }

  /* صناديق الأقساط والحقول: لا تتجاوز العرض */
  .installment-row,
  #single-payment-box [style*="display: flex"],
  .form-section .form-group {
    max-width: 100% !important;
  }

  /* صفوف الأقساط داخل الفورم: عمود واحد، أزرار بحجم مريح */
  .form-section .installment-row {
    grid-template-columns: 1fr !important;
    gap: 0.5rem !important;
  }
  .btn-remove-inst {
    height: 42px !important;
    width: 42px !important;
  }
}

/* أجهزة iOS/أندرويد صغيرة */
@media (max-width: 480px) {
  .form-section .card-body,
  .form-section .card-header {
    padding: 0.6rem 0.65rem !important;
  }
  .form-section h1,
  .form-section h2,
  .form-section .card-header-title {
    font-size: 0.95rem !important;
  }

  /* إخفاء الوصف الفرعي الطويل في الهيدر لترتيب العنوان الرئيسي على الجوال */
  .header-subtitle {
    display: none;
  }
  .header-icon {
    width: 32px;
    height: 32px;
    font-size: 1rem;
  }
}


/* صفحات الأدوات تُعزل فوق صفحة مدير الملفات كي لا يبقى مدير الملفات ظاهراً تحتها. */
#tax-calc-full-page, #buildings-full-page, #building-form-full-page, #search-full-page, #tenants-full-page, #drive-full-page {
  position: relative;
  z-index: 20;
  background: var(--bg-color, #f8fafc);
  isolation: isolate;
}

/* صفحة المباني */
.buildings-page { width:100%; grid-column:1/-1; margin-bottom:2rem; }.buildings-shell { max-width:1150px; margin:auto; overflow:hidden; background:#fff; border:1px solid #ddd6fe; border-radius:23px; box-shadow:0 18px 40px rgba(76,29,149,.12); }.buildings-header { min-height:122px; display:flex; align-items:center; justify-content:space-between; gap:1rem; padding:1.25rem 1.55rem; background:radial-gradient(circle at 10% 10%,rgba(196,181,253,.56),transparent 30%),linear-gradient(120deg,#f5f3ff,#faf5ff); border-bottom:1px solid #ddd6fe; }.buildings-title { position:relative; padding-right:68px; }.buildings-title>div { position:absolute; right:0; top:5px; width:53px; height:53px; display:grid; place-items:center; border-radius:17px; font-size:1.7rem; color:#fff; background:linear-gradient(145deg,#7c3aed,#a855f7); box-shadow:0 10px 19px rgba(124,58,237,.3); }.buildings-title span { color:#7c3aed; font-size:.73rem; font-weight:900; }.buildings-title h2 { margin:.08rem 0; color:#4c1d95; font-size:1.55rem; font-weight:900; }.buildings-title p { margin:0; color:#7e679b; font-size:.79rem; }.buildings-back { border:1px solid #c4b5fd; border-radius:11px; padding:.6rem .85rem; color:#6d28d9; background:#fff; font:inherit; font-size:.82rem; font-weight:850; cursor:pointer; }.buildings-tabs { display:flex; gap:.45rem; padding:.75rem 1.5rem; background:#fcfbff; border-bottom:1px solid #ede9fe; flex-wrap:wrap; }.buildings-tabs button { border-radius:10px !important; padding:.55rem .95rem !important; }.buildings-content { padding:1.3rem 1.5rem; background:linear-gradient(#fff,#fdfcff); }
@media(max-width:620px){.buildings-header{padding:1rem;}.buildings-title{padding-right:55px;}.buildings-title>div{width:44px;height:44px;font-size:1.35rem;border-radius:14px;}.buildings-title h2{font-size:1.2rem;}.buildings-title p{display:none;}.buildings-content,.buildings-tabs{padding:.8rem;}}

/* صفحة المستأجرين */
.tenants-page{width:100%;grid-column:1/-1;margin-bottom:2rem}.tenants-shell{max-width:1150px;margin:auto;overflow:hidden;background:#fff;border:1px solid #99f6e4;border-radius:23px;box-shadow:0 18px 40px rgba(13,148,136,.12)}.tenants-header{min-height:122px;padding:1.25rem 1.55rem;display:flex;align-items:center;justify-content:space-between;gap:1rem;background:radial-gradient(circle at 10% 10%,rgba(94,234,212,.4),transparent 30%),linear-gradient(120deg,#f0fdfa,#f8fffe);border-bottom:1px solid #99f6e4}.tenants-title{position:relative;padding-right:68px}.tenants-title>div{position:absolute;right:0;top:5px;width:53px;height:53px;display:grid;place-items:center;border-radius:17px;font-size:1.7rem;background:linear-gradient(145deg,#0d9488,#14b8a6);box-shadow:0 10px 19px rgba(13,148,136,.27)}.tenants-title span{color:#0f766e;font-size:.73rem;font-weight:900}.tenants-title h2{margin:.08rem 0;color:#134e4a;font-size:1.55rem;font-weight:900}.tenants-title p{margin:0;color:#53837d;font-size:.79rem}.tenants-actions{display:flex;gap:.45rem;flex-wrap:wrap}.tenants-home,.tenants-add{border-radius:11px;padding:.6rem .85rem;font:inherit;font-size:.82rem;font-weight:850;cursor:pointer}.tenants-home{border:1px solid #99f6e4;background:#fff;color:#0f766e}.tenants-add{border:0;background:#0d9488;color:#fff}.tenants-list-view,.tenants-detail-view{padding:1.3rem 1.5rem;background:linear-gradient(#fff,#f9fffe)}.tenants-filter{box-shadow:0 7px 15px rgba(13,148,136,.07)}@media(max-width:620px){.tenants-header{padding:1rem}.tenants-title{padding-right:55px}.tenants-title>div{width:44px;height:44px;font-size:1.35rem;border-radius:14px}.tenants-title h2{font-size:1.2rem}.tenants-title p{display:none}.tenants-list-view,.tenants-detail-view{padding:1rem}.tenants-actions{justify-content:flex-end}}

/* الصفحة الرئيسية: لوحة تطبيقات واضحة ومهيأة لللمس والكمبيوتر */
.home-shell { position:fixed; inset:0; z-index:9000; overflow:auto; color:#eef6ff; font-family:"Segoe UI",Tahoma,Arial,sans-serif; background:radial-gradient(circle at 85% -10%,#1e5f8f 0,transparent 33%),linear-gradient(125deg,#071525 0%,#102840 48%,#081b31 100%); }
.home-dashboard { position:relative; z-index:1; max-width:1220px; margin:0 auto; padding:1.6rem 1.25rem 2.3rem; }
.home-orb { position:fixed; border-radius:999px; filter:blur(1px); pointer-events:none; opacity:.3; }
.home-orb-one { width:360px; height:360px; background:#0ea5e9; top:-210px; left:-115px; }
.home-orb-two { width:280px; height:280px; background:#8b5cf6; bottom:-160px; right:-100px; }
.home-topbar { display:flex; align-items:center; justify-content:space-between; gap:1rem; }
.home-brand { display:flex; align-items:center; gap:.75rem; min-width:0; }
.home-brand-icon { width:52px; height:52px; display:grid; place-items:center; flex:0 0 auto; border-radius:17px; font-size:1.7rem; background:linear-gradient(145deg,#3b82f6,#1d4ed8); box-shadow:0 12px 26px rgba(30,64,175,.45); }
.home-brand-name { font-size:1.12rem; font-weight:900; letter-spacing:.2px; }.home-brand-name span { color:#9cc9ff; font-weight:700; }.home-brand p { margin:.2rem 0 0; color:#a9c0d7; font-size:.78rem; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.home-logout { border:1px solid rgba(255,255,255,.15); background:rgba(15,35,57,.66); color:#fecaca; border-radius:12px; padding:.6rem .85rem; cursor:pointer; font:inherit; font-size:.82rem; font-weight:800; transition:.2s; }.home-logout:hover { transform:translateY(-2px); border-color:#fb7185; background:rgba(127,29,29,.3); }
.home-hero { margin-top:1.55rem; min-height:190px; padding:1.55rem 2rem; display:flex; align-items:center; justify-content:space-between; overflow:hidden; border:1px solid rgba(147,197,253,.2); border-radius:25px; background:linear-gradient(112deg,rgba(10,38,66,.9),rgba(20,67,105,.69)); box-shadow:0 22px 45px rgba(0,0,0,.2); }
.home-eyebrow { display:inline-block; margin-bottom:.55rem; padding:.28rem .65rem; border-radius:999px; color:#a5d8ff; background:rgba(56,189,248,.12); font-size:.72rem; font-weight:800; }.home-hero h1 { margin:0; font-size:clamp(1.55rem,3vw,2.35rem); line-height:1.24; letter-spacing:.1px; }.home-hero h1 em { color:#7dd3fc; font-style:normal; }.home-hero p { max-width:570px; margin:.7rem 0 0; color:#b7c9d9; font-size:.9rem; line-height:1.7; }
.home-hero-art { position:relative; width:175px; height:135px; flex:0 0 auto; display:grid; place-items:center; }.home-hero-art span { position:relative; z-index:2; font-size:5rem; filter:drop-shadow(0 10px 10px rgba(0,0,0,.25)); }.home-hero-art:before { content:""; position:absolute; inset:8px; border-radius:50%; background:radial-gradient(circle at 30% 28%,#7dd3fc,#2563eb 62%,#1e3a8a); opacity:.72; }.home-hero-art i,.home-hero-art b { position:absolute; z-index:3; color:#fde68a; font-style:normal; }.home-hero-art i { top:3px; right:14px; font-size:1.4rem; }.home-hero-art b { bottom:4px; left:13px; font-size:1.5rem; color:#dbeafe; }
.home-status-row { display:flex; flex-wrap:wrap; gap:.65rem; margin-top:1rem; }.home-status-row > div { box-shadow:0 8px 20px rgba(1,13,28,.15); }
.home-section-title { display:flex; align-items:end; justify-content:space-between; gap:1rem; margin:2rem 0 .85rem; }.home-section-title span { color:#7dd3fc; font-size:.72rem; font-weight:800; }.home-section-title h2 { margin:.18rem 0 0; color:#fff; font-size:1.12rem; }.home-section-title small { color:#8faac1; font-size:.74rem; }
.home-app-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:1rem; }
.home-app-tile { --tile-gradient:linear-gradient(135deg,#1d4ed8,#3b82f6); position:relative; min-height:185px; overflow:hidden; border:1px solid rgba(255,255,255,.14); border-radius:21px; padding:1.1rem; text-align:right; cursor:grab; color:#fff; background:var(--tile-gradient); box-shadow:0 14px 25px -15px rgba(0,0,0,.75); display:flex; flex-direction:column; align-items:flex-start; gap:.52rem; transition:transform .18s ease,box-shadow .18s ease,border-color .18s ease; }.home-app-tile:before { content:""; position:absolute; width:135px; height:135px; border-radius:50%; background:rgba(255,255,255,.13); top:-62px; left:-40px; }.home-app-tile:hover { transform:translateY(-5px); box-shadow:0 23px 34px -17px rgba(0,0,0,.86); border-color:rgba(255,255,255,.47); }.home-app-tile:active { cursor:grabbing; transform:translateY(-1px); }
.home-app-icon { position:relative; width:52px; height:52px; display:grid; place-items:center; border-radius:16px; background:rgba(255,255,255,.19); border:1px solid rgba(255,255,255,.22); font-size:1.75rem; box-shadow:inset 0 1px 1px rgba(255,255,255,.18); }.home-app-title { position:relative; font-size:1.05rem; font-weight:900; }.home-app-desc { position:relative; color:rgba(255,255,255,.88); font-size:.75rem; line-height:1.55; }.home-app-arrow { position:absolute; left:1rem; bottom:.9rem; width:28px; height:28px; display:grid; place-items:center; border-radius:50%; background:rgba(0,0,0,.16); font-size:1.05rem; transition:transform .18s; }.home-app-tile:hover .home-app-arrow { transform:translateX(-4px); }
.home-footer { margin-top:2.25rem; padding-top:1rem; border-top:1px solid rgba(148,163,184,.15); text-align:center; color:#7490aa; font-size:.74rem; }

/* صفحة إضافة المستأجر */
.tenant-entry-page{max-width:900px;margin:0 auto;padding:1rem}.tenant-entry-hero{padding:1.25rem 1.45rem;display:flex;align-items:center;justify-content:space-between;gap:1rem;border-radius:20px;background:radial-gradient(circle at 10% 15%,rgba(110,231,183,.46),transparent 30%),linear-gradient(120deg,#ecfdf5,#f0fdfa);border:1px solid #a7f3d0;box-shadow:0 12px 26px rgba(6,95,70,.09);margin-bottom:.85rem}.tenant-entry-hero span{color:#047857;font-size:.73rem;font-weight:900}.tenant-entry-hero h2{margin:.1rem 0;color:#064e3b;font-size:1.4rem;font-weight:900}.tenant-entry-hero p{margin:0;color:#477d70;font-size:.8rem}.tenant-entry-steps{display:flex;align-items:center;direction:ltr}.tenant-entry-steps b{display:grid;place-items:center;width:29px;height:29px;border-radius:50%;background:#059669;color:#fff;font-size:.78rem}.tenant-entry-steps i{width:17px;height:2px;background:#6ee7b7}.tenant-entry-toolbar{padding:0 .15rem}.tenant-entry-page>.card{border-radius:16px;overflow:hidden;border:1px solid #e2e8f0;box-shadow:0 7px 18px rgba(15,23,42,.055)}.tenant-entry-page>.card>.card-header{padding:.82rem 1rem;background:linear-gradient(90deg,#f8fafc,#fff);border-bottom:1px solid #e2e8f0}.tenant-entry-page>.card>.card-header .card-header-title{font-size:.98rem!important;color:#0f172a!important}.tenant-entry-page>.card>.card-body{padding:1rem}.tenant-entry-page .form-group>label{font-size:.78rem;font-weight:800;color:#334155}.tenant-entry-page input,.tenant-entry-page select,.tenant-entry-page textarea{border-radius:9px!important}.tenant-entry-page .card+.card{margin-top:.9rem}

/* توزيع نموذج المستأجر والمعاينة */
/* Keep the original, spacious two-column proportions: the document preview is
   intentionally the wider column so an A4 page is comfortable to read. */
@media (min-width:1251px){.app-container{grid-template-columns:1fr 1.15fr;gap:1.5rem;max-width:1750px;padding:1.5rem 2rem}.tenant-entry-page{max-width:none;margin:0;padding:.2rem}.preview-section{position:sticky;top:1rem;align-self:start;max-height:calc(100vh - 2rem)}.preview-toolbar{border-radius:16px 16px 0 0;background:linear-gradient(100deg,#0f172a,#1e3a5f);border:0;color:#fff}.preview-toolbar .preview-title{color:#fff}.preview-wrapper{border-radius:0 0 16px 16px;max-height:calc(100vh - 105px);padding:1.5rem;overflow:auto;background:linear-gradient(135deg,#334155,#475569);box-shadow:0 14px 28px rgba(15,23,42,.16)}.preview-wrapper .a4-paper{margin:0 auto;box-shadow:0 9px 25px rgba(0,0,0,.3)}}
@media screen{body.preview-manual-hidden .preview-section{display:none!important}}@media (min-width:1251px){body.preview-manual-hidden .app-container{grid-template-columns:1fr;max-width:960px}}
@media (max-width:900px) { .home-app-grid { grid-template-columns:repeat(3,minmax(0,1fr)); } }
@media (max-width:660px) { .home-dashboard { padding:1rem .8rem 1.5rem; }.home-brand-icon { width:45px; height:45px; border-radius:14px; }.home-brand-name { font-size:.95rem; }.home-logout span { display:none; }.home-hero { min-height:0; padding:1.25rem; border-radius:19px; }.home-hero-art { width:90px; height:100px; }.home-hero-art span { font-size:3.4rem; }.home-hero-art i,.home-hero-art b { display:none; }.home-hero p { font-size:.78rem; }.home-app-grid { grid-template-columns:repeat(2,minmax(0,1fr)); gap:.7rem; }.home-app-tile { min-height:162px; padding:.85rem; border-radius:17px; }.home-app-icon { width:44px; height:44px; border-radius:13px; font-size:1.5rem; }.home-app-title { font-size:.9rem; }.home-app-desc { font-size:.67rem; }.home-section-title { margin-top:1.5rem; }.home-section-title small { display:none; }.home-status-row { gap:.45rem; }.home-status-row > div { max-width:100%; } }

/* صفحة الاستهلاكات */
.consumption-page { width:100%; grid-column:1 / -1; margin-bottom:2rem; position:relative; z-index:30; background:#fffaf5; }
.consumption-page.consumption-is-open { position:fixed !important; inset:0 !important; z-index:9500 !important; width:100vw !important; min-height:100vh !important; margin:0 !important; overflow:auto !important; background:#fffaf5 !important; }
.consumption-shell { max-width:1160px; margin:0 auto; overflow:hidden; border:1px solid #fed7aa; border-radius:22px; background:#fff; box-shadow:0 16px 38px rgba(120,53,15,.13); }
.consumption-header { padding:1.25rem 1.5rem; display:flex; align-items:center; justify-content:space-between; gap:1rem; background:radial-gradient(circle at 15% 10%,rgba(253,186,116,.45),transparent 33%),linear-gradient(125deg,#fff7ed,#fffbeb); border-bottom:1px solid #fed7aa; }
.consumption-heading { display:flex; align-items:center; gap:.8rem; }.consumption-bolt { width:57px; height:57px; display:grid; place-items:center; flex:0 0 auto; border-radius:18px; background:linear-gradient(145deg,#f59e0b,#ea580c); font-size:1.85rem; box-shadow:0 10px 19px rgba(234,88,12,.28); }.consumption-heading span { color:#c2410c; font-size:.73rem; font-weight:900; }.consumption-heading h2 { margin:.08rem 0; color:#7c2d12; font-size:1.55rem; font-weight:900; }.consumption-heading p { margin:0; color:#9a5b35; font-size:.78rem; }
.consumption-actions { display:flex; gap:.45rem; flex-wrap:wrap; }.cons-btn,.cons-load-btn { border:0; border-radius:10px; padding:.58rem .82rem; cursor:pointer; font:inherit; font-size:.8rem; font-weight:850; transition:transform .16s,box-shadow .16s; }.cons-btn:hover,.cons-load-btn:hover { transform:translateY(-2px); box-shadow:0 8px 14px rgba(120,53,15,.17); }.cons-btn-settings { color:#fff; background:#b45309; }.cons-btn-back { color:#9a3412; border:1px solid #fed7aa; background:#fff; }
.cons-select-bar { padding:1rem 1.5rem; display:grid; grid-template-columns:1fr 1fr auto; gap:.75rem; align-items:end; background:#fff; border-bottom:1px solid #ffedd5; }.cons-select-field { display:grid; gap:.32rem; color:#9a3412; font-size:.78rem; font-weight:850; }.cons-select-field select { width:100%; min-width:0; padding:.66rem .7rem; color:#431407; border:1.5px solid #fdba74; border-radius:10px; outline:none; background:#fffaf5; font:inherit; font-weight:700; }.cons-select-field select:focus { border-color:#ea580c; box-shadow:0 0 0 3px rgba(251,146,60,.18); }.cons-load-btn { min-height:40px; color:#fff; background:linear-gradient(135deg,#ea580c,#f59e0b); }
.cons-unit-body { padding:1.3rem 1.5rem; background:linear-gradient(#fff,#fffcf8); }.cons-empty-state { min-height:230px; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:.48rem; text-align:center; color:#9a5b35; }.cons-empty-state div { width:64px; height:64px; display:grid; place-items:center; margin-bottom:.25rem; border-radius:22px; background:#fff1dc; font-size:2rem; }.cons-empty-state strong { color:#9a3412; font-size:1rem; }.cons-empty-state span { font-size:.8rem; color:#a87a5b; }.cons-summary-cards { display:flex; flex-wrap:wrap; gap:.7rem; align-items:stretch; margin-bottom:1.1rem; }.cons-summary-cards > div { box-shadow:0 5px 13px rgba(120,53,15,.06); }.cons-table-heading { margin:1.1rem 0 .65rem; color:#9a3412; font-size:1.02rem; font-weight:900; }
@media (max-width:700px) { .consumption-header { padding:1rem; align-items:flex-start; }.consumption-bolt { width:48px; height:48px; border-radius:15px; font-size:1.55rem; }.consumption-heading h2 { font-size:1.2rem; }.consumption-heading p { display:none; }.consumption-actions { justify-content:flex-end; }.cons-btn span { display:none; }.cons-select-bar { padding:.85rem 1rem; grid-template-columns:1fr; gap:.6rem; }.cons-load-btn { width:100%; }.cons-unit-body { padding:1rem; }.consumption-shell { border-radius:17px; } }

/* تجربة هاتف حقيقية: مساحات لمس كبيرة، لا قصّ للمحتوى، وتخطيط عمود واحد. */
@media (max-width: 767px) {
  html { -webkit-text-size-adjust: 100%; }
  body { min-width: 0; padding-bottom: env(safe-area-inset-bottom); }
  button, [role="button"], input[type="checkbox"], input[type="radio"] { touch-action: manipulation; }
  button, .btn, .buildings-back, .tenants-home, .tenants-add, .cons-btn, .cons-load-btn { min-height: 44px; }

  .app-container { width: 100%; padding: .7rem; gap: .85rem; }
  .app-header { position:sticky; top:0; z-index:200; padding-top:calc(.6rem + env(safe-area-inset-top)); }
  .header-actions { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); }
  .header-actions .btn { width:100%; }
  .header-actions #user-profile-badge { grid-column:1/-1; }

  .tenant-entry-page { width:100%; padding:0; }
  .tenant-entry-hero { padding:1rem; border-radius:16px; align-items:flex-start; }
  .tenant-entry-hero h2 { font-size:1.14rem; }
  .tenant-entry-hero p, .tenant-entry-steps { display:none; }
  .tenant-entry-toolbar { display:grid !important; grid-template-columns:1fr 1fr; gap:.5rem; padding:0; }
  .tenant-entry-toolbar > span { display:none; }
  .tenant-entry-toolbar button { width:100%; margin:0 !important; }
  .preview-section { width:100%; }
  .preview-toolbar { padding:.65rem .75rem; }
  .preview-wrapper { padding:.7rem; justify-content:flex-start; overflow:auto; -webkit-overflow-scrolling:touch; }
  /* نحافظ على ورقة A4 قابلة للقراءة بالتمرير، ولا نضغطها إلى نص غير مقروء. */
  .preview-wrapper .a4-paper { width:210mm; min-width:210mm; max-width:none; transform-origin:top right; }

  .buildings-page, .tenants-page, .consumption-page { margin:0; width:100%; }
  .buildings-shell, .tenants-shell, .consumption-shell { border-radius:16px; width:100%; }
  .buildings-header, .tenants-header, .consumption-header { flex-wrap:wrap; }
  .buildings-back, .tenants-actions, .consumption-actions { width:100%; }
  .buildings-back { text-align:center; }
  .tenants-actions > *, .consumption-actions > * { flex:1 1 0; text-align:center; }
  .buildings-tabs { flex-wrap:nowrap; overflow-x:auto; -webkit-overflow-scrolling:touch; }
  .buildings-tabs button { flex:0 0 auto; }
  .tenants-filter, .search-bar { display:grid !important; grid-template-columns:1fr !important; }

  .modal-overlay { padding:0 !important; align-items:flex-end !important; }
  .modal-card { width:100% !important; max-width:100% !important; max-height:94dvh; margin:0 !important; border-radius:20px 20px 0 0; }
  .modal-body { padding:.9rem; }
  .modal-footer { position:sticky; bottom:0; background:#fff; padding:.75rem; box-shadow:0 -8px 18px rgba(15,23,42,.08); }
}

@media (max-width: 390px) {
  .home-app-grid { grid-template-columns:1fr 1fr; gap:.55rem; }
  .home-app-tile { min-height:145px; padding:.7rem; }
  .home-app-desc { display:none; }
  .header-actions { grid-template-columns:1fr; }
  .tenant-entry-toolbar { grid-template-columns:1fr; }
}

/* مدير الملفات: واجهة تشبه المستكشف، مع وضوح للأدوات والمجلدات والملفات. */
.drive-page { width:100%; grid-column:1/-1; margin-bottom:2rem; }
.drive-shell { max-width:1240px !important; overflow:hidden; border:1px solid #bfdbfe !important; border-radius:24px !important; box-shadow:0 18px 42px rgba(30,64,175,.15) !important; }
.drive-header { min-height:105px; padding:1.25rem 1.55rem !important; background:radial-gradient(circle at 8% 10%,rgba(125,211,252,.52),transparent 30%),linear-gradient(125deg,#eff6ff,#f8fbff 55%,#eef2ff) !important; border-bottom:1px solid #bfdbfe !important; }
.drive-header h2 { display:flex; align-items:center; gap:.55rem; color:#172554 !important; font-size:1.5rem !important; }
.drive-header .btn-home { min-height:40px; border:1px solid #93c5fd; border-radius:11px; background:#fff; color:#1d4ed8; }
#drive-breadcrumbs { padding:.75rem 1.55rem !important; min-height:48px; background:#fff !important; color:#1d4ed8 !important; font-size:.82rem !important; }
.drive-toolbar { padding:.85rem 1.55rem !important; gap:.45rem !important; background:linear-gradient(180deg,#f8fafc,#f1f5f9) !important; }
.drive-toolbar .btn { min-height:39px; padding:.45rem .72rem !important; border-radius:10px !important; box-shadow:0 3px 7px rgba(15,23,42,.09); transition:transform .15s,filter .15s; }
.drive-toolbar .btn:hover { transform:translateY(-2px); filter:brightness(1.04); }
.drive-toolbar > span[style*="width:1px"] { height:29px !important; background:#cbd5e1 !important; }
#drive-sort { min-height:39px; border:1px solid #cbd5e1 !important; border-radius:10px !important; background:#fff !important; }
#drive-status { padding:.35rem .6rem; color:#475569 !important; }
#drive-count { padding:.32rem .7rem !important; color:#1d4ed8 !important; background:#dbeafe !important; border:1px solid #bfdbfe; }
#drive-drop-zone { margin:.85rem 1.55rem 0; padding:1rem !important; border:2px dashed #60a5fa !important; border-radius:14px; background:linear-gradient(135deg,#eff6ff,#f0f9ff) !important; color:#1d4ed8 !important; }
#drive-folder-info { margin:.7rem 1.55rem 0; padding:.6rem .75rem !important; border:1px solid #e2e8f0; border-radius:11px; background:#f8fafc !important; }
.drive-items { padding:1.2rem 1.55rem 1.6rem !important; min-height:320px !important; }
.drive-grid { grid-template-columns:repeat(auto-fill,minmax(175px,1fr)) !important; gap:1rem !important; }
.drive-item-card { border-color:#dbeafe !important; border-radius:17px !important; padding:1rem !important; background:linear-gradient(145deg,#fff,#f8fbff) !important; box-shadow:0 5px 13px rgba(30,64,175,.06); }
.drive-item-card.is-folder { background:linear-gradient(145deg,#fffdf4,#fffbeb) !important; border-color:#fde68a !important; }
.drive-item-card:hover { border-color:#60a5fa !important; }
.drive-list-scroll { border:1px solid #dbeafe; border-radius:14px; }
.drive-list-head { border:0 !important; background:#eff6ff !important; }
.drive-list-row:last-child { border-bottom:0 !important; }
#drive-select-bar { margin:0 1.55rem; border-radius:0 0 12px 12px; }

@media (max-width:767px) {
  .drive-page { margin:0; }
  .drive-shell { border-radius:17px !important; }
  .drive-header { min-height:0; padding:1rem !important; }
  .drive-header h2 { font-size:1.13rem !important; line-height:1.55; }
  .drive-header .btn-home { width:100%; }
  #drive-breadcrumbs { padding:.65rem .85rem !important; overflow-x:auto; flex-wrap:nowrap !important; white-space:nowrap; }
  .drive-toolbar { display:flex !important; flex-wrap:nowrap !important; overflow-x:auto; padding:.75rem .85rem !important; -webkit-overflow-scrolling:touch; }
  .drive-toolbar .btn,.drive-toolbar select { flex:0 0 auto; }
  .drive-toolbar > span[style*="width:1px"],#drive-status { display:none !important; }
  #drive-drop-zone { margin:.75rem .85rem 0; padding:.8rem !important; font-size:.78rem !important; }
  #drive-folder-info { margin:.65rem .85rem 0; font-size:.72rem !important; }
  .drive-items { padding:1rem .85rem 1.4rem !important; min-height:280px !important; }
  .drive-grid { grid-template-columns:repeat(2,minmax(0,1fr)) !important; gap:.65rem !important; }
  .drive-item-card { min-width:0; padding:.75rem .55rem !important; border-radius:14px !important; }
  .drive-item-card > div:nth-child(3) { font-size:1.8rem !important; }
  .drive-item-card > div:nth-child(4) { font-size:.72rem !important; }
  #drive-select-bar { margin:0 .85rem; font-size:.76rem !important; }

  /* هاتف: لا نستخدم جدولاً بعرض ثابت لمدير الملفات. تتحول القائمة إلى
     بطاقات مختصرة كي تبقى الأسماء والأزرار قابلة للمس من دون تمرير أفقي. */
  #drive-full-page { width:100% !important; min-width:0; }
  .drive-header { display:block !important; text-align:right; }
  .drive-header h2 { margin-bottom:.7rem !important; }
  .drive-header .btn-home { min-height:44px; }
  .drive-toolbar { gap:.5rem !important; scroll-snap-type:x proximity; }
  .drive-toolbar .btn { min-height:43px !important; font-size:.77rem !important; scroll-snap-align:start; }
  .drive-toolbar > div { flex:0 0 auto; }
  #drive-sort { max-width:145px; font-size:.74rem !important; }
  #drive-upload-progress { padding:.65rem .85rem !important; }
  #drive-select-bar { padding:.6rem !important; gap:.4rem !important; }
  #drive-select-bar .btn { flex:1 1 44%; min-height:42px; font-size:.76rem !important; }
  .drive-list-scroll { overflow:visible !important; border:0 !important; }
  .drive-list-head { display:none !important; }
  .drive-list-row {
    display:grid !important;
    grid-template-columns:32px minmax(0,1fr) auto !important;
    gap:.45rem !important;
    min-width:0 !important;
    margin-bottom:.55rem;
    padding:.7rem !important;
    border:1px solid #dbeafe !important;
    border-radius:13px !important;
    box-shadow:0 3px 10px rgba(30,64,175,.06);
  }
  .drive-list-row > span:nth-child(3),
  .drive-list-row > span:nth-child(4),
  .drive-list-row > span:nth-child(5) { display:none !important; }
  .drive-list-row > span:nth-child(2) { min-width:0; font-size:.8rem; }
  .drive-list-row > span:last-child {
    grid-column:2 / -1;
    display:flex !important;
    flex-wrap:wrap;
    gap:.35rem;
    justify-content:flex-start !important;
    padding-top:.25rem;
  }
  .drive-list-row > span:last-child .btn { min-height:38px; padding:.35rem .5rem !important; font-size:.72rem !important; }
  #drive-preview-modal > div { width:100% !important; max-width:none !important; max-height:100dvh !important; height:100dvh; border-radius:0 !important; }
  #drive-preview-modal > div > div:first-child { padding:.75rem !important; }
  #drive-preview-title { max-width:100%; font-size:.85rem !important; }
  #drive-preview-body { padding:.5rem !important; }
  #drive-preview-body img, #drive-preview-body iframe, #drive-preview-body video { max-width:100% !important; max-height:76dvh !important; }
  #drive-share-modal > div, #drive-move-modal > div, #drive-share-sel-modal > div { width:calc(100% - 1.3rem) !important; padding:1rem !important; border-radius:16px !important; }

  /* نافذة الإعدادات: واجهة جوال مستقلة، مع تبويبات أفقية ومحتوى قابل للتمرير. */
  #settings-modal { padding:0 !important; align-items:flex-end !important; }
  #settings-modal .settings-modal-card {
    width:100% !important;
    max-width:100% !important;
    height:100dvh !important;
    max-height:100dvh !important;
    margin:0 !important;
    border-radius:20px 20px 0 0 !important;
    display:flex !important;
    flex-direction:column !important;
    overflow:hidden !important;
  }
  #settings-modal .modal-header { padding:.85rem 1rem !important; flex:0 0 auto; }
  #settings-modal .modal-header h3, #settings-modal .card-header-title { font-size:1rem !important; min-width:0; }
  #settings-modal .settings-nav-tabs {
    flex:0 0 auto;
    flex-wrap:nowrap !important;
    overflow-x:auto !important;
    overflow-y:hidden !important;
    padding:.55rem .75rem !important;
    gap:.4rem !important;
    -webkit-overflow-scrolling:touch;
    scrollbar-width:thin;
  }
  #settings-modal .settings-nav-tabs .modal-tab-btn {
    flex:0 0 auto !important;
    min-height:42px;
    padding:.55rem .72rem !important;
    font-size:.74rem !important;
    white-space:nowrap;
  }
  #settings-modal .modal-body {
    flex:1 1 auto !important;
    min-height:0;
    overflow-y:auto !important;
    overflow-x:hidden !important;
    padding:.9rem !important;
    display:block !important;
    -webkit-overflow-scrolling:touch;
  }
  #settings-modal [id^="settings-tab-"] { min-width:0; }
  #settings-modal .settings-box-highlight { padding:.85rem !important; border-radius:13px !important; }
  #settings-modal .settings-box-highlight h4 { font-size:.93rem !important; line-height:1.55; }
  #settings-modal .form-row { display:grid !important; grid-template-columns:1fr !important; gap:.7rem !important; }
  #settings-modal .form-group { min-width:0; }
  #settings-modal input[type="text"],
  #settings-modal input[type="password"],
  #settings-modal input[type="number"],
  #settings-modal input[type="url"],
  #settings-modal select,
  #settings-modal textarea { width:100% !important; min-height:43px; font-size:16px !important; box-sizing:border-box; }
  #settings-modal textarea { min-height:110px; }
  #settings-modal button.btn { min-height:42px; font-size:.8rem !important; }
  #settings-modal [style*="display:flex"] { max-width:100%; }
  #settings-modal [style*="justify-content:flex-end"] { justify-content:stretch !important; flex-wrap:wrap !important; }
  #settings-modal [style*="justify-content:flex-end"] .btn { flex:1 1 130px; }
  #settings-modal table { min-width:760px; }
  #settings-modal table th, #settings-modal table td { white-space:nowrap; }
  #settings-tab-visitors [style*="overflow-x:auto"] { margin:0 -.15rem; border-radius:10px !important; }
  #settings-tab-visitors [style*="flex:1 1 150px"] { flex-basis:calc(50% - .4rem) !important; }
}

/* حاسبة الضريبة: تنظيم بصري للمدخلات ثم النتائج، دون تغيير معادلات الحساب. */
.tax-page { width:100%; grid-column:1/-1; margin-bottom:2rem; }
.tax-shell { max-width:1080px !important; border:0 !important; border-radius:24px !important; background:#fff !important; box-shadow:0 20px 44px rgba(127,29,29,.14) !important; }
.tax-header { min-height:105px; padding:1.2rem 1.6rem !important; color:#fff; background:radial-gradient(circle at 12% 10%,rgba(251,191,36,.22),transparent 30%),linear-gradient(120deg,#7f1d1d,#b91c1c 55%,#ef4444) !important; border:0 !important; }
.tax-header h2 { color:#fff !important; font-size:1.65rem !important; text-shadow:0 2px 6px rgba(0,0,0,.16); }
.tax-header > div:first-child,.tax-header > div:last-child > div { filter:drop-shadow(0 4px 4px rgba(0,0,0,.15)); }
.tax-header .btn { min-height:40px; border-color:rgba(255,255,255,.5) !important; color:#7f1d1d !important; }
.tax-content { padding:1.45rem 1.6rem 1.7rem !important; background:linear-gradient(180deg,#fffafa,#fff) !important; }
.tax-presets { border:1px solid #fecaca !important; border-radius:16px; overflow:hidden; box-shadow:0 7px 16px rgba(127,29,29,.07); }
.tax-presets [data-tax-preset] { background:linear-gradient(135deg,#fee2e2,#fff1f2) !important; color:#991b1b; transition:transform .16s,background .16s; }
.tax-presets [data-tax-preset]:hover { transform:translateY(-2px); background:#fecaca !important; }
.tax-period-grid,.tax-rent-grid { padding:1rem; border:1px solid #fee2e2; border-radius:16px; background:#fff; box-shadow:0 6px 15px rgba(127,29,29,.045); }
.tax-period-grid input,.tax-rent-grid input,#tax_page_municipal_fee { border:1.5px solid #fca5a5 !important; background:#fff7ed !important; border-radius:10px !important; color:#7f1d1d; }
.tax-period-grid > div,.tax-rent-grid > div { min-width:0; }
.tax-period-grid label { color:#991b1b !important; }
.tax-rent-grid label { color:#334155 !important; }
.tax-content hr { border-color:#fecaca !important; border-width:1px !important; }
.tax-results { max-width:640px; margin:0 auto 1.6rem !important; padding:1rem; border-radius:18px; background:linear-gradient(135deg,#fff7ed,#fff); border:1px solid #fed7aa; }
.tax-results > div { width:100% !important; max-width:none !important; min-height:55px; padding:.45rem .75rem; justify-content:space-between !important; gap:.85rem !important; border-bottom:1px dashed #fed7aa; }
.tax-results > div:last-child { border:0; background:#fff1f2; border-radius:12px; }
.tax-results label { font-size:1rem !important; white-space:normal !important; }
.tax-results [id$="_value"],.tax-results input { width:190px !important; flex:0 0 auto; border-radius:10px !important; border-color:#fca5a5 !important; }
.tax-actions { padding-top:1rem !important; }
.tax-actions > div { display:flex; gap:.55rem; flex-wrap:wrap; }
.tax-actions .btn { min-height:42px; }

@media (max-width:767px) {
  .tax-page { margin:0; }
  .tax-shell { border-radius:17px !important; }
  .tax-header { min-height:0; padding:1rem !important; flex-wrap:wrap; gap:.7rem; }
  .tax-header h2 { order:-1; width:calc(100% - 50px); font-size:1.25rem !important; text-align:right !important; }
  .tax-header > div:first-child { font-size:1.5rem !important; }
  .tax-header > div:last-child { width:100%; display:block !important; }
  .tax-header > div:last-child > div { display:none; }
  .tax-header .btn { width:100%; }
  .tax-content { padding:.85rem !important; }
  .tax-presets { grid-template-columns:1fr 1fr !important; margin-bottom:1rem !important; }
  .tax-presets > div { min-height:54px; padding:.45rem !important; border:0 !important; border-bottom:1px solid #fecaca !important; font-size:.78rem !important; }
  .tax-presets [data-tax-preset],.tax-presets [data-tax-days] { font-size:1.08rem !important; }
  .tax-period-grid,.tax-rent-grid { display:grid !important; grid-template-columns:1fr !important; gap:.7rem !important; padding:.8rem; margin-bottom:1rem !important; }
  .tax-period-grid > div,.tax-rent-grid > div { display:grid !important; grid-template-columns:1fr !important; gap:.35rem !important; text-align:right !important; }
  .tax-period-grid input,.tax-rent-grid input,.tax-rent-grid [id$="_rent"],.tax-rent-grid [id$="_value"] { width:100% !important; min-width:0 !important; box-sizing:border-box; }
  .tax-period-grid > div:last-child { display:flex !important; flex-direction:row !important; justify-content:space-between; align-items:stretch; }
  .tax-period-grid > div:last-child > div { flex:1; display:flex !important; justify-content:center; }
  .tax-results { padding:.7rem; gap:.35rem !important; }
  .tax-results > div { display:grid !important; grid-template-columns:1fr !important; padding:.7rem !important; gap:.4rem !important; text-align:right; }
  .tax-results [id$="_value"],.tax-results input { width:100% !important; box-sizing:border-box; min-height:45px; }
  .tax-actions { display:grid !important; grid-template-columns:1fr !important; gap:.55rem !important; }
  .tax-actions > div { display:grid !important; grid-template-columns:1fr !important; }
  .tax-actions button { width:100% !important; min-height:46px !important; justify-content:center; }
}

/* شريط التنقل العلوي: يفصل هوية النظام عن أدوات العمل بوضوح. */
.app-topbar { min-height:78px; padding: .85rem 1.5rem; gap:1.25rem; background:radial-gradient(circle at 88% -70%,rgba(56,189,248,.38),transparent 45%),linear-gradient(115deg,#0f172a,#172554 52%,#1e3a8a); border-bottom:1px solid rgba(125,211,252,.25); box-shadow:0 8px 22px rgba(15,23,42,.22); }
.app-topbar .header-title-box { min-width:260px; }
.app-topbar .header-icon { width:48px; height:48px; border-radius:15px; background:linear-gradient(145deg,#38bdf8,#2563eb); border:1px solid rgba(255,255,255,.24); box-shadow:0 8px 17px rgba(2,132,199,.3); }
.header-icon img,.home-brand-icon img { width:100%; height:100%; object-fit:contain; border-radius:inherit; background:#fff; }
#login-brand-logo img { width:100%; height:100%; object-fit:contain; border-radius:inherit; background:#fff; padding:4px; box-sizing:border-box; }
.app-topbar .header-title { font-size:1.2rem; letter-spacing:0; }
.app-topbar .header-subtitle { max-width:540px; color:#bfdbfe; font-size:.73rem; line-height:1.45; }
.header-nav { display:flex; align-items:center; justify-content:flex-end; flex-wrap:wrap; gap:.45rem; }
.header-nav-btn { min-height:38px; width:auto !important; padding:.48rem .7rem !important; border-radius:11px !important; border:1px solid rgba(191,219,254,.26) !important; color:#e0f2fe !important; background:rgba(15,23,42,.32) !important; font-size:.77rem !important; font-weight:800 !important; box-shadow:none; transition:transform .16s,background .16s,border-color .16s; }
.header-nav-btn:hover { transform:translateY(-2px); color:#fff !important; background:rgba(59,130,246,.35) !important; border-color:#7dd3fc !important; }
.header-nav-home { background:linear-gradient(135deg,#eff6ff,#dbeafe) !important; color:#1d4ed8 !important; border-color:#93c5fd !important; }
.header-nav-settings { background:linear-gradient(135deg,#1d4ed8,#2563eb) !important; color:#fff !important; border-color:#60a5fa !important; }
.header-nav-sample { color:#fde68a !important; }
.header-nav-clear { color:#bae6fd !important; }
.header-user-badge { min-height:38px; border-radius:11px !important; border-color:rgba(191,219,254,.34) !important; background:rgba(255,255,255,.94) !important; box-shadow:0 3px 10px rgba(0,0,0,.14); }
.header-user-badge .btn { min-height:28px !important; width:auto !important; }

@media (max-width: 900px) {
  .app-topbar { align-items:flex-start; flex-wrap:wrap; padding: .75rem 1rem; }
  .app-topbar .header-title-box { flex:1 1 auto; }
  .header-nav { flex:1 1 100%; justify-content:flex-start; }
}
@media (max-width: 767px) {
  .app-topbar { position:sticky; padding:calc(.65rem + env(safe-area-inset-top)) .65rem .65rem; gap:.55rem; }
  .app-topbar .header-title-box { width:100%; }
  .app-topbar .header-icon { width:40px; height:40px; border-radius:13px; font-size:1.25rem; }
  .app-topbar .header-title { font-size:1rem; }
  .app-topbar .header-subtitle { display:none; }
  .header-nav { display:flex !important; flex-wrap:nowrap !important; overflow-x:auto; width:calc(100vw - 1.3rem); padding:.15rem 0 .35rem; gap:.4rem; justify-content:flex-start; -webkit-overflow-scrolling:touch; scrollbar-width:none; }
  .header-nav::-webkit-scrollbar { display:none; }
  .header-nav-btn { flex:0 0 auto; min-height:42px; padding:.52rem .72rem !important; font-size:.76rem !important; white-space:nowrap; }
  .header-user-badge { flex:0 0 auto !important; min-height:42px; white-space:nowrap; }
  .header-user-badge #current-user-name { max-width:95px; overflow:hidden; text-overflow:ellipsis; }
}

/* قاعدة موحّدة للصفحات التي تُنشأ من JavaScript: لا تسمح لبطاقة أو نافذة
   أو جدول بزيادة عرض الهاتف، مع إبقاء البيانات العريضة قابلة للتمرير. */
@media (max-width: 767px) {
  body { min-width:0; overscroll-behavior-x:none; }
  .app-container, .app-container > *, [id$="-full-page"], .full-page,
  .buildings-page, .tenants-page, .drive-page, .tax-page, .consumption-page {
    min-width:0 !important; max-width:100% !important;
  }
  .card, .form-card, .settings-box-highlight, .buildings-shell, .tenants-shell,
  .consumption-shell, .tax-shell { max-width:100% !important; box-sizing:border-box; }
  .form-group, .form-section, .form-row > *, .form-row-3 > *, .form-row-4 > * {
    min-width:0 !important;
  }
  .form-group input, .form-group select, .form-group textarea { width:100% !important; box-sizing:border-box; }
  .modal, .modal-overlay { padding:.5rem !important; align-items:flex-end !important; }
  .modal-content, .modal-card, .settings-modal-card {
    width:100% !important; max-width:100% !important; max-height:94dvh !important;
    box-sizing:border-box; border-radius:18px 18px 12px 12px !important;
  }
  .modal-body { max-height:calc(94dvh - 65px); overflow:auto; -webkit-overflow-scrolling:touch; }
  .table-wrapper, .table-container, .history-table-wrap, .bldg-table-wrap,
  .records-table-wrap, .invoice-table-wrap { width:100%; overflow-x:auto; -webkit-overflow-scrolling:touch; }
  table { max-width:none; }
  .bldg-table, .history-table, .records-table, .invoice-table { min-width:620px; }
  .buildings-header, .tenants-header, .consumption-header, .tax-header { align-items:flex-start; }
  .buildings-actions, .tenants-actions, .consumption-actions, .tax-actions { width:100%; }
  .buildings-actions .btn, .tenants-actions .btn, .consumption-actions .btn, .tax-actions .btn { flex:1 1 130px; }
  .lang-en .buildings-title, .lang-en .tenants-title { padding-right:0; padding-left:55px; }
  .lang-en .buildings-title > div, .lang-en .tenants-title > div { right:auto; left:0; }
}
