/* ============================================================
   ESTANTEFY — Dark Theme (Spotify-inspired)
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;500;600;700;800&display=swap');

/* ============================================================
   CSS CUSTOM PROPERTIES
   ============================================================ */
:root {
  --font-body:  'Montserrat', 'Inter', sans-serif;
  --font-title: 'Montserrat', 'Inter', sans-serif;

  /* Core palette */
  --bg:         #121212;
  --sidebar-bg: #000000;
  --surface:    #181818;
  --surface-2:  #282828;
  --elevated:   #282828;

  /* Accent */
  --accent:       #1DB954;
  --accent-hover: #1ed760;
  --accent-dark:  #158a3e;

  /* Text */
  --text:       #FFFFFF;
  --text-muted: #B3B3B3;
  --text-light: #727272;

  /* Borders */
  --border:      #282828;
  --border-dark: #535353;

  /* Status / semantic colors */
  --pink:      #E91E8C;
  --pink-dark: #C2166E;
  --blue:      #2196F3;
  --green:     #1DB954;
  --orange:    #FF9800;
  --purple:    #9C27B0;
  --red:       #F44336;
  --beige:     #282828;

  /* Layout */
  --sidebar-w:    240px;
  --header-h:     64px;
  --bottom-nav-h: 0px;

  /* Radius */
  --r-xs:   4px;
  --r-sm:   6px;
  --r-md:   10px;
  --r-lg:   14px;
  --r-xl:   20px;
  --r-full: 9999px;

  /* Shadows */
  --shadow-xs: 0 1px 3px rgba(0,0,0,.6);
  --shadow-sm: 0 2px 8px rgba(0,0,0,.6);
  --shadow-md: 0 4px 16px rgba(0,0,0,.7);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.8);
  --shadow-xl: 0 16px 48px rgba(0,0,0,.9);

  /* Transitions */
  --t:  .15s ease;
  --t2: .25s ease;
}

/* ============================================================
   RESET / BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
  overflow-x: hidden;
  max-width: 100%;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  overflow-x: hidden;
  max-width: 100%;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }
img { max-width: 100%; display: block; }
button { font-family: inherit; }
input, select, textarea { font-family: inherit; }
h1,h2,h3,h4,h5,h6 { font-family: var(--font-title); font-weight: 700; line-height: 1.25; }

/* ============================================================
   APP LAYOUT
   ============================================================ */
.app-layout {
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
  max-width: 100%;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 200;
  transition: transform var(--t2);
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-header {
  padding: 20px 16px 12px;
  flex-shrink: 0;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  padding: 6px 0;
}

.sidebar-logo-img {
  height: auto;
  width: auto;
  object-fit: contain;
  max-width: 180px;
}

.logo-icon {
  font-size: 1.6rem;
  flex-shrink: 0;
}

.sidebar-logo-text {
  font-family: var(--font-title);
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -.01em;
}

.sidebar-tagline {
  font-size: .68rem;
  color: var(--text-muted);
  margin-top: 1px;
  font-weight: 400;
}

/* User info block */
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px 16px;
  border-bottom: 1px solid var(--border);
}

.sidebar-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface-2);
  display: flex; align-items: center; justify-content: center;
  font-size: .9rem; font-weight: 700;
  flex-shrink: 0;
  color: var(--text);
}

.sidebar-user-info { min-width: 0; }

.sidebar-user-name {
  font-size: .82rem; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: var(--text);
}

.sidebar-user-email {
  font-size: .72rem; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Nav */
.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  font-size: .875rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  cursor: pointer;
  transition: color var(--t), background var(--t);
  position: relative;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.nav-item:hover {
  color: var(--text);
  background: rgba(255,255,255,.07);
}

.nav-item.active {
  color: var(--text);
  font-weight: 700;
  background: rgba(255,255,255,.1);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 20%; bottom: 20%;
  width: 3px;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
}

.nav-icon {
  font-size: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  flex-shrink: 0;
}

.nav-svg-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  stroke: currentColor;
  transition: stroke var(--t);
}

/* Catalog parent / child */
.nav-catalog-group { display: flex; flex-direction: column; }

.nav-catalog-parent {
  display: flex;
  align-items: center;
  gap: 8px;
}
.nav-catalog-parent > span:first-of-type { flex: 1; }

.nav-catalog-arrow {
  margin-left: auto;
  transition: transform var(--t);
  color: var(--text-muted);
  flex-shrink: 0;
}
.nav-catalog-parent.active .nav-catalog-arrow,
.nav-catalog-parent.nav-parent-open .nav-catalog-arrow { transform: rotate(90deg); }

/* Sub-nav — exibido dentro do grupo Minha Biblioteca */
.nav-sub-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding-left: 14px;
  margin-top: 2px;
  position: relative;
}
.nav-sub-list::before {
  content: '';
  position: absolute;
  left: 18px; top: 4px; bottom: 4px;
  width: 1px;
  background: var(--border-dark);
  border-radius: 1px;
}

.nav-sub-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: var(--r-sm);
  font-size: .82rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--t), background var(--t);
  position: relative;
}
.nav-sub-item:hover  { color: var(--text); background: rgba(255,255,255,.07); }
.nav-sub-item.active { color: var(--accent); font-weight: 700; background: rgba(29,185,84,.1); }

/* Nav divider */
.nav-divider {
  height: 1px;
  background: var(--border);
  margin: 8px 0;
}

/* Sidebar footer */
.sidebar-footer {
  padding: 12px 16px 16px;
  flex-shrink: 0;
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  min-width: 0;
}

/* ============================================================
   TOP HEADER
   ============================================================ */
.top-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: rgba(18,18,18,.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 24px;
}

.hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text);
  padding: 6px;
  border-radius: var(--r-sm);
  transition: background var(--t);
}
.hamburger:hover { background: var(--surface-2); }

.header-title-group { flex: 1; min-width: 0; }

.header-title {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  transition: background var(--t), color var(--t);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

.header-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: #000;
  display: flex; align-items: center; justify-content: center;
  font-size: .82rem;
  font-weight: 700;
}

/* ============================================================
   BREADCRUMB BAR
   ============================================================ */
.breadcrumb-bar {
  padding: 8px 24px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: .78rem;
  color: var(--text-light);
}

.breadcrumb-item {
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--t);
}
.breadcrumb-item:hover { color: var(--text); }
.breadcrumb-current { color: var(--text); font-weight: 600; }
.breadcrumb-sep { color: var(--text-light); }

/* ============================================================
   PAGE CONTENT
   ============================================================ */
