:root {
  --sand:    #F5F0E8;
  --sand2:   #EDE6D9;
  --sand3:   #DDD4C4;
  --rose:    #F2E4E1;
  --rose2:   #E8CECA;
  --sage:    #DDE8DF;
  --sage2:   #C4D9C8;
  --sky:     #DDE6F0;
  --sky2:    #BDCFE3;
  --lavender:#E8E4F2;
  --lav2:    #D0C9E8;
  --peach:   #F5E6D8;
  --peach2:  #E8CEBC;

  --ink:     #2C2825;
  --ink2:    #5C5550;
  --ink3:    #8C8480;
  --border:  rgba(44,40,37,0.10);
  --border2: rgba(44,40,37,0.18);

  --accent:  #7B9E87;
  --accent2: #5C8068;

  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;

  --font-display: 'Lora', Georgia, serif;
  --font-body: 'DM Sans', system-ui, sans-serif;

  --sidebar-w: 250px;
  --topbar-h: 56px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
  font-family: var(--font-body);
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--sand);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ── SCREENS ── */
.screen { display: none; width: 100vw; height: 100vh; }
.screen.active { display: flex; }

/* ══════════════════════════════════════
   LOGIN
══════════════════════════════════════ */
#screen-login {
  align-items: center;
  justify-content: center;
  background: var(--sand);
  background-image: radial-gradient(circle at 20% 80%, var(--rose) 0%, transparent 50%),
                    radial-gradient(circle at 80% 20%, var(--sage) 0%, transparent 50%);
}

.login-card {
  background: rgba(255,255,255,0.7);
  border: 1px solid var(--border2);
  border-radius: var(--r-xl);
  padding: 40px 36px;
  width: 100%;
  max-width: 360px;
  backdrop-filter: blur(12px);
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 32px;
}
.login-logo-icon {
  width: 38px; height: 38px;
  background: var(--ink);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
}
.login-logo-icon svg { width: 18px; height: 18px; stroke: var(--sand); fill: none; stroke-width: 1.8; }
.login-logo-name { font-family: var(--font-display); font-size: 17px; color: var(--ink); }

.login-heading { font-family: var(--font-display); font-size: 22px; margin-bottom: 6px; color: var(--ink); }
.login-sub { font-size: 13px; color: var(--ink3); margin-bottom: 28px; }

.lfield { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.lfield label { font-size: 12px; font-weight: 500; color: var(--ink2); letter-spacing: 0.02em; }
.lfield input {
  padding: 10px 13px;
  border: 1px solid var(--border2);
  border-radius: var(--r-sm);
  font-size: 13.5px;
  font-family: var(--font-body);
  background: white;
  color: var(--ink);
  outline: none;
  transition: border-color .15s;
}
.lfield input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(123,158,135,0.15); }

.btn-login {
  width: 100%;
  padding: 11px;
  background: var(--ink);
  color: var(--sand);
  border: none;
  border-radius: var(--r-sm);
  font-size: 13.5px;
  font-weight: 500;
  font-family: var(--font-body);
  cursor: pointer;
  margin-top: 6px;
  transition: opacity .15s;
}
.btn-login:hover { opacity: 0.85; }
.login-foot { margin-top: 20px; font-size: 12px; color: var(--ink3); text-align: center; }
.login-foot a { color: var(--accent2); text-decoration: none; font-weight: 500; }

/* ══════════════════════════════════════
   MAIN LAYOUT
══════════════════════════════════════ */
#screen-app { flex-direction: row; }

/* SIDEBAR */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sand2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 0;
  flex-shrink: 0;
  z-index: 100;
  transition: transform .28s cubic-bezier(.4,0,.2,1);
}

