/* Tamayuz V6.45 - unified automatic responsive modes
   desktop >= 1200px | tablet 768-1199px | mobile <= 767px */

:root{
  --tm-device-gutter:28px;
  --tm-device-sidebar:270px;
}
html[data-tm-device="desktop"]{--tm-device-gutter:28px;--tm-device-sidebar:270px}
html[data-tm-device="tablet"]{--tm-device-gutter:18px;--tm-device-sidebar:0px}
html[data-tm-device="mobile"]{--tm-device-gutter:12px;--tm-device-sidebar:0px}

/* Shared safeguards across every authenticated dashboard. */
.tm-main{min-width:0;overflow-x:hidden}
.tm-panel,.tm-topbar,.tm-welcome,.tm-dashboard-card,.tm-progress-card{min-width:0}
.tm-table-wrap{max-width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch}
.tm-course-table,.tm-table{max-width:none}
img,video,iframe{max-width:100%}
input,select,textarea,button{max-width:100%}

/* Device mode control injected by app.js; hidden on desktop/tablet. */
.tm-device-sidebar-toggle,.tm-device-sidebar-backdrop{display:none}

/* ===== Tablet / iPad ===== */
@media (min-width:768px) and (max-width:1199px){
  .tm-sidebar{
    width:92px;padding:14px 10px;transition:width .2s ease;
  }
  .tm-main{
    margin-right:92px;width:calc(100% - 92px);padding:18px;
  }
  .tm-brand{padding:0 2px 12px}
  .tm-brand-logo{min-height:68px;max-height:76px}
  .tm-logo{width:68px!important;max-width:68px!important;height:62px!important;max-height:62px!important}
  .tm-user-card{justify-content:center;padding:9px;margin-bottom:12px}
  .tm-user-card>div:last-child{display:none}
  .tm-avatar{width:38px;height:38px}
  .tm-nav{gap:5px;padding-left:0}
  .tm-nav-item{min-height:48px;justify-content:center;padding:0 8px;gap:0;border-right-width:3px}
  .tm-nav-item>span,.tm-nav-arrow{display:none!important}
  .tm-nav-item i{width:auto;font-size:21px}
  .tm-subnav{display:none!important}
  .tm-sidebar-bottom{padding-top:9px}
  .tm-sidebar-bottom .tm-nav-item{margin-top:4px}
  .tm-topbar{padding:16px 18px;margin-bottom:16px;gap:12px;flex-wrap:wrap}
  .tm-topbar h1{font-size:22px}
  .tm-panel,.tm-course-lifecycle{padding:16px;border-radius:17px}
  .tm-dashboard-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:13px}
  .tm-course-stats{grid-template-columns:repeat(2,minmax(0,1fr))}
  .tm-filters{grid-template-columns:repeat(2,minmax(0,1fr))}
  .tm-form-grid.three,.tm-permission-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  .tm-supervision-courses{grid-template-columns:1fr}
  .tm-builder-shell{padding:16px}
  .tm-builder-progress{flex-wrap:wrap;gap:12px}
  .tm-progress-copy{min-width:0;width:100%}
}

