/* ═══════════════════════════════════════════════════════════
   VENDIFY THEME — aggressive visual layer (loads after dashboard-ui.css)
   ═══════════════════════════════════════════════════════════ */

:root {
  --vf-bg: #eef1f6;
  --vf-surface: #ffffff;
  --vf-ink: #101828;
  --vf-muted: #667085;
  --vf-border: #eaecf0;
  --vf-radius-shell: 28px;
  --vf-radius-card: 28px;
  --vf-radius-pill: 999px;
  --vf-shadow-shell: 0 8px 32px rgba(16, 24, 40, 0.06);
  --vf-shadow-card: 0 1px 2px rgba(16, 24, 40, 0.04), 0 12px 36px rgba(16, 24, 40, 0.06);
}

body {
  background: var(--vf-bg) !important;
}

/* ─── Floating app shell (Vendify sidebar + content gap) ─── */
.ui-app.legacy-app-shell,
.legacy-app-shell.ui-app {
  background: var(--vf-bg) !important;
  padding: 12px !important;
  gap: 12px !important;
  box-sizing: border-box;
}

.ui-sidebar,
.app-sidebar,
#sidebar {
  border-radius: var(--vf-radius-shell) !important;
  border: 1px solid var(--vf-border) !important;
  box-shadow: var(--vf-shadow-shell) !important;
  height: calc(100dvh - 24px) !important;
  max-height: calc(100dvh - 24px) !important;
  margin: 0 !important;
  padding: 1.25rem 0.85rem !important;
}

.ui-sidebar__logo {
  padding: 0 0.85rem 1rem !important;
  margin-bottom: 0.5rem !important;
}

.ui-sidebar__logo-text {
  font-size: 1.35rem !important;
  font-weight: 900 !important;
  letter-spacing: -0.03em !important;
}

.ui-sidebar__nav {
  padding: 0 0.35rem !important;
  gap: 0.25rem !important;
}

.sidebar-nav-link,
.ui-nav-link {
  border-radius: var(--vf-radius-pill) !important;
  min-height: 2.9rem !important;
  padding: 0.7rem 1rem !important;
  font-size: 0.9rem !important;
}

.sidebar-nav-link i,
.ui-nav-link i {
  font-size: 1.15rem !important;
}

.ui-nav-chevron {
  font-size: 0.85rem !important;
  opacity: 0.35;
  flex-shrink: 0;
}

.sidebar-nav-link-active .ui-nav-chevron,
.ui-nav-link--active .ui-nav-chevron {
  opacity: 0.7;
  color: #fff !important;
}

.ui-main,
.legacy-view-root > main {
  padding: 0.25rem 0.5rem 1rem !important;
  gap: 1.25rem !important;
}

/* ─── Welcome header (Vendify) ─── */
.ui-page-header--vendify {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem 1.5rem;
  margin-bottom: 0.25rem;
}

.ui-page-header--vendify.ui-page-header--with-strip {
  flex-direction: column !important;
  flex-wrap: nowrap !important;
  align-items: stretch !important;
}

.ui-page-header--vendify .ui-page-header__title {
  font-size: clamp(1.65rem, 3vw, 2.15rem) !important;
  font-weight: 800 !important;
  color: var(--vf-ink) !important;
  letter-spacing: -0.04em !important;
  line-height: 1.1 !important;
}

.ui-page-header--vendify .ui-page-header__subtitle {
  font-size: 0.95rem !important;
  color: var(--vf-muted) !important;
  margin-top: 0.4rem !important;
}

.ui-page-header--vendify .ui-page-header__eyebrow {
  display: none;
}

.ui-page-header--vendify:not(.ui-page-header--with-strip) .ui-page-header__eyebrow {
  display: block !important;
  font-size: 0.6875rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.16em !important;
  text-transform: uppercase !important;
  color: var(--vf-muted) !important;
  margin-bottom: 0.35rem !important;
}

.ui-page-header--vendify:not(.ui-page-header--with-strip) {
  flex-direction: column !important;
  flex-wrap: nowrap !important;
  align-items: stretch !important;
  margin-bottom: 0.5rem !important;
}

