/* ==========================================================================
   PNLE-REVIEW — Layout
   App shell: sidebar, main panel, top bar, dashboard rows, breakpoints.
   ========================================================================== */

.app {
  display: grid;
  grid-template-columns: 234px minmax(0, 1fr);
  gap: 10px;
  min-height: 100vh;
  padding: 10px;
}

/* ============================== Sidebar ============================== */
.sidebar {
  position: sticky;
  top: 10px;
  display: flex;
  flex-direction: column;
  /* --vh is set by fit.js (viewport height in the zoomed app's px) */
  height: calc(var(--vh, 100vh) - 20px);
  min-height: 640px;
  padding: 24px 14px 16px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 0 0 0;
}
.brand__logo {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 13px;
  color: #fff;
  background: linear-gradient(145deg, #3d72d6 0%, #1f4aa0 100%);
  box-shadow: var(--shadow-primary), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.brand__logo .icon { width: 36px; height: 36px; stroke-width: 1.7; }
.brand__text strong {
  display: block;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.6px;
  color: var(--text);
}
.brand__text small {
  display: block;
  margin-top: 3px;
  font-size: 9px;
  white-space: nowrap;
  color: var(--text-2);
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-top: 22px;
}
.nav__link {
  display: flex;
  align-items: center;
  gap: 13px;
  height: 34px;
  padding: 0 12px;
  border-radius: 8px;
  font-size: 14px;
  color: var(--text-2);
  transition: background-color 0.15s ease, color 0.15s ease;
}
.nav__link:hover { background: var(--primary-softer); color: var(--text); }
.nav__link.is-active {
  background: var(--primary-soft);
  color: var(--text);
  font-weight: 500;
}
.nav__icon {
  display: grid;
  place-items: center;
  width: 19px;
  height: 19px;
  border-radius: 5px;
  color: #fff;
  background: linear-gradient(160deg, #6d95e2, #3e6cc9);
}
.nav__icon .icon { width: 12px; height: 12px; stroke-width: 2.4; }

.sidebar__flowers {
  width: 136px;
  margin-top: auto;
  margin-left: -6px;
  margin-bottom: -6px;
  pointer-events: none;
}

.sidebar__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px;
}
.sidebar__settings {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
  color: var(--text-2);
}
.sidebar__settings-icon {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(160deg, #6d95e2, #3e6cc9);
}
.sidebar__settings-icon .icon { width: 13px; height: 13px; }

/* ============================== Main ============================== */
.main {
  display: flex;
  flex-direction: column;
  gap: 11px;
  min-width: 0;
  padding: 8px 14px 12px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}

/* ---------- Top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 72px;
  padding: 0 8px 0 24px;
}
.greeting { flex: 1; min-width: 0; }
.greeting__title {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 36px;
  font-weight: 600;
  line-height: 1.15;
  color: #1f3670;
}
:root[data-theme="dark"] .greeting__title { color: var(--script); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .greeting__title { color: var(--script); }
}
.greeting__flower { width: 24px; height: 24px; opacity: 0.75; }
.greeting__sub {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 2px;
  padding-left: 16px;
  overflow: hidden;
  font-size: 14px;
  letter-spacing: 0.2px;
  white-space: nowrap;
  color: var(--text-2);
}
.greeting__sparkle { width: 16px; height: 16px; fill: var(--yellow); opacity: 0.85; }

.topbar__flowers {
  width: 150px;
  height: 84px;
  object-fit: contain;
  margin: -6px -14px -6px -8px;
  pointer-events: none;
}

/* ============================== Dashboard rows ============================== */
.row {
  display: grid;
  gap: 12px;
}
/* Rows 1–2 share column widths; row 3 shifts the split (matches the design) */
.row--a { grid-template-columns: minmax(0, 1.9fr) minmax(0, 1.19fr) minmax(0, 1fr); }
.row--b { grid-template-columns: minmax(0, 1.63fr) minmax(0, 1.16fr) minmax(0, 1.03fr); }

/* ============================== Fit to screen ==============================
   Set by js/fit.js on desktop when the page fits: the app (already zoomed
   the same on every page) gets a fixed height and the page rows share it.
   Each page sets its own --fit-rows on its .main--<page> class. */
/* Rows never shrink below their content; extra height is shared 295 : 211 : 267 */
.main--home { --fit-rows: min-content minmax(min-content, 295fr) minmax(min-content, 211fr) minmax(min-content, 267fr) min-content; }
.is-fit body { overflow: hidden; }
.is-fit .app { min-height: 0; grid-template-rows: minmax(0, 1fr); }
.is-fit .sidebar { position: static; height: auto; min-height: 0; }
.is-fit .main {
  display: grid;
  grid-template-rows: var(--fit-rows, auto 1fr);
  min-height: 0;
}

/* ============================== Breakpoints ============================== */
@media (max-width: 1320px) {
  .row--a,
  .row--b { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .row--a > :first-child,
  .row--b > :first-child { grid-column: 1 / -1; }
  .topbar__flowers { display: none; }
}

@media (max-width: 1024px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: static;
    height: auto;
    min-height: 0;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
  }
  .brand__logo { width: 44px; height: 44px; }
  .brand__logo .icon { width: 28px; height: 28px; }
  .nav {
    flex-direction: row;
    order: 3;
    width: 100%;
    margin-top: 0;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .nav__link { flex: none; }
  .motivation-card,
  .sidebar__flowers { display: none; }
  .sidebar__footer { margin-left: auto; gap: 14px; }
}

@media (max-width: 720px) {
  .app { padding: 8px; gap: 8px; }
  .main { padding: 10px; }
  .row--a,
  .row--b { grid-template-columns: minmax(0, 1fr); }
  .topbar { flex-wrap: wrap; gap: 10px; padding: 4px 4px 8px; }
  .greeting { flex-basis: 100%; }
  .greeting__title { font-size: 30px; }
  .greeting__sub { padding-left: 4px; font-size: 13px; }
  .search { order: 5; flex-basis: 100%; width: auto; }
  .profile { margin-left: auto; }
  .brand__text small { display: none; }
  .sidebar__settings { font-size: 0; gap: 0; }
}