.page-content {
  padding: 28px 32px;
  flex: 1;
  box-sizing: border-box;
  max-width: 100%;
  overflow-x: hidden;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.page-header h1 {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -.02em;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 24px;
  border-radius: var(--r-full);
  font-family: var(--font-body);
  font-size: .875rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: background var(--t), color var(--t), transform var(--t), box-shadow var(--t);
  white-space: nowrap;
  text-decoration: none;
  letter-spacing: .02em;
}
.btn:active { transform: scale(.96); }

.btn-primary { background: var(--accent); color: #000; }
.btn-primary:hover { background: var(--accent-hover); color: #000; transform: scale(1.02); }

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border: 1.5px solid var(--border-dark);
}
.btn-secondary:hover { background: var(--elevated); border-color: var(--text); }

.btn-outline {
  background: transparent;
  color: var(--text);
  border: 1.5px solid var(--border-dark);
}
.btn-outline:hover { background: rgba(255,255,255,.07); border-color: var(--text); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: none;
}
.btn-ghost:hover { color: var(--text); background: rgba(255,255,255,.07); }

.btn-danger { background: #c0392b; color: #fff; }
.btn-danger:hover { background: #e74c3c; }

.btn-sm { padding: 7px 16px; font-size: .78rem; }
.btn-lg { padding: 15px 32px; font-size: 1rem; }
.btn-full { width: 100%; }

.btn-google {
  background: var(--surface-2);
  color: var(--text);
  border: 1.5px solid var(--border-dark);
  border-radius: var(--r-full);
  gap: 10px;
}
.btn-google:hover { background: var(--elevated); border-color: var(--text); }

.btn:disabled { opacity: .4; cursor: not-allowed; pointer-events: none; }

/* ============================================================
   FORMS
   ============================================================ */
.form-group { margin-bottom: 16px; }
.form-group:last-child { margin-bottom: 0; }

label {
  display: block;
  font-size: .78rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.form-control {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--border-dark);
  border-radius: var(--r-md);
  background: var(--surface-2);
  color: var(--text);
  font-size: .875rem;
  font-family: var(--font-body);
  transition: border-color var(--t);
  appearance: none;
}
.form-control:focus {
  outline: none;
  border-color: var(--accent);
}
.form-control::placeholder { color: var(--text-light); }

select.form-control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23B3B3B3' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
  cursor: pointer;
}
select.form-control option { background: var(--surface-2); color: var(--text); }

textarea.form-control { resize: vertical; min-height: 80px; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-hint { font-size: .75rem; color: var(--text-muted); margin-top: 4px; }
.form-msg { min-height: 20px; }
.form-msg .error   { color: #f87171; font-size: .85rem; }
.form-msg .success { color: var(--accent); font-size: .85rem; }

.input-group { position: relative; }
.input-icon {
  position: absolute;
  right: 12px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted);
  font-size: .9rem;
}

/* ============================================================
   COVER UPLOAD
   ============================================================ */
.cover-upload-zone {
  border: 2px dashed var(--border-dark);
  border-radius: var(--r-lg);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--t), background var(--t);
  background: var(--surface-2);
  position: relative;
  overflow: hidden;
}
.cover-upload-zone:hover { border-color: var(--accent); background: rgba(29,185,84,.05); }
.cover-upload-zone input[type="file"] {
  position: absolute; inset: 0;
  opacity: 0; cursor: pointer;
  width: 100%; height: 100%;
}
.cover-preview {
  max-height: 120px; width: auto;
  margin: 0 auto 8px;
  border-radius: var(--r-sm);
  display: none;
}
.cover-preview.visible { display: block; }
.cover-upload-icon { font-size: 2rem; margin-bottom: 6px; opacity: .5; }
.cover-upload-text { font-size: .85rem; color: var(--text-muted); font-weight: 500; }
.cover-upload-hint { font-size: .72rem; color: var(--text-light); margin-top: 4px; }

/* ============================================================
   STATUS SELECTOR (modal)
   ============================================================ */
.status-selector { display: flex; flex-wrap: wrap; gap: 8px; }

.status-btn {
  padding: 7px 16px;
  border-radius: var(--r-full);
  border: 1.5px solid var(--border-dark);
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: .78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--t);
  font-family: var(--font-body);
}
.status-btn:hover { border-color: var(--text); color: var(--text); }
.status-btn.active.quero_ler  { background: #4527A0; border-color: #7C4DFF; color: #fff; }
.status-btn.active.lendo      { background: #1565C0; border-color: #42A5F5; color: #fff; }
.status-btn.active.lido       { background: var(--accent-dark); border-color: var(--accent); color: #fff; }
.status-btn.active.abandonado { background: #37474F; border-color: #78909C; color: #fff; }
.status-btn.active.favorito   { background: #880E4F; border-color: #F06292; color: #fff; }

/* ============================================================
   STAR RATING
   ============================================================ */
.star-rating { display: flex; gap: 2px; }
.star-rating .star {
  font-size: 1.1rem;
  color: var(--text-light);
  cursor: default;
  transition: color var(--t);
}
.star-rating .star.filled { color: #FFC107; }
.star-rating.interactive .star { cursor: pointer; }
.star-rating.interactive .star:hover,
.star-rating.interactive .star.hover { color: #FFD54F; }

/* ============================================================
   BOOK CARDS
   ============================================================ */
.books-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 16px;
}

.book-card {
  background: var(--surface);
  border-radius: var(--r-lg);
  overflow: hidden;
  cursor: pointer;
  transition: background var(--t), transform var(--t2);
  cursor: pointer;
  text-decoration: none;
  color: var(--text);
  position: relative;
  display: flex;
  flex-direction: column;
}
.book-card:hover {
  background: var(--surface-2);
  transform: translateY(-2px);
}

.book-cover-wrap {
  position: relative;
  aspect-ratio: 2/3;
  overflow: hidden;
  background: var(--surface-2);
  border-radius: var(--r-md) var(--r-md) 0 0;
}
.book-cover-wrap img {
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: var(--r-md) var(--r-md) 0 0;
  transition: transform .3s ease;
}
.book-card:hover .book-cover-wrap img { transform: scale(1.04); }

.book-cover-placeholder {
  width: 100%; height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px;
  background: linear-gradient(145deg, var(--surface-2) 0%, #1a1a2e 100%);
  gap: 8px;
}
.book-cover-placeholder .cover-icon { font-size: 2.5rem; opacity: .6; }
.book-cover-placeholder span:last-child {
  font-size: .7rem;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.3;
  word-break: break-word;
}

/* Status badge on card */
.book-status-badge {
  position: absolute;
  top: 8px; left: 8px;
  padding: 3px 8px;
  border-radius: var(--r-full);
  font-size: .62rem;
  font-weight: 700;
  letter-spacing: .03em;
  backdrop-filter: blur(8px);
}
.status-lendo      { background: rgba(33,150,243,.85);  color: #fff; }
.status-lido       { background: rgba(29,185,84,.85);   color: #000; }
.status-quero_ler  { background: rgba(156,39,176,.85);  color: #fff; }
.status-abandonado { background: rgba(97,97,97,.85);    color: #fff; }
.status-favorito   { background: rgba(233,30,140,.85);  color: #fff; }

/* Card actions overlay */
.book-card-actions {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.75);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  opacity: 0;
  transition: opacity var(--t2);
  border-radius: var(--r-md) var(--r-md) 0 0;
}
.book-card:hover .book-card-actions { opacity: 1; }

/* Card info */
.book-info {
  padding: 10px 12px 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.book-title {
  font-size: .82rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.book-author {
  font-size: .72rem;
  color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.book-card-rating { margin-top: 4px; }
.book-card-rating .star { font-size: .85rem; }

/* List view */
.books-list { display: flex; flex-direction: column; gap: 8px; }
.books-list .book-card {
  flex-direction: row;
  align-items: center;
  border-radius: var(--r-md);
}
.books-list .book-cover-wrap {
  width: 48px;
  aspect-ratio: 2/3;
  border-radius: var(--r-sm) 0 0 var(--r-sm);
  flex-shrink: 0;
}
.books-list .book-cover-wrap img { border-radius: var(--r-sm) 0 0 var(--r-sm); }
.books-list .book-info { flex-direction: row; align-items: center; gap: 12px; flex: 1; }
.books-list .book-card-actions { border-radius: var(--r-sm) 0 0 var(--r-sm); }

@media (max-width: 640px) {
  .book-card-remove-btn { display: none !important; }
}

/* ============================================================
   BOOK DETAIL (book.php)
   ============================================================ */
.book-detail {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 32px;
  align-items: start;
  min-width: 0;
  overflow: hidden;
}

.book-detail-cover {
  position: sticky;
  top: calc(var(--header-h) + 20px);
}

.book-detail-cover img,
.book-detail-cover .book-cover-placeholder {
  width: 100%;
  aspect-ratio: 2/3;
  object-fit: cover;
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
}

.book-detail-info h1 {
  font-size: 1.75rem;
  font-weight: 800;
  margin-bottom: 8px;
  letter-spacing: -.02em;
}

.book-detail-author {
  font-size: 1rem;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 16px;
}

.book-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
}

.book-meta-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: .8rem;
  color: var(--text-muted);
  background: var(--surface-2);
  padding: 4px 12px;
  border-radius: var(--r-full);
}
.book-meta-item strong { color: var(--text); }

.book-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 24px;
}

.book-description {
  font-size: .9rem;
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 20px;
}

.spec-label { font-weight: 700; }

/* Notification badge */
.notif-bell-btn { position: relative; }
.notif-badge {
  position: absolute; top: -3px; right: -3px;
  background: #E91E8C; color: #fff;
  font-size: .6rem; font-weight: 800;
  min-width: 16px; height: 16px;
  border-radius: 999px; padding: 0 3px;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none; line-height: 1;
}

/* ── Notification panel ── */
.notif-wrapper { position: relative; }
.notif-panel {
  display: none;
  position: absolute; top: calc(100% + 10px); right: -8px;
  width: 340px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-sm); box-shadow: 0 8px 40px rgba(0,0,0,.5);
  z-index: 10000; flex-direction: column;
  overflow: hidden;
}
.notif-panel.is-open { display: flex; }
.notif-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  font-size: .85rem; font-weight: 700;
  flex-shrink: 0;
}
.notif-panel-list {
  max-height: 360px; overflow-y: auto;
  overscroll-behavior: contain;
}
.notif-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  transition: background .12s;
  color: inherit; text-decoration: none;
}
.notif-item:last-child { border-bottom: none; }
.notif-item.unread { background: rgba(29,185,84,.06); }
.notif-item-link { cursor: pointer; }
.notif-item-link:hover { background: var(--surface-2); }
.notif-item-icon {
  font-size: 1.1rem; flex-shrink: 0; margin-top: 1px;
}
.notif-item-body { flex: 1; min-width: 0; }
.notif-item-msg {
  font-size: .82rem; line-height: 1.4;
  color: var(--text);
  word-break: break-word;
}
.notif-item-time {
  font-size: .72rem; color: var(--text-muted); margin-top: 2px;
}
.notif-empty {
  padding: 24px 16px; text-align: center;
  font-size: .83rem; color: var(--text-muted);
}
.notif-panel-footer {
  padding: 10px 16px; border-top: 1px solid var(--border);
  text-align: center; font-size: .8rem; flex-shrink: 0;
}
.notif-panel-footer a { color: var(--accent); text-decoration: none; }
@media (max-width: 520px) {
  .notif-panel {
    width: calc(100vw - 16px);
    right: -4px;
  }
}

/* ── Comment replies & mentions ── */
.comment-reply-btn {
  background: none; border: none; cursor: pointer; padding: 2px 6px;
  font-size: .75rem; color: var(--text-muted); font-family: inherit;
  border-radius: var(--r-xs); transition: color .15s;
}
.comment-reply-btn:hover { color: var(--accent); }
.comment-reply-banner {
  display: flex; align-items: center; gap: 8px;
  background: rgba(29,185,84,.08); border-left: 3px solid var(--accent);
  padding: 6px 10px; border-radius: 0 var(--r-xs) var(--r-xs) 0;
  font-size: .8rem; color: var(--text-muted); margin-bottom: 6px;
}
.comment-reply-banner button {
  background: none; border: none; cursor: pointer; font-size: .8rem;
  color: var(--text-muted); margin-left: auto; padding: 0 4px;
}
.comment-reply-badge {
  font-size: .75rem; color: var(--accent); margin-bottom: 4px;
  display: flex; align-items: center; gap: 4px;
}
.comment-nested { margin-left: 36px; }
.comment-highlight {
  animation: comment-flash 3s ease forwards;
}
@keyframes comment-flash {
  0%   { background: rgba(29,185,84,.25); border-radius: var(--r-sm); }
  60%  { background: rgba(29,185,84,.12); }
  100% { background: transparent; }
}
.mention-highlight { color: var(--accent); font-weight: 600; }

/* @mention autocomplete dropdown */
.mention-dropdown {
  position: absolute; z-index: 1000;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-xs); box-shadow: 0 4px 16px rgba(0,0,0,.3);
  min-width: 200px; max-height: 180px; overflow-y: auto;
}
.mention-option {
  padding: 8px 12px; cursor: pointer; font-size: .85rem;
  transition: background .1s; display: flex; align-items: center; gap: 8px;
}
.mention-option:hover { background: var(--surface-2); }
.mention-option-avatar {
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--accent); color: #000;
  display: flex; align-items: center; justify-content: center;
  font-size: .7rem; font-weight: 700; flex-shrink: 0;
}

/* ============================================================
   SECTION CARD
   ============================================================ */
.section-card {
  background: var(--surface);
  border-radius: var(--r-xl);
  padding: 24px;
  margin-bottom: 20px;
}

.section-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  gap: 12px;
}

.section-card-header h3 {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -.01em;
}

/* ============================================================
   STATS GRID (dashboard)
   ============================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  border-radius: var(--r-xl);
  padding: 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: background var(--t), transform var(--t2);
}
.stat-card:hover { background: var(--surface-2); }

.stat-card-link {
  text-decoration: none;
  color: var(--text);
  cursor: pointer;
}
.stat-card-link:hover {
  background: var(--surface-2);
  transform: translateY(-2px);
  color: var(--text);
}

.stat-card.pink   { border-top: 3px solid #E91E8C; }
.stat-card.green  { border-top: 3px solid var(--accent); }
.stat-card.blue   { border-top: 3px solid #2196F3; }
.stat-card.purple { border-top: 3px solid #9C27B0; }
.stat-card.orange { border-top: 3px solid #FF9800; }

.stat-icon  { font-size: 1.5rem; margin-bottom: 2px; }
.stat-value { font-size: 2rem; font-weight: 800; letter-spacing: -.03em; color: var(--text); }
.stat-label { font-size: .78rem; color: var(--text-muted); font-weight: 500; text-transform: uppercase; letter-spacing: .04em; }

/* ============================================================
   GOAL CARD
   ============================================================ */
.goal-card {
  background: var(--surface);
  border-radius: var(--r-xl);
  padding: 24px;
  margin-bottom: 24px;
}

.goal-numbers {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 12px;
}

.goal-current { font-size: 2.5rem; font-weight: 800; letter-spacing: -.04em; color: var(--accent); }
.goal-target  { font-size: .9rem; color: var(--text-muted); }

.progress-bar-wrap {
  background: var(--surface-2);
  border-radius: var(--r-full);
  height: 8px;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-bar {
  height: 100%;
  border-radius: var(--r-full);
  transition: width .5s ease;
}
.progress-bar.green { background: var(--accent); }

.goal-percent { font-size: .8rem; color: var(--text-muted); font-weight: 500; }

/* ============================================================
   CHART CONTAINER
   ============================================================ */
.chart-container { position: relative; width: 100%; }

/* ============================================================
   MODALS
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.8);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  visibility: hidden;
}
.modal-overlay.open { visibility: visible; }

.modal {
  background: var(--surface);
  border-radius: var(--r-xl);
  max-width: 640px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 28px;
  box-shadow: var(--shadow-xl);
  position: relative;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 12px;
}

.modal-title { font-size: 1.15rem; font-weight: 700; letter-spacing: -.01em; }

.modal-close {
  background: none;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px 8px;
  border-radius: var(--r-sm);
  transition: color var(--t), background var(--t);
  flex-shrink: 0;
}
.modal-close:hover { color: var(--text); background: var(--surface-2); }

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* ============================================================
   TOAST NOTIFICATIONS
   ============================================================ */
.toast-container {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: var(--surface-2);
  border: 1px solid var(--border-dark);
  border-radius: var(--r-lg);
  padding: 14px 18px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: .875rem;
  max-width: 360px;
  animation: toastIn .25s ease;
  color: var(--text);
}
.toast.success { border-left: 3px solid var(--accent); }
.toast.error   { border-left: 3px solid #f87171; }
.toast.info    { border-left: 3px solid #60a5fa; }

.toast-dismiss {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: .85rem;
  padding: 4px 6px; border-radius: var(--r-xs);
  flex-shrink: 0; line-height: 1;
  transition: color var(--t);
}
.toast-dismiss:hover { color: var(--text); }

.toast-body { flex: 1; min-width: 0; }
.toast-title { font-weight: 600; }
.toast-msg   { font-size: .8rem; color: var(--text-muted); margin-top: 2px; }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes toastOut {
  from { opacity: 1; transform: translateY(0);    max-height: 80px; margin-bottom: 0; }
  to   { opacity: 0; transform: translateY(16px); max-height: 0;    margin-bottom: -10px; }
}
.toast.out {
  animation: toastOut .25s ease forwards;
  pointer-events: none;
}

/* ============================================================
   CATALOG CONTROLS
   ============================================================ */
.catalog-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
  align-items: center;
}

.catalog-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-2);
  border: 1.5px solid var(--border-dark);
  border-radius: var(--r-full);
  padding: 0 16px;
  flex: 1;
  min-width: 200px;
  transition: border-color var(--t);
}
.catalog-search:focus-within { border-color: var(--accent); }

.search-icon { font-size: .9rem; color: var(--text-muted); flex-shrink: 0; }

.catalog-search input {
  border: none;
  background: transparent;
  padding: 10px 0;
  font-size: .875rem;
  color: var(--text);
  width: 100%;
  outline: none;
  font-family: var(--font-body);
}
.catalog-search input::placeholder { color: var(--text-light); }

.filter-select {
  padding: 10px 32px 10px 14px;
  border: 1.5px solid var(--border-dark);
  border-radius: var(--r-full);
  background: var(--surface-2);
  color: var(--text);
  font-size: .825rem;
  font-family: var(--font-body);
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%23B3B3B3' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  appearance: none;
  transition: border-color var(--t);
}
.filter-select:focus { outline: none; border-color: var(--accent); }
.filter-select option { background: var(--surface-2); }

.view-toggle {
  display: flex;
  gap: 2px;
  background: var(--surface-2);
  border-radius: var(--r-full);
  padding: 3px;
}

.view-btn {
  background: none;
  border: none;
  padding: 6px 10px;
  border-radius: var(--r-full);
  cursor: pointer;
  color: var(--text-muted);
  font-size: 1rem;
  transition: background var(--t), color var(--t);
}
.view-btn.active, .view-btn:hover { background: var(--elevated); color: var(--text); }

/* ============================================================
   FILTER CHIPS
   ============================================================ */
.tags-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 16px;
  border-radius: var(--r-full);
  font-size: .78rem;
  font-weight: 600;
  cursor: pointer;
  border: 1.5px solid var(--border-dark);
  background: var(--surface-2);
  color: var(--text-muted);
  transition: all var(--t);
  user-select: none;
  white-space: nowrap;
}
.filter-chip:hover { border-color: var(--text); color: var(--text); background: rgba(255,255,255,.07); }
.filter-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #000;
  font-weight: 700;
}

/* Generic tag */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--r-full);
  font-size: .72rem;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--text-muted);
  border: 1px solid var(--border-dark);
}

/* ============================================================
   AUTH PAGE
   ============================================================ */
body.auth-page {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
}

.auth-hero {
  flex: 1;
  background: linear-gradient(145deg, #0a0a0a 0%, #111111 40%, #0d2818 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
  min-height: 100vh;
}

.auth-hero-content { max-width: 400px; }
.auth-hero-books   { font-size: 4rem; margin-bottom: 20px; }

.auth-hero-logo {
  font-family: var(--font-title);
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -.04em;
  margin-bottom: 12px;
  color: var(--text);
}

.auth-hero-tagline {
  font-size: 1.05rem;
  color: var(--text-muted);
  margin-bottom: 32px;
  line-height: 1.6;
}

.auth-hero-features { display: flex; flex-direction: column; gap: 14px; }

.auth-feature {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: .9rem;
}

.auth-feature-icon {
  width: 36px; height: 36px;
  background: rgba(29,185,84,.15);
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.auth-panel {
  width: 420px;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 40px;
  min-height: 100vh;
  overflow-y: auto;
}

.auth-panel-inner { width: 100%; max-width: 340px; }

.auth-tabs {
  display: flex;
  background: var(--surface-2);
  border-radius: var(--r-full);
  padding: 4px;
  margin-bottom: 24px;
  gap: 4px;
}

.auth-tab {
  flex: 1;
  padding: 9px 16px;
  border: none;
  background: transparent;
  border-radius: var(--r-full);
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-muted);
  font-family: var(--font-body);
  transition: background var(--t), color var(--t);
}
.auth-tab.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.auth-divider {
  text-align: center;
  font-size: .75rem;
  color: var(--text-light);
  margin: 16px 0;
  position: relative;
}
.auth-divider::before, .auth-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 38%; height: 1px;
  background: var(--border-dark);
}
.auth-divider::before { left: 0; }
.auth-divider::after  { right: 0; }

.auth-links { text-align: center; }

.auth-card {
  background: var(--surface);
  border-radius: var(--r-xl);
  padding: 28px;
  width: 100%;
}
.auth-title {
  font-family: var(--font-title);
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 20px;
}

/* ============================================================
   PROFILE
   ============================================================ */
.profile-hero {
  background: linear-gradient(135deg, rgba(29,185,84,.2), rgba(33,150,243,.15));
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 32px;
  display: flex;
  align-items: center;
  gap: 24px;
  margin-bottom: 28px;
}

.profile-avatar-lg {
  width: 88px; height: 88px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface-2);
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem; font-weight: 800;
  flex-shrink: 0;
  border: 3px solid var(--accent);
  overflow: hidden;
  color: var(--text);
}

.profile-hero-info h2 { font-size: 1.4rem; font-weight: 800; }
.profile-hero-stats   { display: flex; gap: 24px; margin-top: 10px; flex-wrap: wrap; }
.profile-hero-stat    { font-size: .85rem; color: var(--text-muted); }
.profile-hero-stat strong { font-weight: 700; display: block; font-size: 1.1rem; color: var(--text); }

/* ============================================================
   HISTORY / ACTIVITY FEED
   ============================================================ */
.activity-feed { display: flex; flex-direction: column; }

.activity-item {
  display: flex;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.activity-item:last-child { border-bottom: none; }

.activity-icon {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--surface-2);
  display: flex; align-items: center; justify-content: center;
  font-size: .9rem;
  flex-shrink: 0;
}
.activity-text { flex: 1; }
.activity-text strong { font-size: .88rem; font-weight: 600; }
.activity-text p { font-size: .8rem; color: var(--text-muted); margin-top: 2px; }
.activity-time { font-size: .72rem; color: var(--text-light); margin-top: 3px; }

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin-top: 32px;
}

