/* ============================================================
   BASE — reset, body, layout shell
   ============================================================ */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family);
  background-color: var(--color-toy-bg);
  color: var(--color-on-surface);
  min-height: 100vh;
  display: flex;
}

img, svg {
  display: block;
  max-width: 100%;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

a {
  text-decoration: none;
  color: inherit;
}

input, textarea, select {
  font-family: inherit;
  border: none;
  outline: none;
  background: none;
}

/* ── Scrollbar ───────────────────────────────────────────── */
::-webkit-scrollbar       { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--color-outline-variant); border-radius: var(--radius-full); }

/* ── Material Symbols baseline alignment ─────────────────── */
.material-symbols-outlined {
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  vertical-align: middle;
  line-height: 1;
  user-select: none;
}

/* ══════════════════════════════════════════════════════════
   APP LAYOUT SHELL
══════════════════════════════════════════════════════════ */

/* ─── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background-color: var(--color-surface-container);
  display: flex;
  flex-direction: column;
  padding: var(--space-md) 0;
  gap: var(--space-base);
  z-index: 100;
  overflow-y: auto;
  transition: transform var(--transition-slow);
}

.sidebar.is-collapsed {
  transform: translateX(-100%);
}

/* Brand */
.sidebar__brand {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 0 var(--space-md);
  margin-bottom: var(--space-md);
}

.sidebar__brand-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background-color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-on-primary);
  flex-shrink: 0;
}

.sidebar__brand-icon .material-symbols-outlined {
  font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

.sidebar__brand-name {
  display: block;
  font-size: var(--text-label-md-size);
  font-weight: var(--text-label-md-weight);
  color: var(--color-primary);
  line-height: 1.2;
}

.sidebar__brand-sub {
  display: block;
  font-size: var(--text-label-sm-size);
  font-weight: var(--text-label-sm-weight);
  color: var(--color-on-surface-variant);
  opacity: 0.7;
}

/* Nav */
.sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.sidebar__link {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 12px var(--space-md);
  margin: 0 var(--space-base);
  border-radius: var(--radius-full);
  color: var(--color-on-surface-variant);
  font-size: var(--text-label-md-size);
  font-weight: var(--text-label-md-weight);
  transition: background var(--transition-fast), transform var(--transition-fast), color var(--transition-fast);
}

.sidebar__link:hover {
  background-color: rgba(233, 225, 217, 0.5);
  transform: translateX(4px);
}

.sidebar__link.is-active {
  background-color: var(--color-primary);
  color: var(--color-on-primary);
  transform: scale(0.97);
}

.sidebar__link-icon {
  font-size: 22px;
  flex-shrink: 0;
}

/* Footer widget */
.sidebar__footer {
  padding: var(--space-md);
  margin-top: auto;
}

.sidebar__update-widget {
  padding: var(--space-md);
  background-color: rgba(211, 220, 108, 0.2);
  border-radius: var(--radius-xl);
  display: flex;
  flex-direction: column;
  gap: var(--space-base);
}

.sidebar__update-label {
  font-size: var(--text-label-sm-size);
  font-weight: var(--text-label-sm-weight);
  color: var(--color-secondary);
}

.sidebar__update-track {
  height: 8px;
  background-color: rgba(255, 255, 255, 0.5);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.sidebar__update-fill {
  height: 100%;
  background-color: var(--color-toy-lime);
  border-radius: var(--radius-full);
  transition: width var(--transition-slow);
}

.sidebar__update-caption {
  font-size: 10px;
  color: var(--color-on-surface-variant);
}

/* ─── App shell (right of sidebar) ───────────────────────── */
.app-shell {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left var(--transition-slow);
}

.app-shell.sidebar-collapsed {
  margin-left: 0;
}

/* ─── Top Bar ─────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--topbar-height);
  background-color: rgba(255, 248, 242, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-surface-container-high);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-lg);
  gap: var(--space-md);
}

.topbar__left {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  min-width: 0;
}

.topbar__title {
  font-size: var(--text-headline-lg-size);
  font-weight: var(--text-headline-lg-weight);
  line-height: var(--text-headline-lg-lh);
  letter-spacing: var(--text-headline-lg-ls);
  color: var(--color-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar__right {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  flex-shrink: 0;
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: var(--space-base);
}

.topbar__avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  border: 2px solid white;
  box-shadow: var(--shadow-card);
  overflow: hidden;
  transition: transform var(--transition-base);
  cursor: pointer;
  padding: 0;
}

.topbar__avatar:hover { transform: scale(1.08); }
.topbar__avatar img   { width: 100%; height: 100%; object-fit: cover; }

/* ─── Page content ────────────────────────────────────────── */
.page-content {
  flex: 1;
  padding: var(--space-container);
  display: flex;
  flex-direction: column;
  gap: var(--space-gutter);
}

/* ── Typography utilities ────────────────────────────────── */
.text-display-lg  { font-size: var(--text-display-lg-size);  font-weight: var(--text-display-lg-weight);  line-height: var(--text-display-lg-lh);  letter-spacing: var(--text-display-lg-ls); }
.text-headline-lg { font-size: var(--text-headline-lg-size); font-weight: var(--text-headline-lg-weight); line-height: var(--text-headline-lg-lh); letter-spacing: var(--text-headline-lg-ls); }
.text-headline-md { font-size: var(--text-headline-md-size); font-weight: var(--text-headline-md-weight); line-height: var(--text-headline-md-lh); }
.text-headline-sm { font-size: var(--text-headline-sm-size); font-weight: var(--text-headline-sm-weight); line-height: var(--text-headline-sm-lh); }
.text-body-lg     { font-size: var(--text-body-lg-size);     font-weight: var(--text-body-lg-weight);     line-height: var(--text-body-lg-lh); }
.text-body-md     { font-size: var(--text-body-md-size);     font-weight: var(--text-body-md-weight);     line-height: var(--text-body-md-lh); }
.text-body-sm     { font-size: var(--text-body-sm-size);     font-weight: var(--text-body-sm-weight);     line-height: var(--text-body-sm-lh); }
.text-label-md    { font-size: var(--text-label-md-size);    font-weight: var(--text-label-md-weight);    line-height: var(--text-label-md-lh);    letter-spacing: var(--text-label-md-ls); }
.text-label-sm    { font-size: var(--text-label-sm-size);    font-weight: var(--text-label-sm-weight);    line-height: var(--text-label-sm-lh); }