/* ─── Vendify KPI grid (dashboard top row) ─── */
/* Hero height budget: ~15% shorter than previous (scale factor 0.85) */
.ui-dashboard-hero {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.85rem;
  width: 100%;
}

@media (min-width: 1024px) {
  .ui-dashboard-hero {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
    align-items: stretch;
    gap: 0.85rem;
  }
}

.ui-dashboard-hero__left,
.ui-dashboard-hero__right {
  min-width: 0;
}

@media (min-width: 1024px) {
  .ui-dashboard-hero__left {
    display: flex;
    flex-direction: column;
  }

  .ui-dashboard-hero__right {
    display: flex;
    flex-direction: column;
  }

  .ui-dashboard-hero__right .ui-vendify-kpi-grid--square {
    flex: 1;
    height: 100%;
    grid-template-rows: 1fr 1fr;
    grid-auto-rows: unset;
  }
}

.ui-dashboard-hero__net7 {
  height: 100%;
  display: flex;
  flex-direction: column;
  /* p-4 → ~15% less; keeps chart/KPI row aligned */
  padding: 0.85rem !important;
}

@media (min-width: 1280px) {
  .ui-dashboard-hero__net7 {
    /* xl:p-5 (1.25rem) × 0.85 */
    padding: 1.0625rem !important;
  }
}

.ui-dashboard-hero__net7 .ui-widget__header {
  margin-bottom: 0.15rem !important;
}

.ui-dashboard-hero__net7 .ui-widget__title {
  font-size: 0.9rem !important;
}

.ui-dashboard-hero__net7 .ui-widget__value {
  margin-bottom: 0.55rem !important;
}

.ui-vendify-kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
  width: 100%;
  height: auto;
}

.ui-vendify-kpi-grid--square {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  /* 5.5rem × 0.85 */
  grid-auto-rows: minmax(4.675rem, auto);
}

@media (min-width: 1024px) {
  .ui-vendify-kpi-grid:not(.ui-vendify-kpi-grid--square) {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.85rem;
  }
}