.page-btn {
  width: 36px; height: 36px;
  border-radius: var(--r-full);
  border: 1.5px solid var(--border-dark);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  font-size: .85rem;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--t);
  font-family: var(--font-body);
}
.page-btn:hover    { border-color: var(--text); color: var(--text); }
.page-btn.active   { background: var(--accent); border-color: var(--accent); color: #000; font-weight: 700; }
.page-btn:disabled { opacity: .3; cursor: not-allowed; }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-muted);
}
.empty-state-icon { font-size: 3.5rem; margin-bottom: 16px; opacity: .4; }
.empty-state h3   { font-size: 1.2rem; font-weight: 700; margin-bottom: 8px; color: var(--text); }
.empty-state p    { font-size: .9rem; max-width: 300px; margin: 0 auto 20px; color: var(--text-muted); }

/* ============================================================
   SKELETON LOADER
   ============================================================ */
@keyframes shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position:  400px 0; }
}
.skeleton {
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 50%, var(--surface) 75%);
  background-size: 800px 100%;
  animation: shimmer 1.4s infinite linear;
  border-radius: var(--r-xs);
}
.skeleton-book-card { border-radius: var(--r-lg); overflow: hidden; background: var(--surface); }
.skeleton-cover     { aspect-ratio: 2/3; }
.skeleton-text      { height: 14px; margin: 8px 12px 4px; }
.skeleton-text.short { width: 60%; }