.sidebar-head {
  padding: 20px 18px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
}
.s-logo-icon {
  width: 30px; height: 30px;
  background: var(--ink);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.s-logo-icon svg { width: 15px; height: 15px; stroke: var(--sand); fill: none; stroke-width: 1.8; }
.s-logo-name { font-family: var(--font-display); font-size: 14.5px; color: var(--ink); }

.nav-group { padding: 14px 10px 6px; }
.nav-group-label { font-size: 10.5px; font-weight: 500; color: var(--ink3); letter-spacing: 0.08em; text-transform: uppercase; padding: 0 8px 6px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  font-size: 13.5px;
  color: var(--ink2);
  cursor: pointer;
  transition: background .12s, color .12s;
  font-weight: 400;
  text-decoration: none;
}
.nav-item:hover { background: var(--border); color: var(--ink); }
.nav-item.active { background: var(--ink); color: var(--sand); font-weight: 500; }
.nav-item svg, .nav-item a svg { width: 15px; height: 15px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.8; }

.sidebar-foot {
  margin-top: auto;
  padding: 10px;
  border-top: 1px solid var(--border);
}

/* User card in sidebar */
.user-card {
  border-radius: var(--r-md);
  cursor: pointer;
  transition: background .12s;
  position: relative;
}
.user-card:hover { background: var(--border); }
.user-card-top {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border-radius: var(--r-md);
}
.u-avatar-lg {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--lavender);
  color: #5A4C8A;
  font-size: 13px;
  font-weight: 500;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  border: 1.5px solid var(--lav2);
}
.u-info { flex: 1; min-width: 0; }
.u-fullname { font-size: 13px; color: var(--ink); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.u-email { font-size: 11px; color: var(--ink3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.u-caret { width: 14px; height: 14px; fill: none; stroke: var(--ink3); stroke-width: 1.8; flex-shrink: 0; transition: transform .2s; }
.user-card.open .u-caret { transform: rotate(180deg); }

.user-dropdown {
  display: none;
  background: white;
  border: 1px solid var(--border2);
  border-radius: var(--r-md);
  padding: 4px;
  margin: 4px 0 0;
  box-shadow: 0 8px 24px rgba(44,40,37,0.10);
}
.user-dropdown.open { display: block; }

/* Mini stats inside dropdown */
.u-stats-row {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  gap: 0;
}
.u-stat { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.u-stat-val { font-family: var(--font-display); font-size: 16px; color: var(--ink); }
.u-stat-lbl { font-size: 10.5px; color: var(--ink3); }
.u-stat-sep { width: 1px; height: 28px; background: var(--border); }

.dd-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
}
.dd-item:hover { background: var(--sand); }
.dd-item svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.dd-item.danger { color: #A0473C; }
.dd-sep { height: 1px; background: var(--border); margin: 3px 0; }

/* MAIN */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--sand);
}

/* TOPBAR */
.topbar {
  height: var(--topbar-h);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--sand);
  gap: 12px;
}
.topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 34px; height: 34px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border2);
  background: transparent;
  cursor: pointer;
  color: var(--ink);
  flex-shrink: 0;
}
.menu-toggle svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.page-title { font-family: var(--font-display); font-size: 19px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.topbar-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-body);
  cursor: pointer;
  border: 1px solid var(--border2);
  background: white;
  color: var(--ink);
  transition: background .12s;
  white-space: nowrap;
}
.btn:hover { background: var(--sand); }
.btn svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.btn-accent { background: var(--ink); color: var(--sand); border-color: var(--ink); }
.btn-accent:hover { background: var(--ink2); border-color: var(--ink2); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--border); }
.btn-danger { color: #A0473C; border-color: rgba(160,71,60,.25); }
.btn-danger:hover { background: var(--rose); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-xs { padding: 3px 8px; font-size: 11.5px; }

/* CONTENT */
.content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  scrollbar-width: thin;
  scrollbar-color: var(--sand3) transparent;
}

/* BADGES */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
}
.b-read      { background: var(--sage);    color: #3A6B48; }
.b-reading   { background: var(--sky);     color: #3A5F80; }
.b-planned   { background: var(--sand3);   color: var(--ink2); }
.b-listened  { background: var(--lavender);color: #5A4C8A; }
.b-dnf       { background: var(--rose);    color: #8A3A34; }
.b-reread    { background: var(--peach);   color: #8A5C34; }

.tag {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 11.5px;
  background: var(--sand2);
  color: var(--ink2);
  border: 1px solid var(--border);
  white-space: nowrap;
}

/* TOAST */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: var(--ink);
  color: var(--sand);
  font-size: 13px;
  padding: 10px 20px;
  border-radius: 99px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 9999;
  opacity: 0;
  transition: opacity .2s, transform .2s;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; }

/* OVERLAY */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(44,40,37,0.35);
  z-index: 99;
}
.sidebar-overlay.open { display: block; }

/* MODAL */
.modal-wrap {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(44,40,37,0.4);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-wrap.open { display: flex; }
.modal-box {
  background: var(--sand);
  border-radius: var(--r-xl);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border2);
  margin: auto;
  width: 80%;
  max-width: 600px;
}
.modal-head {
  padding: 20px 24px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}
.modal-title { font-family: var(--font-display); font-size: 17px; color: var(--ink); }
.modal-body { padding: 20px 24px; overflow-y: auto; flex: 1; }
.modal-foot { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }
.close-btn {
  width: 30px; height: 30px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border2);
  background: transparent;
  cursor: pointer;
  color: var(--ink3);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  line-height: 1;
}
.close-btn:hover { background: var(--rose); color: #8A3A34; }

/* FORM FIELDS */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }
.fl { font-size: 12px; font-weight: 500; color: var(--ink2); letter-spacing: 0.02em; }
.fi {
  padding: 9px 12px;
  border: 1px solid var(--border2);
  border-radius: var(--r-sm);
  font-size: 13.5px;
  font-family: var(--font-body);
  background: white;
  color: var(--ink);
  outline: none;
  transition: border-color .15s;
  width: 100%;
}
.fi:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(123,158,135,0.12); }
.frow { display: flex; gap: 12px; }
.frow > .field { flex: 1; }

/* ══════════════════════════════════════
   DASHBOARD
══════════════════════════════════════ */
.dash-hero {
  background: var(--sage);
  border: 1px solid var(--sage2);
  border-radius: var(--r-xl);
  padding: 28px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 20px;
  overflow: hidden;
  position: relative;
}
.dash-hero::before {
  content: '';
  position: absolute;
  right: -30px; top: -30px;
  width: 200px; height: 200px;
  border-radius: 50%;
  background: rgba(255,255,255,0.35);
}
.dash-hero::after {
  content: '';
  position: absolute;
  right: 80px; bottom: -50px;
  width: 140px; height: 140px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
}
.hero-label { font-size: 12px; color: #4A7A5A; margin-bottom: 6px; font-weight: 500; letter-spacing: 0.03em; }
.hero-count { font-family: var(--font-display); font-size: 36px; color: #253D2C; line-height: 1; margin-bottom: 6px; }
.hero-sub { font-size: 13px; color: #5C8068; }
.hero-progress { flex: 1; max-width: 240px; }
.hero-pct { font-family: var(--font-display); font-size: 42px; color: #253D2C; text-align: right; }
.progress-track { height: 6px; background: rgba(44,80,52,0.15); border-radius: 99px; margin-top: 10px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent2); border-radius: 99px; }
.hero-foot { font-size: 12px; color: #5C8068; margin-top: 6px; text-align: right; }

.stats-row { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; margin-bottom: 20px; }
.stat-card { background: white; border: 1px solid var(--border); border-radius: var(--r-lg); padding: 18px 20px; }
.stat-lbl { font-size: 11.5px; color: var(--ink3); margin-bottom: 6px; font-weight: 400; }
.stat-val { font-family: var(--font-display); font-size: 28px; color: var(--ink); line-height: 1; }
.stat-sub { font-size: 11.5px; color: var(--ink3); margin-top: 5px; }

.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.section-label { font-family: var(--font-display); font-size: 15px; color: var(--ink); }

.reading-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px,1fr)); gap: 12px; margin-bottom: 20px; }
.book-card-h {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  display: flex;
  align-items: stretch;
  overflow: hidden;
  cursor: pointer;
  transition: border-color .15s, transform .15s;
  min-width: 300px;
}
.book-card-h:hover { border-color: var(--border2); transform: translateY(-1px); }
.bch-cover {
  width: 56px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}
.bch-body { padding: 12px 14px 12px 10px; flex: 1; min-width: 0; }
.bch-title { font-size: 13.5px; font-weight: 500; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 2px; }
.bch-author { font-size: 12px; color: var(--ink3); margin-bottom: 8px; }

.chart-card { background: white; border: 1px solid var(--border); border-radius: var(--r-lg); padding: 22px; }
.bars { display: flex; align-items: flex-end; gap: 10px; height: 100px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px; height: 100%; }
.bar-val { font-size: 11px; color: var(--ink3); font-weight: 500; }
.bar {
  width: 100%;
  border-radius: 4px 4px 0 0;
  background: var(--sand3);
  transition: background .2s;
  cursor: pointer;
}
.bar:hover { background: var(--sage2); }
.bar.current { background: var(--accent); }
.bar-year { font-size: 10.5px; color: var(--ink3); margin-top: 6px; }
.bar-year.current { color: var(--ink); font-weight: 500; }

/* ══════════════════════════════════════
   CATALOG
══════════════════════════════════════ */
.filter-bar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
.search-wrap { position: relative; flex: 1; min-width: 180px; }
.search-wrap svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 14px; height: 14px; fill: none; stroke: var(--ink3); stroke-width: 1.8; pointer-events: none; }
.search-inp {
  width: 100%;
  padding: 8px 12px 8px 33px;
  border: 1px solid var(--border2);
  border-radius: var(--r-sm);
  font-size: 13.5px;
  font-family: var(--font-body);
  background: white;
  color: var(--ink);
  outline: none;
}
.search-inp:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(123,158,135,0.12); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  padding: 6px 13px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--border2);
  background: white;
  color: var(--ink2);
  cursor: pointer;
  transition: background .12s, border-color .12s;
  text-decoration: none;
}
.chip:hover { background: var(--sand2); }
.chip.on { background: var(--ink); color: var(--sand); border-color: var(--ink); }

