/* H99 unified rich-text editor and safe table rendering */
.h99-editor-source[hidden]{display:none!important}
.h99-editor-shell{
  position:relative;
  width:100%;
  margin-top:6px;
  border:1px solid var(--v2-border,rgba(148,163,184,.28));
  border-radius:14px;
  background:var(--v2-card,#1d2026);
  color:var(--v2-text,#e5e7eb);
  overflow:visible;
}
.h99-editor-toolbar{
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:6px;
  padding:8px;
  border-bottom:1px solid var(--v2-border,rgba(148,163,184,.22));
  background:color-mix(in srgb,var(--v2-card-2,#171a20) 94%,transparent);
  border-radius:14px 14px 0 0;
}
.h99-editor-button,
.h99-editor-select,
.h99-editor-color{
  min-height:32px;
  border:1px solid var(--v2-border,rgba(148,163,184,.28));
  border-radius:9px;
  background:var(--v2-card,#22262d);
  color:var(--v2-text,#e5e7eb);
  font:inherit;
}
.h99-editor-button{
  padding:5px 10px;
  cursor:pointer;
  font-weight:700;
}
.h99-editor-button:hover,
.h99-editor-button:focus-visible{
  border-color:var(--v2-accent,#22c5ad);
  outline:none;
}
.h99-editor-button.is-primary{
  background:var(--v2-accent,#22c5ad);
  color:#071a17;
  border-color:transparent;
}
.h99-editor-select{padding:4px 8px}
.h99-editor-color{width:42px;padding:3px;cursor:pointer}
.h99-editor-surface{
  min-height:165px;
  padding:14px 16px;
  background:var(--v2-card,#1d2026);
  color:var(--v2-text,#e5e7eb);
  caret-color:var(--v2-text,#e5e7eb);
  border-radius:0 0 14px 14px;
  outline:none;
  overflow:auto;
  line-height:1.5;
  word-break:break-word;
}
.h99-editor-shell[data-h99-profile="email"] .h99-editor-surface{min-height:340px}
.h99-editor-surface:focus{
  box-shadow:inset 0 0 0 2px color-mix(in srgb,var(--v2-accent,#22c5ad) 55%,transparent);
}
.h99-editor-surface.is-invalid{
  box-shadow:inset 0 0 0 2px #ef4444;
}
.h99-editor-surface p{margin:.35em 0}
.h99-editor-surface h1,.h99-editor-surface h2,.h99-editor-surface h3,.h99-editor-surface h4{margin:.55em 0 .3em}
.h99-editor-surface a,.h99-rich-content a{color:#38bdf8;text-decoration:underline}
.h99-editor-table-panel{
  position:absolute;
  z-index:30;
  top:48px;
  right:8px;
  display:grid;
  grid-template-columns:repeat(2,minmax(100px,1fr));
  gap:8px;
  width:min(360px,calc(100vw - 40px));
  padding:12px;
  border:1px solid var(--v2-border,rgba(148,163,184,.3));
  border-radius:12px;
  background:var(--v2-card,#20242b);
  box-shadow:0 18px 50px rgba(0,0,0,.32);
}
.h99-editor-table-panel[hidden]{display:none!important}
.h99-editor-table-panel label{display:grid;gap:4px;font-size:12px}
.h99-editor-table-panel input[type="number"]{
  width:100%;
  padding:7px 8px;
  border:1px solid var(--v2-border,rgba(148,163,184,.3));
  border-radius:8px;
  background:var(--v2-card-2,#171a20);
  color:var(--v2-text,#e5e7eb);
}
.h99-editor-table-panel .h99-editor-check{
  display:flex;
  align-items:center;
  gap:7px;
}
.h99-editor-table-tools{
  display:flex;
  flex-wrap:wrap;
  gap:5px;
  padding-left:6px;
  border-left:1px solid var(--v2-border,rgba(148,163,184,.25));
}
.h99-editor-table-tools[hidden]{display:none!important}
.h99-editor-surface table,
.h99-rich-content table{
  display:table;
  width:100%;
  min-width:460px;
  margin:10px 0;
  border-collapse:collapse;
  table-layout:auto;
  color:inherit;
}
.h99-editor-surface th,.h99-editor-surface td,
.h99-rich-content th,.h99-rich-content td{
  min-width:70px;
  padding:7px 9px;
  border:1px solid color-mix(in srgb,var(--v2-text,#e5e7eb) 28%,transparent)!important;
  vertical-align:top;
  text-align:left;
  color:inherit;
}
.h99-editor-surface th,.h99-rich-content th{
  font-weight:800;
  background:color-mix(in srgb,var(--v2-accent,#22c5ad) 14%,transparent);
}
.thread-message-body .h99-rich-content{
  display:block;
  max-width:100%;
  overflow-x:auto;
  white-space:normal;
}
.h99-rich-content p{margin:.35em 0}
.h99-rich-content ul,.h99-rich-content ol{padding-left:1.5em}
html[data-theme="light"] .h99-editor-shell,
html[data-theme="light"] .h99-editor-toolbar,
html[data-theme="light"] .h99-editor-surface,
html[data-theme="light"] .h99-editor-button,
html[data-theme="light"] .h99-editor-select,
html[data-theme="light"] .h99-editor-table-panel{
  background:#fff;
  color:#111827;
}
html[data-theme="light"] .h99-editor-toolbar{background:#f8fafc}
html[data-theme="light"] .h99-editor-table-panel input[type="number"]{
  background:#fff;
  color:#111827;
}
@media(max-width:720px){
  .h99-editor-toolbar{gap:4px;padding:7px}
  .h99-editor-button{padding:5px 8px;font-size:12px}
  .h99-editor-select{max-width:110px}
  .h99-editor-table-tools{
    width:100%;
    padding:6px 0 0;
    border-left:0;
    border-top:1px solid var(--v2-border,rgba(148,163,184,.25));
  }
  .h99-editor-table-panel{left:8px;right:8px;width:auto}
  .h99-editor-surface{min-height:145px;padding:12px}
}

/* HVSZ_H99B_EMAIL_EDITOR_CONTRAST_FIX
   A régi e-mail sablonok gyakran saját fehér háttérrel burkolják a teljes
   tartalmat. Az editorban ezt semlegesítjük, a mentett HTML-t nem írjuk át. */
.h99-editor-shell[data-h99-profile="email"] .h99-editor-surface{
  background:#111827 !important;
  color:#f8fafc !important;
  caret-color:#f8fafc !important;
}
.h99-editor-shell[data-h99-profile="email"] .h99-editor-surface *{
  background-color:transparent !important;
  background-image:none !important;
}
.h99-editor-shell[data-h99-profile="email"] .h99-editor-surface a{
  color:#38bdf8 !important;
}
.h99-editor-shell[data-h99-profile="email"] .h99-editor-surface hr{
  border-color:rgba(226,232,240,.28) !important;
}
.h99-editor-shell[data-h99-profile="email"] .h99-editor-surface table,
.h99-editor-shell[data-h99-profile="email"] .h99-editor-surface td,
.h99-editor-shell[data-h99-profile="email"] .h99-editor-surface th{
  color:inherit !important;
}
html[data-theme="light"] .h99-editor-shell[data-h99-profile="email"] .h99-editor-surface{
  background:#ffffff !important;
  color:#111827 !important;
  caret-color:#111827 !important;
}
html[data-theme="light"] .h99-editor-shell[data-h99-profile="email"] .h99-editor-surface a{
  color:#2563eb !important;
}
html[data-theme="light"] .h99-editor-shell[data-h99-profile="email"] .h99-editor-surface hr{
  border-color:rgba(15,23,42,.22) !important;
}

/* HVSZ_H99C_NEUTRAL_DARK_SURFACES
   Az e-mail editor és a Beállítások almenü a közös grafitszürke V2
   felületet használja a korábbi sötétkék panel helyett. */
html[data-theme="dark"] body.ui-v2-shell .h99-editor-shell[data-h99-profile="email"],
html[data-theme="dark"] body.ui-v2-shell .h99-editor-shell[data-h99-profile="email"] .h99-editor-toolbar{
  background:linear-gradient(180deg,#23252a 0%,#1e2024 100%) !important;
  border-color:rgba(148,163,184,.20) !important;
}
html[data-theme="dark"] body.ui-v2-shell .h99-editor-shell[data-h99-profile="email"] .h99-editor-surface{
  background:#1d1f23 !important;
  color:#f3f4f6 !important;
  caret-color:#f3f4f6 !important;
}
html[data-theme="dark"] body.ui-v2-shell .settings-sidebar{
  background:linear-gradient(180deg,#202226 0%,#1b1d21 100%) !important;
  border-color:rgba(148,163,184,.18) !important;
  box-shadow:0 14px 38px rgba(0,0,0,.16) !important;
}
html[data-theme="dark"] body.ui-v2-shell .settings-menu{
  background:transparent !important;
}
html[data-theme="dark"] body.ui-v2-shell .settings-link,
html[data-theme="dark"] body.ui-v2-shell .settings-link:visited{
  color:#d1d5db !important;
  background:transparent !important;
  border-color:transparent !important;
  opacity:.92 !important;
}
html[data-theme="dark"] body.ui-v2-shell .settings-link:hover{
  color:#f9fafb !important;
  background:#292c32 !important;
  border-color:rgba(148,163,184,.16) !important;
}
html[data-theme="dark"] body.ui-v2-shell .settings-link.settings-link-active{
  color:#f9fafb !important;
  background:linear-gradient(180deg,#30333a 0%,#292c32 100%) !important;
  border-color:rgba(148,163,184,.24) !important;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.035) !important;
}

/* Világos témában marad a tiszta, semleges világos felület. */
html[data-theme="light"] body.ui-v2-shell .settings-sidebar{
  background:#ffffff !important;
  border-color:rgba(15,23,42,.12) !important;
}
html[data-theme="light"] body.ui-v2-shell .settings-link.settings-link-active{
  background:#eef1f4 !important;
  border-color:rgba(15,23,42,.12) !important;
  color:#111827 !important;
}