/* ============================================================
   UTILITIES
   ============================================================ */
.flex           { display: flex; }
.flex-col       { flex-direction: column; }
.items-center   { align-items: center; }
.justify-between{ justify-content: space-between; }
.gap-2          { gap: 8px; }
.gap-3          { gap: 12px; }
.gap-4          { gap: 16px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.text-muted  { color: var(--text-muted); }
.text-sm     { font-size: .82rem; }
.text-xs     { font-size: .75rem; }
.font-medium { font-weight: 500; }
.font-bold   { font-weight: 700; }
.truncate    { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rounded-full { border-radius: var(--r-full); }
.w-full      { width: 100%; }
.hidden      { display: none !important; }
.sr-only     { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.fade-in     { animation: fadeIn .4s ease; }
@keyframes fadeIn { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:translateY(0); } }

/* ============================================================
   RESPONSIVE — Tablet
   ============================================================ */
@media (max-width: 1024px) {
  .book-detail { grid-template-columns: 200px 1fr; gap: 24px; }
  .books-grid  { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}

/* ============================================================
   BOTTOM NAV — mobile only (ALWAYS hidden on desktop)
   ============================================================ */
.bottom-nav { display: none !important; }

/* ============================================================
   RESPONSIVE — Mobile ≤ 768px
   ============================================================ */
@media (max-width: 768px) {
  :root {
    --sidebar-w:    0px;
    --bottom-nav-h: 66px;
  }

  .sidebar {
    transform: translateX(-260px);
    width: 260px;
    box-shadow: var(--shadow-xl);
    z-index: 300;
  }
  .sidebar.open { transform: translateX(0); }

  .main-content {
    margin-left: 0;
    padding-bottom: var(--bottom-nav-h);
  }

  .hamburger { display: flex; align-items: center; justify-content: center; }
  .top-header   { padding: 0 16px; gap: 10px; height: 58px; }
  .header-title { font-size: 1.1rem; font-weight: 800; letter-spacing: -.01em; }
  .breadcrumb-bar { display: none; }
  .page-content { padding: 16px; }

  /* Mobile typography improvements */
  .stat-value  { font-size: 2.2rem; }
  .stat-label  { font-size: .82rem; }
  .book-title  { font-size: .88rem; }
  .book-author { font-size: .76rem; }
  .section-card-header h3 { font-size: 1.1rem; }

  .auth-hero  { display: none; }
  .auth-panel { width: 100%; padding: 32px 24px; }

  .book-detail { grid-template-columns: 1fr; }
  /* Coluna esquerda ocupa largura total; só a imagem é centralizada e limitada */
  .book-detail-cover {
    position: static;
    width: 100%;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
  }
  .book-detail-cover > img,
  .book-detail-cover > .book-cover-empty {
    max-width: 160px;
    width: 100%;
  }
  /* Controles (status, avaliação, botões) ficam full-width */
  .book-detail-cover > div {
    width: 100%;
  }
  .book-detail-cover .status-selector {
    flex-direction: row !important;
    flex-wrap: wrap;
    gap: 6px;
  }
  .book-detail-cover .status-btn {
    flex: 1 1 auto;
    min-width: 0;
    font-size: .78rem;
    padding: 8px 6px;
    justify-content: center !important;
    text-align: center !important;
  }
  /* Botões de ação do livro ocupam largura total em mobile */
  .book-detail-cover .btn {
    width: 100%;
    white-space: normal;
    text-align: center;
  }
  .book-detail-cover > div.rs-total-time {
    text-align: center;
  }

  .form-row { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .books-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; }

  /* Modal: bottom-sheet que para acima do nav */
  .modal-overlay {
    align-items: flex-end;
    padding: 0 0 var(--bottom-nav-h) 0;
  }
  .modal {
    padding: 24px 20px 0;
    border-radius: var(--r-xl) var(--r-xl) 0 0;
    max-height: calc(92vh - var(--bottom-nav-h));
    width: 100%;
    display: flex;
    flex-direction: column;
  }
  /* Área scrollável dentro do modal */
  .modal > form,
  .modal > .modal-scroll-body {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 8px;
  }
  /* Footer sempre visível no fundo do modal */
  .modal-footer {
    position: sticky;
    bottom: 0;
    background: var(--surface);
    margin-top: 0;
    padding: 14px 0 18px;
    border-top: 1px solid var(--border);
    z-index: 1;
    flex-shrink: 0;
  }
  /* Página: garante espaço abaixo do último elemento */
  .page-content {
    padding-bottom: calc(var(--bottom-nav-h) + 20px);
  }

  .profile-hero { flex-direction: column; text-align: center; padding: 24px; }
  .profile-hero-stats { justify-content: center; }

  .toast-container { bottom: calc(var(--bottom-nav-h) + 12px); right: 16px; left: 16px; }
  .toast { max-width: none; cursor: pointer; }
  .toast-dismiss { display: none; }
  @keyframes toastIn {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
  }

  /* Catalog controls empilham verticalmente */
  .catalog-controls { flex-direction: column; align-items: stretch; }
  .catalog-search   { min-width: unset; }
  .filter-select    { width: 100%; }

  /* Cabeçalho de página mais compacto */
  .page-header-block { margin-bottom: 20px; }

  /* Cards com padding reduzido */
  .section-card { padding: 16px; }

  /* Tabela/lista de livros: toque mais fácil */
  .book-list-item { padding: 12px; }

  .sidebar-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.6);
    z-index: 299;
    display: none;
  }
  .sidebar-overlay.open { display: block; }

  /* Bottom Nav — Spotify-style */
  .bottom-nav {
    display: flex !important;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: var(--bottom-nav-h);
    background: #0a0a0a;
    border-top: 1px solid rgba(255,255,255,.08);
    z-index: 9999;
    align-items: stretch;
    box-shadow: 0 -2px 24px rgba(0,0,0,.9);
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  .bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px 4px;
    color: #6a6a6a;
    text-decoration: none;
    font-size: .65rem;
    font-weight: 600;
    letter-spacing: .02em;
    transition: color var(--t);
    cursor: pointer;
    border: none;
    background: none;
    -webkit-tap-highlight-color: transparent;
    text-transform: uppercase;
  }
  .bottom-nav-item:active { background: rgba(255,255,255,.04); }
  .bottom-nav-item.active { color: #fff; }
  .bottom-nav-item.active .bottom-nav-icon { stroke: #fff; }

  .bottom-nav-icon {
    width: 24px; height: 24px;
    display: block;
    stroke: #6a6a6a;
    transition: stroke var(--t);
    flex-shrink: 0;
  }

  .bottom-nav-label { display: block; line-height: 1; }

  .bottom-nav-fab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: none;
    background: none;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
  }

  .bottom-nav-fab-inner {
    width: 50px; height: 50px;
    border-radius: 50%;
    background: var(--accent);
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 20px rgba(29,185,84,.5);
    transition: transform var(--t), box-shadow var(--t);
    margin-top: -16px;
    border: 3px solid #0a0a0a;
  }
  .bottom-nav-fab:active .bottom-nav-fab-inner { transform: scale(.92); box-shadow: 0 2px 10px rgba(29,185,84,.3); }
  .bottom-nav-fab-inner svg { stroke: #000; }

  /* FAB lateral oculto no mobile — substituído pelo botão central do bottom nav */
  .fab { display: none !important; }
}

@media (max-width: 480px) {
  .stats-grid       { grid-template-columns: repeat(2, 1fr); }
  .books-grid       { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .catalog-controls { gap: 6px; flex-direction: column; }
  .catalog-search   { min-width: unset; width: 100%; }
  .filter-select    { font-size: .8rem; padding: 8px 10px; width: 100%; }
  .page-content     { padding: 10px; }
  .section-card     { padding: 14px; }
  .modal            { padding: 20px 16px; }
  .stat-value       { font-size: 1.9rem; }
  .book-title       { font-size: .82rem; }
  .book-author      { font-size: .72rem; }
}

/* ============================================================
   SCROLLBAR custom (WebKit)
   ============================================================ */
::-webkit-scrollbar       { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-dark); border-radius: var(--r-full); }
::-webkit-scrollbar-thumb:hover { background: var(--text-light); }

/* ============================================================
   FAB (Floating Action Button)
   ============================================================ */
.fab {
  position: fixed;
  bottom: 28px; right: 28px;
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(29,185,84,.4);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
  color: #000;
  transition: transform var(--t), box-shadow var(--t), background var(--t);
  z-index: 500;
}
.fab:hover { transform: scale(1.1) rotate(90deg); background: var(--accent-hover); }

/* ============================================================
   DIVIDERS
   ============================================================ */
.divider { height: 1px; background: var(--border); margin: 20px 0; }

/* ============================================================
   ISBN SCANNER
   ============================================================ */
.isbn-input-wrap { display: flex; gap: 8px; align-items: stretch; }
.isbn-input-wrap .form-control { flex: 1; min-width: 0; }

.isbn-scan-btn {
  display: inline-flex; align-items: center; gap: 6px;
  white-space: nowrap; flex-shrink: 0;
  padding: 0 14px; font-size: .85rem;
}
.isbn-scan-btn svg { flex-shrink: 0; }

#isbn-scanner-wrap {
  background: var(--surface-2);
  border: 1px solid var(--border-dark);
  border-radius: var(--r-md);
  padding: 12px; overflow: hidden;
}
#isbn-scanner-box video {
  border-radius: var(--r-sm);
  width: 100% !important;
  max-height: 240px; object-fit: cover;
}
#isbn-scanner-box img { display: none !important; }
#isbn-scanner-status  { font-size: .8rem; color: var(--text-muted); }

/* ============================================================
   DONATION FOOTER
   ============================================================ */
.donation-footer {
  background: #000;
  border-top: 1px solid var(--border);
  padding: 14px 24px;
  margin-top: auto;
}

.donation-footer-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; max-width: 900px; margin: 0 auto; flex-wrap: wrap;
}