.ui-vendify-kpi-grid--square .ui-vendify-kpi {
  min-height: 4.675rem;
  padding: 0.64rem 0.765rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

@media (min-width: 1024px) {
  .ui-vendify-kpi-grid--square .ui-vendify-kpi {
    min-height: 0;
    height: 100%;
  }
}

.ui-vendify-kpi-grid--square .ui-vendify-kpi__value {
  /* +30% vs previous clamp — card height/padding untouched */
  font-size: clamp(1.066rem, 1.495vw, 1.274rem);
  font-weight: 900;
  letter-spacing: -0.04em;
  margin-top: 0.05rem;
  line-height: 1.05;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.ui-vendify-kpi-grid--square .ui-vendify-kpi__label {
  margin-top: 0.2rem;
  font-size: 0.7rem;
}

.ui-vendify-kpi-grid--square .ui-vendify-kpi__badge {
  margin-top: 0.15rem;
  font-size: 0.58rem;
  padding: 0.15rem 0.45rem;
}

.ui-vendify-kpi-grid--square .ui-vendify-kpi__icon {
  width: 2rem;
  height: 2rem;
  font-size: 0.98rem;
  border-radius: 10px;
}

/* Profit-margin stack — same +30% / bolder, no card resize */
.ui-vendify-kpi-grid--square .uk-profit-stack__kpi-main,
.ui-vendify-kpi-grid--square .uk-profit-rate-pct--kpi {
  font-size: 1.066rem !important;
  font-weight: 900 !important;
  line-height: 1.05 !important;
}

.ui-vendify-kpi-grid--square .uk-profit-rate-pct--kpi {
  font-size: 0.884rem !important;
  font-weight: 800 !important;
  opacity: 0.9;
}

/* ─── App typography (PC / modern) ─── */
.ui-main,
.legacy-view-root main {
  font-family: var(--ke-font-body, 'Figtree', sans-serif);
  -webkit-font-smoothing: antialiased;
}

.ui-widget__title {
  font-family: var(--ke-font-display, 'Gabarito', sans-serif) !important;
  font-size: 1.0625rem !important;
  font-weight: 700 !important;
  letter-spacing: -0.02em !important;
}

.ui-widget__subtitle {
  font-size: 0.8125rem !important;
  font-weight: 500 !important;
}

.ui-widget__value {
  font-family: var(--ke-font-display, 'Gabarito', sans-serif) !important;
}

.net7-sales-widget:not(.ui-dashboard-hero__net7) [data-api-net-sales-7d-total] {
  font-family: var(--ke-font-display, 'Gabarito', sans-serif) !important;
  font-size: 1.75rem !important;
  font-weight: 800 !important;
  letter-spacing: -0.03em !important;
}

.ui-dashboard-hero__net7 [data-api-net-sales-7d-total] {
  font-family: var(--ke-font-display, 'Gabarito', sans-serif) !important;
  font-size: 1.275rem !important;
  font-weight: 800 !important;
}

.net7-sales-widget [data-api-net-sales-7d-range] {
  font-size: 0.7rem !important;
  font-weight: 600 !important;
}

.net7-sales-widget [data-net7-sales-chart-wrap],
.net7-sales-widget [data-net7-sales-chart-wrap-top] {
  margin-top: 0.2rem;
  flex: 1 1 auto;
  /* 120px × 0.85 */
  min-height: 102px !important;
  overflow: hidden;
}

.ui-dashboard-hero__net7 [data-net7-sales-chart-wrap],
.ui-dashboard-hero__net7 [data-net7-sales-chart-wrap-top] {
  min-height: 102px !important;
}

.net7-sales-widget .ui-widget__value {
  margin-bottom: 0.35rem !important;
}

.ui-vendify-kpi__value {
  font-family: var(--ke-font-display, 'Gabarito', sans-serif) !important;
}

.ui-vendify-kpi {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 8.5rem;
  padding: 1.1rem 1.15rem;
  border-radius: var(--vf-radius-card);
  border: 1px solid var(--vf-border);
  background: var(--vf-surface);
  box-shadow: var(--vf-shadow-card);
  overflow: hidden;
}

.ui-vendify-kpi--hero {
  background: linear-gradient(145deg, #ff6b35 0%, #ff8f52 100%);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 14px 36px rgba(255, 107, 53, 0.35);
}

.ui-vendify-kpi--mint { background: #e8f6ec; }
.ui-vendify-kpi--sky { background: #e8f1fb; }
.ui-vendify-kpi--cream { background: #fdf3e4; }

.ui-vendify-kpi__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.ui-vendify-kpi__icon {
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(16, 24, 40, 0.06);
  color: var(--vf-ink);
  font-size: 1.15rem;
}

.ui-vendify-kpi--hero .ui-vendify-kpi__icon {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
}

.ui-vendify-kpi__label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--vf-muted);
  margin-top: 0.65rem;
}

.ui-vendify-kpi--hero .ui-vendify-kpi__label {
  color: rgba(255, 255, 255, 0.88);
}

.ui-vendify-kpi__value {
  font-family: var(--ke-font-display);
  font-size: clamp(1.35rem, 2.5vw, 1.75rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--vf-ink);
  line-height: 1.1;
  margin-top: 0.2rem;
}

.ui-vendify-kpi--hero .ui-vendify-kpi__value {
  color: #fff;
}

.ui-vendify-kpi__badge {
  display: inline-flex;
  align-items: center;
  margin-top: 0.45rem;
  padding: 0.2rem 0.55rem;
  border-radius: var(--vf-radius-pill);
  font-size: 0.65rem;
  font-weight: 700;
  background: rgba(16, 24, 40, 0.06);
  color: var(--vf-muted);
  width: fit-content;
}

.ui-vendify-kpi--hero .ui-vendify-kpi__badge {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

/* ─── Cards everywhere ─── */
.glass-panel,
.ui-card,
.ui-widget,
.ui-status-strip,
.ui-ai-insights {
  border-radius: var(--vf-radius-card) !important;
  border: 1px solid var(--vf-border) !important;
  box-shadow: var(--vf-shadow-card) !important;
}

.glass-panel:hover,
.ui-widget:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 44px rgba(16, 24, 40, 0.09) !important;
}

/* Toolbar pills */
.ui-date-box,
#date-range-picker .quick-range-btn,
#drApply,
#drLiveRefresh {
  border-radius: var(--vf-radius-pill) !important;
}

.ui-store-badge {
  border-radius: var(--vf-radius-pill) !important;
}

/* Status cells → mini Vendify cards */
.ui-status-strip {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
}

.ui-status-strip__scroll {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem !important;
  overflow: visible !important;
  padding: 0 !important;
}

.ui-status-cell {
  border-radius: 22px !important;
  min-height: 7.5rem !important;
  box-shadow: var(--vf-shadow-card) !important;
  border: 1px solid var(--vf-border) !important;
}

.ui-status-strip--header .ui-status-cell {
  min-height: 0 !important;
  height: 2.775rem !important;
  border-radius: 10px !important;
}

.ui-status-cell::before {
  display: none !important;
}

/* AI insights — light card instead of orange gradient box */
.ui-ai-insights {
  background: var(--vf-surface) !important;
  border: 1px solid var(--vf-border) !important;
  box-shadow: var(--vf-shadow-card) !important;
}

.ui-ai-insights__track {
  background: #f2f4f7 !important;
  border-color: var(--vf-border) !important;
  min-height: 1.5rem !important;
}

.ui-ai-insights__line-text,
.ui-ai-insights__title,
.ui-ai-insights__detail,
.ui-ai-insights__sep,
.legacy-view-root main .ui-ai-insights__line-text,
.legacy-view-root main .ui-ai-insights__title,
.legacy-view-root main .ui-ai-insights__detail,
.legacy-view-root main .ui-ai-insights__sep {
  color: var(--vf-ink) !important;
  text-shadow: none !important;
}

.ui-ai-insights__detail,
.legacy-view-root main .ui-ai-insights__detail {
  color: var(--vf-ink) !important;
  font-weight: 600 !important;
}

.ui-ai-insights__sep,
.legacy-view-root main .ui-ai-insights__sep {
  color: var(--vf-muted) !important;
}

/* Metrikler panels — light Vendify cards */
.ui-metric-panel {
  background: var(--vf-surface);
  border: 1px solid var(--vf-border);
  border-radius: var(--vf-radius-card);
  box-shadow: var(--vf-shadow-card);
  padding: 1.25rem 1.35rem;
}

.ui-metric-panel__title {
  font-family: var(--ke-font-display);
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--vf-ink);
  margin-bottom: 1rem;
  letter-spacing: -0.02em;
}

.ui-metric-panel__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 0;
  border-bottom: 1px dashed var(--vf-border);
}

.ui-metric-panel__row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.ui-metric-panel__label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--vf-muted);
}

