:root{
  --portal-accent:#00915a;
  --portal-accent-soft:rgba(0,145,90,.12);
  --portal-bg:#f6f7f9;
  --portal-card:#ffffff;
  --portal-text:#111827;
  --portal-muted:rgba(17,24,39,.68);
  --portal-border:rgba(0,0,0,.12);
  --portal-control:#ffffff;
  --portal-control-hover:#f3f4f6;
  --portal-overlay:rgba(0,0,0,.35);
}

html[data-vrah-theme="dark"]{
  --portal-bg:#050912;
  --portal-card:#0f172a;
  --portal-text:#e5edf8;
  --portal-muted:rgba(226,232,240,.74);
  --portal-border:rgba(148,163,184,.28);
  --portal-control:#111827;
  --portal-control-hover:#172033;
  --portal-overlay:rgba(2,6,23,.72);
  color-scheme: dark;
}

html[data-vrah-theme="dark"] body{
  background:var(--portal-bg) !important;
  color:var(--portal-text) !important;
}

html[data-vrah-theme="dark"] .card,
html[data-vrah-theme="dark"] .pcDialog,
html[data-vrah-theme="dark"] .avCalCard,
html[data-vrah-theme="dark"] .avTGWrap,
html[data-vrah-theme="dark"] .avDialog,
html[data-vrah-theme="dark"] .avBulkBar,
html[data-vrah-theme="dark"] .avSlotsList,
html[data-vrah-theme="dark"] details.case,
html[data-vrah-theme="dark"] .box,
html[data-vrah-theme="dark"] .warn,
html[data-vrah-theme="dark"] .ok{
  background:var(--portal-card) !important;
  color:var(--portal-text) !important;
  border-color:var(--portal-border) !important;
  box-shadow:0 12px 32px rgba(0,0,0,.28) !important;
}

html[data-vrah-theme="dark"] .warn{ background:rgba(245,158,11,.14) !important; }
html[data-vrah-theme="dark"] .ok{ background:rgba(16,185,129,.12) !important; }
html[data-vrah-theme="dark"] .muted,
html[data-vrah-theme="dark"] .note,
html[data-vrah-theme="dark"] .small,
html[data-vrah-theme="dark"] .task .muted,
html[data-vrah-theme="dark"] .tgTime .t,
html[data-vrah-theme="dark"] .tgEv .s{
  color:var(--portal-muted) !important;
}

html[data-vrah-theme="dark"] .btn,
html[data-vrah-theme="dark"] input,
html[data-vrah-theme="dark"] textarea,
html[data-vrah-theme="dark"] select{
  background:var(--portal-control) !important;
  color:var(--portal-text) !important;
  border-color:var(--portal-border) !important;
}
html[data-vrah-theme="dark"] .btn:hover{ background:var(--portal-control-hover) !important; }
html[data-vrah-theme="dark"] .btn.primary{
  background:var(--portal-accent) !important;
  color:#ffffff !important;
  border-color:rgba(0,145,90,.42) !important;
}

html[data-vrah-theme="dark"] .task,
html[data-vrah-theme="dark"] .task .case-update,
html[data-vrah-theme="dark"] .avSlotsList .item,
html[data-vrah-theme="dark"] .tgHead,
html[data-vrah-theme="dark"] .tgH,
html[data-vrah-theme="dark"] .tgCol,
html[data-vrah-theme="dark"] .tgTime,
html[data-vrah-theme="dark"] .tgTime .t{
  border-color:rgba(148,163,184,.18) !important;
}

html[data-vrah-theme="dark"] .tgHead,
html[data-vrah-theme="dark"] .tgTime,
html[data-vrah-theme="dark"] .tgCol{
  background:#0f172a !important;
}
html[data-vrah-theme="dark"] .tgCol{
  background-image:linear-gradient(to bottom, rgba(148,163,184,.08) 1px, transparent 1px) !important;
}
html[data-vrah-theme="dark"] .tgEv{ color:var(--portal-text) !important; }
html[data-vrah-theme="dark"] .tgEv.avail{ background:rgba(59,130,246,.14) !important; }
html[data-vrah-theme="dark"] .tgEv.booking.requested{ background:rgba(234,179,8,.18) !important; }
html[data-vrah-theme="dark"] .tgEv.booking.confirmed{ background:rgba(220,38,38,.18) !important; }
html[data-vrah-theme="dark"] details.case.case-blue{ background:rgba(59,130,246,.12) !important; }
html[data-vrah-theme="dark"] a{ color:#93c5fd !important; }

.portal-menu-btn{
  position:fixed;
  top:max(12px, env(safe-area-inset-top));
  right:max(12px, env(safe-area-inset-right));
  z-index:20010;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  min-width:44px;
  height:44px;
  padding:0 14px;
  border-radius:14px;
  border:1px solid rgba(0,145,90,.28);
  background:var(--portal-control);
  color:var(--portal-text);
  box-shadow:0 10px 28px rgba(0,0,0,.14);
  font:600 14px/1 system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
  cursor:pointer;
}
.portal-menu-btn .label{ margin:0; font-size:14px; font-weight:700; color:inherit; }
.portal-menu-overlay{
  position:fixed;
  inset:0;
  z-index:20005;
  background:var(--portal-overlay);
  opacity:0;
  pointer-events:none;
  transition:opacity .16s ease;
}
.portal-menu-overlay.open{ opacity:1; pointer-events:auto; }
.portal-menu-panel{
  position:fixed;
  top:calc(max(12px, env(safe-area-inset-top)) + 56px);
  right:max(12px, env(safe-area-inset-right));
  z-index:20011;
  width:min(290px, calc(100vw - 24px));
  border-radius:18px;
  border:1px solid var(--portal-border);
  background:var(--portal-card);
  color:var(--portal-text);
  box-shadow:0 18px 44px rgba(0,0,0,.22);
  padding:14px;
  display:none;
}
.portal-menu-panel.open{ display:block; }
.portal-menu-head{ display:flex; align-items:center; justify-content:space-between; gap:10px; }
.portal-menu-title{ font-weight:800; font-size:16px; }
.portal-menu-close{
  width:36px; height:36px; border-radius:12px; border:1px solid var(--portal-border);
  background:var(--portal-control); color:var(--portal-text); cursor:pointer;
}
.portal-menu-row{ display:flex; align-items:center; justify-content:space-between; gap:10px; margin-top:12px; }
.portal-menu-copy{ font-size:13px; color:var(--portal-muted); line-height:1.45; }
.portal-theme-toggle{
  display:inline-flex; align-items:center; gap:8px; justify-content:center;
  width:100%; padding:11px 12px; border-radius:12px; border:1px solid var(--portal-border);
  background:var(--portal-control); color:var(--portal-text); font:600 14px/1 system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif; cursor:pointer;
}
.portal-theme-toggle:hover{ background:var(--portal-control-hover); }
html[data-vrah-theme="dark"] .portal-menu-btn,
html[data-vrah-theme="dark"] .portal-menu-close,
html[data-vrah-theme="dark"] .portal-theme-toggle{
  background:var(--portal-control);
  color:var(--portal-text);
  border-color:var(--portal-border);
}
html[data-vrah-theme="dark"] .portal-menu-btn{ box-shadow:0 12px 34px rgba(0,0,0,.32); }

@media (max-width: 640px){
  .portal-menu-btn .label{ display:none; }
  .portal-menu-panel{ width:min(280px, calc(100vw - 20px)); }
}
