/* ============================================================
   WHALE OS — Home Dashboard v3.3 Relate Style
   Light SaaS • Executive Command Center • Arabic RTL First
   ============================================================ */

/* ── Root Layout ── */
.hd-root {
  min-height: 100vh;
  background: var(--bg-primary, #fcfcfc);
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

.hd-main {
  display: flex;
  flex-direction: column;
  gap: 24px;
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px 24px 60px;
  width: 100%;
}

.hd-left {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}

.hd-right {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

/* ── Section Wrapper ── */
.hd-section {
  background: #ffffff;
  border: 1px solid var(--stone-divider, #e2e8f0);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow-relate-card);
}

/* ── Glass Base Fallback to Clean Card ── */
.hd-glass {
  background: #ffffff;
  border: 1px solid var(--stone-divider, #e2e8f0);
  border-radius: 16px;
  box-shadow: var(--shadow-relate-card);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.hd-glass:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-relate-card-hover);
  border-color: #cbd5e1;
}

/* ── Executive Hero Zone ── */
.hd-hero {
  padding: 24px 28px;
  background: #ffffff;
  border: 1px solid var(--stone-divider, #e2e8f0);
  border-radius: 16px;
  box-shadow: var(--shadow-relate-card);
  position: relative;
  overflow: hidden;
}

.hd-hero::before,
.hd-hero::after {
  display: none;
}

.hd-hero-inner {
  position: relative;
  z-index: 1;
}

.hd-hero-greeting {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--primary, #145aff);
  letter-spacing: 0.02em;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.hd-hero-greeting-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary, #145aff);
}

.hd-hero-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--midnight-ink, #020520);
  line-height: 1.25;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
  font-family: var(--font-heading, 'Cairo', sans-serif);
}

.hd-hero-title span {
  color: var(--primary, #145aff);
}

.hd-hero-sub {
  font-size: 13.5px;
  color: var(--ash-helper, #6b7280);
  line-height: 1.5;
  max-width: 600px;
  margin-bottom: 18px;
}

.hd-hero-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

/* ── Pill Buttons ── */
.hd-btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  background: var(--primary, #145aff);
  color: #ffffff;
  border-radius: 9999px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 1px 2px rgba(20, 90, 255, 0.2);
}

.hd-btn-primary:hover {
  background: var(--royal-hover, #0d47d9);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(20, 90, 255, 0.25);
}

.hd-btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  background: #ffffff;
  color: var(--graphite-body, #14141e);
  border-radius: 9999px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--stone-divider, #e2e8f0);
  cursor: pointer;
  transition: all 0.15s ease;
}

.hd-btn-ghost:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

/* ── Decision KPI Strip ── */
.hd-stats-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.hd-stat-card {
  padding: 16px 18px;
  border-radius: 14px;
  background: #ffffff;
  border: 1px solid var(--stone-divider, #e2e8f0);
  box-shadow: var(--shadow-relate-card);
  transition: all 0.2s ease;
  cursor: default;
  position: relative;
  overflow: hidden;
}

.hd-stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-relate-card-hover);
  border-color: #cbd5e1;
}

.hd-stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: 14px 14px 0 0;
}

.hd-stat-card.s-blue::before  { background: var(--primary, #145aff); }
.hd-stat-card.s-cyan::before  { background: var(--azure-focus, #0099ff); }
.hd-stat-card.s-green::before { background: var(--mint-win, #16ca2e); }
.hd-stat-card.s-amber::before { background: var(--amber-pending, #ffa64d); }

.hd-stat-icon {
  font-size: 18px;
  margin-bottom: 8px;
  display: block;
}

.hd-stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--midnight-ink, #020520);
  line-height: 1;
  margin-bottom: 4px;
  font-family: var(--font-metrics, 'Inter', sans-serif);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.hd-stat-label {
  font-size: 12px;
  color: var(--ash-helper, #6b7280);
  font-weight: 500;
}

/* ── Command Bar in Dashboard ── */
.hd-ai-bar {
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: #ffffff;
  border: 1px solid var(--stone-divider, #e2e8f0);
  border-radius: 9999px;
  box-shadow: var(--shadow-relate-card);
  cursor: pointer;
  transition: all 0.2s ease;
}

.hd-ai-bar:hover {
  border-color: #cbd5e1;
  box-shadow: var(--shadow-relate-card-hover);
}

.hd-ai-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--lavender-wash, #f0f4fe);
  color: var(--primary, #145aff);
  display: grid;
  place-items: center;
  font-size: 15px;
  flex-shrink: 0;
}

.hd-ai-input-ghost {
  flex: 1;
  font-size: 13.5px;
  color: var(--ash-helper, #6b7280);
}

.hd-ai-shortcut {
  font-size: 11px;
  color: var(--slate-caption, #475569);
  background: #f8fafc;
  border: 1px solid var(--stone-divider, #e2e8f0);
  padding: 3px 8px;
  border-radius: 6px;
  font-family: var(--font-metrics, 'Inter', monospace);
}

/* ── Section Header ── */
.hd-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.hd-section-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--midnight-ink, #020520);
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: inherit;
}

.hd-section-title-icon {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 13px;
  background: var(--lavender-wash, #f0f4fe);
  color: var(--primary, #145aff);
}

.hd-see-all {
  font-size: 12.5px;
  color: var(--primary, #145aff);
  cursor: pointer;
  font-weight: 500;
  background: none;
  border: none;
  padding: 4px 8px;
  border-radius: 8px;
  transition: opacity 0.15s ease;
}

.hd-see-all:hover {
  opacity: 0.8;
  background: var(--lavender-wash, #f0f4fe);
}

/* ── Module Launchers Grid ── */
.hd-modules-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.hd-module-card {
  padding: 16px 18px;
  border-radius: 14px;
  border: 1px solid var(--stone-divider, #e2e8f0);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  background: #ffffff;
  box-shadow: var(--shadow-relate-card);
}

.hd-module-card:hover {
  transform: translateY(-2px);
  border-color: #cbd5e1;
  box-shadow: var(--shadow-relate-card-hover);
}

.hd-module-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 17px;
  flex-shrink: 0;
  background: var(--fog-surface, #f8fafc);
  color: var(--midnight-ink, #020520);
}

.hd-module-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--midnight-ink, #020520);
  line-height: 1.3;
}

.hd-module-desc {
  font-size: 12px;
  color: var(--ash-helper, #6b7280);
  line-height: 1.45;
}

.hd-module-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--stone-divider, #e2e8f0);
}

.hd-module-cta {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--primary, #145aff);
}

.hd-module-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 9999px;
  background: #f1f5f9;
  color: var(--slate-caption, #475569);
  letter-spacing: 0.02em;
}

/* ── Workspaces Grid ── */
.hd-workspaces-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.hd-ws-card {
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--stone-divider, #e2e8f0);
  background: #ffffff;
  cursor: pointer;
  transition: all 0.18s ease;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: var(--shadow-relate-card);
}

.hd-ws-card:hover {
  transform: translateY(-2px);
  border-color: #cbd5e1;
  box-shadow: var(--shadow-relate-card-hover);
}

.hd-ws-icon {
  font-size: 20px;
  line-height: 1;
}

.hd-ws-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--midnight-ink, #020520);
  line-height: 1.3;
}

.hd-ws-meta {
  font-size: 11px;
  color: var(--ash-helper, #6b7280);
}

.hd-ws-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  font-weight: 500;
  color: var(--mint-win, #16ca2e);
  margin-top: auto;
}

.hd-ws-status::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

/* ── Progress Card ── */
.hd-progress-card {
  padding: 20px;
  border-radius: 16px;
  border: 1px solid var(--stone-divider, #e2e8f0);
  background: #ffffff;
  box-shadow: var(--shadow-relate-card);
}

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

.hd-progress-label {
  font-size: 13px;
  color: var(--midnight-ink, #020520);
  font-weight: 600;
}

.hd-progress-val {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary, #145aff);
  font-family: var(--font-metrics, 'Inter', sans-serif);
  font-variant-numeric: tabular-nums;
}

.hd-progress-bar-track {
  height: 6px;
  background: #f1f5f9;
  border-radius: 9999px;
  overflow: hidden;
  margin-bottom: 16px;
}

.hd-progress-bar-fill {
  height: 100%;
  border-radius: 9999px;
  background: var(--primary, #145aff);
  transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.hd-progress-milestones {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hd-milestone {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid var(--stone-divider, #e2e8f0);
}

.hd-milestone-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.hd-milestone-dot.done { background: var(--mint-win, #16ca2e); }
.hd-milestone-dot.active { background: var(--primary, #145aff); }
.hd-milestone-dot.pending { background: #cbd5e1; }

.hd-milestone-name {
  font-size: 12.5px;
  color: var(--graphite-body, #14141e);
  flex: 1;
}

.hd-milestone-badge {
  font-size: 10.5px;
  font-weight: 500;
  padding: 2px 7px;
  border-radius: 9999px;
}

.hd-milestone-badge.done {
  background: #eefcf0;
  color: #15803d;
}

.hd-milestone-badge.active {
  background: var(--lavender-wash, #f0f4fe);
  color: var(--primary, #145aff);
}

.hd-milestone-badge.pending {
  background: #f1f5f9;
  color: var(--ash-helper, #6b7280);
}

/* ── Rail Widgets ── */
.hd-rail-widget {
  padding: 16px 18px;
  border-radius: 14px;
  border: 1px solid var(--stone-divider, #e2e8f0);
  background: #ffffff;
  box-shadow: var(--shadow-relate-card);
}

.hd-rail-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--midnight-ink, #020520);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.hd-rail-see-all {
  font-size: 12px;
  color: var(--primary, #145aff);
  cursor: pointer;
  font-weight: 500;
  background: none;
  border: none;
  padding: 0;
}

/* ── Activity Timeline / Live Activity Ledger ── */
.hd-timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.hd-timeline-item {
  display: flex;
  gap: 10px;
  padding: 8px 0;
  position: relative;
  border-bottom: 1px solid #f8fafc;
}

.hd-timeline-item:last-child {
  border-bottom: none;
}

.hd-timeline-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 10px;
  flex-shrink: 0;
  background: var(--lavender-wash, #f0f4fe);
  color: var(--primary, #145aff);
  margin-top: 1px;
}

.hd-timeline-body {
  flex: 1;
  min-width: 0;
}

.hd-timeline-text {
  font-size: 12px;
  color: var(--graphite-body, #14141e);
  line-height: 1.4;
  margin-bottom: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hd-timeline-time {
  font-size: 10.5px;
  color: var(--ash-helper, #6b7280);
}

/* ── Favorites ── */
.hd-fav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.15s ease;
  margin-bottom: 2px;
}

.hd-fav-item:hover {
  background: #f8fafc;
}

.hd-fav-icon {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: var(--lavender-wash, #f0f4fe);
  color: var(--primary, #145aff);
  display: grid;
  place-items: center;
  font-size: 12px;
  flex-shrink: 0;
}

.hd-fav-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--graphite-body, #14141e);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Quick Chips Bar ── */
.hd-quick-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.hd-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 9999px;
  background: #ffffff;
  border: 1px solid var(--stone-divider, #e2e8f0);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--slate-caption, #475569);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.hd-chip:hover {
  background: #f8fafc;
  color: var(--midnight-ink, #020520);
  border-color: #cbd5e1;
}

.hd-chip.active {
  background: var(--lavender-wash, #f0f4fe);
  color: var(--primary, #145aff);
  border-color: rgba(20, 90, 255, 0.25);
  font-weight: 600;
}

/* ── SVG Charts Styling ── */
.svg-chart-container {
  background: #ffffff;
  border: 1px solid var(--stone-divider, #e2e8f0);
  border-radius: 16px;
  padding: 20px;
  margin-top: 16px;
  box-shadow: var(--shadow-relate-card);
}

.svg-chart-grid-line {
  stroke: var(--stone-divider, #e2e8f0);
  stroke-width: 1;
  stroke-dasharray: 4,4;
}

.svg-chart-axis {
  stroke: #cbd5e1;
  stroke-width: 1;
}

.svg-chart-text {
  font-family: inherit;
  font-size: 10.5px;
  fill: var(--ash-helper, #6b7280);
}

/* ── Floating AI Copilot (Relate Clean SaaS) ── */
.floating-copilot-container {
  position: fixed;
  bottom: 24px;
  inset-inline-end: 24px;
  z-index: 9999;
}

.copilot-trigger-btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--primary, #145aff);
  border: none;
  box-shadow: 0 4px 14px rgba(20, 90, 255, 0.35);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 20px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.copilot-trigger-btn:hover {
  transform: scale(1.06);
  background: var(--royal-hover, #0d47d9);
  box-shadow: 0 6px 20px rgba(20, 90, 255, 0.45);
}

.copilot-panel {
  position: absolute;
  bottom: 64px;
  inset-inline-end: 0;
  width: 380px;
  height: 500px;
  border-radius: 16px;
  background: #ffffff;
  border: 1px solid var(--stone-divider, #e2e8f0);
  box-shadow: var(--shadow-relate-modal);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(12px) scale(0.97);
  pointer-events: none;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.copilot-panel.active {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

.copilot-header {
  padding: 14px 16px;
  background: #ffffff;
  border-bottom: 1px solid var(--stone-divider, #e2e8f0);
  display: flex;
  align-items: center;
  gap: 10px;
}

.copilot-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--lavender-wash, #f0f4fe);
  color: var(--primary, #145aff);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.copilot-info {
  flex: 1;
}

.copilot-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--midnight-ink, #020520);
}

.copilot-subtitle {
  font-size: 10.5px;
  color: var(--mint-win, #16ca2e);
  font-weight: 500;
}

.copilot-chat-body {
  flex: 1;
  padding: 14px 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #fcfcfc;
}

.copilot-msg {
  max-width: 85%;
  padding: 8px 12px;
  border-radius: 14px;
  font-size: 12px;
  line-height: 1.5;
}

.copilot-msg.bot {
  background: #ffffff;
  border: 1px solid var(--stone-divider, #e2e8f0);
  color: var(--midnight-ink, #020520);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.copilot-msg.user {
  background: var(--primary, #145aff);
  color: #ffffff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.copilot-footer {
  padding: 10px 14px;
  background: #ffffff;
  border-top: 1px solid var(--stone-divider, #e2e8f0);
  display: flex;
  gap: 8px;
}

.copilot-input {
  flex: 1;
  height: 36px;
  border-radius: 9999px;
  border: 1px solid var(--stone-divider, #e2e8f0);
  padding: 0 14px;
  font-size: 12px;
  outline: none;
}

.copilot-input:focus {
  border-color: var(--primary, #145aff);
}

.copilot-send-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary, #145aff);
  border: none;
  color: #ffffff;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.15s ease;
}

.copilot-send-btn:hover {
  background: var(--royal-hover, #0d47d9);
}

/* ── Responsive ── */
@media (max-width: 960px) {
  .hd-right {
    grid-template-columns: 1fr;
  }
  .hd-stats-strip {
    grid-template-columns: repeat(2, 1fr);
  }
  .hd-workspaces-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .hd-main {
    padding: 16px 12px 40px;
  }
  .hd-modules-grid {
    grid-template-columns: 1fr;
  }
  .hd-stats-strip {
    grid-template-columns: 1fr 1fr;
  }
  .hd-workspaces-grid {
    grid-template-columns: 1fr 1fr;
  }
}
