/* ==========================================================================
   Horizonte Dark — Área de Login de Membros, Conta e Equipe
   ========================================================================== */

#hd-auth-root,
#hd-account-overlay,
.hd-modal-backdrop {
  --hd-bg: #09090b;
  --hd-surface: #111114;
  --hd-surface-2: #18181c;
  --hd-surface-3: #202024;
  --hd-border: #29292e;
  --hd-border-soft: #202024;
  --hd-text: #f4f4f5;
  --hd-muted: #a1a1aa;
  --hd-muted-2: #71717a;
  --hd-primary: #f5f5f4;
  --hd-primary-text: #111113;
  --hd-success: #4ade80;
  --hd-danger: #f87171;
  --hd-warning: #fbbf24;
  --hd-radius: 10px;
  --hd-radius-lg: 16px;
  --hd-shadow: 0 24px 72px rgba(0, 0, 0, 0.45);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--hd-text);
  box-sizing: border-box;
}

#hd-auth-root *,
#hd-account-overlay *,
.hd-modal-backdrop *,
.hd-sidebar-footer-wrap * {
  box-sizing: border-box;
}

#hd-auth-root [hidden],
#hd-account-overlay [hidden],
.hd-modal-backdrop[hidden],
.hd-sidebar-footer-wrap [hidden] {
  display: none !important;
}

/* --------------------------------------------------------------------------
   1. Tela de Login / Cadastro / Recuperação (#hd-auth-root)
   -------------------------------------------------------------------------- */
#hd-auth-root {
  position: fixed;
  inset: 0;
  z-index: 99999;
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(390px, 540px) 1fr;
  background: var(--hd-bg);
  overflow-y: auto;
}

.hd-auth-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(32px, 6vw, 80px);
  border-right: 1px solid var(--hd-border-soft);
  background: var(--hd-bg);
}

.hd-auth-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 56px;
  color: #fff;
  font-size: 16px;
  font-weight: 750;
  letter-spacing: -0.02em;
}

.hd-auth-brand-mark {
  display: inline-block;
  width: 35px;
  height: 35px;
  flex: 0 0 auto;
  background: url('/brand/app-icon.svg?v=20261110_flat_tip1') center/contain no-repeat;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.45));
}

.hd-eyebrow {
  margin: 0 0 8px;
  color: var(--hd-muted-2);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.hd-auth-card h1 {
  margin: 0 0 7px;
  font-size: 32px;
  line-height: 1.12;
  letter-spacing: -0.035em;
  color: var(--hd-text);
}

.hd-auth-subtitle {
  margin: 0;
  color: var(--hd-muted);
  font-size: 14px;
  line-height: 1.55;
}

.hd-linked-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 18px;
  padding: 13px 15px;
  border: 1px solid #2f4b3b;
  border-radius: 12px;
  background: #101913;
}

.hd-linked-notice strong {
  display: block;
  color: #dcfce7;
  font-size: 13px;
}

.hd-linked-notice p {
  margin: 3px 0 0;
  color: #86efac;
  font-size: 12px;
}

.hd-auth-form {
  display: grid;
  gap: 15px;
  margin-top: 24px;
}

.hd-field {
  display: grid;
  gap: 7px;
}

.hd-field label {
  color: #d4d4d8;
  font-size: 12px;
  font-weight: 600;
}

.hd-field small {
  color: var(--hd-muted);
  font-size: 12px;
  line-height: 1.4;
}

.hd-optional {
  color: var(--hd-muted-2);
  font-size: 11px;
  font-weight: 500;
}

.hd-input,
.hd-select,
.hd-textarea {
  width: 100%;
  border: 1px solid var(--hd-border);
  border-radius: 9px;
  outline: none;
  background: #0e0e11;
  color: var(--hd-text);
  padding: 10px 12px;
  font: inherit;
  font-size: 14px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.hd-input:focus,
.hd-select:focus,
.hd-textarea:focus {
  border-color: #71717a;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.06);
  background: #111114;
}

.hd-input:disabled {
  color: var(--hd-muted);
  background: var(--hd-surface);
  cursor: default;
}

.hd-password-wrap {
  display: grid;
  grid-template-columns: 1fr auto;
}

.hd-password-wrap .hd-input {
  grid-column: 1 / -1;
  grid-row: 1;
  padding-right: 46px;
}

.hd-password-wrap .hd-icon-btn {
  grid-column: 2;
  grid-row: 1;
  align-self: center;
  margin-right: 4px;
}

.hd-field-help {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 2px;
}

.hd-form-error {
  margin: 0;
  padding: 10px 12px;
  border-radius: 9px;
  border: 1px solid rgba(248, 113, 113, 0.35);
  background: rgba(248, 113, 113, 0.1);
  color: #fecaca;
  font-size: 12px;
}

.hd-auth-links {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 22px;
  font-size: 13px;
}

.hd-auth-aside {
  position: relative;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  padding: 64px;
  background: #0c0c0f;
}

.hd-auth-aside::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 34%, rgba(255, 255, 255, 0.06), transparent 36%),
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px);
  background-size: auto, 40px 40px, 40px 40px;
}

