/* =========================================================
   Dashboard shell — ink sidebar + gold (landing spirit)
   ========================================================= */

:root {
  --sidebar-bg: #0b0f14;
  --sidebar-text: #c9d4e5;
  --sidebar-active: #c5a059;
  --content-bg: #f7f5f1;
  --kpi-icon-bg: #f5efe3;
}

html, body {
  background: var(--content-bg) !important;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
  background: var(--content-bg);
}

.app-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 1.35rem 0.9rem;
  background: var(--sidebar-bg) !important;
  border-inline-end: none !important;
  backdrop-filter: none !important;
  overflow-y: auto;
  color: #fff;
  display: flex;
  flex-direction: column;
}

.app-sidebar.founder-shell {
  overflow: hidden;
}

.app-brand {
  display: flex;
  align-items: center;
  padding: 0.35rem 0.75rem 1.4rem;
  gap: 0.75rem;
}

.app-brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, #e0c57a, #c5a059);
  box-shadow: 0 8px 24px rgba(197, 160, 89, 0.35);
  color: #14110b;
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 0.78rem;
}

.app-brand-text {
  color: #fff !important;
  font-size: 1rem;
}

.app-brand .text-muted {
  color: #8FA3BF !important;
}

.app-nav-section {
  color: #6B7F99 !important;
  margin: 1rem 0.85rem 0.35rem;
  font-size: 0.68rem;
}

.app-nav-link {
  color: var(--sidebar-text) !important;
  border-radius: 14px;
  padding: 0.78rem 0.95rem;
  font-weight: 500;
}

.app-nav-link i {
  opacity: 0.9;
  width: 1.25rem;
  text-align: center;
}

.app-nav-link:hover {
  background: rgba(255, 255, 255, 0.06) !important;
  color: #fff !important;
}

.app-nav-link.active {
  background: linear-gradient(135deg, #e0c57a, #c5a059) !important;
  color: #14110b !important;
  font-weight: 750;
  box-shadow: 0 8px 20px rgba(197, 160, 89, 0.35);
}

.app-nav-link.active i { opacity: 1; }

.app-main {
  background: var(--content-bg);
  min-width: 0;
}

.app-topbar {
  height: auto;
  min-height: 72px;
  background: transparent !important;
  border-bottom: none !important;
  backdrop-filter: none !important;
  padding: 1rem 1.75rem 0.5rem;
  align-items: center;
  gap: 0.75rem;
  overflow: visible;
  position: relative;
  z-index: 50;
}

.app-topbar > .d-flex {
  min-width: 0;
  flex: 1;
}

.app-topbar-welcome h1 {
  font-size: 1.55rem;
  font-weight: 750;
  letter-spacing: -0.02em;
  margin: 0;
  color: #0F172A;
  line-height: 1.3;
}

html[dir="rtl"] .app-topbar-welcome h1 {
  letter-spacing: 0;
}

.app-topbar-welcome p {
  margin: 0.2rem 0 0;
  color: #64748B;
  font-size: 0.92rem;
}

.app-topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
  margin-inline-start: 0.75rem;
  position: relative;
  z-index: 60;
}

.topbar-icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: #fff;
  display: grid;
  place-items: center;
  color: #334155;
  position: relative;
  cursor: pointer;
  text-decoration: none;
}

.topbar-icon-btn .badge-dot {
  position: absolute;
  top: -4px;
  inset-inline-end: -4px;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  background: #EF4444;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  display: grid;
  place-items: center;
  padding: 0 4px;
}

