/* ==================================================================
   OrgCharts — Design System & Stylesheet v2
   Clean, modern, responsive. System fonts. CSS custom properties.
   ================================================================== */

/* --- Design Tokens --- */
:root {
  /* Colors */
  --color-bg: #f8f9fc;
  --color-surface: #ffffff;
  --color-surface-hover: #f1f3f9;
  --color-border: #e2e5f1;
  --color-text: #1a1d2e;
  --color-text-muted: #6b7394;
  --color-primary: #4f46e5;
  --color-primary-hover: #4338ca;
  --color-primary-light: #eef2ff;
  --color-success: #059669;
  --color-success-light: #ecfdf5;
  --color-warning: #d97706;
  --color-warning-light: #fffbeb;
  --color-danger: #dc2626;
  --color-danger-light: #fef2f2;
  --color-info: #2563eb;
  --color-info-light: #eff6ff;

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'Fira Mono', monospace;

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;

  /* Radii */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.08);
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.04), 0 4px 12px rgba(0, 0, 0, 0.03);

  /* Transitions */
  --transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);

  /* Glassmorphism */
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(255, 255, 255, 0.4);
  --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
}

/* --- Reset & Base --- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Homepage full-height layout */
body.is-homepage {
  background: var(--color-surface);
}

body.is-homepage .site-header {
  box-shadow: none;
  border: none;
}

body.is-homepage main {
  padding-top: 0;
}

a {
  color: var(--color-primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

img {
  max-width: 100%;
  height: auto;
}

/* --- Layout --- */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.container-sm {
  max-width: 520px;
}

.container-wide {
  max-width: 1400px;
}

main#main-content {
  flex: 1;
  padding: var(--space-xl) 0 var(--space-2xl);
}

/* --- Header --- */
.site-header {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--glass-border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--glass-shadow);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}

.logo {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--color-text);
  text-decoration: none;
}

.logo svg {
  color: var(--color-primary);
}

.logo:hover {
  text-decoration: none;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.nav-link {
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text-muted);
  text-decoration: none;
  transition: background var(--transition), color var(--transition);
}

.nav-link:hover {
  background: var(--color-surface-hover);
  color: var(--color-text);
  text-decoration: none;
}

.nav-separator {
  width: 1px;
  height: 24px;
  background: var(--color-border);
  margin: 0 var(--space-sm);
}

.nav-user {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.nav-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  background: var(--color-primary-light);
  color: var(--color-primary);
  font-size: 0.7rem;
  font-weight: 700;
}

.nav-logout {
  color: var(--color-danger) !important;
}

/* Mobile hamburger */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
}

.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--color-text);
  border-radius: 2px;
  transition: transform var(--transition);
}

/* --- Footer --- */
.site-footer {
  padding: var(--space-lg) 0;
  text-align: center;
  font-size: 0.8rem;
  color: var(--color-text-muted);
  border-top: 1px solid var(--color-border);
}

/* --- Page Header --- */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

.page-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* --- Flash Messages --- */
.flash-container {
  margin-top: var(--space-md);
}

.flash {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: var(--space-sm);
  animation: flashIn 0.3s ease;
}

@keyframes flashIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.flash-success {
  background: var(--color-success-light);
  color: var(--color-success);
}

.flash-error {
  background: var(--color-danger-light);
  color: var(--color-danger);
}

.flash-info {
  background: var(--color-info-light);
  color: var(--color-info);
}

.flash-warning {
  background: var(--color-warning-light);
  color: var(--color-warning);
}

.flash-close {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: inherit;
  opacity: 0.6;
  padding: 0 4px;
}

.flash-close:hover {
  opacity: 1;
}

/* --- Cards --- */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-card);
}

.card-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: var(--space-md);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-md);
}

/* --- Auth Card --- */
.auth-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.auth-card h1 {
  margin-bottom: var(--space-xs);
}

.auth-subtitle {
  color: var(--color-text-muted);
  margin-bottom: var(--space-lg);
}

.auth-card form {
  text-align: left;
}

.auth-footer {
  margin-top: var(--space-lg);
  font-size: 0.9rem;
  color: var(--color-text-muted);
}