.donation-text {
  display: flex; align-items: center; gap: 8px;
  font-size: .82rem; color: var(--text-muted);
  flex: 1; min-width: 0;
}

.donation-heart { color: #E91E8C; font-size: 1rem; flex-shrink: 0; }

.btn-pix {
  display: inline-flex; align-items: center; gap: 7px;
  background: #32bcad; color: #fff;
  border: none; border-radius: var(--r-full);
  padding: 8px 18px; font-size: .83rem; font-weight: 700;
  cursor: pointer; white-space: nowrap; flex-shrink: 0;
  transition: background var(--t), transform var(--t);
  font-family: var(--font-body);
}
.btn-pix:hover  { background: #27a99b; transform: translateY(-1px); }
.btn-pix:active { transform: translateY(0); }

.pix-inline-link { color: #27a99b; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.pix-inline-link:hover { color: #1ed7c8; }

.pix-key-box {
  background: var(--surface-2);
  border: 1px dashed var(--border-dark);
  border-radius: var(--r-md); padding: 16px;
  display: flex; flex-direction: column; gap: 4px;
}
.pix-key-label { font-size: .72rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.pix-key-value { font-size: 1.25rem; font-weight: 700; color: var(--text); letter-spacing: .06em; }

@media (max-width: 600px) {
  .donation-footer { padding: 12px 16px; }
  .donation-footer-inner { flex-direction: column; align-items: flex-start; gap: 10px; }
  .btn-pix { width: 100%; justify-content: center; }
}

/* ============================================================
   CATALOG TABS
   ============================================================ */
.catalog-tabs {
  display: flex; gap: 4px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.catalog-tab {
  background: none; border: none;
  border-bottom: 2px solid transparent;
  padding: 12px 20px;
  font-size: .875rem; font-weight: 600;
  cursor: pointer; color: var(--text-muted);
  margin-bottom: -1px;
  transition: color var(--t), border-color var(--t);
  font-family: var(--font-body); letter-spacing: .02em;
}
.catalog-tab:hover { color: var(--text); }
.catalog-tab.active { color: var(--text); border-bottom-color: var(--accent); }

/* ============================================================
   LITERARY CALCULATOR
   ============================================================ */
.calc-result-box {
  display: flex; flex-wrap: wrap; gap: 12px;
  background: var(--surface-2); border-radius: var(--r-lg);
  padding: 16px; margin-top: 12px;
}
.calc-stat {
  display: flex; flex-direction: column; align-items: center;
  background: var(--surface); border-radius: var(--r-md);
  padding: 10px 16px; min-width: 100px; flex: 1; text-align: center;
}
.calc-stat-val   { font-size: 1.3rem; font-weight: 800; color: var(--text); line-height: 1.2; }
.calc-stat-label { font-size: .72rem; color: var(--text-muted); margin-top: 4px; text-transform: uppercase; letter-spacing: .04em; }
.calc-highlight  { background: rgba(29,185,84,.15); border: 1px solid rgba(29,185,84,.3); }
.calc-highlight .calc-stat-val { color: var(--accent); }

/* ============================================================
   STATUS BUTTONS — SAVING / DONE FEEDBACK
   ============================================================ */
@keyframes status-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: .55; }
}
.status-saving { animation: status-pulse .7s ease-in-out infinite; pointer-events: none; cursor: wait; }
.status-done   { outline: 2.5px solid var(--accent); outline-offset: 1px; }

/* ============================================================
   TAG INPUT
   ============================================================ */
.tag-input-wrap { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.tag-input-wrap .form-control { flex: 1; }

/* Tag suggestions (existing tags below input) */
.tag-suggestions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; align-items: center; }
.tag-suggest-label { font-size: .72rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
.tag-suggest {
  display: inline-flex; align-items: center;
  background: var(--surface-2, var(--surface));
  border: 1.5px dashed var(--border);
  color: var(--text-muted);
  border-radius: var(--r-full);
  padding: 2px 10px;
  font-size: .75rem;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.tag-suggest:hover {
  background: rgba(29,185,84,.12);
  border-color: var(--accent);
  color: var(--accent);
}

/* ============================================================
   CALCULATOR SLIDER
   ============================================================ */
.calc-slider-row { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.calc-slider-row input[type="range"] { flex: 1; accent-color: var(--accent); }

/* ============================================================
   FEEDBACK SECTION
   ============================================================ */
.feedback-section { background: #000; border-top: 1px solid var(--border); padding: 24px 32px; }
.feedback-inner   { max-width: 680px; margin: 0 auto; }
.feedback-header  { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.feedback-icon    { font-size: 1.5rem; line-height: 1; margin-top: 2px; }
.feedback-title   { font-weight: 700; font-size: .95rem; color: var(--text); }
.feedback-sub     { font-size: .8rem; color: var(--text-muted); margin-top: 2px; }
.feedback-form    { display: flex; flex-direction: column; gap: 8px; }

.feedback-textarea {
  width: 100%;
  border: 1.5px solid var(--border-dark);
  border-radius: var(--r-md);
  padding: 10px 14px;
  font-family: var(--font-body); font-size: .88rem;
  color: var(--text); background: var(--surface-2);
  resize: vertical; min-height: 80px;
  transition: border-color var(--t); box-sizing: border-box;
}
.feedback-textarea:focus { outline: none; border-color: var(--accent); }

.feedback-footer-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.feedback-char   { font-size: .75rem; color: var(--text-muted); }
.feedback-status { font-size: .82rem; min-height: 18px; }
.feedback-status.success { color: var(--accent); }
.feedback-status.error   { color: #f87171; }

@media (max-width: 600px) {
  .feedback-section { padding: 20px 16px; }
}

/* ============================================================
   READING GOAL CALCULATOR
   ============================================================ */
.rdcalc-wrap {
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.rdcalc-card {
  background: var(--surface);
  border-radius: var(--r-xl);
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.rdcalc-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.rdcalc-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.rdcalc-label {
  font-size: .78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.rdcalc-optional {
  text-transform: none;
  font-weight: 400;
  font-size: .72rem;
  color: var(--text-light);
}

.rdcalc-error {
  font-size: .84rem;
  color: #f87171;
  min-height: 18px;
}

/* Results */
.rdcalc-results {
  background: var(--surface);
  border-radius: var(--r-xl);
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  animation: fadeIn .35s ease;
}

.rdcalc-headline {
  text-align: center;
  font-size: .9rem;
  color: var(--text-muted);
  font-weight: 500;
}

.rdcalc-stats {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.rdcalc-stat {
  flex: 1;
  background: var(--surface-2);
  border-radius: var(--r-lg);
  padding: 20px 12px;
  text-align: center;
  min-width: 0;
  transition: background var(--t);
}

.rdcalc-stat--accent {
  background: rgba(29,185,84,.12);
  border: 1px solid rgba(29,185,84,.25);
}

.rdcalc-stat-value {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -.04em;
  line-height: 1;
}

.rdcalc-stat--accent .rdcalc-stat-value {
  color: var(--accent);
}

.rdcalc-stat-label {
  font-size: .7rem;
  color: var(--text-muted);
  margin-top: 6px;
  text-transform: uppercase;
  letter-spacing: .04em;
  font-weight: 600;
}

.rdcalc-progress-card {
  background: var(--surface-2);
  border-radius: var(--r-lg);
  padding: 16px 18px;
}

.rdcalc-progress-header {
  display: flex;
  justify-content: space-between;
  font-size: .75rem;
  color: var(--text-muted);
  font-weight: 500;
}

.rdcalc-progress-footer {
  font-size: .75rem;
  color: var(--text-light);
  text-align: center;
  margin-top: 4px;
}

.rdcalc-tip {
  text-align: center;
  font-size: .88rem;
  color: var(--text-muted);
  padding: 12px 16px;
  background: var(--surface-2);
  border-radius: var(--r-lg);
  font-weight: 500;
}

@media (max-width: 480px) {
  .rdcalc-card { padding: 20px 16px; }
  .rdcalc-results { padding: 20px 16px; }
  .rdcalc-row { grid-template-columns: 1fr; }
  .rdcalc-stat-value { font-size: 1.7rem; }
}

/* ============================================================
   READING PLAN (book detail)
   ============================================================ */
.rdplan-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: var(--r-full);
  font-size: .72rem;
  font-weight: 700;
  background: rgba(29,185,84,.15);
  color: var(--accent);
  border: 1px solid rgba(29,185,84,.3);
  letter-spacing: .04em;
  text-transform: uppercase;
}

.rdplan-stats-row {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.rdplan-stat {
  flex: 1;
  min-width: 64px;
  background: var(--surface-2);
  border-radius: var(--r-lg);
  padding: 14px 10px;
  text-align: center;
}

.rdplan-stat--accent {
  background: rgba(29,185,84,.12);
  border: 1px solid rgba(29,185,84,.25);
}

.rdplan-stat-val {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -.03em;
  line-height: 1;
}

.rdplan-stat--accent .rdplan-stat-val { color: var(--accent); }

.rdplan-stat-lbl {
  font-size: .68rem;
  color: var(--text-muted);
  margin-top: 5px;
  text-transform: uppercase;
  letter-spacing: .04em;
  font-weight: 600;
}

.rdplan-deadline {
  font-size: .8rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

/* ============================================================
   SPOTIFY WRAPPED / STATS PAGE
   ============================================================ */
.wrapped-hero {
  position: relative;
  overflow: hidden;
  border-radius: var(--r-xl);
  margin-bottom: 24px;
  padding: 48px 32px;
  text-align: center;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wrapped-hero-bg {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #0d2818 0%, #1a0830 50%, #0a1628 100%);
  z-index: 0;
}
.wrapped-hero-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 30% 50%, rgba(29,185,84,.25) 0%, transparent 60%),
              radial-gradient(circle at 70% 50%, rgba(156,39,176,.2) 0%, transparent 60%);
}

.wrapped-hero-content { position: relative; z-index: 1; }

.wrapped-year {
  font-size: .85rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: .2em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.wrapped-title {
  font-size: 2.4rem;
  font-weight: 800;
  letter-spacing: -.04em;
  color: #fff;
  margin-bottom: 8px;
}

.wrapped-sub {
  font-size: .95rem;
  color: var(--text-muted);
}

/* Personality */
.wrapped-personality {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--surface);
  border-radius: var(--r-xl);
  padding: 20px 24px;
  margin-bottom: 24px;
  border-left: 4px solid var(--accent);
}

.wrapped-personality-emoji { font-size: 2.8rem; flex-shrink: 0; line-height: 1; }
.wrapped-personality-title { font-size: 1.1rem; font-weight: 800; margin-bottom: 4px; }
.wrapped-personality-desc  { font-size: .85rem; color: var(--text-muted); }

/* Stats grid */
.wrapped-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px,1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.wrapped-stat-card {
  border-radius: var(--r-xl);
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.wrapped-stat-card--green  { background: linear-gradient(135deg, #0d2818, #134d27); border: 1px solid rgba(29,185,84,.3); }
.wrapped-stat-card--blue   { background: linear-gradient(135deg, #0d1a2e, #1a3a5c); border: 1px solid rgba(33,150,243,.3); }
.wrapped-stat-card--purple { background: linear-gradient(135deg, #1a0830, #3a1060); border: 1px solid rgba(156,39,176,.3); }
.wrapped-stat-card--orange { background: linear-gradient(135deg, #2a1400, #5a2a00); border: 1px solid rgba(255,152,0,.3); }

.wrapped-stat-number {
  font-size: 2.8rem;
  font-weight: 800;
  letter-spacing: -.05em;
  color: #fff;
  line-height: 1;
}

.wrapped-stat-label {
  font-size: .78rem;
  color: rgba(255,255,255,.6);
  text-transform: uppercase;
  letter-spacing: .04em;
  font-weight: 600;
}

/* Highlights */
.wrapped-highlights {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px,1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.wrapped-highlight-card {
  background: var(--surface);
  border-radius: var(--r-xl);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: background var(--t);
}
.wrapped-highlight-card:hover { background: var(--surface-2); }

.wrapped-highlight-eyebrow {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--accent);
  font-weight: 700;
  margin-bottom: 6px;
}

.wrapped-highlight-value {
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: -.03em;
  color: var(--text);
  line-height: 1.1;
}

.wrapped-highlight-sub {
  font-size: .78rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Genres */
.wrapped-genres {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.wrapped-genre-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--r-full);
  background: rgba(255,255,255,.06);
  border: 1.5px solid var(--gc, var(--accent));
  transition: background var(--t);
}
.wrapped-genre-pill:hover { background: rgba(255,255,255,.1); }

.wrapped-genre-name  { font-size: .85rem; font-weight: 600; color: var(--text); }
.wrapped-genre-count {
  font-size: .72rem;
  font-weight: 700;
  background: var(--gc, var(--accent));
  color: #000;
  border-radius: var(--r-full);
  padding: 1px 7px;
}

/* Plan stats */
.wrapped-plan-stats {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.wrapped-plan-stat {
  flex: 1;
  min-width: 80px;
  background: var(--surface-2);
  border-radius: var(--r-lg);
  padding: 16px 12px;
  text-align: center;
}

.wrapped-plan-val { font-size: 1.8rem; font-weight: 800; color: var(--accent); letter-spacing: -.03em; }
.wrapped-plan-lbl { font-size: .7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; margin-top: 4px; font-weight: 600; }

/* Footer motivational */
.wrapped-footer-card {
  background: var(--surface);
  border-radius: var(--r-xl);
  padding: 36px;
  text-align: center;
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.wrapped-footer-emoji { font-size: 3rem; margin-bottom: 12px; }
.wrapped-footer-text  { font-size: 1.05rem; color: var(--text-muted); font-weight: 500; max-width: 400px; line-height: 1.6; }

@media (max-width: 600px) {
  .wrapped-title { font-size: 1.7rem; }
  .wrapped-stat-number { font-size: 2rem; }
  .wrapped-highlights { grid-template-columns: 1fr 1fr; }
  .wrapped-highlight-value { font-size: 1.3rem; }
  .rdplan-stats-row { gap: 8px; }
  .rdplan-stat-val { font-size: 1.3rem; }
}

/* ============================================================
   STATUS BAR COLORS
   ============================================================ */
:root {
  --status-lido:        #1DB954;
  --status-lendo:       #2196F3;
  --status-quero-ler:   #FF9800;
  --status-abandonado:  #727272;
  --status-favorito:    #E91E8C;
}
.progress-bar           { background: var(--accent); }
.progress-bar.blue      { background: var(--blue); }
.progress-bar.orange    { background: var(--orange); }
.progress-bar.purple    { background: var(--purple); }
.progress-bar.gray      { background: var(--text-light); }

/* ============================================================
   SOCIAL / AMIGOS
   ============================================================ */
.social-search-form {
  display: flex;
  gap: 10px;
  align-items: center;
}
.social-user-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.social-user-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.social-user-card:last-child { border-bottom: none; }

.social-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--accent);
  color: #000;
  font-weight: 800;
  font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.social-avatar.sm { width: 32px; height: 32px; font-size: .8rem; }

.social-user-info { flex: 1; min-width: 0; }
.social-user-name {
  font-weight: 600;
  font-size: .92rem;
  color: var(--text);
  text-decoration: none;
}
.social-user-name:hover { color: var(--accent); }
.social-user-meta { font-size: .78rem; color: var(--text-muted); margin-top: 2px; }

.badge-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #000;
  font-size: .7rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 1px 7px;
  margin-left: 6px;
}

/* Feed */
.social-feed {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.feed-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.feed-item:last-child { border-bottom: none; }
.feed-item-body { flex: 1; min-width: 0; }
.feed-item-text { font-size: .9rem; line-height: 1.5; }
.feed-book-title { color: var(--accent); font-weight: 600; }
.feed-book-title:hover { text-decoration: underline; }
.feed-rating { color: #FFB300; font-size: .85rem; }
.feed-item-meta { font-size: .75rem; color: var(--text-muted); margin-top: 4px; }
.feed-cover {
  width: 36px; height: 52px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
}

/* Comments */
.comment-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  border-radius: var(--r-md);
  transition: background .3s;
}
.comment-item:last-child { border-bottom: none; }


.comment-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text-muted);
  font-weight: 700;
  font-size: .85rem;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.comment-body { flex: 1; min-width: 0; }
.comment-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}
.comment-author {
  font-weight: 600;
  font-size: .85rem;
  color: var(--text);
  text-decoration: none;
}
.comment-author:hover { color: var(--accent); }
.comment-date { font-size: .75rem; color: var(--text-muted); }
.comment-delete {
  background: none; border: none;
  color: var(--text-light);
  cursor: pointer; font-size: .75rem;
  padding: 2px 4px;
  border-radius: 4px;
  transition: color .2s;
  margin-left: auto;
}
.comment-delete:hover { color: #f87171; }
.comment-text { font-size: .88rem; color: var(--text-muted); line-height: 1.5; }

/* ============================================================
   CLUBES DE LEITURA
   ============================================================ */

/* Cards de clube */
.club-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px;
  display: flex;
  flex-direction: column;
  transition: border-color var(--t), box-shadow var(--t);
}
.club-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}
.club-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.club-card-stats  { display: flex; gap: 12px; font-size: .8rem; color: var(--text-muted); margin-top: 10px; }

/* Badges */
.club-badge-admin {
  background: var(--accent);
  color: #000;
  font-size: .7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--r-full);
  white-space: nowrap;
  flex-shrink: 0;
}
.club-badge-overdue {
  background: #7f1d1d;
  color: #fca5a5;
  font-size: .7rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--r-full);
  white-space: nowrap;
}

/* Convite row */
.club-invite-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.club-invite-row:last-child { border-bottom: none; }

/* Livro no clube */
.club-book-card { overflow: hidden; }
.club-book-header {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}
.club-book-cover {
  width: 72px;
  height: 104px;
  border-radius: var(--r-sm);
  overflow: hidden;
  flex-shrink: 0;
  background: var(--surface-2);
}
.club-book-cover img { width: 100%; height: 100%; object-fit: cover; }
.club-book-cover-placeholder {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem;
  color: var(--text-muted);
}
.club-book-info  { min-width: 0; }
.club-my-status  { flex-shrink: 0; min-width: 140px; }

/* Goal badge */
.club-book-goal  { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.club-goal-badge {
  display: inline-flex;
  align-items: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  padding: 2px 10px;
  font-size: .78rem;
  color: var(--text-muted);
}
.club-goal-badge.overdue {
  border-color: #fca5a5;
  color: #fca5a5;
  background: #7f1d1d30;
}

/* Status dos membros */
.club-members-status {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.club-member-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  cursor: default;
}
.club-member-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid #444;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .85rem;
  color: var(--text);
  overflow: hidden;
  transition: border-color var(--t);
}
.club-member-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* Seção de comentários */
.club-comments-section {
  margin-top: 20px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}
.club-comments-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 0;
  font-family: inherit;
  transition: color var(--t);
}
.club-comments-toggle:hover { color: var(--accent); }
.comments-count {
  background: var(--surface-2);
  border-radius: var(--r-full);
  padding: 1px 8px;
  font-size: .75rem;
}
.club-comments-body { padding-top: 12px; }
.club-comments-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.club-comment {
  background: var(--surface-2);
  border-radius: var(--r-md);
  padding: 12px;
}
.club-comment-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.club-comment-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .8rem;
  flex-shrink: 0;
  overflow: hidden;
}
.club-comment-avatar img { width: 100%; height: 100%; object-fit: cover; }
.club-comment-text {
  font-size: .85rem;
  color: var(--text-muted);
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}
.club-add-comment { border-top: 1px solid var(--border); padding-top: 12px; }

/* Gerenciar livros da lista */
.manage-book-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  transition: background var(--t);
}
.manage-book-row:last-child { border-bottom: none; }
.manage-book-row:hover { background: var(--surface-2); }
.manage-book-cover {
  width: 36px;
  height: 52px;
  border-radius: var(--r-xs);
  object-fit: cover;
  flex-shrink: 0;
}
.manage-book-cover-placeholder {
  width: 36px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  border-radius: var(--r-xs);
  font-size: 1.2rem;
  flex-shrink: 0;
}

/* Btn extra-small */
.btn-xs {
  padding: 3px 10px;
  font-size: .75rem;
  border-radius: var(--r-xs);
}
.form-control-sm {
  padding: 6px 10px;
  font-size: .85rem;
}
.ml-2 { margin-left: 8px; }
.ml-auto { margin-left: auto; }
.flex-1 { flex: 1; min-width: 0; }

@media (max-width: 768px) {
  .club-book-header { flex-direction: column; }
  .club-my-status   { min-width: unset; width: 100%; }
  .club-invite-row  { flex-direction: column; align-items: flex-start; }
}

/* Oculta o botão + do header em mobile (redundante com o FAB do bottom nav) */
@media (max-width: 768px) {
  .header-add-btn { display: none !important; }

  /* Social: form de busca empilha */
  .social-search-form { flex-direction: column; align-items: stretch; }
  .social-search-form .form-control { width: 100%; }
  .social-search-form .btn { width: 100%; justify-content: center; }

  /* Targets de toque mínimos (44px) */
  .btn, .catalog-tab, .bottom-nav-item, .nav-item { min-height: 44px; }

  /* Catalog tabs rolam horizontalmente em telas pequenas */
  .catalog-tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; flex-wrap: nowrap; scrollbar-width: none; }
  .catalog-tabs::-webkit-scrollbar { display: none; }
  .catalog-tab { white-space: nowrap; flex-shrink: 0; padding: 12px 14px; }
}

/* ============================================================
   SIDEBAR — SECTION LABELS (Spotify-style groups)
   ============================================================ */
.nav-section-label {
  font-size: .65rem;
  font-weight: 700;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: .1em;
  padding: 14px 12px 4px;
  margin-top: 2px;
  user-select: none;
}

/* ============================================================
   PAGE HEADER BLOCK
   ============================================================ */
.page-header-block {
  margin-bottom: 28px;
}
.page-header-block h1 {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -.03em;
  color: var(--text);
}
.page-header-block p {
  font-size: .9rem;
  color: var(--text-muted);
  margin-top: 6px;
  line-height: 1.5;
}
@media (max-width: 768px) {
  .page-header-block h1 { font-size: 1.6rem; }
  .page-header-block p  { font-size: .85rem; }
}

/* ============================================================
   PROFILE — COMPACT HERO
   ============================================================ */
.profile-hero-compact {
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 28px;
  margin-bottom: 0;
}

.profile-hero-compact-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.profile-hero-compact-info h2 {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -.02em;
  margin-bottom: 4px;
}

.section-form-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 20px;
  color: var(--text);
}

/* ============================================================
   AVATAR UPLOAD ZONE
   ============================================================ */
.avatar-upload-zone {
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
  border-radius: 50%;
  display: block;
}
.avatar-upload-zone:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 50%;
}

.avatar-upload-overlay {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, .65);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  opacity: 0;
  transition: opacity var(--t2);
  font-size: .68rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: .03em;
  text-transform: uppercase;
}
.avatar-upload-zone:hover .avatar-upload-overlay { opacity: 1; }

/* ============================================================
   DANGER ZONE — Subtle (GitHub/Stripe style)
   ============================================================ */
.danger-zone {
  border: 1px solid rgba(244, 67, 54, .2);
  border-radius: var(--r-xl);
  padding: 20px 24px;
  background: rgba(244, 67, 54, .03);
  margin-top: 24px;
}
.danger-zone-title {
  font-size: .75rem;
  font-weight: 700;
  color: #EF5350;
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 6px;
}
.danger-zone-desc {
  font-size: .84rem;
  color: var(--text-muted);
  margin-bottom: 16px;
  line-height: 1.5;
}

/* ============================================================
   LIST CARD (profile page)
   ============================================================ */
.list-card {
  background: var(--surface-2);
  border-radius: var(--r-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  transition: background var(--t);
}
.list-card:hover { background: var(--elevated); }

/* ============================================================
   MANAGE BOOK ROWS (profile lists modal)
   ============================================================ */
.manage-book-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
}
.manage-book-cover {
  width: 36px;
  aspect-ratio: 2/3;
  object-fit: cover;
  border-radius: var(--r-xs);
  flex-shrink: 0;
}
.manage-book-cover-placeholder {
  width: 36px;
  aspect-ratio: 2/3;
  border-radius: var(--r-xs);
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .9rem;
  flex-shrink: 0;
}

/* ============================================================
   BOOK DETAIL — specs, title, notes
   ============================================================ */
.book-detail-title {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1.2;
  margin-bottom: 6px;
  word-break: break-word;
  overflow-wrap: break-word;
}
.book-detail-author {
  font-size: 1rem;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 20px;
  word-break: break-word;
}
.book-detail-meta {
  display: flex; flex-direction: column; gap: 16px;
  min-width: 0; overflow: hidden;
}

.book-specs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}
.spec-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.spec-label {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
}
.spec-value {
  font-size: .88rem;
  color: var(--text);
  font-weight: 500;
}

.notes-editor {
  width: 100%;
  min-height: 120px;
  background: var(--surface-2);
  border: 1.5px solid var(--border-dark);
  border-radius: var(--r-md);
  padding: 12px 14px;
  font-family: var(--font-body);
  font-size: .88rem;
  color: var(--text);
  resize: vertical;
  transition: border-color var(--t);
  box-sizing: border-box;
}
.notes-editor:focus { outline: none; border-color: var(--accent); }

/* ============================================================
   PWA INSTALL BANNER
   ============================================================ */
#pwa-install-banner {
  position: fixed;
  bottom: calc(var(--bottom-nav-h) + 12px);
  left: 12px; right: 12px;
  background: var(--surface);
  border: 1.5px solid var(--accent);
  border-radius: var(--r-xl);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-xl);
  z-index: 1000;
  animation: slideUpBanner .3s ease;
}
@keyframes slideUpBanner {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
#pwa-install-banner img {
  width: 40px; height: 40px;
  border-radius: var(--r-sm);
  flex-shrink: 0;
}
.pwa-banner-text { flex: 1; min-width: 0; }
.pwa-banner-title { font-size: .88rem; font-weight: 700; }
.pwa-banner-sub   { font-size: .75rem; color: var(--text-muted); margin-top: 1px; }
.pwa-banner-actions { display: flex; gap: 8px; flex-shrink: 0; }
#pwa-install-btn  { font-size: .8rem; padding: 6px 14px; }
#pwa-dismiss-btn  {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: 1.1rem; padding: 4px; line-height: 1;
}

/* ============================================================
   RESPONSIVE — profile hero compact + book detail mobile
   ============================================================ */
@media (max-width: 768px) {
  /* Profile hero empilha verticalmente */
  .profile-hero-compact {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  .profile-hero-compact-info h2 { font-size: 1.2rem; }
  .profile-hero-stats { justify-content: center; }
  .profile-hero-compact .text-muted { font-size: .82rem; }

  /* book.php detail */
  .book-detail-title { font-size: 1.4rem; }
  .book-detail-cover > img,
  .book-detail-cover > .book-cover-empty { max-width: 140px; }
  .book-specs { grid-template-columns: repeat(2, 1fr); }
  .calc-slider-row { flex-direction: column; gap: 8px; }
  .calc-slider-row input[type="range"] { width: 100%; }
  .calc-slider-row input[type="number"] { width: 100% !important; }
  .tag-input-wrap { flex-wrap: wrap; }
  .tag-input-wrap .form-control { min-width: 0; }
  .tag-input-wrap .btn { flex-shrink: 0; }

  /* Esconde botão Adicionar Livro do cabeçalho da Biblioteca */
  .catalog-page-add-btn { display: none !important; }

  /* PWA banner: ajuste para telas muito pequenas */
  #pwa-install-banner { bottom: calc(var(--bottom-nav-h) + 8px); }
}

@media (max-width: 480px) {
  .book-detail-title { font-size: 1.2rem; }
  .book-specs { grid-template-columns: 1fr 1fr; gap: 8px; }
  .book-detail-cover > img,
  .book-detail-cover > .book-cover-empty { max-width: 120px; }
  #pwa-install-banner { flex-wrap: wrap; }
  .pwa-banner-actions { width: 100%; justify-content: flex-end; }
  .form-row { grid-template-columns: 1fr; }
  .rdplan-stats-row { flex-wrap: wrap; }
  .rdplan-stat { min-width: calc(50% - 5px); }
  #calc-current { width: 100% !important; flex-shrink: 1 !important; }
  .section-card { overflow: hidden; }
  .book-description { word-break: break-word; overflow-wrap: break-word; }
}

/* ============================================================
   MANAGE LIST MODAL — TABS
   ============================================================ */
.manage-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.manage-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 8px 16px;
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  font-family: var(--font-body);
  margin-bottom: -1px;
  transition: color var(--t), border-color var(--t);
}
.manage-tab:hover { color: var(--text); }
.manage-tab.active { color: var(--text); border-bottom-color: var(--accent); }

/* ============================================================
   LIST CARD ACTIONS
   ============================================================ */
.list-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.list-card-btn-danger {
  color: var(--red);
  border: 1px solid rgba(244,67,54,.4);
  border-radius: var(--r-xs);
  padding: 3px 10px;
  background: transparent;
  cursor: pointer;
  font-size: .75rem;
  font-weight: 600;
  font-family: inherit;
}
@media (max-width: 480px) {
  .list-card-actions { gap: 8px; }
  .list-card-actions .btn-xs { padding: 6px 12px; font-size: .8rem; }
  .list-card-btn-danger { padding: 6px 12px; font-size: .8rem; }
}

/* ── Biblioteca: contador total ── */
.library-total-badge {
  display: inline-block;
  font-size: .7rem;
  font-weight: 600;
  background: rgba(29,185,84,.15);
  color: var(--accent);
  border: 1px solid rgba(29,185,84,.3);
  border-radius: 999px;
  padding: 2px 10px;
  margin-left: 10px;
  vertical-align: middle;
  letter-spacing: .02em;
}

/* ── Busca: contador de resultados ── */
.books-result-count {
  font-size: .82rem;
  color: var(--accent);
  font-weight: 600;
  margin: 0 0 10px;
  padding: 6px 12px;
  background: rgba(29,185,84,.08);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--r-xs) var(--r-xs) 0;
}