.hd-auth-aside-art {
  position: absolute;
  inset: 12% 12% 24%;
  display: grid;
  place-items: center;
  opacity: 0.94;
}

.hd-auth-emblem {
  width: min(260px, 56%);
  aspect-ratio: 1;
  background: url('/brand/app-icon.svg?v=20261110_flat_tip1') center/contain no-repeat;
  filter: drop-shadow(0 32px 54px rgba(0, 0, 0, 0.5));
  display: block;
}

.hd-auth-aside p {
  position: relative;
  max-width: 480px;
  margin: 0;
  color: #d4d4d8;
  font-size: 18px;
  line-height: 1.5;
}

/* --------------------------------------------------------------------------
   2. Botões, Avatares e Badges Comuns
   -------------------------------------------------------------------------- */
.hd-btn,
.hd-icon-btn,
.hd-text-btn {
  border: 0;
  cursor: pointer;
  font: inherit;
  transition: 0.15s ease;
}

.hd-btn {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 650;
  white-space: nowrap;
}

.hd-btn.primary {
  background: var(--hd-primary);
  color: var(--hd-primary-text);
}

.hd-btn.primary:hover {
  background: #ffffff;
  transform: translateY(-1px);
}

.hd-btn.secondary {
  border: 1px solid var(--hd-border);
  background: var(--hd-surface-2);
  color: var(--hd-text);
}

.hd-btn.secondary:hover {
  background: var(--hd-surface-3);
  border-color: #3f3f46;
}

.hd-btn.full {
  width: 100%;
}

.hd-btn:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  transform: none;
}

.hd-text-btn {
  padding: 0;
  background: transparent;
  color: #d4d4d8;
  font-size: 13px;
  font-weight: 600;
}

.hd-text-btn:hover {
  color: #ffffff;
}

.hd-danger-text {
  color: var(--hd-danger) !important;
}

.hd-icon-btn {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 9px;
  background: transparent;
  color: var(--hd-muted);
  font-size: 16px;
}

.hd-icon-btn:hover {
  background: var(--hd-surface-3);
  color: var(--hd-text);
}

.hd-avatar {
  display: inline-grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  overflow: hidden;
  border: 1px solid #34343a;
  border-radius: 50%;
  background: #27272c;
  color: #e4e4e7;
  font-size: 12px;
  font-weight: 750;
  background-position: center;
  background-size: cover;
}

.hd-avatar-xl {
  width: 88px;
  height: 88px;
  font-size: 24px;
}

.hd-role-badge,
.hd-status-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border: 1px solid var(--hd-border);
  border-radius: 20px;
  color: var(--hd-muted);
  font-size: 11px;
  font-weight: 650;
  background: transparent;
}

.hd-status-badge.success {
  border-color: rgba(74, 222, 128, 0.28);
  color: var(--hd-success);
}

/* --------------------------------------------------------------------------
   3. Rodapé da Sidebar + Menu Popover (Screenshot 2)
   -------------------------------------------------------------------------- */
.hd-sidebar-footer-wrap {
  position: relative;
  width: 100%;
}

.hd-sidebar-account {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: #f4f4f5;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.hd-sidebar-account:hover {
  background: #18181c;
}

.hd-sidebar-account[aria-expanded="true"] {
  background: #141418;
  border-color: #f4f4f5;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.35);
}

.hd-sidebar-account-copy {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 2px;
}

.hd-sidebar-account-copy strong,
.hd-sidebar-account-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hd-sidebar-account-copy strong {
  font-size: 12.5px;
  font-weight: 700;
  color: #f4f4f5;
}

.hd-sidebar-account-copy small {
  font-size: 11px;
  color: #a1a1aa;
}

.hd-account-linked-pill {
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
  color: #4ade80 !important;
  font-size: 11px !important;
  font-weight: 600;
}

.hd-account-linked-pill > span {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 0 2px rgba(74, 222, 128, 0.16);
}

.hd-sidebar-dots {
  color: #a1a1aa;
  font-size: 16px;
  line-height: 1;
  padding-inline: 2px;
}

.hd-account-popover {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 8px);
  z-index: 2000;
  padding: 7px;
  border: 1px solid #29292e;
  border-radius: 12px;
  background: #18181c;
  box-shadow: 0 24px 72px rgba(0, 0, 0, 0.55);
  display: grid;
  gap: 2px;
  max-height: min(520px, calc(100vh - 92px));
  overflow-y: auto;
}

