html, body{height:100% !important;}
/* 12 Meridians Portal - light mode */
.tm12-standalone,
body.tm12-portal-open{
  overflow: hidden !important;
}

/* Portal overlays the whole viewport, regardless of theme layout */
.tm12-portal{
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  z-index: 999999 !important;
}

/* Higher specificity reset for theme collisions */
#tm12-portal-app,
#tm12-portal-app *{
  box-sizing: border-box !important;
}

#tm12-portal-app a{
  color: inherit !important;
}

.tm12-portal { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, Arial, sans-serif; }
.tm12-portal__shell { position: relative; display: flex; height: 100vh; width: 100%; background: #f6f7fb; color: #0f172a; overflow: hidden; }
.tm12-portal__sidebar { width: 280px; background: #ffffff; border-right: 1px solid #e5e7eb; padding: 18px 16px; display: flex; flex-direction: column; }
.tm12-portal__brand { display: flex; gap: 12px; align-items: center; padding: 6px 8px 14px; }
.tm12-portal__logo { width: 44px; height: 44px; border-radius: 14px; background: #0f172a; color: #fff; display:flex; align-items:center; justify-content:center; font-weight: 800; letter-spacing: -0.5px; overflow: hidden; }
.tm12-portal__logo.is-img { background: transparent; }
.tm12-portal__logo img { width: 44px; height: 44px; object-fit: contain; display:block; border-radius: 14px; }
.tm12-portal__brandname { font-weight: 800; font-size: 16px; }
.tm12-portal__brandtag { color: #64748b; font-size: 12px; margin-top: 2px; }

.tm12-portal__nav { display:flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.tm12-portal__navitem { padding: 10px 12px; border-radius: 12px; text-decoration: none; color: #0f172a; border: 1px solid transparent; display:flex; align-items:center; justify-content: space-between; }
.tm12-portal__navitem:hover { background: #0f172a; color: #fff !important; }
.tm12-portal__navitem.is-active { background: #0f172a; color: #fff; }
.tm12-portal__navitem.is-active span,
.tm12-portal__navitem:hover span { color: inherit !important; }
.tm12-portal__sidebarfoot { margin-top: auto; padding: 10px 8px; color: #64748b; }

.tm12-portal__main { flex: 1; display:flex; flex-direction: column; min-width: 0; min-height: 0; }
.tm12-portal__topbar { padding: 16px 18px; display:flex; align-items:center; justify-content: space-between; gap: 12px; border-bottom: 1px solid #e5e7eb; background: rgba(246,247,251,0.85); backdrop-filter: blur(8px); }
.tm12-portal__topbarleft{display:flex; align-items:center; gap:10px; min-width:0;}
.tm12-portal__topbarright{display:flex; align-items:center; gap:10px;}

.tm12-portal__burger{display:none; width:40px; height:40px; border:1px solid #e5e7eb; background:#ffffff; border-radius:12px; padding:10px; cursor:pointer;}
.tm12-portal__burger span{display:block; height:2px; background:#0f172a; border-radius:999px; margin:4px 0;}
.tm12-portal__burger:focus{outline:none; box-shadow:0 0 0 3px rgba(15,23,42,0.12);}
.tm12-portal__content { padding: 18px; overflow:auto; flex: 1; min-height: 0; -webkit-overflow-scrolling: touch; }
.tm12-pill { padding: 8px 12px; border-radius: 999px; background: #ffffff; border: 1px solid #e5e7eb; font-size: 13px; }
.tm12-pill--muted { color: #64748b; }

.tm12-card { background: #fff; border: 1px solid #e5e7eb; border-radius: 18px; padding: 18px; box-shadow: 0 10px 30px rgba(15,23,42,0.06); max-width: 980px; }
.tm12-card__head { display:flex; justify-content: space-between; gap: 16px; align-items: flex-start; flex-wrap: wrap; }

.tm12-h1 { font-size: 26px; margin: 0 0 6px; letter-spacing: -0.4px; }
.tm12-h2 { font-size: 18px; margin: 0 0 10px; }
.tm12-h3 { font-size: 16px; margin: 0 0 10px; }
.tm12-muted { color: #64748b; margin: 0 0 10px; }
.tm12-small { font-size: 12px; }

.tm12-auth { display:grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 14px; }
.tm12-auth__panel { border: 1px solid #e5e7eb; border-radius: 16px; padding: 14px; background: #f8fafc; }

.tm12-form label { display:block; font-weight: 600; font-size: 13px; color: #0f172a; margin: 10px 0 6px; }
.tm12-form input, .tm12-form textarea, .tm12-form select { width: 100%; padding: 10px 12px; border-radius: 12px; border: 1px solid #cbd5e1; background: #fff; font-size: 14px; outline: none; }
.tm12-form textarea { min-height: 110px; resize: vertical; }
.tm12-form input:focus, .tm12-form textarea:focus, .tm12-form select:focus { border-color: #0f172a; box-shadow: 0 0 0 3px rgba(15,23,42,0.12); }

.tm12-form__msg { margin-top: 10px; font-size: 13px; }
.tm12-form__msg.is-error { color: #b91c1c; }
.tm12-form__msg.is-ok { color: #047857; }

.tm12-btn { padding: 10px 14px; border-radius: 12px; border: 1px solid #cbd5e1; background: #fff; cursor:pointer; font-weight: 700; }
.tm12-btn:hover { background: #f1f5f9; }
.tm12-btn--primary { background: #0f172a; border-color: #0f172a; color: #fff; }
.tm12-btn--primary:hover { background: #111827; }
.tm12-btn--ghost { background: transparent; }
.tm12-btn--ghost:hover { background: #f1f5f9; }

.tm12-grid { display:grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tm12-grid__full { grid-column: 1 / -1; }
.tm12-grid--cards { grid-template-columns: 1fr 1fr; margin-top: 12px; }

.tm12-actions { display:flex; justify-content: flex-end; gap: 10px; margin-top: 14px; }

.tm12-flex{display:flex; gap: 12px; align-items: center;}
.tm12-flex--between{justify-content: space-between;}
.tm12-flex--wrap{flex-wrap: wrap;}

.tm12-progress { width: 220px; min-width: 220px; background: #e2e8f0; border-radius: 999px; padding: 4px; position: relative; display: flex; flex-direction: column; align-items: center; }
.tm12-progress__bar { height: 10px; background: transparent; border-radius: 999px; overflow: hidden; }
.tm12-progress__bar > span { display:block; height: 10px; width: 0%; background: #0f172a; border-radius: 999px; }
.tm12-progress__text { margin-top: 6px; font-size: 12px; color: #64748b; text-align: center; }

.tm12-divider{height:1px; background:#e5e7eb; margin: 14px 0; border-radius:999px;}

.tm12-yn{display:flex; flex-direction: column; gap: 10px;}
.tm12-yn__row{display:grid; grid-template-columns: 1fr auto; gap: 12px; align-items: start; padding: 12px; border: 1px solid #e5e7eb; border-radius: 16px; background: #fff;}
.tm12-yn__q{font-weight: 600; font-size: 14px;}
.tm12-yn__a{display:flex; gap: 10px; align-items: center;}
.tm12-radio{display:flex; gap: 8px; align-items: center; padding: 8px 10px; border: 1px solid #e5e7eb; border-radius: 999px; background: #f8fafc; font-weight: 700; font-size: 13px; cursor: pointer;}
.tm12-radio input{width: 16px; height: 16px;}

.tm12-check{display:flex; gap: 8px; align-items: center; padding: 8px 10px; border: 1px solid #cbd5e1; border-radius: 999px; background: #f8fafc; font-weight: 700; font-size: 13px; cursor: pointer;}
.tm12-check input{width: 16px; height: 16px;}

.tm12-steps { display:flex; gap: 8px; margin: 12px 0 8px; flex-wrap: wrap; }
.tm12-step { padding: 8px 10px; border-radius: 999px; border: 1px solid #cbd5e1; background: #fff; cursor:pointer; font-weight: 700; font-size: 13px; }
.tm12-step.is-active { background: #0f172a; color: #fff; border-color:#0f172a; }
.tm12-stepbody { display:none; }
.tm12-stepbody.is-active { display:block; }

.tm12-fieldset { border: 1px solid #e5e7eb; border-radius: 16px; padding: 12px; margin-top: 12px; }
.tm12-fieldset legend { font-weight: 800; padding: 0 6px; }

.tm12-checkgrid { display:grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 8px 0 10px; }
.tm12-check { display:flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 12px; border: 1px solid #e5e7eb; background: #fff; }
.tm12-check input { width: 16px; height: 16px; }

.tm12-list { list-style: none; padding: 0; margin: 0; display:flex; flex-direction: column; gap: 10px; }
.tm12-list li { padding: 10px 12px; border-radius: 14px; border: 1px solid #e5e7eb; background: #fff; display:flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }

.tm12-badge { padding: 4px 8px; border-radius: 999px; background: #f1f5f9; border: 1px solid #e5e7eb; font-size: 12px; color: #334155; }
.tm12-badge--complete { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.tm12-badge--pending { background: #fff7ed; border-color: #fed7aa; color: #9a3412; }

.tm12-grid2 { display:grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tm12-field { display:block; }
.tm12-field > span { display:block; font-weight: 600; font-size: 13px; color: #0f172a; margin: 10px 0 6px; }
.tm12-field input, .tm12-field textarea { width: 100%; padding: 10px 12px; border-radius: 12px; border: 1px solid #cbd5e1; background: #fff; font-size: 14px; outline: none; }
.tm12-field input:focus, .tm12-field textarea:focus { border-color: #0f172a; box-shadow: 0 0 0 3px rgba(15,23,42,0.12); }

.tm12-appt-request__box { border: 1px solid #e5e7eb; border-radius: 16px; padding: 14px; background: #f8fafc; }

.tm12-tablewrap { overflow:auto; border: 1px solid #e5e7eb; border-radius: 16px; background:#fff; }
.tm12-table { width:100%; border-collapse: collapse; font-size: 14px; }
.tm12-table th, .tm12-table td { padding: 10px 12px; border-bottom: 1px solid #e5e7eb; text-align: left; vertical-align: top; }
.tm12-table th { background:#f8fafc; font-weight: 800; }

@media (max-width: 980px) {
  .tm12-portal__sidebar { width: 240px; }
  .tm12-auth { grid-template-columns: 1fr; }
  .tm12-grid, .tm12-grid--cards { grid-template-columns: 1fr; }
  .tm12-progress { width: 100%; min-width: 0; }
}

@media (max-width: 720px) {
  .tm12-portal__burger{display:inline-block;}
  .tm12-portal__shell { flex-direction: row; height: 100vh; min-height: 100vh; }
  .tm12-portal__topbar{ padding: 12px 12px; }
  .tm12-portal__content{ padding: 12px; }

  /* Off-canvas sidebar */
  .tm12-portal__sidebar{
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: min(320px, 84vw);
    border-right: 1px solid #e5e7eb;
    transform: translateX(-105%);
    transition: transform .22s ease;
    z-index: 1000000;
    box-shadow: 0 18px 60px rgba(15,23,42,0.18);
  }
  .tm12-portal__sidebar.is-open{ transform: translateX(0); }

  body.tm12-sidebar-open .tm12-portal::after{
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,0.45);
    z-index: 999999;
  }

  .tm12-grid2{ grid-template-columns: 1fr; }
  .tm12-grid, .tm12-grid--cards { grid-template-columns: 1fr; }
  .tm12-btn{ width: 100%; justify-content: center; }
  .tm12-card{ padding: 14px; }
  .tm12-bodymap__svgwrap{ max-width: 340px; }
}

@media (max-width: 420px) {
  .tm12-portal__sidebar{ padding: 14px; }
  .tm12-card{ border-radius: 16px; }
  .tm12-bodymap__svgwrap{ max-width: 300px; }
}

#tm12-portal-app{margin:0 !important; padding:0 !important;}


/* Body map */
.tm12-bodymap { border:1px solid #e5e7eb; border-radius: 14px; padding: 14px; background: #fff; }
.tm12-bodymap__toolbar { display:flex; gap:10px; align-items:center; justify-content:space-between; flex-wrap:wrap; margin-bottom: 12px; }
.tm12-bodymap__views, .tm12-bodymap__tools { display:flex; gap:8px; align-items:center; flex-wrap:wrap; }
.tm12-bodymap__stage { display:grid; grid-template-columns: 1fr; gap: 10px; }
.tm12-bodymap__canvas { display:none; }
.tm12-bodymap__canvas.is-active { display:block; }
.tm12-bodymap__svgwrap { position:relative; width:100%; max-width: 420px; margin: 0 auto; aspect-ratio: 200 / 520; }
.tm12-bodymap__svg { width:100%; height:100%; display:block; }
.tm12-bodymap__img { width:100%; height:100%; display:block; }
.tm12-bodymap__shape circle,
.tm12-bodymap__shape rect { fill: #f8fafc; stroke: #cbd5e1; stroke-width: 2; }
.tm12-bodymap__detail { stroke:#cbd5e1; stroke-width: 2; stroke-dasharray: 4 4; fill:none; opacity: .8; }
.tm12-bodymap__markers { position:absolute; inset:0; }
.tm12-bodymap__marker { position:absolute; transform: translate(-50%, -50%); width: 14px; height: 14px; border-radius: 50%; background:#111827; border:2px solid #fff; box-shadow: 0 3px 10px rgba(0,0,0,.15); cursor:pointer; }
.tm12-bodymap__marker[data-layer="admin"] { background:#2563eb; }
.tm12-bodymap__list { margin-top: 12px; font-size: 13px; }
.tm12-bodymap__list ul { list-style:none; padding:0; margin:0; display:grid; gap:8px; }
.tm12-bodymap__list li { display:flex; gap:10px; align-items:flex-start; justify-content:space-between; border:1px solid #e5e7eb; border-radius: 12px; padding:10px 12px; background:#fff; }
.tm12-bodymap__list .tm12-bodymap__meta { display:flex; flex-direction:column; gap:2px; }
.tm12-bodymap__list .tm12-bodymap__actions { display:flex; gap:8px; }
.tm12-bodymap__modal { position:fixed; inset:0; background: rgba(17,24,39,.55); display:none; align-items:center; justify-content:center; z-index: 9999; padding: 16px; }
.tm12-bodymap__modal.is-open { display:flex; }
.tm12-bodymap__modalcard { width:100%; max-width: 420px; border-radius: 16px; background:#fff; padding: 14px; border:1px solid #e5e7eb; }
.tm12-bodymap__modalcard h3 { margin:0 0 8px; font-size: 16px; }
.tm12-bodymap__modalrow { display:flex; flex-direction:column; gap:6px; margin: 10px 0; }
.tm12-bodymap__modalactions { display:flex; gap:10px; justify-content:flex-end; margin-top: 12px; }