.topbar-notif {
  position: relative;
  z-index: 70;
}
.topbar-notif-menu {
  position: absolute;
  top: calc(100% + 0.55rem);
  inset-inline-end: 0;
  width: min(360px, calc(100vw - 1.5rem));
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 16px;
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.16);
  z-index: 1400;
  overflow: hidden;
}
.topbar-notif-menu[hidden] { display: none !important; }
.topbar-notif-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem 0.65rem;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}
.topbar-notif-head strong {
  font-size: 0.92rem;
  color: #0F172A;
}
.topbar-notif-head em {
  font-style: normal;
  font-size: 0.75rem;
  color: #c5a059;
  font-weight: 700;
}
.topbar-notif-list {
  max-height: 320px;
  overflow: auto;
}
.topbar-notif-empty {
  margin: 0;
  padding: 1.25rem 1rem;
  text-align: center;
  color: #94A3B8;
  font-size: 0.88rem;
}
.topbar-notif-item {
  display: flex;
  gap: 0.65rem;
  padding: 0.75rem 1rem;
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid rgba(15, 23, 42, 0.04);
}
.topbar-notif-item:hover { background: #f8fafc; }
.topbar-notif-item.is-unread { background: #f5efe3; }
.topbar-notif-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: transparent;
  margin-top: 0.45rem;
  flex-shrink: 0;
}
.topbar-notif-item.is-unread .topbar-notif-dot { background: #c5a059; }
.topbar-notif-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.topbar-notif-body strong {
  font-size: 0.86rem;
  color: #0F172A;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar-notif-body em {
  font-style: normal;
  font-size: 0.78rem;
  color: #64748B;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.topbar-notif-body small {
  font-size: 0.7rem;
  color: #94A3B8;
}
.topbar-notif-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.8rem 1rem;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.86rem;
  color: #8a6a2f;
  background: #faf7f1;
  border-top: 1px solid rgba(15, 23, 42, 0.06);
}
.topbar-notif-footer:hover { background: #f5efe3; color: #0F172A; }

html[data-theme="dark"] .topbar-notif-menu { background: #0f172a; border-color: rgba(248,250,252,0.08); }
html[data-theme="dark"] .topbar-notif-head strong,
html[data-theme="dark"] .topbar-notif-body strong { color: #f8fafc; }
html[data-theme="dark"] .topbar-notif-item:hover { background: rgba(248,250,252,0.04); }
html[data-theme="dark"] .topbar-notif-item.is-unread { background: rgba(197,160,89,0.12); }
html[data-theme="dark"] .topbar-notif-footer { background: rgba(197,160,89,0.08); border-top-color: rgba(248,250,252,0.06); }

.topbar-profile {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 999px;
  padding: 0.3rem 0.75rem 0.3rem 0.35rem;
  flex-shrink: 0;
  max-width: 13.5rem;
  overflow: hidden;
}

.topbar-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #c5a059, #d4b87a);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.9rem;
  overflow: hidden;
  flex-shrink: 0;
}

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

.topbar-profile-meta {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  line-height: 1.4;
  letter-spacing: 0;
  min-width: 0;
  overflow: hidden;
}

.topbar-profile-meta strong {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 8.5rem;
}

.topbar-profile-meta span {
  display: block;
  font-size: 0.7rem;
  color: #64748B;
  line-height: 1.4;
  letter-spacing: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 8.5rem;
}

@media (max-width: 1200px) {
  .topbar-profile-meta span { display: none; }
  .topbar-profile { max-width: 10rem; }
}

@media (max-width: 992px) {
  .topbar-profile-meta { display: none; }
  .topbar-profile {
    padding: 0.25rem;
    border-radius: 50%;
    max-width: none;
  }
}

.app-content {
  padding: 0.5rem 1.75rem 2.5rem;
}

/* KPI row — 5 cards */
.dash-kpi-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.9rem;
  margin-bottom: 1rem;
}

.dash-kpi {
  background: #fff;
  border-radius: 18px;
  padding: 1.05rem 1.1rem;
  border: 1px solid rgba(15, 23, 42, 0.05);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.04);
}

.dash-kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.55rem;
}

.dash-kpi-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--kpi-icon-bg);
  color: #c5a059;
  display: grid;
  place-items: center;
  font-size: 1.05rem;
}

.dash-kpi-label {
  font-size: 0.82rem;
  color: #64748B;
  font-weight: 600;
}

.dash-kpi-value {
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 0;
  color: #0F172A;
}

.dash-kpi-delta {
  margin-top: 0.25rem;
  font-size: 0.75rem;
  color: #10B981;
  font-weight: 650;
}

.dash-mid {
  display: grid;
  grid-template-columns: 1.1fr 1.15fr 1fr;
  gap: 0.9rem;
  margin-bottom: 1rem;
}

.dash-bottom {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 0.9rem;
}