.hd-account-popover button {
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #f4f4f5;
  font: inherit;
  font-size: 13px;
  font-weight: 550;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s ease;
}

.hd-account-popover button:hover {
  background: #242429;
}

.hd-account-popover button.hd-danger-text {
  color: #f87171;
}

.hd-account-popover button.hd-danger-text:hover {
  background: rgba(248, 113, 113, 0.1);
  color: #fca5a5;
}

/* --------------------------------------------------------------------------
   4. Painel Completo de Conta e Equipe (#hd-account-overlay)
   -------------------------------------------------------------------------- */
#hd-account-overlay {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: var(--sidebar-w, 224px);
  z-index: 9500;
  background: var(--hd-bg);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

body.sidebar-collapsed #hd-account-overlay {
  left: 0;
}

.hd-account-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  min-height: 60px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px clamp(22px, 4vw, 58px);
  border-bottom: 1px solid var(--hd-border-soft);
  background: rgba(9, 9, 11, 0.9);
  backdrop-filter: blur(16px);
}

.hd-account-nav-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.hd-account-tab {
  padding: 7px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--hd-muted);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.15s ease;
}

.hd-account-tab:hover {
  background: #141417;
  color: var(--hd-text);
}

.hd-account-tab.active {
  background: #202024;
  color: #ffffff;
  border-color: #2e2e34;
}

.hd-account-content {
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
  padding: 36px clamp(22px, 4vw, 58px) 72px;
}

/* Banner: Conteúdo anterior encontrado (Screenshots 1, 3, 4, 5) */
.hd-legacy-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
  padding: 16px 20px;
  border: 1px solid #3b3520;
  border-radius: 12px;
  background: #17150d;
}

.hd-legacy-banner strong {
  display: block;
  color: #f4f4f5;
  font-size: 14px;
  font-weight: 700;
}

.hd-legacy-banner p {
  margin: 4px 0 0;
  color: var(--hd-muted);
  font-size: 12.5px;
}

/* Cabeçalhos de Página */
.hd-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}

.hd-page-header h1 {
  margin: 0 0 7px;
  font-size: clamp(26px, 3vw, 34px);
  line-height: 1.12;
  letter-spacing: -0.035em;
  color: var(--hd-text);
}

.hd-page-header p {
  margin: 0;
  color: var(--hd-muted);
  font-size: 14px;
}

/* Panels & Layouts */
.hd-panel {
  padding: 24px;
  border: 1px solid var(--hd-border-soft);
  border-radius: var(--hd-radius-lg);
  background: var(--hd-surface);
}

.hd-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.hd-panel-header h2 {
  margin: 0 0 4px;
  font-size: 16px;
  letter-spacing: -0.015em;
}

.hd-panel-header p {
  margin: 0;
  color: var(--hd-muted);
  font-size: 12px;
}

/* Meu Perfil (Screenshot 1) */
.hd-profile-layout {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 28px;
  align-items: start;
}

.hd-avatar-editor {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 11px;
  padding-top: 4px;
}

.hd-avatar-editor .hd-btn {
  width: 100%;
}

.hd-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.hd-panel-actions {
  grid-column: 2;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
}

/* Membros Toolbar & Rows (Screenshot 3) */
.hd-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.hd-toolbar .hd-input {
  max-width: 360px;
}

.hd-toolbar .hd-select {
  max-width: 190px;
}

.hd-resource-list {
  display: grid;
  gap: 8px;
}

.hd-resource-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--hd-border-soft);
  border-radius: 10px;
  background: #141417;
}

.hd-resource-row-main {
  flex: 1;
  min-width: 0;
}

.hd-resource-row-main strong,
.hd-resource-row-main small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hd-resource-row-main strong {
  color: var(--hd-text);
  font-size: 14px;
  font-weight: 650;
}

.hd-resource-row-main small {
  margin-top: 3px;
  color: var(--hd-muted);
  font-size: 12px;
}

.hd-resource-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hd-empty-text {
  color: var(--hd-muted-2);
  font-size: 14px;
  padding: 4px 0;
}

/* Grids & Cards (Workspaces, Segurança, Projetos Compartilhados) */
.hd-split-grid {
  display: grid;
  grid-template-columns: minmax(300px, 0.9fr) minmax(0, 1.35fr);
  gap: 16px;
  align-items: start;
}

.hd-split-grid > * { min-width: 0; }
.hd-security-sessions-panel { min-width: 0; overflow: hidden; }
.hd-security-sessions-panel .hd-resource-list { min-width: 0; }
.hd-security-sessions-panel .hd-resource-row { min-width: 0; }
.hd-security-sessions-panel .hd-resource-row-main small { white-space: normal; overflow-wrap: anywhere; line-height: 1.45; }
.hd-security-sessions-panel .hd-resource-row > .hd-btn,
.hd-security-sessions-panel .hd-resource-row > .hd-status-badge { flex: 0 0 auto; }

