/* core 3.3.0 */
/* TenantHop panel styles: panel, cards, PIM strip, saved tenants, organizations list, status pill.
   Shared by TenantHop-SelfHosted, TenantHop-baseIT and the TenantHop WordPress plugin: every rule is scoped to .thop,
   page styles of a host (header, footer, page background, theme switch) belong to the host. */

/* ====== Design: "EntraID SID Converter" / IRB Look & Feel ====== */

.thop {
  /* Group Card / Panel */
  --esc-panel-bg: rgba(248, 250, 252, 0.12);
  --esc-panel-bg-2: rgba(248, 250, 252, 0.08);
  --esc-panel-border: rgba(248, 250, 252, 0.26);
  --esc-panel-shadow: 0 36px 90px -40px rgba(0, 0, 0, 0.55);

  /* Surfaces & Typography */
  --esc-surface: #F8FAFC;
  --esc-surface-2: #FFFFFF;
  --esc-text: #0F172A;
  --esc-heading: #0F172A;
  --esc-muted: #475569;
  --esc-border: #E2E8F0;
  --esc-border-soft: #EEF2F7;

  /* Inputs */
  --esc-input-bg: #FFFFFF;
  --esc-input-border: #CBD5E1;
  --esc-input-focus: #3ADEEB;

  /* Accent / States */
  --esc-brand: #3ADEEB;
  --esc-brand-strong: #22D3E6;
  --esc-positive: #16A34A;
  --esc-danger: #EF4444;
  --esc-warn: #F59E0B;

  /* Shadows */
  --esc-shadow-card: 0 18px 48px -22px rgba(15, 23, 42, 0.35);
  --esc-shadow-soft: 0 8px 20px -16px rgba(15, 23, 42, 0.28);

  /* Portal accent colors */
  --thop-m365: #BE185D;
  --thop-entra: #0A6FC2;
  --thop-intune: #4F46E5;
  --thop-defender: #C2410C;
  --thop-purview: #7C3AED;
  --thop-azure: #0284C7;
  --thop-exo: #0F766E;
}

.thop [hidden] { display: none !important; }

.thop * {
  box-sizing: border-box;
  font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

/* GROUP CARD */
.thop {
  position: relative;
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px;
  border-radius: 22px;
  background: transparent;
  z-index: 0;
}
.thop::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 22px;
  background: linear-gradient(180deg, var(--esc-panel-bg), var(--esc-panel-bg-2));
  border: 1px solid var(--esc-panel-border);
  box-shadow: var(--esc-panel-shadow);
  z-index: -1;
}

/* Cards */
.thop .card {
  border: 1px solid var(--esc-border);
  border-radius: 16px;
  background: var(--esc-surface);
  padding: 1.5rem 1.75rem;
  margin-bottom: 16px;
  box-shadow: var(--esc-shadow-card);
}
.thop .header-card {
  border-color: var(--esc-border-soft);
}

/* Headings / Text */
.thop h2 {
  margin: 0 0 0.85rem;
  font-size: 24px;
  line-height: 1.2;
  color: var(--esc-heading);
}
.thop h3 {
  margin: 0;
  font-size: 19px;
  line-height: 1.25;
  color: var(--esc-heading);
}
.thop h4 {
  margin: 0 0 0.6rem;
  font-size: 16px;
  color: var(--esc-heading);
}
.thop p {
  margin: 0 0 0.85rem;
  color: var(--esc-text);
  font-size: 14px;
  line-height: 1.65;
}
.thop .muted {
  color: var(--esc-muted);
  font-size: 13px;
}

/* Layout */
.thop .row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-end;
}
.thop .toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.thop .field {
  flex: 1 1 240px;
  min-width: 220px;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}
.thop label {
  font-size: 13px;
  font-weight: 600;
  color: var(--esc-text);
}
.thop label small {
  font-weight: 400;
  color: var(--esc-muted);
}

/* Inputs */
.thop input[type="text"] {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--esc-input-border);
  background: var(--esc-input-bg);
  color: var(--esc-text);
  font-size: 14px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}
.thop input[type="text"]::placeholder {
  color: #7A8899;
}
.thop input[type="text"]:focus {
  border-color: var(--esc-input-focus);
  box-shadow: 0 0 0 3px rgba(58, 222, 235, 0.22);
  outline: none;
  background: #FFFFFF;
}
.thop input.thop-tid {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 18px;
  padding: 0.85rem 1rem;
}
.thop .thop-hint {
  min-height: 1.4em;
  margin: 0.5rem 0 1rem;
}
.thop .thop-hint.bad {
  color: #8B5E00;
}