.dash-card {
  background: #fff;
  border-radius: 18px;
  padding: 1.15rem 1.25rem;
  border: 1px solid rgba(15, 23, 42, 0.05);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.04);
}

.dash-card h2 {
  font-size: 1.05rem;
  font-weight: 750;
  margin: 0 0 1rem;
  color: #0F172A;
}

.attention-item,
.reco-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}

.attention-item:last-child,
.reco-item:last-child { border-bottom: none; }

.attention-logo {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: #f5efe3;
  color: #c5a059;
  display: grid;
  place-items: center;
  font-weight: 800;
  flex-shrink: 0;
}

.attention-body { flex: 1; min-width: 0; }
.attention-body strong { display: block; font-size: 0.92rem; }
.attention-body p { margin: 0.2rem 0 0; font-size: 0.8rem; color: #64748B; }

.status-pill {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.28rem 0.6rem;
  border-radius: 999px;
  white-space: nowrap;
}

.status-pill.urgent { background: #FEE2E2; color: #B91C1C; }
.status-pill.warning { background: #FEF3C7; color: #B45309; }
.status-pill.excellent { background: #D1FAE5; color: #047857; }

.reco-item i {
  color: #c5a059;
  margin-top: 0.15rem;
}

.dash-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.dash-table th {
  text-align: start;
  color: #94A3B8;
  font-weight: 650;
  font-size: 0.75rem;
  padding: 0.45rem 0.35rem;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}

.dash-table td {
  padding: 0.75rem 0.35rem;
  border-bottom: 1px solid rgba(15, 23, 42, 0.05);
  vertical-align: middle;
  color: #334155;
}

.prio-high { color: #DC2626; font-weight: 700; }
.prio-medium { color: #D97706; font-weight: 700; }
.prio-low { color: #059669; font-weight: 700; }

.chart-wrap {
  position: relative;
  max-width: 220px;
  margin: 0 auto;
}

.chart-legend {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem 0.75rem;
  margin-top: 1rem;
  font-size: 0.8rem;
  color: #64748B;
}

.chart-legend span::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-inline-end: 0.4rem;
}

.lg-done::before { background: #c5a059; }
.lg-progress::before { background: #e0c57a; }
.lg-delayed::before { background: #F59E0B; }
.lg-none::before { background: #CBD5E1; }

/* Landing redesign */
.landing-v2 {
  min-height: 100vh;
  background: #fff;
}

.landing-v2-nav {
  max-width: 1180px;
  margin: 0 auto;
  padding: 1.1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.landing-v2-links {
  display: flex;
  gap: 1.4rem;
  align-items: center;
}

.landing-v2-links a {
  color: #334155;
  font-weight: 600;
  font-size: 0.95rem;
}

.landing-v2-links a.active { color: #c5a059; }

.landing-hero-v2 {
  max-width: 1180px;
  margin: 0.5rem auto 2rem;
  padding: 0 1.5rem;
}

.landing-hero-panel {
  position: relative;
  border-radius: 28px;
  overflow: hidden;
  min-height: 420px;
  display: grid;
  align-items: end;
  background:
    linear-gradient(120deg, rgba(11, 27, 51, 0.82) 10%, rgba(197, 160, 89, 0.55) 55%, rgba(212, 184, 122, 0.35) 100%),
    url("https://images.unsplash.com/photo-1486406146926-c627a92ad1ab?auto=format&fit=crop&w=1800&q=80") center/cover;
  color: #fff;
  padding: 3rem;
}

.landing-hero-panel h1 {
  font-size: clamp(1.9rem, 4vw, 2.8rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  max-width: 18ch;
  margin: 0 0 0.85rem;
  line-height: 1.25;
}

.landing-hero-panel p {
  max-width: 42rem;
  opacity: 0.92;
  line-height: 1.7;
  margin: 0 0 1.35rem;
}

.lang-pill {
  display: inline-flex;
  background: #F1F5F9;
  border-radius: 999px;
  padding: 0.2rem;
  gap: 0.15rem;
}

.lang-pill button {
  border: none;
  background: transparent;
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  font-weight: 700;
  font-size: 0.8rem;
  color: #64748B;
  cursor: pointer;
}

.lang-pill button.active {
  background: #c5a059;
  color: #14110b;
}

html[data-theme="dark"] .app-main,
html[data-theme="dark"] .app-content,
html[data-theme="dark"] html,
html[data-theme="dark"] body {
  background: #0b0f14 !important;
}

html[data-theme="dark"] .dash-kpi,
html[data-theme="dark"] .dash-card,
html[data-theme="dark"] .topbar-icon-btn,
html[data-theme="dark"] .topbar-profile {
  background: #121820;
  color: #eef1f4;
  border-color: rgba(197, 160, 89, 0.16);
}

html[data-theme="dark"] .app-topbar-welcome h1,
html[data-theme="dark"] .dash-kpi-value,
html[data-theme="dark"] .dash-card h2 {
  color: #eef1f4;
}

@media (max-width: 1200px) {
  .dash-kpi-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dash-mid { grid-template-columns: 1fr; }
  .dash-bottom { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .dash-kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .landing-v2-links { display: none; }
  .app-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(86vw, 280px);
    transform: translateX(-105%);
    z-index: 40;
    transition: transform 220ms ease;
  }
  [dir="rtl"] .app-sidebar {
    inset: 0 0 0 auto;
    transform: translateX(105%);
  }
  .app-sidebar.open { transform: translateX(0); }
}

/* ========== Founder sidebar (clean shell) ========== */
.sb-founder {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  gap: 0.85rem;
  padding: 0 0.15rem;
}

.sb-company {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  text-align: start;
  border: 1px solid rgba(255,255,255,.1);
  background: rgba(255,255,255,.06);
  color: #fff;
  border-radius: 14px;
  padding: 0.7rem 0.8rem;
  cursor: default;
  margin-bottom: 0.35rem;
}
.sb-company-mark {
  width: 36px; height: 36px; border-radius: 11px;
  background: linear-gradient(135deg, #c5a059, #3B82F6);
  display: grid; place-items: center;
  font-weight: 800; font-size: 0.95rem; flex-shrink: 0;
}
.sb-company-meta { flex: 1; min-width: 0; line-height: 1.2; }
.sb-company-meta strong { display: block; font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-company-meta span { font-size: 0.72rem; color: #8FA3BF; }

.sb-nav {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  flex: 1;
  overflow-y: auto;
  padding-bottom: 0.5rem;
}

.sb-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.72rem 0.9rem;
  border-radius: 12px;
  color: #C9D4E5 !important;
  font-weight: 550;
  font-size: 0.92rem;
  text-decoration: none;
  position: relative;
}
.sb-link i {
  width: 1.25rem;
  text-align: center;
  font-size: 1.05rem;
  opacity: 0.9;
}
.sb-link:hover {
  background: rgba(255,255,255,.06);
  color: #fff !important;
}
.sb-link.active {
  background: rgba(197, 160, 89, 0.28) !important;
  color: #fff !important;
  font-weight: 700;
  box-shadow: none;
}
.sb-link.active::before {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  top: 8px; bottom: 8px;
  width: 3px;
  border-radius: 99px;
  background: #3B82F6;
}
.sb-badge {
  margin-inline-start: auto;
  min-width: 20px;
  height: 20px;
  border-radius: 999px;
  background: #c5a059;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 800;
  font-style: normal;
  display: grid;
  place-items: center;
  padding: 0 5px;
}

.sb-ai {
  margin-top: auto;
  padding: 1rem;
  border-radius: 16px;
  background: linear-gradient(160deg, rgba(197,160,89,.22), rgba(0,201,167,.12));
  border: 1px solid rgba(255,255,255,.08);
  color: #E8EEF8;
}
.sb-ai-title {
  font-weight: 750;
  font-size: 0.88rem;
  margin-bottom: 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.sb-ai p {
  margin: 0 0 0.75rem;
  font-size: 0.78rem;
  line-height: 1.5;
  color: #A8B8CC;
}
.sb-ai-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  width: 100%;
  border-radius: 12px;
  padding: 0.65rem 0.85rem;
  background: #c5a059;
  color: #fff !important;
  font-weight: 700;
  font-size: 0.85rem;
  text-decoration: none;
}
.sb-ai-btn:hover { filter: brightness(1.06); color: #fff !important; }

.app-sidebar.founder-shell .app-brand {
  padding-bottom: 0.85rem;
}
