/* =============================================================================
   DASHBOARD (/me) — Google "My Account" style
   Top app bar (search + avatar) · left sidebar nav · Material-You cards.
   ============================================================================= */

/* ----------------------------------------------------------- app bar */
.me-appbar {
  position: sticky;
  top: 0;
  z-index: 90;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.me-appbar-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 64px;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 16px;
}
.me-menu-btn {
  display: none; /* visible on mobile viewports */
  background: transparent;
  border: none;
  color: var(--text-muted);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}
.me-menu-btn:hover { background: var(--bg-hover); }

.me-appbar-title {
  font-size: 20px;
  color: var(--text-muted);
  font-weight: 400;
  white-space: nowrap;
}
@media (max-width: 720px) {
  .me-appbar-title { display: none; }
  .me-menu-btn { display: inline-flex; }
}

/* Search bar — center pill (Google style) */
.me-search {
  position: relative;
  flex: 1;
  max-width: 640px;
  margin: 0 auto;
}
.me-search input {
  width: 100%;
  height: 46px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  padding: 0 20px 0 48px;
  outline: none;
  transition: background 0.15s, box-shadow 0.15s;
}
.me-search input:focus {
  background: var(--surface);
  box-shadow: 0 1px 1px rgba(0,0,0,0.16);
  border-color: transparent;
}
.me-search .msym.search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}
/* Search results dropdown */
.me-search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-height: 380px;
  overflow-y: auto;
  z-index: 120;
}
.me-search-item {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 12px 18px;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  text-align: left;
  font-family: var(--font);
}
.me-search-item:last-child { border-bottom: none; }
.me-search-item:hover { background: var(--bg-hover); }
.me-search-item .msym { color: var(--text-muted); }
.me-search-item-title { font-size: 14px; color: var(--text); }
.me-search-item-sub { font-size: 12px; color: var(--text-muted); }

/* Appbar right side: theme toggle + avatar */
.me-appbar-actions { display: flex; align-items: center; gap: 6px; }

/* -------------------------------------------------------- body layout */
.me-body {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 0;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 16px;
  min-height: calc(100vh - 64px - 56px);
}

/* ------------------------------------------------------------ sidebar */
.me-sidebar {
  padding: 16px 8px 24px 0;
  position: sticky;
  top: 64px;
  align-self: start;
  max-height: calc(100vh - 64px);
  overflow-y: auto;
}
.me-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.me-nav-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 18px;
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  background: transparent;
  border: none;
  font-family: var(--font);
  text-align: left;
  width: 100%;
  transition: background 0.13s, color 0.13s;
}
.me-nav-item .msym { font-size: 20px; }
.me-nav-item:hover { background: var(--bg-hover); color: var(--text); }
.me-nav-item.active {
  background: var(--accent-soft);
  color: var(--accent);
}
.me-nav-item.active .msym { font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24; }

/* Mobile: sidebar collapses into slide-out drawer toggled via menu button */
.me-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(32, 33, 36, 0.6);
  z-index: 95;
}
@media (max-width: 960px) {
  .me-body { grid-template-columns: 1fr; }
  .me-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 288px;
    background: var(--surface);
    z-index: 100;
    padding: 16px 12px;
    transform: translateX(-105%);
    transition: transform 0.22s ease-out;
    box-shadow: var(--shadow);
    max-height: none;
  }
  .me-sidebar.open { transform: translateX(0); }
  .me-backdrop.show { display: block; }
  .me-sidebar-head {
    display: flex !important;
    align-items: center;
    gap: 12px;
    padding: 12px 18px 18px;
    font-size: 20px;
    color: var(--text-muted);
  }
}
.me-sidebar-head { display: none; }

/* ------------------------------------------------------------- content */
.me-content {
  padding: 32px 0 64px 40px;
  min-width: 0;
}
@media (max-width: 960px) {
  .me-content { padding-left: 0; }
}