/* --- Forms --- */
.form-group {
  margin-bottom: var(--space-md);
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: var(--space-xs);
  color: var(--color-text);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="url"],
input[type="tel"],
input[type="date"],
select,
textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.94rem;
  background: var(--color-surface);
  color: var(--color-text);
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
  line-height: normal;
}

select.sm,
.select-sm {
  appearance: none;
  -webkit-appearance: none;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 6px 32px 6px 12px;
  font-size: 0.85rem;
  font-family: inherit;
  color: var(--color-text);
  cursor: pointer;
  transition: all var(--transition);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='M3 4.5l3 3 3-3'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  height: 36px;
  line-height: normal;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-light), 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* File Upload Premium Style */
input[type="file"] {
  padding: 8px;
  background: var(--color-surface);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 0.85rem;
}

input[type="file"]::file-selector-button {
  background: var(--color-primary-light);
  color: var(--color-primary);
  border: none;
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-weight: 600;
  margin-right: 12px;
  cursor: pointer;
  transition: background var(--transition);
}

input[type="file"]::file-selector-button:hover {
  background: #e0e7ff;
}

input:disabled {
  background: #f3f4f6;
  color: #9ca3af;
  cursor: not-allowed;
}

.form-inline {
  display: flex;
  gap: var(--space-sm);
  align-items: flex-end;
}

.form-inline .form-group {
  margin-bottom: 0;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  padding: 10px 20px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn:hover {
  text-decoration: none;
}

.btn-primary {
  background: var(--color-primary);
  color: #fff;
}

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

.btn-outline {
  background: transparent;
  border-color: var(--color-border);
  color: var(--color-text);
}

.btn-outline:hover {
  background: var(--color-surface-hover);
}

.btn-danger {
  background: var(--color-danger);
  color: #fff;
  border-color: var(--color-danger);
}

.btn-danger:hover {
  background: #b91c1c;
}

.btn-sm {
  padding: 5px 12px;
  font-size: 0.8rem;
}

.btn-block {
  width: 100%;
}

/* --- Badges --- */
.badge {
  display: inline-block;
  padding: 2px 8px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  background: var(--color-bg);
  color: var(--color-text-muted);
}

.badge-primary {
  background: var(--color-primary-light);
  color: var(--color-primary);
}

.badge-warning {
  background: var(--color-warning-light);
  color: var(--color-warning);
}

.badge-success {
  background: var(--color-success-light);
  color: var(--color-success);
}

.badge-danger {
  background: var(--color-danger-light);
  color: var(--color-danger);
}

/* --- Tables --- */
.table-responsive {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.table th,
.table td {
  padding: 10px 16px;
  text-align: left;
  font-size: 0.875rem;
}

.table th {
  background: var(--color-bg);
  font-weight: 600;
  color: var(--color-text-muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.table td {
  border-top: 1px solid var(--color-border);
}

.table tr:hover td {
  background: var(--color-surface-hover);
}

.member-row {
  transition: background var(--transition);
}

.member-row:hover td {
  background: var(--color-primary-light) !important;
  opacity: 1;
}

.card-header {
  border-bottom: 1px solid var(--color-border);
  padding-bottom: var(--space-sm);
  margin-bottom: var(--space-md);
}

.member-cell {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.mini-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-full);
  background: var(--color-primary-light);
  color: var(--color-primary);
  font-size: 0.65rem;
  font-weight: 700;
  flex-shrink: 0;
}

/* --- Dashboard --- */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

.stat-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-card);
  text-align: center;
}

.stat-number {
  font-size: 2rem;
  font-weight: 700;
  color: var(--color-primary);
}

.stat-icon {
  font-size: 1.5rem;
  margin-bottom: var(--space-xs);
}

.stat-label {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: var(--space-xs);
}

.stat-value {
  font-size: 1rem;
  font-weight: 600;
  margin-top: var(--space-xs);
}

.action-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-md);
}

.action-card {
  display: block;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-card);
  text-decoration: none;
  color: var(--color-text);
  transition: all var(--transition);
}

