/* Phone and tablet navigation: a compact hamburger button opens a side menu. */
#mobile-menu-toggle, #mobile-menu-backdrop { display: none; }

@media (max-width: 900px) {
  body { padding-bottom: 0; }
  #mobile-menu-toggle {
    display: flex; position: fixed; z-index: 62; right: 0; top: 38%;
    width: 48px; height: 58px; align-items: center; justify-content: center;
    border: 0; border-radius: 16px 0 0 16px; background: var(--turquoise); color: #fff;
    box-shadow: 0 5px 17px #003b4b40; font-size: 27px; line-height: 1; cursor: pointer;
  }
  #mobile-menu-backdrop {
    position: fixed; z-index: 54; inset: 0; width: 100%; height: 100%; border: 0;
    background: #062b36a8; opacity: 0; pointer-events: none; transition: opacity .2s ease;
  }
  .sidebar {
    position: fixed; z-index: 60; top: 0; right: 0; bottom: 0; left: auto;
    width: min(86vw, 315px); height: 100vh; padding: 22px 14px; background: var(--turquoise);
    overflow-y: auto; box-shadow: -9px 0 25px #003b4b50; transform: translateX(110%);
    transition: transform .22s ease;
  }
  body.mobile-menu-open { overflow: hidden; }
  body.mobile-menu-open .sidebar { transform: translateX(0); }
  body.mobile-menu-open #mobile-menu-backdrop { display: block; opacity: 1; pointer-events: auto; }
  body.mobile-menu-open #mobile-menu-toggle { right: min(86vw, 315px); border-radius: 0 16px 16px 0; }
  .sidebar::after { display: none; }
  .sidebar .brand { display: flex; margin: 2px 4px 22px; }
  .sidebar nav { display: grid; gap: 16px; width: 100%; }
  .sidebar .nav-group { display: grid; gap: 5px; }
  .nav-group-title { display: block; font-size: 11px; color: #bfe9ef; padding: 0 9px 4px; }
  .sidebar .nav-btn {
    display: flex; align-items: center; justify-content: flex-start; width: 100%; min-height: 46px;
    padding: 10px 13px; color: #e8f8fa; font-size: 14px; text-align: right; white-space: normal;
  }
  .nav-btn::before { display: none; }
  .nav-btn.active { box-shadow: inset -3px 0 var(--gold); background: #ffffff24; }
  .paper-note { display: block; margin-top: 24px; }
  main { margin-right: 0; padding: 23px 16px; min-height: 100vh; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two { grid-template-columns: 1fr; }
  header { align-items: flex-start; gap: 14px; flex-direction: column; margin-bottom: 22px; }
  .table { min-width: 700px; }
  .card { overflow-x: auto; }
  .section-title { gap: 10px; align-items: flex-start; }
  .tabs { overflow-x: auto; padding-bottom: 2px; white-space: nowrap; }
  .dialog-actions { flex-wrap: wrap; }
}

@media (max-width: 560px) {
  .metrics { grid-template-columns: 1fr; }
  .role { flex-direction: column; align-items: flex-start; }
  .metric strong { font-size: 25px; }
  h1 { font-size: 22px; }
  .item { align-items: flex-start; flex-direction: column; }
  .form-grid { grid-template-columns: 1fr; }
}

/* Clearer recurring-task cards: readable type and breathing room before notes. */
body { font-size: 15px; }
h2 { font-size: 19px; }
.muted, #greeting { font-size: 13px; line-height: 1.65; }
.item { padding: 14px; }
.item label { display: flex; flex-direction: column; gap: 6px; font-size: 15px; line-height: 1.35; }
.item label small { display: block; line-height: 1.6; }
.pill { font-size: 11px; padding: 5px 10px; }

/* خطة العمل: أقسام واضحة بدل قائمة واحدة طويلة من المهام. */
.fbc-work-plan { overflow: visible; }
.fbc-plan-note { margin: 14px 0 20px; }
.fbc-plan-groups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.fbc-plan-group { border: 1px solid var(--line); border-radius: 18px; padding: 18px; background: #fff; }
.fbc-plan-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.fbc-plan-heading h3 { margin: 0; color: var(--ink); font-size: 18px; }
.fbc-plan-heading p { margin: 5px 0 0; }
.fbc-plan-condition { margin: 12px 0; padding: 10px 12px; border-radius: 10px; background: #fff7e8; color: #7c5314; font-size: 13px; line-height: 1.6; }
.fbc-plan-list { display: grid; gap: 8px; margin-top: 12px; }
.fbc-plan-task { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid #edf3f5; }
.fbc-plan-task:last-child { border-bottom: 0; }
.fbc-plan-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.fbc-plan-task .item-main { min-width: 0; align-items: flex-start; }
.fbc-plan-task label { display: flex; flex-direction: column; gap: 8px; min-width: 0; line-height: 1.55; }
.fbc-plan-task label b { display: block; font-size: 16px; line-height: 1.6; }
.fbc-plan-task label small { display: block; margin-top: 2px; line-height: 1.7; }
.fbc-task-filter-card { margin-top: 18px; }

@media (max-width: 900px) {
  .fbc-plan-groups { grid-template-columns: 1fr; }
  .fbc-plan-task, .item:has(.fbc-plan-actions) { align-items: flex-start; }
  .fbc-plan-actions { width: 100%; justify-content: flex-start; }
}