/* ===== Mobile ===== */
@media (max-width:767px){
  html,body{max-width:100%;overflow-x:hidden}
  body.tm-mobile-sidebar-open{overflow:hidden}
  .tm-layout{display:block;min-height:100vh}
  .tm-sidebar{
    width:min(86vw,320px);height:100dvh;right:0;top:0;z-index:1200;
    padding:16px 12px;transform:translateX(105%);transition:transform .22s ease;
    box-shadow:-18px 0 46px rgba(25,39,52,.18);
  }
  body.tm-mobile-sidebar-open .tm-sidebar{transform:translateX(0)}
  .tm-main{margin-right:0;width:100%;padding:12px;padding-bottom:86px}
  .tm-brand-logo{min-height:88px;max-height:98px}
  .tm-logo{width:112px!important;max-width:112px!important;height:84px!important;max-height:84px!important}
  .tm-user-card{margin-bottom:12px}
  .tm-nav-item{min-height:44px}
  .tm-topbar{padding:14px 15px;margin-bottom:14px;border-radius:15px;gap:12px;align-items:flex-start;flex-direction:column}
  .tm-topbar>div,.tm-topbar-actions{max-width:100%}
  .tm-topbar h1{font-size:20px;line-height:1.4}
  .tm-page-subtitle{font-size:12px;line-height:1.8}
  .tm-role-badge{padding:6px 10px;font-size:11px}
  .tm-welcome{min-height:auto;padding:18px;border-radius:16px}
  .tm-panel,.tm-course-lifecycle{padding:14px;border-radius:16px;margin-bottom:14px}
  .tm-panel-head{align-items:flex-start;gap:10px;flex-wrap:wrap;margin-bottom:12px}
  .tm-panel-head h2{font-size:17px}
  .tm-panel-head p{font-size:11.5px;line-height:1.7}
  .tm-collapse-toggle{margin-inline-start:auto}
  .tm-dashboard-grid,.tm-course-stats,.tm-filters,.tm-lifecycle-grid,.tm-form-grid,.tm-form-grid.four,.tm-permission-grid,.tm-progress-details,.tm-supervision-courses,.tm-team-grid,.tm-kpi-grid{grid-template-columns:1fr!important}
  .tm-dashboard-card{padding:15px;gap:12px;border-radius:15px}
  .tm-dashboard-card>i:first-child{width:42px;height:42px;font-size:19px}
  .tm-dashboard-card h3{font-size:15px}
  .tm-dashboard-card p{font-size:11px;line-height:1.6}
  .tm-course-stats{gap:10px}
  .tm-stat-card{min-height:86px;padding:13px}
  .tm-filters{gap:8px}
  .tm-filters>*{width:100%;min-width:0}
  .tm-table-wrap{border-radius:12px;margin-inline:-2px}
  .tm-course-table{min-width:900px}
  .tm-actions-cell{min-width:150px;white-space:nowrap}
  .tm-builder-shell{padding:12px;border-radius:16px}
  .tm-builder-progress{display:block;margin-bottom:12px}
  .tm-progress-copy{min-width:0;width:100%;margin-bottom:10px}
  .tm-time-12{grid-template-columns:1fr auto 1fr;gap:5px}
  .tm-time-12 select:last-child{grid-column:1/-1}
  .tm-content-children{margin-inline-start:6px;padding-inline-start:7px}
  .tm-bank-import{padding:11px}
  .tm-profile-hero{align-items:flex-start;gap:12px}
  .tm-avatar.xl{width:54px;height:54px;font-size:24px}
  .tm-certificate-builder{grid-template-columns:1fr}
  .tm-cert-frame{min-height:0;padding:14px}
  .tm-cert-body{padding:22px 8px 16px}
  .tm-cert-body h3{font-size:23px}
  .tm-cert-student{font-size:20px}

  .tm-device-sidebar-toggle{
    display:grid;position:fixed;right:14px;bottom:calc(16px + env(safe-area-inset-bottom));
    width:54px;height:54px;border:0;border-radius:50%;place-items:center;z-index:1250;
    background:#1b8e68;color:#fff;box-shadow:0 10px 28px rgba(20,75,57,.28);font-size:24px;cursor:pointer
  }
  .tm-device-sidebar-toggle[aria-expanded="true"]{background:#c97327}
  .tm-device-sidebar-backdrop{
    display:block;position:fixed;inset:0;background:rgba(18,31,26,.34);z-index:1150;
    opacity:0;pointer-events:none;transition:opacity .2s ease
  }
  body.tm-mobile-sidebar-open .tm-device-sidebar-backdrop{opacity:1;pointer-events:auto}
}

/* Very small phones */
@media (max-width:420px){
  .tm-main{padding:9px;padding-bottom:82px}
  .tm-topbar{padding:12px}
  .tm-panel,.tm-course-lifecycle{padding:11px}
  .tm-primary-btn,.tm-secondary-btn,.tm-ghost-btn{white-space:normal;text-align:center}
}

/* ===== Tamayuz V6.47: device preview controls + true iframe viewport simulator ===== */
.tm-device-preview-tools{
  margin-top:14px;padding-top:13px;border-top:1px solid rgba(89,103,91,.14)
}
.tm-device-preview-title{
  display:flex;align-items:center;gap:8px;padding:0 10px 9px;color:#66746c;font-size:11px;font-weight:700
}
.tm-device-preview-title i{font-size:15px;color:#168f6b}
.tm-device-preview-buttons{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px;padding:0 6px 6px}
.tm-device-preview-btn{
  border:1px solid #e0e9e3;background:#fff;color:#405047;border-radius:11px;min-height:48px;padding:6px 4px;
  display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;cursor:pointer;font-family:inherit;font-size:9px;
  transition:.16s ease;box-shadow:0 2px 8px rgba(38,63,52,.03)
}
.tm-device-preview-btn i{font-size:17px;color:#168f6b}
.tm-device-preview-btn:hover{border-color:#88c8b3;background:#f2fbf7;transform:translateY(-1px)}
.tm-device-preview-embedded .tm-device-preview-tools{display:none!important}
body.tm-device-preview-open{overflow:hidden!important}
.tm-device-preview-overlay{
  position:fixed;inset:0;z-index:99999;background:rgba(19,27,24,.88);backdrop-filter:blur(4px);
  display:flex;flex-direction:column;align-items:stretch;direction:rtl
}
.tm-device-preview-toolbar{
  min-height:72px;padding:12px 18px;background:#fff;border-bottom:1px solid #dfe8e3;
  display:flex;align-items:center;justify-content:space-between;gap:14px;box-shadow:0 6px 24px rgba(0,0,0,.14);z-index:2
}
.tm-device-preview-meta{display:flex;align-items:center;gap:10px;color:#24342c}
.tm-device-preview-meta>i{width:38px;height:38px;border-radius:12px;background:#eaf7f1;color:#168f6b;display:grid;place-items:center;font-size:19px}
.tm-device-preview-meta strong{font-size:14px}.tm-device-preview-meta span{font-size:12px;color:#7b8a82;direction:ltr}
.tm-device-preview-toolbar-actions{display:flex;gap:7px;align-items:center}
.tm-device-preview-action{
  border:1px solid #dfe8e3;background:#fff;color:#33453b;border-radius:10px;height:40px;padding:0 12px;
  display:inline-flex;align-items:center;gap:6px;font-family:inherit;font-weight:700;font-size:11px;cursor:pointer
}
.tm-device-preview-action:hover{background:#f5faf7;border-color:#9fcdbd}.tm-device-preview-action.danger{color:#b84b3d;border-color:#f0d4cf}
.tm-device-preview-canvas{flex:1;min-height:0;display:flex;align-items:center;justify-content:center;overflow:auto;padding:16px}
.tm-device-preview-stage{
  position:relative;flex:0 0 auto;background:#fff;border-radius:18px;box-shadow:0 22px 70px rgba(0,0,0,.45);overflow:visible;
  transition:width .18s ease,height .18s ease
}
.tm-device-preview-stage::before{
  content:attr(data-width) " × " attr(data-height);position:absolute;bottom:-27px;left:50%;transform:translateX(-50%);
  color:#cdd8d2;font-size:10px;direction:ltr;white-space:nowrap
}
.tm-device-preview-frame{
  display:block;border:0;background:#fff;transform-origin:top left;border-radius:18px;overflow:hidden
}
@media (min-width:768px) and (max-width:1199px){
  .tm-device-preview-tools{margin-top:8px;padding-top:8px}
  .tm-device-preview-title span,.tm-device-preview-btn span{display:none}
  .tm-device-preview-title{justify-content:center;padding:0 0 6px}.tm-device-preview-title i{font-size:16px}
  .tm-device-preview-buttons{grid-template-columns:1fr;gap:5px;padding:0}
  .tm-device-preview-btn{min-height:38px;padding:4px}.tm-device-preview-btn i{font-size:18px}
}
@media (max-width:767px){
  .tm-device-preview-title{padding-inline:8px}
  .tm-device-preview-buttons{grid-template-columns:repeat(3,1fr);padding-inline:4px}
  .tm-device-preview-toolbar{padding:9px 10px;min-height:64px;align-items:flex-start}
  .tm-device-preview-meta{gap:7px}.tm-device-preview-meta>i{width:34px;height:34px}
  .tm-device-preview-meta strong{font-size:12px}.tm-device-preview-meta span{display:block;font-size:9px}
  .tm-device-preview-action{width:38px;padding:0;justify-content:center}.tm-device-preview-action span{display:none}
  .tm-device-preview-canvas{padding:10px 6px 28px}
}


/* ===== Tamayuz V6.48: hard mobile canvas fix =====
   Prevent legacy sidebar/main widths from squeezing the real mobile viewport. */
@media (max-width:767px){
  html,body{
    width:100%!important;max-width:100%!important;min-width:0!important;
    overflow-x:hidden!important;
  }
  body>.tm-layout,.tm-layout{
    display:block!important;width:100%!important;max-width:100%!important;min-width:0!important;
    margin:0!important;padding:0!important;
  }
  .tm-layout>.tm-main,.tm-main{
    display:block!important;
    margin:0!important;margin-right:0!important;margin-left:0!important;
    width:100%!important;max-width:100%!important;min-width:0!important;
    padding:10px!important;padding-bottom:84px!important;
    overflow-x:hidden!important;
  }
  .tm-main>*{
    max-width:100%!important;min-width:0!important;
  }
  .tm-sidebar{
    position:fixed!important;right:0!important;left:auto!important;top:0!important;
    width:min(86vw,320px)!important;max-width:320px!important;min-width:0!important;
    margin:0!important;height:100dvh!important;
    transform:translateX(105%)!important;
  }
  body.tm-mobile-sidebar-open .tm-sidebar{transform:translateX(0)!important}
  .tm-topbar,.tm-welcome,.tm-panel,.tm-course-lifecycle,.tm-progress-card,
  .tm-student-courses,.tm-dashboard-grid,.tm-course-stats,.tm-kpi-grid,
  .tm-attendance-stats,.tm-dashboard-attendance,.tm-quick-actions{
    width:100%!important;max-width:100%!important;min-width:0!important;
    margin-inline:0!important;
  }
  .tm-dashboard-grid,.tm-course-stats,.tm-kpi-grid,.tm-attendance-stats,
  .tm-dashboard-attendance,.tm-quick-actions,.tm-branch-type-grid,
  .tm-user-role-filters,.tm-form-grid,.tm-form-grid.two,.tm-form-grid.three,
  .tm-form-grid.four,.tm-permission-grid,.tm-progress-details{
    grid-template-columns:minmax(0,1fr)!important;
  }
  .tm-dashboard-card,.tm-stat-card,.tm-kpi-card,.tm-quick-card,.tm-progress-card{
    width:100%!important;max-width:100%!important;min-width:0!important;
  }
  .tm-dashboard-card>* , .tm-stat-card>* , .tm-kpi-card>* , .tm-quick-card>*{
    min-width:0!important;
  }
  .tm-dashboard-card h3,.tm-dashboard-card p,.tm-page-subtitle,.tm-topbar h1,
  .tm-panel h1,.tm-panel h2,.tm-panel h3{
    overflow-wrap:anywhere;word-break:normal;
  }
  .tm-table-wrap{width:100%!important;max-width:100%!important;overflow-x:auto!important}
}

/* Explicit simulator device classes. They also protect against legacy CSS with later/higher specificity. */
html.tm-preview-mobile,html.tm-preview-mobile body{
  width:100%!important;max-width:100%!important;min-width:0!important;overflow-x:hidden!important;
}
html.tm-preview-mobile .tm-layout{display:block!important;width:100%!important;max-width:100%!important;min-width:0!important}
html.tm-preview-mobile .tm-layout>.tm-main,
html.tm-preview-mobile .tm-main{
  margin:0!important;margin-right:0!important;margin-left:0!important;
  width:100%!important;max-width:100%!important;min-width:0!important;
  padding:10px!important;padding-bottom:84px!important;overflow-x:hidden!important;
}
html.tm-preview-mobile .tm-sidebar{
  position:fixed!important;right:0!important;left:auto!important;top:0!important;
  width:min(86vw,320px)!important;max-width:320px!important;
  transform:translateX(105%)!important;
}
html.tm-preview-mobile body.tm-mobile-sidebar-open .tm-sidebar{transform:translateX(0)!important}
html.tm-preview-mobile .tm-main>*{max-width:100%!important;min-width:0!important}
html.tm-preview-mobile .tm-dashboard-grid,
html.tm-preview-mobile .tm-course-stats,
html.tm-preview-mobile .tm-kpi-grid,
html.tm-preview-mobile .tm-attendance-stats,
html.tm-preview-mobile .tm-dashboard-attendance,
html.tm-preview-mobile .tm-quick-actions,
html.tm-preview-mobile .tm-branch-type-grid,
html.tm-preview-mobile .tm-user-role-filters,
html.tm-preview-mobile .tm-form-grid,
html.tm-preview-mobile .tm-permission-grid,
html.tm-preview-mobile .tm-progress-details{grid-template-columns:minmax(0,1fr)!important}
html.tm-preview-mobile .tm-topbar,
html.tm-preview-mobile .tm-welcome,
html.tm-preview-mobile .tm-panel,
html.tm-preview-mobile .tm-course-lifecycle,
html.tm-preview-mobile .tm-progress-card{width:100%!important;max-width:100%!important;min-width:0!important;margin-inline:0!important}

/* Simulator chrome: use almost all available screen so the device preview is easier to inspect. */
.tm-device-preview-toolbar{min-height:64px!important;padding:9px 14px!important}
.tm-device-preview-canvas{padding:8px 10px 30px!important}
.tm-device-preview-stage{border:5px solid #e9eeeb;border-radius:22px!important;background:#fff}
.tm-device-preview-frame{border-radius:17px!important}


/* ===== Tamayuz V6.49: true iframe viewport fix =====
   The global iframe max-width rule was shrinking the simulated viewport before
   transform scaling. Keep the internal iframe at the requested CSS-pixel size
   and scale only its visual presentation. */
.tm-device-preview-stage{
  overflow:hidden!important;
  contain:layout paint;
}
.tm-device-preview-frame{
  max-width:none!important;
  max-height:none!important;
  min-width:0!important;
  min-height:0!important;
  flex:none!important;
  position:absolute!important;
  top:0!important;
  left:0!important;
  margin:0!important;
  padding:0!important;
  border:0!important;
  transform-origin:top left!important;
}
.tm-device-preview-stage[data-profile="mobile"] .tm-device-preview-frame,
.tm-device-preview-stage[data-profile="tablet"] .tm-device-preview-frame,
.tm-device-preview-stage[data-profile="desktop"] .tm-device-preview-frame{
  max-width:none!important;
}
.tm-device-preview-meta .tm-preview-actual{
  display:inline-flex;align-items:center;gap:4px;padding:3px 7px;border-radius:999px;
  background:#eef7f2;color:#267157;font-size:10px;direction:ltr
}
.tm-device-preview-meta .tm-preview-actual.is-mismatch{background:#fff0ec;color:#b94d3f}


/* ===== Tamayuz V6.50: iPad/tablet navigation drawer =====
   Tablet no longer reserves a permanent 92px sidebar. It uses a full overlay
   drawer so the content owns the entire 820px viewport. */
@media (min-width:768px) and (max-width:1199px){
  html,body{max-width:100%;overflow-x:hidden}
  body.tm-mobile-sidebar-open{overflow:hidden}
  .tm-layout{display:block!important;width:100%!important;max-width:100%!important;min-width:0!important;margin:0!important;padding:0!important}
  .tm-layout>.tm-main,.tm-main{
    margin:0!important;margin-right:0!important;margin-left:0!important;
    width:100%!important;max-width:100%!important;min-width:0!important;
    padding:18px!important;padding-bottom:88px!important;overflow-x:hidden!important;
  }
  .tm-main>*{max-width:100%!important;min-width:0!important}
  .tm-sidebar{
    position:fixed!important;right:0!important;left:auto!important;top:0!important;
    width:min(44vw,340px)!important;max-width:340px!important;min-width:300px!important;
    height:100dvh!important;margin:0!important;padding:16px 13px!important;
    z-index:1200!important;transform:translateX(105%)!important;
    transition:transform .22s ease!important;
    box-shadow:-20px 0 54px rgba(25,39,52,.20)!important;
    overflow-y:auto!important;overflow-x:hidden!important;
  }
  body.tm-mobile-sidebar-open .tm-sidebar{transform:translateX(0)!important}

  /* Restore the full navigation labels inside the tablet drawer. */
  .tm-brand{padding:0 8px 14px!important}
  .tm-brand-logo{min-height:84px!important;max-height:96px!important}
  .tm-logo{width:108px!important;max-width:108px!important;height:82px!important;max-height:82px!important}
  .tm-user-card{justify-content:flex-start!important;padding:11px 12px!important;margin-bottom:13px!important}
  .tm-user-card>div:last-child{display:block!important;min-width:0!important}
  .tm-avatar{width:40px!important;height:40px!important;flex:0 0 40px!important}
  .tm-nav{gap:5px!important;padding-left:0!important}
  .tm-nav-item{min-height:45px!important;justify-content:flex-start!important;padding:0 12px!important;gap:10px!important;border-right-width:3px!important}
  .tm-nav-item>span{display:inline!important;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  .tm-nav-arrow{display:inline-flex!important;margin-inline-start:auto!important}
  .tm-nav-item i{width:22px!important;font-size:18px!important;flex:0 0 22px!important}
  .tm-subnav{display:block!important}
  .tm-sidebar-bottom{padding-top:11px!important}
  .tm-sidebar-bottom .tm-nav-item{margin-top:4px!important}

  /* Tablet drawer toggle/backdrop. */
  .tm-device-sidebar-toggle{
    display:grid!important;position:fixed!important;right:18px!important;
    bottom:calc(18px + env(safe-area-inset-bottom))!important;
    width:56px!important;height:56px!important;border:0!important;border-radius:50%!important;
    place-items:center!important;z-index:1250!important;background:#1b8e68!important;color:#fff!important;
    box-shadow:0 10px 30px rgba(20,75,57,.30)!important;font-size:24px!important;cursor:pointer!important;
  }
  .tm-device-sidebar-toggle[aria-expanded="true"]{background:#c97327!important}
  .tm-device-sidebar-backdrop{
    display:block!important;position:fixed!important;inset:0!important;background:rgba(18,31,26,.38)!important;
    z-index:1150!important;opacity:0!important;pointer-events:none!important;transition:opacity .2s ease!important;
  }
  body.tm-mobile-sidebar-open .tm-device-sidebar-backdrop{opacity:1!important;pointer-events:auto!important}

  /* Preview controls can use full labels because the tablet drawer is wide now. */
  .tm-device-preview-tools{margin-top:12px!important;padding-top:11px!important}
  .tm-device-preview-title{justify-content:flex-start!important;padding:0 9px 8px!important}
  .tm-device-preview-title span,.tm-device-preview-btn span{display:inline!important}
  .tm-device-preview-buttons{grid-template-columns:repeat(3,minmax(0,1fr))!important;gap:6px!important;padding:0 5px 6px!important}
  .tm-device-preview-btn{min-height:48px!important;padding:6px 4px!important}
}

/* Explicit tablet simulator safeguard. */
html.tm-preview-tablet,html.tm-preview-tablet body{
  width:100%!important;max-width:100%!important;min-width:0!important;overflow-x:hidden!important;
}
html.tm-preview-tablet .tm-layout{display:block!important;width:100%!important;max-width:100%!important;min-width:0!important}
html.tm-preview-tablet .tm-layout>.tm-main,
html.tm-preview-tablet .tm-main{
  margin:0!important;margin-right:0!important;margin-left:0!important;
  width:100%!important;max-width:100%!important;min-width:0!important;
  padding:18px!important;padding-bottom:88px!important;overflow-x:hidden!important;
}
html.tm-preview-tablet .tm-sidebar{
  position:fixed!important;right:0!important;left:auto!important;top:0!important;
  width:min(44vw,340px)!important;max-width:340px!important;min-width:300px!important;
  height:100dvh!important;transform:translateX(105%)!important;z-index:1200!important;
}
html.tm-preview-tablet body.tm-mobile-sidebar-open .tm-sidebar{transform:translateX(0)!important}
html.tm-preview-tablet .tm-device-sidebar-toggle{display:grid!important}
html.tm-preview-tablet .tm-device-sidebar-backdrop{display:block!important}

/* ===== Tamayuz V6.51: visitor/public iPad + mobile navigation drawer ===== */
.tm-public-menu-backdrop{display:none}
@media (max-width:1199px){
  body.tm-visitor-body.tm-public-menu-open{overflow:hidden}
  body.tm-visitor-body .tm-public-nav{
    position:sticky!important;top:0!important;z-index:1200!important;
    min-height:64px!important;height:64px!important;background:#fff!important;
    border-bottom:1px solid #e7ece9!important;box-shadow:0 1px 0 rgba(18,45,34,.03)!important;
  }
  body.tm-visitor-body .tm-public-nav-inner{
    width:100%!important;max-width:none!important;height:64px!important;min-height:64px!important;
    padding:7px 18px!important;margin:0!important;display:flex!important;align-items:center!important;
    gap:10px!important;justify-content:flex-start!important;box-sizing:border-box!important;
  }
  body.tm-visitor-body .tm-public-logo{order:1!important;margin-inline-start:0!important;margin-inline-end:auto!important;display:flex!important;align-items:center!important;flex:0 0 auto!important}
  body.tm-visitor-body .tm-public-logo img{width:50px!important;height:46px!important;max-height:46px!important;object-fit:contain!important;display:block!important}
  body.tm-visitor-body .tm-public-tools{order:2!important;display:flex!important;align-items:center!important;gap:4px!important;flex:0 0 auto!important}
  body.tm-visitor-body .tm-nav-icon{width:36px!important;height:36px!important;min-width:36px!important;padding:0!important;display:grid!important;place-items:center!important;border-radius:10px!important;font-size:18px!important}
  body.tm-visitor-body .tm-mobile-menu{order:3!important;display:grid!important;place-items:center!important;width:38px!important;height:38px!important;min-width:38px!important;padding:0!important;margin:0!important;border:1px solid #dbe4df!important;border-radius:10px!important;background:#fff!important;color:#1f332b!important;font-size:20px!important;z-index:1220!important}

  body.tm-visitor-body .tm-public-menu{
    position:fixed!important;top:64px!important;right:0!important;bottom:0!important;left:auto!important;
    width:min(360px,86vw)!important;max-width:86vw!important;height:calc(100dvh - 64px)!important;
    padding:20px 16px 28px!important;margin:0!important;background:#fff!important;
    display:flex!important;flex-direction:column!important;align-items:stretch!important;justify-content:flex-start!important;
    gap:7px!important;overflow-y:auto!important;overscroll-behavior:contain!important;
    box-shadow:-18px 0 42px rgba(20,41,32,.16)!important;z-index:1210!important;
    transform:translateX(105%)!important;visibility:hidden!important;opacity:0!important;
    transition:transform .22s ease,opacity .18s ease,visibility .18s ease!important;
  }
  body.tm-visitor-body .tm-public-menu.is-open{
    transform:translateX(0)!important;visibility:visible!important;opacity:1!important;
  }
  body.tm-visitor-body .tm-public-menu a{
    width:100%!important;min-height:48px!important;display:flex!important;align-items:center!important;
    justify-content:flex-start!important;padding:11px 14px!important;border-radius:12px!important;
    color:#20342c!important;background:#f8faf9!important;border:1px solid #edf1ef!important;
    text-decoration:none!important;font-size:15px!important;font-weight:700!important;box-sizing:border-box!important;
  }
  body.tm-visitor-body .tm-public-menu a:hover,
  body.tm-visitor-body .tm-public-menu a:focus{background:#eef8f3!important;color:#118a66!important;border-color:#d8eadf!important}
  body.tm-visitor-body .tm-public-menu-backdrop{
    display:block!important;position:fixed!important;top:64px!important;right:0!important;bottom:0!important;left:0!important;
    background:rgba(17,31,25,.42)!important;backdrop-filter:blur(2px)!important;z-index:1205!important;
    opacity:0!important;visibility:hidden!important;pointer-events:none!important;transition:opacity .18s ease,visibility .18s ease!important;
  }
  body.tm-visitor-body .tm-public-menu-backdrop.is-open{opacity:1!important;visibility:visible!important;pointer-events:auto!important}
}
@media (max-width:767px){
  body.tm-visitor-body .tm-public-nav,
  body.tm-visitor-body .tm-public-nav-inner{height:60px!important;min-height:60px!important}
  body.tm-visitor-body .tm-public-nav-inner{padding:6px 12px!important;gap:6px!important}
  body.tm-visitor-body .tm-public-logo img{width:46px!important;height:42px!important;max-height:42px!important}
  body.tm-visitor-body .tm-nav-icon{width:34px!important;height:34px!important;min-width:34px!important;font-size:17px!important}
  body.tm-visitor-body .tm-mobile-menu{width:36px!important;height:36px!important;min-width:36px!important}
  body.tm-visitor-body .tm-public-menu{top:60px!important;width:min(330px,92vw)!important;max-width:92vw!important;height:calc(100dvh - 60px)!important;padding:16px 12px 24px!important}
  body.tm-visitor-body .tm-public-menu-backdrop{top:60px!important}
}

/* ===== Tamayuz V6.52: balanced visitor header on iPad/mobile ===== */
@media (max-width:1199px){
  body.tm-visitor-body .tm-public-nav-inner{
    direction:rtl!important;
    display:flex!important;
    flex-direction:row!important;
    align-items:center!important;
    justify-content:flex-start!important;
    width:100%!important;
  }
  body.tm-visitor-body .tm-public-logo{
    order:1!important;
    margin:0!important;
    flex:0 0 auto!important;
  }
  body.tm-visitor-body .tm-public-tools{
    order:2!important;
    margin-inline-start:auto!important;
    margin-inline-end:0!important;
    display:flex!important;
    align-items:center!important;
    gap:6px!important;
    flex:0 0 auto!important;
  }
  body.tm-visitor-body .tm-mobile-menu{
    order:3!important;
    margin:0!important;
    margin-inline-start:2px!important;
    flex:0 0 auto!important;
  }
  body.tm-visitor-body .tm-public-menu{
    right:0!important;
    left:auto!important;
  }
}
@media (min-width:768px) and (max-width:1199px){
  body.tm-visitor-body .tm-public-nav,
  body.tm-visitor-body .tm-public-nav-inner{
    height:62px!important;
    min-height:62px!important;
  }
  body.tm-visitor-body .tm-public-nav-inner{
    padding:6px 16px!important;
  }
  body.tm-visitor-body .tm-public-logo img{
    width:48px!important;
    height:44px!important;
    max-height:44px!important;
  }
  body.tm-visitor-body .tm-nav-icon{
    width:36px!important;
    height:36px!important;
    min-width:36px!important;
  }
  body.tm-visitor-body .tm-mobile-menu{
    width:38px!important;
    height:38px!important;
    min-width:38px!important;
  }
  body.tm-visitor-body .tm-public-menu{
    top:62px!important;
    height:calc(100dvh - 62px)!important;
    width:min(360px,74vw)!important;
    max-width:360px!important;
  }
  body.tm-visitor-body .tm-public-menu-backdrop{
    top:62px!important;
  }
}


/* ===== Tamayuz V6.53: tablet portrait inspection + route diagnostics ===== */
.tm-device-preview-meta .tm-preview-route-warning{
  display:inline-flex;align-items:center;padding:3px 8px;border-radius:999px;
  background:#fff0ec;color:#b84b3d;font-size:10px;font-style:normal;direction:rtl;
}
.tm-device-preview-stage[data-profile="tablet"][data-orientation="portrait"]{
  align-self:flex-start;
}
.tm-device-preview-canvas[data-orientation="portrait"]{
  align-items:flex-start!important;
  padding-top:12px!important;
}
@media (max-height:900px){
  .tm-device-preview-stage[data-profile="tablet"][data-orientation="portrait"]{margin-top:0!important;margin-bottom:24px!important}
}

/* ===== Tamayuz V6.56: definitive iPad portrait public header + drawer fix =====
   Portrait iPad uses a compact split header and a left-side overlay drawer.
   Landscape iPad (e.g. 1180x820) is intentionally left on the desktop-style
   horizontal navigation because that layout already tests well. */
@media (min-width:768px) and (max-width:900px){
  body.tm-visitor-body .tm-public-nav{
    position:sticky!important;
    top:0!important;
    z-index:1400!important;
    height:64px!important;
    min-height:64px!important;
    background:var(--tm-visitor-menu-bg,#fff)!important;
    border-bottom:1px solid #e7ece9!important;
  }
  body.tm-visitor-body .tm-public-nav-inner{
    position:relative!important;
    display:block!important;
    width:100%!important;
    max-width:none!important;
    height:64px!important;
    min-height:64px!important;
    margin:0!important;
    padding:0 14px!important;
    box-sizing:border-box!important;
  }

  /* Brand fixed at the far right. */
  body.tm-visitor-body .tm-public-logo{
    position:absolute!important;
    right:14px!important;
    left:auto!important;
    top:50%!important;
    transform:translateY(-50%)!important;
    margin:0!important;
    padding:0!important;
    width:52px!important;
    height:50px!important;
    display:flex!important;
    align-items:center!important;
    justify-content:center!important;
    z-index:1420!important;
  }
  body.tm-visitor-body .tm-public-logo img{
    display:block!important;
    width:50px!important;
    height:46px!important;
    max-width:50px!important;
    max-height:46px!important;
    object-fit:contain!important;
  }

  /* Account + dark mode fixed at the far left, next to the hamburger. */
  body.tm-visitor-body .tm-public-tools{
    position:absolute!important;
    left:58px!important;
    right:auto!important;
    top:50%!important;
    transform:translateY(-50%)!important;
    margin:0!important;
    padding:0!important;
    display:flex!important;
    flex-direction:row!important;
    align-items:center!important;
    gap:4px!important;
    width:auto!important;
    z-index:1420!important;
  }
  body.tm-visitor-body .tm-nav-icon{
    width:36px!important;
    height:36px!important;
    min-width:36px!important;
    padding:0!important;
    margin:0!important;
    display:grid!important;
    place-items:center!important;
    border-radius:10px!important;
    line-height:1!important;
    font-size:18px!important;
  }
  body.tm-visitor-body .tm-mobile-menu{
    position:absolute!important;
    left:14px!important;
    right:auto!important;
    top:50%!important;
    transform:translateY(-50%)!important;
    display:grid!important;
    place-items:center!important;
    width:38px!important;
    height:38px!important;
    min-width:38px!important;
    margin:0!important;
    padding:0!important;
    border:1px solid #dbe4df!important;
    border-radius:10px!important;
    background:var(--tm-visitor-menu-bg,#fff)!important;
    color:var(--tm-visitor-menu-color,#17202a)!important;
    font-size:20px!important;
    z-index:1430!important;
  }

  /* Do not allow the legacy absolute dropdown to participate in layout. */
  body.tm-visitor-body .tm-public-menu{
    position:fixed!important;
    top:64px!important;
    bottom:0!important;
    left:0!important;
    right:auto!important;
    width:min(340px,82vw)!important;
    max-width:340px!important;
    height:calc(100dvh - 64px)!important;
    margin:0!important;
    padding:18px 14px 26px!important;
    box-sizing:border-box!important;
    background:var(--tm-visitor-menu-bg,#fff)!important;
    border:0!important;
    border-radius:0!important;
    display:flex!important;
    flex-direction:column!important;
    align-items:stretch!important;
    justify-content:flex-start!important;
    gap:7px!important;
    overflow-y:auto!important;
    overflow-x:hidden!important;
    overscroll-behavior:contain!important;
    box-shadow:18px 0 44px rgba(20,41,32,.18)!important;
    transform:translateX(-105%)!important;
    opacity:0!important;
    visibility:hidden!important;
    pointer-events:none!important;
    transition:transform .22s ease,opacity .18s ease,visibility .18s ease!important;
    z-index:1415!important;
  }
  body.tm-visitor-body .tm-public-menu.is-open{
    transform:translateX(0)!important;
    opacity:1!important;
    visibility:visible!important;
    pointer-events:auto!important;
  }
  body.tm-visitor-body .tm-public-menu a{
    position:relative!important;
    width:100%!important;
    min-height:50px!important;
    margin:0!important;
    padding:12px 15px!important;
    box-sizing:border-box!important;
    display:flex!important;
    align-items:center!important;
    justify-content:flex-start!important;
    text-align:right!important;
    border:1px solid #e8eeea!important;
    border-radius:12px!important;
    background:#f8faf9!important;
    color:var(--tm-visitor-menu-color,#17202a)!important;
    font-size:15px!important;
    font-weight:700!important;
    white-space:normal!important;
  }
  body.tm-visitor-body .tm-public-menu a:after{display:none!important}
  body.tm-visitor-body .tm-public-menu a:hover,
  body.tm-visitor-body .tm-public-menu a:focus{
    background:#eef8f3!important;
    border-color:#d6e9de!important;
    color:#118a66!important;
  }
  body.tm-visitor-body .tm-public-menu-backdrop{
    position:fixed!important;
    top:64px!important;
    right:0!important;
    bottom:0!important;
    left:0!important;
    display:block!important;
    margin:0!important;
    background:rgba(17,31,25,.42)!important;
    backdrop-filter:blur(2px)!important;
    opacity:0!important;
    visibility:hidden!important;
    pointer-events:none!important;
    transition:opacity .18s ease,visibility .18s ease!important;
    z-index:1410!important;
  }
  body.tm-visitor-body .tm-public-menu-backdrop.is-open{
    opacity:1!important;
    visibility:visible!important;
    pointer-events:auto!important;
  }
  body.tm-visitor-body.tm-public-menu-open{overflow:hidden!important}

  /* Dark visitor mode remains readable inside the portrait drawer. */
  body.tm-visitor-dark .tm-public-menu a{
    background:#252c3a!important;
    border-color:#343d4d!important;
    color:#fff!important;
  }
  body.tm-visitor-dark .tm-public-menu a:hover,
  body.tm-visitor-dark .tm-public-menu a:focus{
    background:#2d3748!important;
    border-color:#405065!important;
    color:#5ed4c3!important;
  }
}

/* ===== Tamayuz V6.57: user card text stacking fix =====
   Keep the account name and role on separate readable lines inside mobile/tablet drawers. */
@media (max-width:1199px){
  .tm-user-card{
    display:flex!important;
    align-items:center!important;
    justify-content:flex-start!important;
    gap:10px!important;
    min-height:62px!important;
    height:auto!important;
    overflow:visible!important;
  }
  .tm-user-card>div:last-child{
    display:flex!important;
    flex:1 1 auto!important;
    min-width:0!important;
    flex-direction:column!important;
    align-items:flex-start!important;
    justify-content:center!important;
    gap:3px!important;
    height:auto!important;
    line-height:normal!important;
    overflow:visible!important;
  }
  .tm-user-card>div:last-child>*{
    position:static!important;
    inset:auto!important;
    display:block!important;
    width:100%!important;
    max-width:100%!important;
    margin:0!important;
    padding:0!important;
    transform:none!important;
    white-space:normal!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
  }
  .tm-user-card>div:last-child>*:first-child{
    font-size:14px!important;
    font-weight:800!important;
    line-height:1.45!important;
    color:#1f2e27!important;
  }
  .tm-user-card>div:last-child>*:not(:first-child){
    font-size:11px!important;
    font-weight:500!important;
    line-height:1.45!important;
    color:#8a948f!important;
  }
  .tm-user-card .tm-avatar{
    flex:0 0 40px!important;
    width:40px!important;
    height:40px!important;
    align-self:center!important;
  }
}

@media (max-width:767px){
  .tm-user-card{min-height:60px!important;padding:10px 11px!important}
  .tm-user-card>div:last-child>*:first-child{font-size:13px!important}
  .tm-user-card>div:last-child>*:not(:first-child){font-size:10.5px!important}
}

/* ===== Tamayuz V6.58: one-scroll sidebar =====
   The entire sidebar is the only vertical scroll container.
   Remove the legacy nested scrollbar from .tm-nav so logo, account card,
   navigation, bottom links and admin preview tools all move together. */
.tm-sidebar{
  overflow-y:auto!important;
  overflow-x:hidden!important;
  overscroll-behavior-y:contain!important;
  -webkit-overflow-scrolling:touch;
  scrollbar-gutter:stable;
}
.tm-sidebar .tm-nav{
  flex:0 0 auto!important;
  min-height:0!important;
  max-height:none!important;
  height:auto!important;
  overflow:visible!important;
  overflow-y:visible!important;
  overflow-x:visible!important;
  scrollbar-width:auto!important;
}
.tm-sidebar .tm-sidebar-bottom{
  flex:0 0 auto!important;
  margin-top:18px!important;
}
.tm-sidebar .tm-device-preview-tools{
  flex:0 0 auto!important;
}

/* Keep drawer variants on the same single-scroll model. */
@media (max-width:1199px){
  .tm-sidebar{
    overflow-y:auto!important;
    overflow-x:hidden!important;
  }
  .tm-sidebar .tm-nav{
    overflow:visible!important;
    max-height:none!important;
  }
}