.action-card:hover {
  text-decoration: none;
  border-color: var(--color-primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.action-card h3 {
  margin: var(--space-sm) 0 var(--space-xs);
  font-size: 1rem;
}

.action-card p {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin: 0;
}

/* --- Premium Buttons --- */
.btn-premium {
  background: linear-gradient(135deg, var(--color-primary), #6366f1);
  color: #fff;
  border: none;
  font-size: 1rem;
  font-weight: 700;
  padding: 14px 28px;
  box-shadow: 0 4px 15px rgba(79, 70, 229, 0.3);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  position: relative;
  overflow: hidden;
}

.btn-premium:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 8px 25px rgba(79, 70, 229, 0.4);
  color: #fff;
}

.btn-premium:active {
  transform: translateY(0) scale(0.98);
}

.btn-premium::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.2) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

.btn-premium:hover::after {
  opacity: 1;
}

.action-icon {
  font-size: 2rem;
  margin-bottom: var(--space-sm);
}

/* --- Teams UI --- */
.teams-section {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  margin-top: var(--space-xl);
}

.teams-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--space-lg);
}

.team-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  transition: all var(--transition);
}

.team-card:hover {
  border-color: var(--color-primary);
  background: var(--color-surface);
  box-shadow: var(--shadow-md);
}

.team-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.team-name {
  font-weight: 700;
  font-size: 1.1rem;
}

.team-meta {
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.team-avatars {
  display: flex;
  margin-top: var(--space-sm);
}

.team-avatars .mini-avatar {
  border: 2px solid var(--color-surface);
  margin-left: -8px;
}

.team-avatars .mini-avatar:first-child {
  margin-left: 0;
}

/* --- Embedded View --- */
body.is-embedded {
  background: transparent;
  padding: 0;
}

body.is-embedded .container {
  max-width: 100%;
  padding: var(--space-md);
}

body.is-embedded .page-header,
body.is-embedded .action-cards {
  display: none;
}

.org-link-card {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  text-decoration: none;
  color: var(--color-text);
  transition: all var(--transition);
}

.org-link-card:hover {
  border-color: var(--color-primary);
  text-decoration: none;
  box-shadow: var(--shadow-sm);
}

.org-link-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-hover));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}

/* --- Empty State --- */
.empty-state {
  text-align: center;
  padding: var(--space-2xl) var(--space-lg);
}

.empty-state h2 {
  margin-bottom: var(--space-sm);
}

.empty-state p {
  color: var(--color-text-muted);
  margin-bottom: var(--space-lg);
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: var(--space-md);
}

/* --- Section --- */
.section {
  margin-bottom: var(--space-xl);
}

.section h2 {
  font-size: 1.15rem;
  margin-bottom: var(--space-md);
}

.text-muted {
  color: var(--color-text-muted);
}

/* --- Member Header --- */
.member-header {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.member-avatar-lg {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-hover));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
  flex-shrink: 0;
}

/* --- Join Org --- */
.org-join-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.org-join-option {
  cursor: pointer;
}

.org-join-option input {
  display: none;
}

.org-join-card {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  transition: all var(--transition);
}

.org-join-option input:checked+.org-join-card {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
}

.org-join-card:hover {
  border-color: var(--color-primary);
}

.org-join-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-hover));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
  flex-shrink: 0;
}

/* ==========================
   HOMEPAGE & PRICING
   ========================== */

.hero {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: 4rem 0;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2xl);
  align-items: center;
}

.hero-content {
  max-width: 540px;
}

.hero-title {
  font-size: 3.5rem;
  line-height: 1.1;
  font-weight: 800;
  margin-bottom: var(--space-md);
  letter-spacing: -0.02em;
}