.view-toggle { display: flex; border: 1px solid var(--border2); border-radius: var(--r-sm); overflow: hidden; flex-shrink: 0; }
.vt-btn {
  padding: 7px 12px;
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 12px;
  font-family: var(--font-body);
  color: var(--ink3);
  display: flex; align-items: center; gap: 5px;
}
.vt-btn.on { background: var(--ink); color: var(--sand); }
.vt-btn svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.8; }

.table-wrap { background: white; border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; }
.t-scroll { overflow-x: auto; }
.btable { width: 100%; border-collapse: collapse; min-width: 560px; }
.btable th {
  padding: 11px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 500;
  color: var(--ink3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border);
  background: var(--sand2);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.btable th:hover { color: var(--ink); }
.btable td { padding: 11px 16px; border-bottom: 1px solid var(--border); font-size: 13.5px; vertical-align: middle; }
.btable tr:last-child td { border-bottom: none; }
.btable tbody tr { cursor: pointer; transition: background .1s; }
.btable tbody tr:hover td { background: var(--sand); }
.td-title { font-weight: 500; color: var(--ink); }

.pagination { display: flex; justify-content: flex-end; align-items: center; gap: 4px; padding: 12px 16px; border-top: 1px solid var(--border); }
.pag-btn {
  padding: 5px 11px;
  font-size: 12px;
  border: 1px solid var(--border2);
  background: white;
  cursor: pointer;
  border-radius: var(--r-sm);
  color: var(--ink2);
  font-family: var(--font-body);
  transition: background .12s;
}
.pag-btn:hover:not(:disabled) { background: var(--sand); }
.pag-btn.active { background: var(--ink); color: var(--sand); border-color: var(--ink); }
.pag-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ══════════════════════════════════════
   SETTINGS
══════════════════════════════════════ */
.settings-wrap { max-width: 560px; display: flex; flex-direction: column; gap: 16px; }
.settings-card { background: white; border: 1px solid var(--border); border-radius: var(--r-xl); padding: 24px; }
.settings-title { font-family: var(--font-display); font-size: 15px; color: var(--ink); margin-bottom: 18px; }
.profile-row { display: flex; gap: 20px; align-items: flex-start; }
.profile-avatar { width: 64px; height: 64px; border-radius: 50%; background: var(--lavender); display: flex; align-items: center; justify-content: center; font-size: 22px; color: var(--ink2); font-weight: 500; flex-shrink: 0; }
.toggle-row-set { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; background: var(--sand2); border-radius: var(--r-md); }
.toggle { position: relative; width: 36px; height: 20px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.tslider { position: absolute; inset: 0; background: var(--border2); border-radius: 99px; cursor: pointer; transition: background .2s; }
.toggle input:checked + .tslider { background: var(--accent); }
.tslider::before { content: ''; position: absolute; width: 14px; height: 14px; left: 3px; top: 3px; background: white; border-radius: 50%; transition: transform .2s; }
.toggle input:checked + .tslider::before { transform: translateX(16px); }

/* ══════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════ */
@media (max-width: 1024px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .dict-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-hero { flex-direction: column; align-items: flex-start; }
  .hero-progress { max-width: 100%; width: 100%; }
  .hero-pct { text-align: left; }
}

@media (max-width: 768px) {
  :root { --sidebar-w: 250px; }
  .sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    transform: translateX(calc(-1 * var(--sidebar-w) - 10px));
    box-shadow: none;
  }
  .sidebar.open { transform: translateX(0); box-shadow: 4px 0 24px rgba(44,40,37,0.12); }
  .menu-toggle { display: flex; }
  .content { padding: 16px; }
  .topbar { padding: 0 16px; }
  .page-title { font-size: 16px; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .dict-grid { grid-template-columns: 1fr; }
  .meta-grid { grid-template-columns: 1fr; }
  .book-layout, .edit-layout { flex-direction: column; align-items: center; }
  .cover-lg, .cover-col-edit { width: 120px; }
  .cover-lg { height: 180px; font-size: 42px; }
  .cards-grid { grid-template-columns: repeat(auto-fill, minmax(130px,1fr)); }
  .reading-grid { grid-template-columns: 1fr; }
  .hero-count { font-size: 28px; }
  .hero-pct { font-size: 34px; }
  .dash-hero { padding: 22px 22px; }
  .topbar-right .btn span { display: none; }
  .filter-bar { gap: 8px; }
  .frow { flex-direction: column; }
}

@media (max-width: 480px) {
  .stats-row { grid-template-columns: 1fr; }
  .cards-grid { grid-template-columns: repeat(2, 1fr); }
  .modal-box { border-radius: var(--r-lg); max-height: 95vh; }
}

/* Scrollbar */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--sand3); border-radius: 99px; }