/* Buttons */
.thop .btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.65rem 1.15rem;
  font-weight: 700;
  font-size: 14px;
  line-height: 1.2;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}
.thop .btn-primary {
  background: var(--esc-brand);
  color: var(--esc-text);
  border-color: rgba(58, 222, 235, 0.55);
  box-shadow: var(--esc-shadow-soft);
}
.thop .btn-primary:hover {
  background: var(--esc-brand-strong);
  transform: translateY(-1px);
  box-shadow: 0 14px 28px -18px rgba(58, 222, 235, 0.55);
}
.thop .btn-secondary {
  background: #FFFFFF;
  color: var(--esc-text);
  border-color: var(--esc-border);
}
.thop .btn-secondary:hover {
  border-color: var(--esc-brand);
  transform: translateY(-1px);
  box-shadow: 0 10px 20px -18px rgba(58, 222, 235, 0.35);
}
.thop .btn-sm {
  padding: 0.45rem 0.9rem;
  font-size: 13px;
}
.thop .btn-xs {
  padding: 0.25rem 0.6rem;
  font-size: 12px;
  gap: 0.3rem;
}
.thop .btn-icon {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: 20px;
  height: 20px;
  font-size: 16px;
  line-height: 1;
}
.thop .btn-xs .btn-icon {
  width: 14px;
  height: 14px;
  font-size: 12px;
}
.thop .copy-btn.copied {
  background: var(--esc-positive);
  color: #03140A;
  border-color: rgba(22, 163, 74, 0.4);
  opacity: 1;
}

/* Saved tenants */
.thop .thop-saved {
  margin-top: 1.1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--esc-border);
}
.thop .thop-saved h4 {
  font-size: 13px;
  margin-bottom: 0.5rem;
}
.thop .chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: #FFFFFF;
  color: var(--esc-text);
  border: 1px solid var(--esc-border);
  border-radius: 999px;
  padding: 0.3rem 0.35rem 0.3rem 0.85rem;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  cursor: pointer;
  transition: border-color 0.16s ease;
}
.thop .chip:hover { border-color: var(--esc-brand); }
.thop .chip.active { border-color: var(--esc-brand); background: #E9FBFD; }
.thop .chip .x {
  display: inline-grid;
  place-items: center;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 50%;
  color: var(--esc-muted);
  font-weight: 400;
}
.thop .chip .x:hover { background: var(--esc-border-soft); color: var(--esc-text); }
.thop .linklike {
  background: none;
  border: 0;
  padding: 0.3rem;
  color: var(--esc-muted);
  font-size: 13px;
  text-decoration: underline;
  cursor: pointer;
}

/* Sign-in (optional) */
.thop .thop-signin {
  margin-top: 1.1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--esc-border);
}
.thop .thop-signin .thop-hint { margin: 0.6rem 0 0; }
.thop .btn:disabled { opacity: 0.6; cursor: progress; transform: none; }

/* Sign-in status pill (like Intune Registry Builder) */
.thop .user-info {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  max-width: 100%;
  padding: 0.45rem 0.85rem;
  background: rgba(22, 163, 74, 0.12);
  border: 1px solid rgba(22, 163, 74, 0.35);
  border-radius: 999px;
  color: var(--esc-text);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.3;
}
.thop .user-info .user-icon { font-size: 15px; flex: none; }
.thop .user-info .user-text { overflow-wrap: anywhere; }
.thop .user-info .user-upn { font-weight: 400; color: var(--esc-muted); }