.hero-gradient {
  background: linear-gradient(135deg, var(--color-primary), #7c3aed);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  font-size: 1.25rem;
  color: var(--color-text-muted);
  margin-bottom: var(--space-xl);
  line-height: 1.5;
}

.hero-features {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

.hero-feature {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--color-text);
}

.hero-feature svg {
  color: var(--color-success);
}

/* Auth Tabs */
.hero-auth {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  box-shadow: var(--shadow-lg);
}

.auth-tabs {
  display: flex;
  border-bottom: 2px solid var(--color-border);
  margin-bottom: var(--space-lg);
}

.auth-tab {
  flex: 1;
  padding: var(--space-md);
  background: none;
  border: none;
  font-weight: 600;
  color: var(--color-text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  transition: all var(--transition);
}

.auth-tab.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

.auth-tab-content {
  display: none;
}

.auth-tab-content.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.product-showcase {
  padding: 6rem 0;
  background: linear-gradient(to bottom, #fdfdff, var(--color-bg));
  border-top: 1px solid var(--color-border);
}

.showcase-header {
  text-align: center;
  margin-bottom: 4rem;
}

.showcase-grid {
  display: grid;
  grid-template-columns: 300px 1fr 300px;
  gap: var(--space-2xl);
  align-items: center;
}

.showcase-features-left,
.showcase-features-right {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.showcase-demo {
  flex: 1;
}

.demo-container-wrapper {
  background: var(--color-bg-alt, var(--color-surface));
  border-radius: 24px;
  border: 1px solid var(--color-border);
  overflow: hidden;
  height: 500px;
  position: relative;
  box-shadow: var(--shadow-lg);
  transition: all 0.3s ease;
}

@media (max-width: 1100px) {
  .showcase-grid {
    grid-template-columns: 1fr 1fr;
  }

  .showcase-demo {
    grid-column: span 2;
    order: -1;
    margin-bottom: var(--space-xl);
  }
}

@media (max-width: 768px) {
  .showcase-grid {
    grid-template-columns: 1fr;
  }

  .showcase-demo {
    grid-column: span 1;
  }
}

.product-showcase.is-expanded .showcase-grid {
  grid-template-columns: 1fr;
}

.product-showcase.is-expanded .showcase-features-left,
.product-showcase.is-expanded .showcase-features-right {
  display: none;
}

.product-showcase.is-expanded .demo-container-wrapper {
  height: 80vh;
  min-height: 600px;
}

.feature-card {
  background: var(--color-surface);
  padding: var(--space-lg);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.feature-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--color-primary-light);
}

.feature-card .feature-icon {
  font-size: 2rem;
  margin-bottom: var(--space-xs);
}

.feature-card h3 {
  font-size: 1.1rem;
  margin: 0;
}

.feature-card p {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  line-height: 1.4;
  margin: 0;
}

.benefits-section {
  padding: 6rem 0;
  background: var(--color-text);
  color: #fff;
  border-radius: 2rem;
  margin: 4rem var(--space-lg);
  overflow: hidden;
  position: relative;
}

.benefits-section::before {
  content: '';
  position: absolute;
  top: -10%;
  left: -10%;
  width: 40%;
  height: 40%;
  background: radial-gradient(circle, rgba(79, 70, 229, 0.2) 0%, transparent 70%);
  z-index: 0;
}

.benefits-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  position: relative;
  z-index: 1;
}

.benefit-item {
  display: flex;
  gap: var(--space-md);
}

.benefit-number {
  font-size: 3rem;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.1);
  line-height: 1;
}

.benefit-content h3 {
  font-size: 1.25rem;
  margin-bottom: var(--space-xs);
}

.benefit-content p {
  color: rgba(255, 255, 255, 0.7);
}

.cta-section {
  text-align: center;
  padding: 6rem 0;
}

.cta-title {
  font-size: 3rem;
  font-weight: 800;
  margin-bottom: var(--space-md);
}

/* Pricing */
.pricing-header {
  text-align: center;
  margin: var(--space-2xl) auto;
  max-width: 600px;
}

.pricing-header h1 {
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: var(--space-sm);
}

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--space-lg);
  margin-bottom: var(--space-2xl);
  align-items: stretch;
}

/* On large desktops, force 4 columns if possible */
@media (min-width: 1200px) {
  .pricing-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.pricing-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  display: flex;
  flex-direction: column;
  position: relative;
}

.pricing-card.featured {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-lg);
}

.pricing-badge {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-primary);
  color: #fff;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.pricing-card.enterprise {
  background: var(--color-bg);
  border-style: dashed;
}