#screen-error {
    font-family: 'Inter', sans-serif;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f5ebe0 0%, #e8e8e8 50%, #e0e8e0 100%);
    padding: 20px;
}

.error-card {
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 24px;
    padding: 48px 40px;
    max-width: 420px;
    width: 100%;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.04),
                0 1px 3px rgba(0, 0, 0, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.6);
}

.logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 40px;
}

.logo-icon {
    width: 36px;
    height: 36px;
    background: #2a2a2a;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-icon svg {
    width: 18px;
    height: 18px;
    stroke: #fff;
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.logo-text {
    font-family: 'Playfair Display', serif;
    font-size: 18px;
    font-weight: 500;
    color: #2a2a2a;
    letter-spacing: -0.3px;
}

.error-code {
    font-family: 'Playfair Display', serif;
    font-size: 72px;
    font-weight: 400;
    color: #2a2a2a;
    line-height: 1;
    margin-bottom: 12px;
    letter-spacing: -2px;
}

.error-title {
    font-family: 'Playfair Display', serif;
    font-size: 24px;
    font-weight: 400;
    color: #2a2a2a;
    margin-bottom: 12px;
    line-height: 1.3;
}

.error-description {
    font-size: 14px;
    font-weight: 400;
    color: #8a8a8a;
    line-height: 1.6;
    margin-bottom: 32px;
}

.error-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.25s ease;
    cursor: pointer;
    border: none;
    font-family: 'Inter', sans-serif;
}