/* Section page heading — uppercase eyebrow + large display title */
.me-section-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  margin-bottom: 4px;
}
.me-section-title {
  font-size: 26px;
  font-weight: 400;
  margin-bottom: 24px;
}
.me-section { animation: section-in 0.22s ease-out; }
@keyframes section-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Outlined card surface (Google Account style) */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 16px;
}
.card-title {
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.card-subtitle { font-size: 13px; color: var(--text-muted); margin-bottom: 16px; }

/* Card with header row (title left, action right) */
.card-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

/* Setting row — icon + label + value + chevron (Google personal info style) */
.setting-row {
  display: flex;
  align-items: center;
  gap: 18px;
  width: 100%;
  padding: 16px 8px;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  text-align: left;
  font-family: var(--font);
  transition: background 0.12s;
  border-radius: var(--radius-sm);
}
.setting-row:hover { background: var(--bg-hover); }
.setting-row:last-child { border-bottom: none; }
.setting-row[disabled] { cursor: default; }
.setting-row[disabled]:hover { background: transparent; }
.setting-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.setting-main { flex: 1; min-width: 0; }
.setting-label { display: block; font-size: 14px; font-weight: 500; color: var(--text); }
.setting-value { display: block; font-size: 13px; color: var(--text-muted); margin-top: 1px; overflow-wrap: anywhere; }
.setting-chevron { color: var(--text-faint); flex-shrink: 0; }

/* Info row without click (plain) */
.info-row {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 14px 8px;
  border-bottom: 1px solid var(--border);
}
.info-row:last-child { border-bottom: none; }

/* Home hero — avatar + name */
.dash-header {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}
.dash-title { font-size: 24px; font-weight: 400; line-height: 1.3; }
.email-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  flex-wrap: wrap;
}
.email-chip .mono { font-size: 13.5px; color: var(--text-muted); }

/* Storage bar (Google Drive style) */
.storage-bar {
  height: 6px;
  border-radius: 3px;
  background: var(--chip);
  overflow: hidden;
  margin: 14px 0 8px;
}
.storage-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--accent);
  transition: width 0.4s ease;
}

/* Quick-links grid (home page) */
.quick-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.quick-item {
  text-align: left;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none !important;
  color: var(--text);
  font-size: 13.5px;
  font-weight: 500;
  transition: background 0.12s, box-shadow 0.12s;
  background: var(--surface);
}
.quick-item:hover { background: var(--bg-hover); box-shadow: var(--shadow-soft); }
.quick-item .setting-icon { width: 38px; height: 38px; }
.quick-item-sub { font-size: 12px; color: var(--text-muted); font-weight: 400; display: block; margin-top: 1px; }

/* ------------------------------------------------------------ activity */
.activity-list { display: flex; flex-direction: column; }
.activity-item {
  display: flex;
  gap: 16px;
  padding: 13px 8px;
  border-bottom: 1px solid var(--border);
  align-items: flex-start;
}
.activity-item:last-child { border-bottom: none; }
.activity-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--chip);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.activity-title { font-size: 13.5px; font-weight: 500; }
.activity-detail { font-size: 12.5px; color: var(--text-muted); margin-top: 1px; }
.activity-time { font-size: 12px; color: var(--text-faint); margin-top: 2px; }

/* ------------------------------------------------------------- devices */
.device {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 8px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.device:last-child { border-bottom: none; }
.device-info { display: flex; align-items: center; gap: 16px; flex: 1; min-width: 220px; }
.device-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--chip);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  flex-shrink: 0;
}
.device-name { font-size: 14px; font-weight: 500; }
.device-meta { font-size: 12.5px; color: var(--text-muted); margin-top: 1px; }
.device-list { display: flex; flex-direction: column; }

/* --------------------------------------------------------- apps grid */
.apps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.app-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  font-size: 13px;
}
.app-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
  font-size: 20px;
}

/* ------------------------------------------------------------ danger */
.card-danger { border-color: var(--danger); }
.card-danger .card-title { color: var(--danger); }
.card-danger .setting-icon { background: var(--danger-soft); color: var(--danger); }

/* ---------------------------------------------------------- 2FA note */
.twofa-row { opacity: 0.85; }

/* ------------------------------------------------------------ loader */
.me-loading {
  min-height: 50vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--text-muted);
  font-size: 13.5px;
}

/* Photo dialog preview */
.photo-preview-wrap { display: flex; justify-content: center; margin: 18px 0; }
.photo-input-hidden { display: none; }
.photo-drop-note {
  text-align: center;
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 8px;
}

/* Storage / stats grid (small cards) */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.stat {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  background: var(--surface);
}
.stat-label { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.stat-value { font-size: 15px; margin-top: 4px; overflow-wrap: anywhere; }