.pricing-card-header {
  text-align: center;
  margin-bottom: var(--space-lg);
}

.pricing-price {
  margin-top: var(--space-sm);
  min-height: 4rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.price-amount {
  font-size: 2.25rem;
  font-weight: 800;
  line-height: 1.1;
}

.price-period {
  color: var(--color-text-muted);
  font-size: 0.85rem;
}

.pricing-features {
  list-style: none;
  margin-bottom: var(--space-xl);
  flex: 1;
}

.pricing-features li {
  padding: var(--space-xs) 0;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  color: var(--color-text);
  font-size: 0.95rem;
}

.pricing-features li::before {
  content: '✓';
  color: var(--color-success);
  font-weight: 700;
}

.pricing-faq {
  max-width: 800px;
  margin: 0 auto;
  padding-bottom: var(--space-2xl);
}

.faq-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-xl);
  margin-top: var(--space-lg);
}

.faq-item h4 {
  font-size: 1.1rem;
  margin-bottom: var(--space-xs);
}

.faq-item p {
  color: var(--color-text-muted);
  font-size: 0.95rem;
}


/* ==========================
   FLUID ORG CHART V2
   ========================== */

.org-chart-page {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--color-bg);
  display: flex;
  flex-direction: column;
  z-index: 1000;
}

/* Header */
.chart-header {
  height: 60px;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-lg);
  z-index: 10;
  box-shadow: var(--shadow-sm);
}

.chart-header-left {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.back-link {
  font-weight: 600;
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

.chart-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0;
}

.chart-controls {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.vr {
  width: 1px;
  height: 24px;
  background: var(--color-border);
}

/* Search */
.chart-search-wrapper {
  position: relative;
  width: 240px;
}

.search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-muted);
  pointer-events: none;
}

#chart-search {
  padding-left: 36px;
  height: 36px;
  font-size: 0.875rem;
}

/* View Switcher */
.view-switcher {
  display: flex;
  background: var(--color-bg);
  padding: 3px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
}

.view-switcher .view-btn {
  width: 32px;
  height: 32px;
  margin: 0;
  padding: 0;
  background: none;
  border: none;
  border-radius: 4px;
}

.view-switcher .view-btn.active {
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
  color: var(--color-primary);
}

/* Zoom controls */
.zoom-controls {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text-muted);
}

.zoom-controls button {
  width: 28px;
  height: 28px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.zoom-controls button:hover {
  background: var(--color-surface-hover);
}

#zoom-fit {
  width: auto;
  padding: 0 8px;
  font-size: 0.8rem;
}

#zoom-level {
  min-width: 48px;
  text-align: center;
  font-feature-settings: "tnum";
}

/* Canvas & Viewport (V3 CSR) */
.chart-canvas {
  flex: 1;
  overflow: hidden;
  position: relative;
  background: radial-gradient(#e5e7eb 1px, transparent 1px);
  background-size: 20px 20px;
  cursor: grab;
  /* Ensure relative positioning for absolute children */
}

.chart-canvas:active {
  cursor: grabbing;
}

#chart-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transform-origin: 0 0;
  /* Hardware acceleration */
  will-change: transform;
}

.chart-svg-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.chart-node-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  pointer-events: none;
  /* Let clicks pass through to container if not on node */
}

/* Nodes */
.org-node {
  position: absolute;
  width: 200px;
  /* Match JS CARD_WIDTH */
  /* Height is dynamic but card content is fixedish */
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: auto;
  /* Re-enable clicks */
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.node-card {
  width: 100% !important;
  height: 90px !important;
  /* Match JS CARD_HEIGHT */
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  box-shadow: var(--shadow-sm);
  display: flex !important;
  gap: var(--space-sm);
  align-items: center !important;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  box-sizing: border-box !important;
}

.node-card:hover {
  border-color: var(--color-primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  z-index: 10;
}

.node-card.highlight {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-light);
}

.node-card.dimmed {
  opacity: 0.3;
}

.node-avatar {
  width: 40px !important;
  height: 40px !important;
  flex-shrink: 0 !important;
  border-radius: 50% !important;
  overflow: hidden !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.node-avatar-img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  display: block !important;
}

.node-avatar-placeholder {
  width: 100%;
  height: 100%;
  background: #e0e7ff;
  color: #4f46e5;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
}

.node-content {
  flex: 1;
  min-width: 0;
  /* Text truncation */
}

.node-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--color-text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.2;
}

