@import url("https://fonts.googleapis.com") screen; /* يتجاهله المتصفح إن تعذر الاتصال؛ الخط الاحتياطي أدناه يعمل دون إنترنت */

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  font-family: "Noto Kufi Arabic", "Noto Sans Arabic", Tahoma, sans-serif;
  background: linear-gradient(160deg, #eef6ff 0%, #f3eefc 45%, #eefaf6 100%);
  color: #202538;
  direction: rtl;
  -webkit-print-color-adjust: exact; print-color-adjust: exact; color-adjust: exact;
}

/* ===================== هيكل الموقع ===================== */
.site {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100vh;
  padding: 8px;
}

.app {
  width: 99%; max-width: 1900px;
  background: #ffffff;
  border-radius: 20px;
  box-shadow: 0 20px 50px rgba(30,50,120,.12), 0 2px 8px rgba(30,50,120,.06);
  padding: 38px 48px 50px;
  border: 1px solid #eef1fb;
  position: relative;
  overflow: hidden;
}
.app::before {
  content: ""; position: absolute; top: 0; right: 0; left: 0; height: 6px;
  background: linear-gradient(90deg, #1a3c6e, #0e9e63 40%, #e07a1a 70%, #7c3fd6);
}
.app-header h1 {
  margin: 6px 0 10px; font-size: 40px; font-weight: 800;
  background: linear-gradient(90deg, #123a73, #0e9e63);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.app-header p { margin: 0 0 30px; color: #5a6280; font-size: 18px; max-width: 920px; line-height: 1.6; }

/* ===================== شريط الخطوات ===================== */
.steps {
  display: flex; list-style: none; margin: 0 0 32px; padding: 0;
  gap: 10px;
}
.steps li {
  flex: 1; text-align: center; padding: 15px 6px; font-size: 15.5px; font-weight: 700;
  background: #f1f4fb; color: #97a0bc; border-radius: 12px; position: relative;
  transition: all .25s ease;
}
.steps li.active {
  background: linear-gradient(135deg, #1a3c6e, #0e6ba8);
  color: #fff; box-shadow: 0 6px 16px rgba(26,60,110,.3);
  transform: translateY(-1px);
}
.steps li.done { background: #d9f2e6; color: #0e7a4d; }

/* ===================== اللوحات (Panels) ===================== */
.panel h2 { font-size: 18px; color: #16305c; margin: 0 0 16px; font-weight: 800; }
.panel.hidden { display: none; }
.panel-actions { display: flex; gap: 10px; margin-top: 24px; justify-content: flex-end; flex-wrap: wrap; }

.btn {
  border: none; border-radius: 10px; padding: 12px 22px; font-size: 14px; font-weight: 700;
  cursor: pointer; font-family: inherit; transition: transform .15s ease, box-shadow .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: linear-gradient(135deg, #1a3c6e, #0e6ba8); color: #fff; box-shadow: 0 6px 16px rgba(26,60,110,.28); }
.btn-primary:disabled { background: #c3cbe0; box-shadow: none; cursor: not-allowed; transform: none; }
.btn-ghost { background: #f1f4fb; color: #334066; }
.btn-secondary { background: linear-gradient(135deg, #ffe3c2, #ffd39a); color: #8a4b06; }
.btn-success { background: linear-gradient(135deg, #14b876, #0e9e63); color: #fff; box-shadow: 0 6px 16px rgba(14,158,99,.3); }
.hidden { display: none !important; }

/* ===================== اختيار المادة ===================== */
.subject-grid { display: flex; gap: 16px; flex-wrap: wrap; }
.subject-card {
  flex: 1; min-width: 220px; padding: 50px 20px; border-radius: 20px;
  border: 2px solid #eef1fb; background: #fbfcff; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 18px;
  font-family: inherit; font-size: 20px; font-weight: 800; color: #334066;
  transition: all .2s ease;
}
.subject-card:hover { border-color: #c9d6f5; transform: translateY(-2px); box-shadow: 0 10px 22px rgba(30,50,120,.08); }
.subject-card .ico {
  font-size: 50px; width: 108px; height: 108px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #eef2fd, #e3ecff);
}
.subject-card.selected { border-color: #1a3c6e; background: linear-gradient(160deg, #eef6ff, #eafaf3); box-shadow: 0 10px 26px rgba(26,60,110,.15); }
.subject-card.selected .ico { background: linear-gradient(135deg, #1a3c6e, #0e6ba8); }

/* ===================== اختيار شكل الخريطة ===================== */
.template-grid { display: flex; gap: 16px; flex-wrap: wrap; }
.template-card {
  flex: 1; min-width: 240px; padding: 40px 26px; border-radius: 20px;
  border: 2px solid #eef1fb; background: #fbfcff; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center;
  font-family: inherit; transition: all .2s ease;
}
.template-card:hover { border-color: #c9d6f5; transform: translateY(-2px); box-shadow: 0 10px 22px rgba(30,50,120,.08); }
.template-card.selected { border-color: #1a3c6e; background: linear-gradient(160deg, #eef6ff, #eafaf3); box-shadow: 0 10px 26px rgba(26,60,110,.15); }
.tpl-thumb {
  font-size: 50px; width: 104px; height: 104px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #eef2fd, #e3ecff);
}
.tpl-thumb-colorful { background: linear-gradient(135deg, #ffe3ee, #fff3d6); }
.tpl-thumb-bubbles { background: linear-gradient(135deg, #e3f7ee, #e3ecff); }
.tpl-name { font-size: 20px; font-weight: 800; color: #334066; }
.tpl-desc { font-size: 15px; color: #7a86a6; line-height: 1.55; }

/* ===================== كتل شرح المحتوى (تملأ الصفحة بمحتوى فعلي) ===================== */
.info-block { margin-top: 44px; padding-top: 36px; border-top: 1px solid #eef1fb; }
.info-block h3 { margin: 0 0 24px; font-size: 23px; font-weight: 800; color: #1a3c6e; }
.info-steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 22px; }
.info-step { display: flex; flex-direction: column; gap: 10px; background: #fbfcff; border: 1px solid #eef1fb; border-radius: 16px; padding: 24px 20px; }
.info-num {
  width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg, #1a3c6e, #0e6ba8);
  color: #fff; font-weight: 800; font-size: 16px; display: flex; align-items: center; justify-content: center;
}
.info-step b { font-size: 17.5px; color: #23262f; }
.info-step p { margin: 2px 0 0; font-size: 15px; color: #6b7394; line-height: 1.6; }
.info-benefits { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px 26px; }
.info-benefits li { font-size: 17px; color: #334066; line-height: 1.6; }
@media (max-width: 760px) {
  .info-steps, .info-benefits { grid-template-columns: 1fr; }
}

/* ===================== رفع الملف ===================== */
.dropzone {
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  border: 2.5px dashed #b9c6ef; border-radius: 18px; padding: 64px 20px;
  cursor: pointer; color: #5a6280; background: linear-gradient(160deg, #fbfcff, #f3f6ff);
  transition: all .2s ease; font-size: 16px;
}
.dropzone.dragover { border-color: #0e9e63; background: linear-gradient(160deg, #eafaf3, #e3f7ee); }
.dz-icon { font-size: 50px; }
.status { margin-top: 16px; font-size: 14.5px; color: #334066; min-height: 18px; font-weight: 600; }
.status.error { color: #c62828; }
.status.ok { color: #0e9e63; }

/* ===================== نموذج الترويسة ===================== */
.form-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px 26px; }
.form-grid label { display: flex; flex-direction: column; gap: 8px; font-size: 14.5px; font-weight: 700; color: #334066; }
.form-grid input {
  padding: 14px 16px; border-radius: 12px; border: 1.5px solid #dfe3f0; font-size: 15.5px; font-family: inherit;
  transition: border-color .15s ease;
}
@media (max-width: 760px) { .form-grid { grid-template-columns: 1fr; } }
.form-grid input:focus { outline: none; border-color: #0e6ba8; box-shadow: 0 0 0 3px rgba(14,107,168,.12); }

/* ===================== معاينة الخريطة ===================== */
.hint { font-size: 13px; color: #7a86a6; margin: 0 0 12px; }
.preview-wrap {
  width: 100%; overflow: auto; background: linear-gradient(160deg, #e6ecf9, #eef6f2); border-radius: 14px; padding: 20px;
  display: flex; justify-content: center;
}
/* النسبة الفعلية تُحسب وتُطبَّق ديناميكياً بجافاسكريبت حسب العرض المتاح
   (انظر applyPreviewScale في app.js) — هذه قيمة احتياطية فقط قبل التنفيذ. */
.preview-scale { transform: scale(0.62); transform-origin: top center; }

/* ====== تصميم صفحة A4 — شبكي مرن يتكيف مع عدد المراحل ====== */
.page {
  -webkit-print-color-adjust: exact; print-color-adjust: exact; color-adjust: exact;
  position: relative;
  width: 210mm; min-height: 297mm;
  background: radial-gradient(circle at 50% 30%, #ffffff 0%, #eef2fb 55%, #e8edfa 100%);
  box-shadow: 0 4px 20px rgba(20,30,60,.15);
  font-family: "Noto Sans Arabic", "Noto Kufi Arabic", sans-serif;
  padding: 8mm 15mm 10mm;
  box-sizing: border-box;
  display: flex; flex-direction: column; gap: 4mm;
}
.page.ltr { direction: ltr; }
.header { display: flex; flex-direction: column; gap: 2mm; }
.header-title { display: flex; align-items: center; justify-content: space-between; background: #1a3c6e; border-radius: 3mm; padding: 2.5mm 5mm; color: #fff; }
.header-title h1 { font-family: "Noto Kufi Arabic", sans-serif; font-size: 17.8pt; font-weight: 800; margin: 0; color: #fff; }
.header-title .subj { font-size: 10.7pt; font-weight: 400; opacity: .92; background: rgba(255,255,255,.15); padding: 1.3mm 3mm; border-radius: 2mm; white-space: nowrap; }
.info-chips { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.8mm; }
.chip { background: #fff; border: 1px solid #d7deed; color: #334066; font-size: 8.6pt; font-weight: 700; border-radius: 2mm; padding: 1.7mm 2mm; min-width: 0; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; box-shadow: 0 1px 2px rgba(20,30,60,.05); }
.chip b { color: #1a3c6e; font-weight: 700; }
.chip span.lbl { color: #7a86a6; font-weight: 600; }

/* ============ جسم الخطاطة الذهنية: سحابة مركزية + أسهم منحنية + حاويات بعناوين مستطيلة ============ */
.mindmap-body { position: relative; }

.arrows-layer { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 1; }
.arrow-path { fill: none; stroke: #1c1c1c; stroke-width: 1.1; stroke-linecap: round; }

.cloud-label {
  position: absolute; z-index: 3;
  display: flex; align-items: center; justify-content: center;
  text-align: center; padding: 0 4mm;
}
.cloud-label span {
  font-family: "Noto Kufi Arabic", sans-serif; font-weight: 800; font-size: 12.5pt;
  color: #123a73; line-height: 1.2;
}

.stage-pill {
  position: absolute; z-index: 2;
  display: flex; align-items: center; justify-content: center; gap: 1.5mm;
  border: 0.5mm dashed var(--card-color, #1a3c6e);
  background: color-mix(in srgb, var(--card-color, #1a3c6e) 14%, #fff);
  border-radius: 20mm;
  font-family: "Noto Kufi Arabic", sans-serif; font-weight: 800; font-size: 9.6pt;
  color: #16305c; padding: 0 3mm; text-align: center;
}
.stage-pill .num {
  width: 5mm; height: 5mm; border-radius: 50%; flex-shrink: 0;
  background: var(--card-color, #1a3c6e); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 6.6pt;
}
.stage-pill .ico { font-size: 10.5pt; }

.stage-box {
  position: absolute; z-index: 2;
  background: #fff; border: 0.5mm solid #1c1c1c; border-radius: 5mm;
  padding: 4mm 3.6mm 3mm;
  background-image: repeating-linear-gradient(#fff 0 6.6mm, #dfe3ee 6.6mm 6.9mm);
  background-position: 0 1mm;
  overflow: hidden;
}
.stage-box ul { list-style: none; margin: 0; padding: 0; }
.stage-box li { position: relative; padding-inline-start: 2.9mm; margin-bottom: 1.7mm; font-size: 8pt; line-height: 1.35; color: #23262f; background: #fff; }
.stage-box li::before { content: ""; position: absolute; inset-inline-start: 0; top: 1.3mm; width: 1.5mm; height: 1.5mm; border-radius: 50%; background: var(--card-color, #1d5fd6); }

.footer { display: flex; gap: 5mm; }
.fbox { flex: 1; background: #fff; border-radius: 3mm; border: .4mm solid #e7eaf3; padding: 2.5mm 3.5mm; display: flex; flex-direction: column; justify-content: center; }
.fbox .ft-title { font-family: "Noto Kufi Arabic", sans-serif; font-weight: 800; font-size: 10.1pt; color: #12305c; margin-bottom: 1mm; }
.fbox p { font-size: 8.3pt; color: #333; line-height: 1.35; margin: 0; }
.fbox .tags { display: flex; flex-wrap: wrap; gap: 1.3mm; }
.fbox .tag { background: #eef2fb; color: #334066; border-radius: 1.8mm; font-size: 7.6pt; padding: 1mm 2.2mm; font-weight: 700; }
[contenteditable="true"]:hover { outline: 1px dashed #9aa4c4; outline-offset: 1px; cursor: text; }
[contenteditable="true"]:focus { outline: 1.5px solid #1a3c6e; background: #fffbe8; }

/* ===================== قالب "ملوّن ومرح": إعادة تلوين لنفس بنية قالب السحابة ===================== */
.page.tpl-colorful .stage-pill {
  border: 0.6mm solid var(--card-color, #1a3c6e);
  background: var(--card-color, #1a3c6e); color: #fff; box-shadow: 0 1.5mm 3mm rgba(0,0,0,.12);
}
.page.tpl-colorful .stage-pill .lbl,
.page.tpl-colorful .stage-pill span:not(.num):not(.ico) { color: #fff; }
.page.tpl-colorful .stage-pill .num { background: rgba(255,255,255,.35); width: 6mm; height: 6mm; font-size: 7.4pt; }
.page.tpl-colorful .stage-box {
  border: 0.6mm dashed var(--card-color, #1a3c6e); border-radius: 7mm;
  background-image: none; box-shadow: 0 2mm 4mm rgba(30,40,70,.10);
}
.page.tpl-colorful .stage-box::before {
  content: "⭐"; position: absolute; top: -3mm; inset-inline-end: 3mm; font-size: 7pt;
}
.page.tpl-colorful .cloud-label span { color: #7c3fd6; font-size: 13.5pt; }
.page.tpl-colorful .header-title { background: linear-gradient(120deg, #ff9ecb, #ffd08a, #8ad3ff); }

/* ===================== قالب "فقاعات تفكير": شبكة أعمدة بلا أسهم ===================== */
.bubbles-banner {
  display: flex; align-items: center; justify-content: center; gap: 4mm;
  margin: 2mm 0 4mm;
}
.bubbles-banner .ribbon-fold {
  width: 0; height: 0; border-top: 5mm solid transparent; border-bottom: 5mm solid transparent;
}
.bubbles-banner .ribbon-fold:first-child { border-inline-start: 8mm solid #eef2fb; }
.bubbles-banner .ribbon-fold:last-child { border-inline-end: 8mm solid #eef2fb; }
.bubbles-banner .ribbon-text {
  background: #fff; border: 0.5mm solid #0e9e63; border-radius: 3mm;
  padding: 2.5mm 8mm; font-family: "Noto Kufi Arabic", sans-serif; font-weight: 800;
  font-size: 14pt; color: #a41f1f;
}
.bubbles-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6mm; }
.bubble-card:last-child:nth-child(odd) { grid-column: 1 / -1; }
.bubble-card {
  position: relative; background: #fff; padding: 4mm 4mm 6mm;
  border: 0.5mm solid var(--card-color, #1d5fd6);
  border-radius: 40% 12% 38% 12% / 12% 38% 10% 42%;
}
.bubble-head { display: flex; align-items: center; gap: 1.6mm; margin-bottom: 2mm; flex-wrap: wrap; }
.bubble-num {
  width: 6.5mm; height: 6.5mm; border-radius: 50%; flex-shrink: 0;
  background: var(--card-color, #1d5fd6); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 8.5pt;
}
.bubble-ico { font-size: 11pt; }
.bubble-title { font-family: "Noto Kufi Arabic", sans-serif; font-weight: 800; font-size: 10.5pt; color: #16305c; }
.bubble-deco { margin-inline-start: auto; font-size: 10pt; }
.bubble-card ul { list-style: none; margin: 0; padding: 0; }
.bubble-card li { position: relative; padding-inline-start: 2.9mm; margin-bottom: 1.7mm; font-size: 8pt; line-height: 1.4; color: #23262f; }
.bubble-card li::before { content: ""; position: absolute; inset-inline-start: 0; top: 1.3mm; width: 1.5mm; height: 1.5mm; border-radius: 50%; background: var(--card-color, #1d5fd6); }
.bubble-tail { position: absolute; bottom: -3.5mm; inset-inline-start: 6mm; display: flex; gap: 1mm; align-items: flex-end; }
.bubble-tail i {
  display: block; border-radius: 50%; background: #fff; border: 0.5mm solid var(--card-color, #1d5fd6);
}
.bubble-tail i:first-child { width: 3.5mm; height: 3.5mm; }
.bubble-tail i:last-child { width: 2mm; height: 2mm; margin-bottom: -1mm; }

.app-footer { margin-top: 26px; font-size: 12px; color: #97a0bc; text-align: center; }
.dev-credit { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-top: 10px; }
.dev-avatar { width: 110px; height: 110px; border-radius: 50%; object-fit: cover; border: 3px solid #dfe3f0; box-shadow: 0 4px 12px rgba(20,30,60,.12); }

/* ===================== قواعد الطباعة ===================== */
@media print {
  @page { size: A4; margin: 0; }
  .app::before, .app-header, .steps,
  .panel h2, .hint, .panel-actions, .app-footer, .dev-credit, .dev-avatar { display: none !important; }
  body { background: #fff !important; }
  .site { display: block !important; padding: 0 !important; min-height: 0 !important; }
  .app { max-width: none !important; padding: 0 !important; margin: 0 !important; border: none !important; box-shadow: none !important; border-radius: 0 !important; overflow: visible !important; }
  .panel.hidden { display: none !important; }
  #panel-5 { display: block !important; }
  .preview-wrap { display: block !important; padding: 0 !important; background: none !important; overflow: visible !important; border-radius: 0 !important; }
  .preview-scale { transform: none !important; display: block !important; }
  #mindmap-page {
    margin: 0 !important; box-shadow: none !important;
    width: 210mm; min-height: 297mm;
  }
  .stage-box, .stage-pill, .bubble-card, .bubbles-banner, .header, .footer { break-inside: avoid; }
}


/* ===================== وضع التضمين داخل iframe (مثل صفحة taalimbase.com/adawat) ===================== */
html.embedded .site { min-height: 0; padding: 0; }
html.embedded body { background: #fff; }
html.embedded .app { width: 100%; max-width: none; border-radius: 0; box-shadow: none; border: none; }

/* =====================================================================
   تخطيط v2: شريط علوي + أزرار الخطوات في الأعلى + عرض كامل بلا فراغات جانبية
   ===================================================================== */
.site { padding: 0; min-height: 100vh; }
.app {
  width: 100%; max-width: none; border-radius: 0; border: none; box-shadow: none;
  padding: 0 clamp(14px, 2.2vw, 36px) 22px; overflow: visible;
}
.app::before { border-radius: 0; }

.topbar {
  display: flex; align-items: center; gap: 14px 22px; flex-wrap: wrap;
  padding: 16px 0 14px; margin-bottom: 14px; border-bottom: 1px solid #eef1fb;
}
.tb-title { flex: 1 1 340px; min-width: 0; }
.tb-title h1 {
  margin: 0; font-size: 28px; font-weight: 800; line-height: 1.25;
  background: linear-gradient(90deg, #123a73, #0e9e63);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.tb-title p { margin: 3px 0 0; font-size: 13.5px; color: #6b7394; line-height: 1.5; }
.tb-dev { display: flex; align-items: center; gap: 10px; }
.tb-avatar {
  width: 58px; height: 58px; border-radius: 50%; object-fit: cover;
  border: 3px solid #dfe3f0; box-shadow: 0 4px 12px rgba(20,30,60,.14);
}
.tb-names b { display: block; font-size: 15.5px; color: #16305c; }
.tb-names span { font-size: 12px; color: #7a86a6; }
.tb-social { display: flex; gap: 7px; }
.soc {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  color: #fff; text-decoration: none; transition: transform .15s ease, box-shadow .15s ease;
}
.soc:hover { transform: translateY(-2px); box-shadow: 0 6px 14px rgba(0,0,0,.2); }
.soc-x { background: #111; } .soc-li { background: #0a66c2; } .soc-yt { background: #ff0000; }
.soc-fb { background: #1877f2; } .soc-wa { background: #25d366; }
.tb-actions { display: flex; gap: 8px; }
.tb-btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 10px 16px; border-radius: 10px;
  border: 1.5px solid #dfe3f0; background: #fff; color: #1a3c6e; font: 700 14px/1 inherit; font-family: inherit;
  cursor: pointer; text-decoration: none; transition: all .15s ease;
}
.tb-btn:hover { background: #eef2fd; border-color: #b9c6ef; }
.tb-share { background: linear-gradient(135deg, #1a3c6e, #0e6ba8); color: #fff; border-color: transparent; }
.tb-share:hover { background: linear-gradient(135deg, #16335d, #0b5a8c); }

.steps { margin: 0 0 18px; }
.steps li { padding: 11px 6px; font-size: 14.5px; }

/* رأس كل لوحة: العنوان + أزرار الخطوة في صف واحد أعلى الصفحة */
.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px 18px; flex-wrap: wrap;
  margin-bottom: 18px;
}
.panel-head h2 { margin: 0; }
.panel-head .panel-actions { margin: 0; }
.sticky-head {
  position: sticky; top: 0; z-index: 30; background: rgba(255,255,255,.97);
  padding: 10px 0; margin-bottom: 14px; border-bottom: 1px solid #eef1fb;
}
html.embedded .sticky-head { position: static; }

/* ضغط الخطوات الأولى ليظهر كل شيء بلا تمرير */
.subject-card { padding: 32px 18px; }
.subject-card .ico { width: 88px; height: 88px; font-size: 42px; }
.template-card { padding: 28px 22px; }
.tpl-thumb { width: 88px; height: 88px; font-size: 42px; }
.dropzone { padding: 46px 20px; }
.info-block { margin-top: 30px; padding-top: 26px; }

/* المحرر: المعاينة + عمود جانبي يملأ الفراغ */
.editor-layout { display: grid; grid-template-columns: minmax(0, 860px) minmax(0, 1fr); gap: 20px; align-items: start; }
.editor-layout .preview-wrap { min-width: 0; }
.editor-side { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; align-content: start; }
.side-card { background: #fbfcff; border: 1px solid #eef1fb; border-radius: 14px; padding: 18px 20px; }
.side-card h3 { margin: 0 0 12px; font-size: 16.5px; color: #1a3c6e; font-weight: 800; }
.side-card ul { margin: 0; padding: 0 18px 0 0; display: grid; gap: 8px; font-size: 14px; color: #4a5272; line-height: 1.6; }
.side-card small { display: block; margin-top: 10px; color: #8a93b2; font-size: 12.5px; }
.tpl-switch { display: flex; flex-wrap: wrap; gap: 8px; }
.tpl-btn {
  flex: 1; min-width: 90px; padding: 10px 8px; border-radius: 10px; border: 1.5px solid #dfe3f0;
  background: #fff; color: #334066; font: 700 13.5px inherit; font-family: inherit; cursor: pointer; transition: all .15s ease;
}
.tpl-btn:hover { border-color: #b9c6ef; background: #f3f6ff; }
.tpl-btn.active { background: linear-gradient(135deg, #1a3c6e, #0e6ba8); color: #fff; border-color: transparent; }
.file-info { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; font-size: 13.5px; }
.file-info dt { color: #8a93b2; font-weight: 700; }
.file-info dd { margin: 0; color: #23262f; font-weight: 700; word-break: break-all; }
@media (max-width: 1000px) { .editor-layout { grid-template-columns: minmax(0, 1fr); } }

.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 2000;
  background: #16305c; color: #fff; padding: 12px 22px; border-radius: 12px; font-size: 14px; font-weight: 700;
  box-shadow: 0 10px 28px rgba(0,0,0,.25);
}
.toast.hidden { display: none; }
@media (max-width: 760px) {
  .tb-title h1 { font-size: 23px; }
  .tb-actions, .tb-social { width: 100%; }
}

@media print {
  .topbar, .panel-head, .editor-side, .toast { display: none !important; }
  .editor-layout { display: block !important; }
  .preview-wrap { height: auto !important; }
  .app { padding: 0 !important; }
}