.hd-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.hd-resource-card {
  padding: 18px;
  border: 1px solid var(--hd-border-soft);
  border-radius: var(--hd-radius-lg);
  background: var(--hd-surface);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}

.hd-resource-card h2 {
  margin: 0;
  font-size: 16px;
  color: var(--hd-text);
}

.hd-resource-card p {
  margin: 0;
  color: var(--hd-muted);
  font-size: 12.5px;
}

.hd-section-block {
  margin-top: 24px;
}

/* Modais (Convidar membro, Novo workspace, Associar conteúdo, Códigos) */
.hd-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 99990;
  background: rgba(0, 0, 0, 0.76);
  backdrop-filter: blur(3px);
  display: grid;
  place-items: center;
  padding: 20px;
}

.hd-modal-card {
  width: min(520px, calc(100vw - 32px));
  padding: 22px;
  border: 1px solid var(--hd-border);
  border-radius: 16px;
  background: #111114;
  box-shadow: var(--hd-shadow);
}

.hd-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.hd-modal-header h2 {
  margin: 0 0 4px;
  font-size: 17px;
  color: var(--hd-text);
}

.hd-modal-header p {
  margin: 0;
  color: var(--hd-muted);
  font-size: 12.5px;
}

.hd-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 22px;
}

.hd-recovery-pre {
  padding: 16px;
  border: 1px dashed #3f3f46;
  border-radius: 10px;
  background: #09090b;
  color: #e4e4e7;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  line-height: 1.8;
  text-align: center;
  margin: 0;
}

.hd-toast-region {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 100000;
  display: grid;
  gap: 8px;
  width: min(360px, calc(100vw - 36px));
}

.hd-toast {
  padding: 12px 15px;
  border: 1px solid var(--hd-border);
  border-radius: 10px;
  background: #1a1a1e;
  box-shadow: var(--hd-shadow);
  color: #e4e4e7;
  font-size: 13px;
}

.hd-toast.error {
  border-color: rgba(248, 113, 113, 0.4);
  color: #fecaca;
}

.hd-library-totals { display:flex; gap:8px; flex-wrap:wrap; }
.hd-library-totals span { border:1px solid var(--hd-border); background:var(--hd-panel); border-radius:999px; padding:8px 12px; color:var(--hd-muted); font-size:12px; }
.hd-channel-list { display:grid; gap:12px; }
.hd-channel-card { border:1px solid var(--hd-border); background:var(--hd-panel); border-radius:14px; overflow:hidden; }
#hd-account-overlay .hd-channel-card { display:block; padding:0; cursor:default; text-align:initial; }
#hd-account-overlay .hd-channel-card:hover { background:var(--hd-panel); border-color:var(--hd-border); }
.hd-channel-card summary { display:flex; align-items:center; gap:12px; padding:15px 16px; cursor:pointer; list-style:none; }
.hd-channel-card summary::-webkit-details-marker { display:none; }
.hd-channel-avatar { display:grid; place-items:center; width:38px; height:38px; border-radius:10px; background:#27272a; border:1px solid #3f3f46; color:#fafafa; font-weight:700; flex:0 0 auto; }
.hd-channel-videos { display:grid; border-top:1px solid var(--hd-border); }
.hd-video-row { display:flex; align-items:center; gap:12px; padding:12px 16px; border-top:1px solid rgba(63,63,70,.55); }
.hd-video-row:first-child { border-top:0; }
.hd-video-row .hd-btn { flex:0 0 auto; }
.hd-settings-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; }
.hd-setting-card { display:grid; gap:12px; align-content:start; }
.hd-setting-card h2, .hd-setting-card p { margin:0; }
.hd-setting-card p { color:var(--hd-muted); line-height:1.55; }
.hd-setting-card .hd-btn { justify-self:start; }

@media (max-width: 960px) {
  #hd-auth-root {
    grid-template-columns: 1fr;
  }
  .hd-auth-aside {
    display: none;
  }
  #hd-account-overlay {
    left: 0;
  }
  .hd-split-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .hd-settings-grid { grid-template-columns:1fr; }
  .hd-video-row { align-items:flex-start; flex-direction:column; }
  .hd-video-row .hd-btn { width:100%; }
  .hd-profile-layout,
  .hd-form-grid,
  .hd-split-grid {
    grid-template-columns: 1fr;
  }
  .hd-panel-actions {
    grid-column: 1;
  }
  .hd-page-header,
  .hd-legacy-banner,
  .hd-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .hd-toolbar .hd-input,
  .hd-toolbar .hd-select {
    max-width: none;
  }
}