.node-title {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 1;
  line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.2;
}

.node-toggle {
  width: 24px;
  height: 24px;
  position: absolute;
  bottom: -34px;
  /* CARD_HEIGHT + GAP? No, simple offset */
  /* Actually we want it below the card, connected by a line? */
  /* JS renders it outside node-card but inside org-node */
  background: #fff;
  border: 1px solid #cbd5e0;
  color: #718096;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  z-index: 5;
  transition: all 0.2s;
  /* Center horizontal */
  left: 50%;
  transform: translateX(-50%);
  margin-top: 10px;
  /* Gap between card and button */
}

.node-toggle:hover {
  background: var(--color-surface-hover);
  color: var(--color-text);
  border-color: var(--color-text-muted);
}

/* List View */
.org-list-view {
  padding: var(--space-xl);
  max-width: 800px;
  margin: 0 auto;
  pointer-events: auto;
}

.list-row {
  display: flex;
  align-items: center;
  padding: var(--space-sm);
  border-bottom: 1px solid var(--color-border);
  cursor: pointer;
  transition: background 0.1s;
  border-radius: var(--radius-sm);
}

.list-row:hover {
  background: var(--color-surface-hover);
}

.list-avatar-sm {
  width: 28px;
  height: 28px;
  background: #e2e8f0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: #64748b;
  margin-right: var(--space-md);
}

.list-name {
  font-weight: 600;
  min-width: 150px;
}

.list-title {
  color: var(--color-text-muted);
  flex: 1;
}

.list-dept {
  font-size: 0.85rem;
  color: var(--color-text-muted);
}


/* Slide-out Panel (Keep existing styles logic) */
.profile-panel {
  position: absolute;
  top: 60px;
  right: 0;
  bottom: 0;
  width: 320px;
  background: var(--color-surface);
  border-left: 1px solid var(--color-border);
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.1);
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  z-index: 50;
}

.profile-panel.open {
  transform: translateX(0);
}

.pp-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--color-text-muted);
}

.pp-header {
  padding: var(--space-xl);
  text-align: center;
  border-bottom: 1px solid var(--color-border);
}

.pp-avatar {
  width: 80px;
  height: 80px;
  background: var(--color-primary-light);
  color: var(--color-primary);
  border-radius: var(--radius-full);
  margin: 0 auto var(--space-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  font-weight: 700;
  overflow: hidden;
}

.pp-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.pp-name {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.pp-title {
  color: var(--color-text-muted);
  font-size: 0.95rem;
}

.pp-body {
  padding: var(--space-xl);
  flex: 1;
  overflow-y: auto;
}

.pp-row {
  margin-bottom: var(--space-lg);
}

.pp-row label {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--color-text-muted);
  font-weight: 600;
  margin-bottom: 4px;
}

.pp-row span,
.pp-row a {
  font-size: 1rem;
  color: var(--color-text);
  font-weight: 500;
}

.pp-footer {
  padding: var(--space-lg);
  border-top: 1px solid var(--color-border);
  text-align: center;
}

/* Mobile Tweaks */
@media (max-width: 768px) {
  .hero-grid {
    grid-template-columns: 1fr;
    gap: var(--space-lg);
    text-align: center;
  }

  .hero-auth {
    margin-top: var(--space-lg);
  }

  .chart-header {
    height: auto;
    flex-direction: column;
    padding: var(--space-sm);
    gap: var(--space-sm);
  }

  .chart-controls {
    width: 100%;
    flex-wrap: wrap;
    justify-content: center;
  }

  .org-chart-page {
    position: relative;
    height: 100vh;
  }

  .profile-panel {
    width: 100%;
    top: auto;
    bottom: 0;
    border-left: none;
    border-top: 1px solid var(--color-border);
    height: 70vh;
    transform: translateY(100%);
  }

  .profile-panel.open {
    transform: translateY(0);
  }
}

/* --- Toggle Switch --- */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #cbd5e1;
  transition: .4s;
  border-radius: 24px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

input:checked+.toggle-slider {
  background-color: var(--color-primary);
}

input:checked+.toggle-slider:before {
  transform: translateX(20px);
}

/* --- Social Input Groups --- */
.social-input-group {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: var(--space-md);
  box-shadow: var(--shadow-sm);
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--color-border);
  transition: all var(--transition);
}