/* Your organizations */
.thop .thop-orgs-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 0.9rem;
}
.thop .thop-orgs-head h4 { margin: 0; }
.thop .thop-orgs-head .count {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.05rem 0.55rem;
  border-radius: 999px;
  background: var(--esc-border-soft);
  color: var(--esc-muted);
  font-size: 12px;
  font-weight: 700;
  vertical-align: 2px;
}
.thop .thop-search {
  position: relative;
  flex: 0 1 340px;
  min-width: 220px;
}
.thop .thop-search::before {
  content: "🔎";
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 13px;
  opacity: 0.6;
  pointer-events: none;
}
.thop .thop-search input[type="text"] { padding-left: 2.1rem; }
.thop .thop-orgs-status:empty { display: none; }
.thop .thop-orgs {
  max-height: 360px;
  overflow: auto;
  border: 1px solid var(--esc-border);
  border-radius: 12px;
  background: #FFFFFF;
}
.thop .org-group {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.9rem;
  background: #F1F5F9;
  border-bottom: 1px solid var(--esc-border);
  color: var(--esc-muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.thop .thop-org {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  width: 100%;
  margin: 0;
  padding: 0.65rem 0.9rem;
  text-align: left;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--esc-border-soft);
  border-left: 3px solid transparent;
  border-radius: 0;
  color: var(--esc-text);
  font-size: 14px;
  line-height: 1.35;
  cursor: pointer;
  transition: background 0.15s ease;
}
.thop .thop-org:last-child { border-bottom: 0; }
.thop .thop-org:hover { background: #F8FAFC; }
.thop .thop-org.active { background: #E9FBFD; border-left-color: var(--esc-brand); }
.thop .thop-org:focus-visible { outline: 2px solid var(--esc-brand); outline-offset: -2px; }
.thop .org-avatar {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: #E0F2FE;
  color: #075985;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.02em;
}
.thop .thop-org.is-home .org-avatar { background: #DCFCE7; color: #166534; }
.thop .org-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.thop .org-name { font-weight: 700; overflow-wrap: anywhere; }
.thop .org-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.15rem 0.5rem;
  color: var(--esc-muted);
  font-size: 12.5px;
}
.thop .org-meta .org-domain { overflow-wrap: anywhere; }
.thop .org-meta .org-tid {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11.5px;
  overflow-wrap: anywhere;
}
.thop .org-meta .sep { opacity: 0.5; }
.thop .badge {
  flex: none;
  font-size: 11px;
  font-weight: 700;
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
}
.thop .badge.home { background: #DCFCE7; color: #166534; }
.thop .badge.guest { background: #E0F2FE; color: #075985; }
.thop .org-go {
  flex: none;
  color: var(--esc-muted);
  font-size: 16px;
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.thop .thop-org:hover .org-go,
.thop .thop-org.active .org-go { opacity: 1; transform: none; }
.thop .thop-orgs-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem 1rem;
  margin-top: 0.75rem;
}
.thop .thop-orgs-foot .linklike { padding: 0; font-size: 12px; }
.thop .thop-manage {
  color: var(--esc-muted) !important;
  font-size: 12px;
}
@media (max-width: 560px) {
  .thop .thop-search { flex-basis: 100%; }
  .thop .org-go { display: none; }
  .thop .org-meta .sep { display: none; }
  .thop .org-meta { flex-direction: column; align-items: flex-start; gap: 0.1rem; }
  .thop .org-meta .org-domain { overflow-wrap: break-word; word-break: normal; max-width: 100%; }
  .thop .thop-org .badge { display: none; }
  .thop .org-avatar { width: 28px; height: 28px; font-size: 11px; }
}

/* Empty state */
.thop .thop-empty {
  margin: 0 0 16px;
  padding: 1.1rem 1.4rem;
  border: 1px dashed var(--esc-panel-border);
  border-radius: 16px;
  color: #CBD5E1;
  font-size: 14px;
  text-align: center;
}
.thop .thop-empty strong { color: #F8FAFC; }

/* Portal grid */
.thop .portal-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  align-items: stretch;
  margin-bottom: 16px;
}
@media (max-width: 1000px) {
  .thop .portal-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 680px) {
  .thop .portal-grid { grid-template-columns: 1fr; }
}
.thop .portal-card {
  padding: 0;
  margin: 0;
  overflow: hidden;
  border-top: 4px solid var(--c);
}
.thop .portal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.15rem 0.75rem;
  border-bottom: 1px solid var(--esc-border);
}
.thop .portal-group {
  padding: 0.7rem 0 0.15rem;
}
.thop ul.portal-links a {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}
.thop .li-ico {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 7px;
  background: var(--esc-border-soft);
  font-size: 13px;
  line-height: 1;
}
.thop ul.portal-links li:hover .li-ico { background: #FFFFFF; }

/* PIM shortcuts */
.thop .pim-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  padding: 0.85rem 1rem;
  margin-bottom: 16px;
  border-radius: 14px;
  background: linear-gradient(135deg, #E0F2FE, #E9FBFD);
  border: 1px solid rgba(10, 111, 194, 0.25);
}
.thop .pim-title { display: flex; align-items: center; gap: 0.65rem; }
.thop .pim-title strong { display: block; font-size: 16px; color: var(--esc-heading); line-height: 1.2; }
.thop .pim-title .muted { display: block; font-size: 12px; }
.thop .pim-ico {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: #0A6FC2;
  font-size: 18px;
}
.thop .pim-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.thop .pim-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.95rem;
  border-radius: 999px;
  background: #0A6FC2;
  color: #FFFFFF !important;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none !important;
  box-shadow: var(--esc-shadow-soft);
  transition: transform 0.16s ease, filter 0.16s ease;
  white-space: nowrap;
}
.thop .pim-btn:hover { transform: translateY(-1px); filter: brightness(1.1); }
@media (max-width: 560px) {
  .thop .pim-actions, .thop .pim-btn { width: 100%; }
  .thop .pim-btn { justify-content: center; }
}
.thop .portal-group + .portal-group {
  border-top: 1px dashed var(--esc-border);
  margin-top: 0.15rem;
}
.thop .group-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0 1.15rem 0.2rem;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--c-btn, var(--c));
}
.thop .portal-head h3 {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 18px;
}
.thop .portal-head .muted {
  display: block;
  margin-top: 0.1rem;
  font-size: 12px;
}
.thop .btn-open {
  flex: none;
  white-space: nowrap;
  background: var(--c-btn, var(--c));
  color: #FFFFFF !important;
  border-color: transparent;
  padding: 0.4rem 0.85rem 0.4rem 0.7rem;
  gap: 0.3rem;
  font-size: 13px;
  text-decoration: none !important;
  box-shadow: var(--esc-shadow-soft);
}
.thop .btn-open:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
}
.thop ul.portal-links {
  list-style: none !important;
  margin: 0 !important;
  padding: 0 0.55rem 0.45rem !important;
}
.thop ul.portal-links li {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin: 0 !important;
  padding: 0 !important;
  border-radius: 9px;
  font-size: 14px;
  line-height: 1.3;
}
.thop ul.portal-links li::before,
.thop ul.portal-links li::marker { content: none; }
.thop ul.portal-links li:hover { background: var(--esc-border-soft); }
.thop ul.portal-links a {
  flex: 1;
  color: var(--esc-text) !important;
  text-decoration: none !important;
  padding: 0.36rem 0.6rem;
}
.thop ul.portal-links li:hover a { color: var(--c-btn, var(--c)) !important; }
.thop .tag {
  flex: none;
  font-size: 11px;
  color: #8B5E00;
  background: #FFF7E6;
  border-radius: 999px;
  font-weight: 600;
  letter-spacing: 0;
  padding: 0.1rem 0.5rem;
}
.thop .copy-btn {
  flex: none;
  background: transparent;
  border: 0;
  border-radius: 7px;
  padding: 0.2rem 0.4rem;
  margin-right: 0.15rem;
  font-size: 13px;
  line-height: 1;
  font-weight: 600;
  color: var(--esc-muted);
  cursor: pointer;
  opacity: 0;
}
.thop ul.portal-links li:hover .copy-btn,
.thop .copy-btn:focus-visible { opacity: 1; }
.thop .copy-btn:hover { background: #FFFFFF; color: var(--esc-text); }
.thop .copy-btn.copied { background: var(--esc-positive); color: #FFFFFF; opacity: 1; }
@media (hover: none) { .thop .copy-btn { opacity: 1; } }
.thop .is-off { opacity: 0.45; pointer-events: none; }

/* Notes */
.thop .notes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0.5rem 1.5rem;
  padding: 0.25rem 0.4rem 0;
}
.thop .notes p {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  color: #CBD5E1;
}
.thop .notes strong { color: #F8FAFC; }
.thop .notes a { color: var(--esc-brand); }

.thop code {
  background: #EEF2F7;
  padding: 0.1rem 0.35rem;
  border-radius: 5px;
  font-size: 12px;
  color: var(--esc-text);
  white-space: nowrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* Accessibility */
.thop .btn:focus-visible,
.thop .chip:focus-visible,
.thop a:focus-visible,
.thop input[type="text"]:focus-visible {
  outline: 2px solid var(--esc-brand);
  outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
  .thop .btn, .thop .chip, .thop .thop-org { transition: none; }
  .thop .btn:hover { transform: none; }
}

@media (max-width: 520px) {
  .thop { padding: 18px; max-width: 100%; }
  .thop .card { padding: 1.25rem 1.35rem; }
  .thop .portal-card { padding: 0; }
}