.ui-metric-panel__value {
  font-family: var(--ke-font-display);
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--vf-ink);
  text-align: right;
}

/* Finans metric cards accent */
.legacy-view-root main .rounded-2xl.border,
.legacy-view-root main .rounded-xl.border {
  border-radius: 22px !important;
}

/* Force light readable text on all dashboard pages (legacy dark templates) */
.legacy-view-root main .glass-panel .text-white,
.legacy-view-root main .glass-panel h1,
.legacy-view-root main .glass-panel h2,
.legacy-view-root main .glass-panel h3,
.legacy-view-root main .ui-widget .text-white {
  color: var(--vf-ink) !important;
}

.legacy-view-root main [class*="text-cyan-1"],
.legacy-view-root main [class*="text-amber-1"],
.legacy-view-root main [class*="text-emerald-2"] {
  color: var(--vf-muted) !important;
}

.legacy-view-root main [class*="text-cyan-1"] .font-bold,
.legacy-view-root main [class*="text-amber-1"] .font-bold,
.legacy-view-root main [class*="text-emerald-2"] .font-bold {
  color: var(--vf-ink) !important;
}

@media (max-width: 1024px) {
  .ui-app.legacy-app-shell {
    padding: 0 !important;
    gap: 0 !important;
  }

  #sidebar {
    border-radius: 0 24px 24px 0 !important;
    height: 100vh !important;
    max-height: 100vh !important;
  }

  .ui-vendify-kpi-grid {
    grid-template-columns: 1fr 1fr;
  }
}