.social-input-group:focus-within {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-light);
}

.social-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  background: #f8fafc;
  border-right: 1px solid var(--color-border);
  flex-shrink: 0;
  color: var(--color-text-muted);
}

.social-input-group input {
  border: none !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  height: 40px;
  padding: 0 12px !important;
}

/* Specific Social Colors on Focus */
.social-input-group:focus-within .icon-linkedin {
  color: #0a66c2;
}

.social-input-group:focus-within .icon-twitter {
  color: #1da1f2;
}

.social-input-group:focus-within .icon-slack {
  color: #4a154b;
}

.social-input-group:focus-within .icon-facebook {
  color: #1877f2;
}

/* --- Profile Panel Enhancements --- */
.pp-socials {
  display: flex;
  gap: var(--space-sm);
  margin-top: 4px;
}

.pp-social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: #f8fafc;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
  transition: all var(--transition);
}

.pp-social-link:hover {
  transform: translateY(-2px);
  color: #fff;
  border-color: transparent;
  box-shadow: var(--shadow-sm);
}

.pp-social-link.icon-linkedin:hover {
  background: #0a66c2;
}

.pp-social-link.icon-twitter:hover {
  background: #1da1f2;
}

.pp-social-link.icon-facebook:hover {
  background: #1877f2;
}

.pp-social-link.icon-slack:hover {
  background: #4a154b;
}

.pp-team-link {
  color: var(--color-primary);
  text-decoration: none;
  font-weight: 500;
  border-bottom: 1px dotted transparent;
  transition: all 0.2s;
}

.pp-team-link:hover {
  color: var(--color-primary-dark);
  border-bottom-color: var(--color-primary-dark);
}

/* ==========================
   SITE FOOTER & LANGUAGE SWITCHER
   ========================== */
.site-footer {
  border-top: 1px solid var(--color-border);
  padding: var(--space-lg) 0;
  margin-top: auto;
  background: var(--color-surface);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.footer-inner p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.lang-switcher {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.lang-label {
  font-size: 1.1rem;
  cursor: pointer;
  line-height: 1;
}

.lang-select {
  appearance: none;
  -webkit-appearance: none;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 6px 28px 6px 12px;
  font-size: 0.85rem;
  font-family: inherit;
  color: var(--color-text);
  cursor: pointer;
  transition: all var(--transition);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='M3 4.5l3 3 3-3'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  min-width: 120px;
}

.lang-select:hover {
  border-color: var(--color-primary);
}

.lang-select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-light);
}

/* ==========================
   RTL SUPPORT
   ========================== */
[dir="rtl"] .lang-select {
  padding: 6px 12px 6px 28px;
  background-position: left 8px center;
}

[dir="rtl"] .back-link,
[dir="rtl"] .common-back {
  direction: rtl;
}

[dir="rtl"] .chart-search-wrapper .search-icon {
  left: auto;
  right: 10px;
}

[dir="rtl"] #chart-search {
  padding-left: var(--space-md);
  padding-right: 36px;
}

[dir="rtl"] .social-icon {
  border-right: none;
  border-left: 1px solid var(--color-border);
}

[dir="rtl"] .profile-panel {
  right: auto;
  left: 0;
  border-left: none;
  border-right: 1px solid var(--color-border);
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.1);
  transform: translateX(-100%);
}

[dir="rtl"] .profile-panel.open {
  transform: translateX(0);
}

[dir="rtl"] .pp-close {
  right: auto;
  left: 16px;
}

@media (max-width: 768px) {
  .footer-inner {
    flex-direction: column;
    text-align: center;
  }
}