.btn-primary {
    background: #2a2a2a;
    color: #fff;
}

.btn-primary:hover {
    background: #3a3a3a;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(42, 42, 42, 0.15);
}

.btn-secondary {
    background: transparent;
    color: #6a6a6a;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.btn-secondary:hover {
    background: rgba(0, 0, 0, 0.03);
    color: #2a2a2a;
}

.btn svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Анимация */
.error-card {
    animation: fadeInUp 0.6s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.error-code {
    animation: fadeIn 0.8s ease-out 0.2s both;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.actions {
  display: flex;
  gap: 8px;
  align-items: center;
}


.actions .btn {
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  background: #fafafa;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.actions .btn:hover {
  background: #fff;
  border-color: #ccc;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

.actions .btn:active {
  transform: scale(0.96);
}

.icon-edit,
.icon-delete {
  width: 22px;
  height: 22px;
  display: block;
  transition: fill 0.15s ease;
}

.icon-edit {
  fill: #555;
  transform: translate(-2px, 2px);
}

.icon-delete {
  fill: #c45b52;
}

.actions .btn:hover .icon-edit {
  fill: #222;
}

.actions .btn:hover .icon-delete {
  fill: #a0352a;
}

.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 12px;
  width: 18px;
  height: 18px;
  pointer-events: none;
  color: #888;
}

.search-inp {
  width: 100%;
  padding: 8px 32px 8px 36px;  /* справа 32px под крестик */
  border: 1px solid #ddd;
  border-radius: 20px;
  font-size: 14px;
}

.search-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  color: #999;
  text-decoration: none;
  border-radius: 50%;
  background: transparent;
  transition: background 0.2s, color 0.2s;
}

.search-clear:hover {
  background: #e0e0e0;
  color: #555;
}

.search-clear svg {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}

.hero-count-small {
  font-size:20px;
  color:#5C8068;
}

.chart-labels {
  display:flex;
  gap:10px;
  margin-top:0;
}