/* ==========================================================================
   LibraTech — Student Dashboard Stylesheet
   Extends tokens and utilities defined in style.css
   ========================================================================== */

html, body.dash-body{ height: 100%; }

body.dash-body{
  background-color: var(--bg-grey);
  background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%22172%22%20height%3D%22140%22%20viewBox%3D%220%200%20172%20140%22%3E%0A%20%20%3Cg%3E%3Crect%20x%3D%224%22%20y%3D%2214%22%20width%3D%2211%22%20height%3D%2246%22%20rx%3D%221.5%22%20fill%3D%22%231565C0%22%20fill-opacity%3D%220.035%22/%3E%3Crect%20x%3D%2218%22%20y%3D%2222%22%20width%3D%229%22%20height%3D%2238%22%20rx%3D%221.5%22%20fill%3D%22%2342A5F5%22%20fill-opacity%3D%220.035%22/%3E%3Crect%20x%3D%2230%22%20y%3D%228%22%20width%3D%2213%22%20height%3D%2252%22%20rx%3D%221.5%22%20fill%3D%22%230D47A1%22%20fill-opacity%3D%220.035%22/%3E%3Crect%20x%3D%2246%22%20y%3D%2226%22%20width%3D%228%22%20height%3D%2234%22%20rx%3D%221.5%22%20fill%3D%22%2390CAF9%22%20fill-opacity%3D%220.035%22/%3E%3Crect%20x%3D%2257%22%20y%3D%2216%22%20width%3D%2212%22%20height%3D%2244%22%20rx%3D%221.5%22%20fill%3D%22%231565C0%22%20fill-opacity%3D%220.035%22/%3E%3Crect%20x%3D%2272%22%20y%3D%2220%22%20width%3D%2210%22%20height%3D%2240%22%20rx%3D%221.5%22%20fill%3D%22%2342A5F5%22%20fill-opacity%3D%220.035%22/%3E%3Crect%20x%3D%2285%22%20y%3D%2210%22%20width%3D%2214%22%20height%3D%2250%22%20rx%3D%221.5%22%20fill%3D%22%230D47A1%22%20fill-opacity%3D%220.035%22/%3E%3Crect%20x%3D%22102%22%20y%3D%2224%22%20width%3D%229%22%20height%3D%2236%22%20rx%3D%221.5%22%20fill%3D%22%2390CAF9%22%20fill-opacity%3D%220.035%22/%3E%3Crect%20x%3D%22114%22%20y%3D%2218%22%20width%3D%2211%22%20height%3D%2242%22%20rx%3D%221.5%22%20fill%3D%22%231565C0%22%20fill-opacity%3D%220.035%22/%3E%3Crect%20x%3D%22128%22%20y%3D%2212%22%20width%3D%2210%22%20height%3D%2248%22%20rx%3D%221.5%22%20fill%3D%22%2342A5F5%22%20fill-opacity%3D%220.035%22/%3E%3Crect%20x%3D%22141%22%20y%3D%2221%22%20width%3D%2212%22%20height%3D%2239%22%20rx%3D%221.5%22%20fill%3D%22%230D47A1%22%20fill-opacity%3D%220.035%22/%3E%3Crect%20x%3D%22156%22%20y%3D%2215%22%20width%3D%229%22%20height%3D%2245%22%20rx%3D%221.5%22%20fill%3D%22%2390CAF9%22%20fill-opacity%3D%220.035%22/%3E%3C/g%3E%0A%20%20%3Crect%20x%3D%220%22%20y%3D%2260%22%20width%3D%22172%22%20height%3D%223%22%20fill%3D%22%231565C0%22%20fill-opacity%3D%220.04%22/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-attachment: fixed;
  overflow-x: hidden;
}

.dash-shell{
  display: flex;
  min-height: 100vh;
}

/* ==========================================================================
   SIDEBAR
   ========================================================================== */
.sidebar{
  position: sticky;
  top: 0;
  height: 100vh;
  width: 268px;
  flex-shrink: 0;
  background: #fff;
  border-right: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  padding: 26px 18px;
  z-index: 200;
  transition: transform 0.35s var(--ease);
}

.sidebar-brand{
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 10px 26px;
}
.sidebar-brand .brand-icon{ width: 40px; height: 40px; border-radius: 12px; }
.sidebar-brand .brand-name{ font-size: 1rem; }
.sidebar-brand .brand-dept{ font-size: 0.68rem; }

.sidebar-nav{
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  overflow-y: auto;
}

.nav-section-label{
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-300);
  padding: 18px 12px 8px;
}
.nav-section-label:first-child{ padding-top: 6px; }

.side-link{
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--ink-500);
  transition: background 0.25s var(--ease), color 0.25s var(--ease);
  position: relative;
}
.side-link .material-symbols-rounded{ font-size: 20px; }
.side-link:hover{ background: var(--bg-grey-dark); color: var(--primary); }
.side-link.active{
  background: var(--gradient-primary);
  color: #fff;
  box-shadow: var(--shadow-sm);
}

.side-badge{
  margin-left: auto;
  background: rgba(255,255,255,0.25);
  color: inherit;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
}
.side-link:not(.active) .side-badge{
  background: var(--bg-grey-dark);
  color: var(--primary);
}

.sidebar-logout{
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--ink-500);
  border-top: 1px solid var(--border-soft);
  margin-top: 8px;
  padding-top: 18px;
  transition: color 0.25s var(--ease);
}
.sidebar-logout:hover{ color: #E53935; }

.sidebar-overlay{
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 27, 45, 0.4);
  z-index: 150;
  opacity: 0;
  transition: opacity 0.3s var(--ease);
}

/* ==========================================================================
   MAIN COLUMN
   ========================================================================== */
.dash-main{
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* Topbar */
.topbar{
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 16px 32px;
  background: rgba(255,255,255,0.75);
  backdrop-filter: blur(14px) saturate(180%);
  -webkit-backdrop-filter: blur(14px) saturate(180%);
  border-bottom: 1px solid var(--border-soft);
}

.icon-btn{
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  color: var(--ink-700);
  background: #fff;
  border: 1px solid var(--border-soft);
  position: relative;
  transition: background 0.25s var(--ease), color 0.25s var(--ease);
  flex-shrink: 0;
}
.icon-btn:hover{ background: var(--bg-grey-dark); color: var(--primary); }
.dot-badge{
  position: absolute;
  top: 8px; right: 9px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #E53935;
  border: 2px solid #fff;
}

.sidebar-toggle{ display: none; }

.topbar-search{
  flex: 1;
  max-width: 460px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border: 1.5px solid var(--border-soft);
  border-radius: var(--radius-pill);
  padding: 10px 18px;
  transition: border-color 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.topbar-search:focus-within{
  border-color: var(--secondary);
  box-shadow: 0 0 0 4px rgba(66,165,245,0.14);
}
.topbar-search .material-symbols-rounded{ color: var(--ink-300); font-size: 20px; }
.topbar-search input{
  border: none;
  outline: none;
  flex: 1;
  font-family: inherit;
  font-size: 0.88rem;
  color: var(--ink-900);
  background: transparent;
}
.topbar-search input::placeholder{ color: var(--ink-300); }

.topbar-actions{
  display: flex;
  align-items: center;
  gap: 14px;
  margin-left: auto;
}

.topbar-profile{
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 6px 6px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-soft);
  background: #fff;
  cursor: pointer;
  transition: background 0.25s var(--ease);
}
.topbar-profile:hover{ background: var(--bg-grey-dark); }
.topbar-profile .material-symbols-rounded{ font-size: 18px; color: var(--ink-300); }

.avatar{
  width: 34px; height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--gradient-primary);
  color: #fff;
  font-size: 0.74rem;
  font-weight: 700;
  flex-shrink: 0;
  overflow: hidden;
}
.avatar img{ width: 100%; height: 100%; object-fit: cover; }

.profile-text{ display: flex; flex-direction: column; line-height: 1.25; }
.profile-text strong{ font-size: 0.82rem; color: var(--ink-900); }
.profile-text span{ font-size: 0.7rem; color: var(--ink-500); }

/* content wrapper */
.dash-content{
  padding: 28px 32px 64px;
  max-width: 1320px;
  width: 100%;
  margin: 0 auto;
}

/* view switcher */
.view{ display: none; }
.view.active{ display: block; animation: viewFade 0.4s var(--ease); }
@keyframes viewFade{
  from{ opacity: 0; transform: translateY(10px); }
  to{ opacity: 1; transform: translateY(0); }
}

.view-head{
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 26px;
}
.view-head h1{ font-size: 1.5rem; font-weight: 700; color: var(--ink-900); margin-bottom: 6px; }
.view-head p{ color: var(--ink-500); font-size: 0.92rem; }

/* ==========================================================================
   PROFILE FORM (Settings)
   ========================================================================== */
.profile-form{ margin-bottom: 8px; }
.profile-grid{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 20px;
}
.field-group{ display: flex; flex-direction: column; gap: 6px; }
.field-group-full{ grid-column: 1 / -1; }
.field-group label{ font-size: 0.82rem; font-weight: 600; color: var(--ink-700); }
.field-group input, .field-group select{
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border-soft);
  background: #fff;
  font-family: inherit;
  font-size: 0.88rem;
  color: var(--ink-900);
  transition: border-color 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.field-group input:focus, .field-group select:focus{
  outline: none;
  border-color: var(--secondary);
  box-shadow: 0 0 0 4px rgba(66,165,245,0.14);
}
.field-group input.field-invalid, .field-group select.field-invalid{ border-color: #E53935; }
.field-error{ font-size: 0.74rem; color: #E53935; min-height: 14px; }

.profile-actions{
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: 4px;
}
.profile-saved-note{
  font-size: 0.82rem;
  color: var(--primary);
  font-weight: 500;
}

/* ==========================================================================
   BOOKMARK BUTTON (catalog cards)
   ========================================================================== */
.book-card{ position: relative; }
.bookmark-btn{
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: rgba(255,255,255,0.9);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  color: var(--ink-300);
  box-shadow: var(--shadow-sm);
  transition: color 0.2s var(--ease), transform 0.2s var(--ease);
  z-index: 2;
}
.bookmark-btn .material-symbols-rounded{ font-size: 18px; }
.bookmark-btn:hover{ transform: scale(1.1); }
.bookmark-btn.saved{ color: var(--primary); }

/* ==========================================================================
   WELCOME BANNER
   ========================================================================== */
.welcome-banner{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  background: var(--gradient-primary);
  border-radius: var(--radius-lg);
  padding: 32px 36px;
  color: #fff;
  margin-bottom: 26px;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}
.welcome-banner::before{
  content: "";
  position: absolute;
  width: 260px; height: 260px;
  background: rgba(255,255,255,0.1);
  border-radius: 50%;
  top: -110px; right: -60px;
}
.banner-eyebrow{
  display: inline-block;
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.85;
  margin-bottom: 8px;
}
.welcome-banner h1{ font-size: 1.4rem; font-weight: 700; margin-bottom: 8px; max-width: 460px; }
.welcome-banner p{ font-size: 0.9rem; opacity: 0.9; max-width: 440px; }
.welcome-banner .btn-primary{
  background: #fff;
  color: var(--primary);
  box-shadow: 0 10px 26px rgba(0,0,0,0.15);
  position: relative;
  z-index: 1;
  flex-shrink: 0;
}

/* ==========================================================================
   STAT CARDS
   ========================================================================== */
.stat-grid{
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-bottom: 26px;
}
.stat-card{
  display: flex;
  align-items: center;
  gap: 14px;
  background: #fff;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease);
}
.stat-card:hover{ transform: translateY(-4px); box-shadow: var(--shadow-md); }

.stat-icon{
  width: 46px; height: 46px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  color: #fff;
  flex-shrink: 0;
}
.stat-icon .material-symbols-rounded{ font-size: 22px; }
.si-1{ background: linear-gradient(135deg, #1565C0, #42A5F5); }
.si-2{ background: linear-gradient(135deg, #EF6C00, #FFB74D); }
.si-3{ background: linear-gradient(135deg, #2E7D32, #66BB6A); }
.si-4{ background: linear-gradient(135deg, #6A1B9A, #AB47BC); }

.stat-value{ display: block; font-size: 1.4rem; font-weight: 700; color: var(--ink-900); }
.stat-caption{ font-size: 0.78rem; color: var(--ink-500); font-weight: 500; }

/* ==========================================================================
   PANELS (Current loans / Recommended)
   ========================================================================== */
.panel-grid{
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 20px;
}

.panel{
  background: #fff;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.panel-head{
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.panel-head h2{ font-size: 1.02rem; font-weight: 600; color: var(--ink-900); }
.panel-link{ font-size: 0.82rem; font-weight: 600; color: var(--primary); }
.panel-link:hover{ opacity: 0.75; }

.loan-list, .rec-list{ display: flex; flex-direction: column; gap: 14px; }

.loan-item, .rec-item{
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px;
  border-radius: var(--radius-sm);
  transition: background 0.25s var(--ease);
}
.loan-item:hover, .rec-item:hover{ background: var(--bg-grey); }

.loan-cover, .rec-cover{
  width: 42px; height: 52px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: #fff;
  flex-shrink: 0;
  font-size: 18px;
}
.loan-cover.sm{ width: 32px; height: 40px; font-size: 15px; border-radius: 6px; }
.lc-1{ background: linear-gradient(160deg, #1565C0, #0D47A1); }
.lc-2{ background: linear-gradient(160deg, #42A5F5, #1565C0); }
.lc-3{ background: linear-gradient(160deg, #64B5F6, #1E88E5); }
.rc-1{ background: linear-gradient(160deg, #26A69A, #00796B); }
.rc-2{ background: linear-gradient(160deg, #7E57C2, #5E35B1); }
.rc-3{ background: linear-gradient(160deg, #EF5350, #C62828); }

.loan-info{ display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.loan-info strong{ font-size: 0.88rem; color: var(--ink-900); }
.loan-info span{ font-size: 0.76rem; color: var(--ink-500); }

.tag{
  font-size: 0.7rem;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
  flex-shrink: 0;
}
.tag-warning{ background: #FFF3E0; color: #EF6C00; }
.tag-ok{ background: #E8F5E9; color: #2E7D32; }
.tag-neutral{ background: var(--bg-grey-dark); color: var(--primary); }

.chip-btn{
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--primary);
  background: var(--bg-grey-dark);
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  flex-shrink: 0;
  transition: background 0.25s var(--ease), color 0.25s var(--ease), transform 0.25s var(--ease);
  position: relative;
  overflow: hidden;
}
.chip-btn:hover{ background: var(--gradient-primary); color: #fff; transform: translateY(-2px); }

/* ==========================================================================
   CATALOG VIEW
   ========================================================================== */
.year-scope-note{
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.84rem;
  color: var(--primary);
  background: var(--bg-grey-dark);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  margin-bottom: 18px;
  font-weight: 500;
}

.catalog-toolbar{
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.catalog-search{ max-width: 360px; }

.filter-chips{ display: flex; gap: 8px; flex-wrap: wrap; }
.filter-chip{
  font-size: 0.82rem;
  font-weight: 600;
  padding: 9px 18px;
  border-radius: var(--radius-pill);
  background: #fff;
  border: 1.5px solid var(--border-soft);
  color: var(--ink-500);
  transition: all 0.25s var(--ease);
}
.filter-chip:hover{ border-color: var(--secondary); color: var(--primary); }
.filter-chip.active{
  background: var(--gradient-primary);
  border-color: transparent;
  color: #fff;
  box-shadow: var(--shadow-sm);
}

.book-grid{
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

.book-card{
  background: #fff;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease);
  opacity: 0;
  animation: cardIn 0.5s var(--ease) forwards;
}
.book-card:hover{ transform: translateY(-6px); box-shadow: var(--shadow-md); }
@keyframes cardIn{
  from{ opacity: 0; transform: translateY(14px); }
  to{ opacity: 1; transform: translateY(0); }
}

.book-cover{
  aspect-ratio: 3 / 4;
  width: 100%;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: #fff;
  overflow: hidden;
}
.book-cover .material-symbols-rounded{ font-size: 34px; }
.book-cover img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
}
.bc-1{ background: linear-gradient(150deg, #1565C0, #0D47A1); }
.bc-2{ background: linear-gradient(150deg, #42A5F5, #1565C0); }
.bc-3{ background: linear-gradient(150deg, #26A69A, #00796B); }
.bc-4{ background: linear-gradient(150deg, #7E57C2, #5E35B1); }
.bc-5{ background: linear-gradient(150deg, #EF5350, #C62828); }
.bc-6{ background: linear-gradient(150deg, #FFA726, #EF6C00); }

.book-card h3{
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink-900);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.book-card .book-author{ font-size: 0.78rem; color: var(--ink-500); }

.book-meta{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
}
.avail-tag{ font-size: 0.7rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avail-tag.avail{ color: #2E7D32; }
.avail-tag.low{ color: #EF6C00; }
.avail-tag.out{ color: #E53935; }

.book-borrow-btn{
  width: 100%;
  justify-content: center;
  padding: 10px 16px;
  font-size: 0.84rem;
}
.book-borrow-btn[disabled]{
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}

.empty-state{
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: var(--ink-300);
  padding: 60px 0;
  font-size: 0.9rem;
}
.empty-state .material-symbols-rounded{ font-size: 40px; }

/* ==========================================================================
   TABLES (Loans / History)
   ========================================================================== */
.table-panel{
  background: #fff;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
}

.loan-table{
  width: 100%;
  border-collapse: collapse;
  min-width: 560px;
}
.loan-table th{
  text-align: left;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-300);
  font-weight: 700;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-soft);
}
.loan-table td{
  padding: 16px 20px;
  font-size: 0.86rem;
  color: var(--ink-700);
  border-bottom: 1px solid var(--border-soft);
}
.loan-table tr:last-child td{ border-bottom: none; }
.title-cell{ display: flex; align-items: center; gap: 10px; font-weight: 600; color: var(--ink-900); }

.text-btn{
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--primary);
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  transition: background 0.25s var(--ease);
}
.text-btn:hover{ background: var(--bg-grey-dark); }
.text-btn-danger{
  font-size: 0.82rem;
  font-weight: 600;
  color: #E53935;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  transition: background 0.25s var(--ease);
}
.text-btn-danger:hover{ background: #FDECEA; }

/* ==========================================================================
   PROFILE PHOTO UPLOAD (Settings)
   ========================================================================== */
.avatar-upload-row{
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 24px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--border-soft);
}
.avatar-preview{
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--bg-grey-dark);
  display: grid;
  place-items: center;
  overflow: hidden;
  flex-shrink: 0;
  color: var(--ink-300);
  border: 1.5px solid var(--border-soft);
}
.avatar-preview img{ width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.avatar-preview .material-symbols-rounded{ font-size: 28px; }
.avatar-preview.has-photo{ cursor: pointer; transition: transform 0.2s var(--ease); }
.avatar-preview.has-photo:hover{ transform: scale(1.05); }

.avatar-preview-box{
  max-width: 320px;
  padding: 20px;
  position: relative;
  text-align: center;
}
.avatar-preview-box .modal-close{
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(15,27,45,0.5);
  color: #fff;
  z-index: 1;
}
.avatar-preview-box .modal-close:hover{ background: rgba(15,27,45,0.7); }
.avatar-preview-box img{
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: var(--radius-lg);
  display: block;
}
.avatar-upload-info{
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.avatar-upload-hint{
  font-size: 0.76rem;
  color: var(--ink-500);
  width: 100%;
}

/* ==========================================================================
   NOTIFICATIONS
   ========================================================================== */
.notif-list{ display: flex; flex-direction: column; gap: 12px; }
.notif-item{
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: #fff;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}
.notif-item.unread{ border-left: 3px solid var(--primary); }
.notif-item strong{ display: block; font-size: 0.88rem; color: var(--ink-900); margin-bottom: 3px; }
.notif-item span{ font-size: 0.8rem; color: var(--ink-500); }

.notif-icon{
  width: 38px; height: 38px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  color: #fff;
  flex-shrink: 0;
}
.notif-icon .material-symbols-rounded{ font-size: 19px; }
.notif-icon.warning{ background: linear-gradient(135deg, #EF6C00, #FFB74D); }
.notif-icon.info{ background: var(--gradient-primary); }
.notif-icon.ok{ background: linear-gradient(135deg, #2E7D32, #66BB6A); }

/* ==========================================================================
   SETTINGS
   ========================================================================== */
.settings-panel{ max-width: 640px; }
.settings-row{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 4px;
  border-bottom: 1px solid var(--border-soft);
}
.settings-row:last-child{ border-bottom: none; }
.settings-row strong{ display: block; font-size: 0.88rem; color: var(--ink-900); margin-bottom: 2px; }
.settings-row span{ font-size: 0.8rem; color: var(--ink-500); }

.switch{ position: relative; width: 44px; height: 26px; flex-shrink: 0; }
.switch input{ opacity: 0; width: 0; height: 0; }
.switch-track{
  position: absolute; inset: 0;
  background: var(--border-soft);
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background 0.25s var(--ease);
}
.switch-track::before{
  content: "";
  position: absolute;
  width: 20px; height: 20px;
  left: 3px; top: 3px;
  background: #fff;
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
  transition: transform 0.25s var(--ease);
}
.switch input:checked ~ .switch-track{ background: var(--gradient-primary); }
.switch input:checked ~ .switch-track::before{ transform: translateX(18px); }

/* ==========================================================================
   BORROW DURATION MODAL
   ========================================================================== */
.modal-overlay{
  position: fixed;
  inset: 0;
  background: rgba(15, 27, 45, 0.55);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s var(--ease), visibility 0.3s var(--ease);
}
.modal-overlay.show{ opacity: 1; visibility: visible; }

.modal-box{
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 28px;
  width: 100%;
  max-width: 420px;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: translateY(20px) scale(0.98);
  transition: transform 0.35s var(--ease);
}
.modal-overlay.show .modal-box{ transform: translateY(0) scale(1); }

.modal-head{
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.modal-head h3{ font-size: 1.05rem; font-weight: 700; color: var(--ink-900); }
.modal-close{
  width: 32px; height: 32px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  color: var(--ink-500);
  transition: background 0.2s var(--ease);
}
.modal-close:hover{ background: var(--bg-grey-dark); }

.modal-book-title{
  font-size: 0.86rem;
  color: var(--ink-500);
  margin-bottom: 18px;
}

.duration-chips{
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.modal-box .field-group{ margin-bottom: 16px; }

.return-date-preview{
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-grey-dark);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 8px;
}
.return-date-preview .material-symbols-rounded{ color: var(--primary); font-size: 22px; }
.return-date-preview input[type="date"]{
  flex-shrink: 0;
  width: 148px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border-soft);
  background: #fff;
  font-family: inherit;
  font-size: 0.82rem;
  color: var(--ink-900);
  transition: border-color 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.return-date-preview input[type="date"]:focus{
  outline: none;
  border-color: var(--secondary);
  box-shadow: 0 0 0 4px rgba(66,165,245,0.14);
}
.return-date-preview strong{ display: block; font-size: 0.78rem; color: var(--ink-900); }
.return-date-preview span{ font-size: 0.82rem; color: var(--ink-500); }

.modal-hint{
  font-size: 0.74rem;
  color: var(--ink-300);
  margin-bottom: 20px;
}

/* ==========================================================================
   TOAST
   ========================================================================== */
.toast{
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translate(-50%, 20px);
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--ink-900);
  color: #fff;
  padding: 14px 22px;
  border-radius: var(--radius-pill);
  font-size: 0.86rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s var(--ease), transform 0.35s var(--ease);
  z-index: 500;
}
.toast.show{ opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast .material-symbols-rounded{ color: #66BB6A; font-size: 20px; }

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 1080px){
  .panel-grid{ grid-template-columns: 1fr; }
  .stat-grid{ grid-template-columns: repeat(2, 1fr); }
  .profile-grid{ grid-template-columns: 1fr; }
  .book-grid{ grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 900px){
  .sidebar{
    position: fixed;
    left: 0; top: 0;
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open{ transform: translateX(0); }
  .sidebar-overlay.show{ display: block; opacity: 1; }
  .sidebar-toggle{ display: grid; }
  .dash-content{ padding: 22px 20px 50px; }
  .topbar{ padding: 14px 20px; gap: 12px; }
  .profile-text{ display: none; }
  .book-grid{ grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px){
  .welcome-banner{ flex-direction: column; align-items: flex-start; }
  .stat-grid{ grid-template-columns: 1fr 1fr; gap: 12px; }
  .stat-card{ padding: 14px; }
  .topbar-search input{ font-size: 0.82rem; }
  .catalog-toolbar{ flex-direction: column; align-items: stretch; }
  .catalog-search{ max-width: 100%; }
}

@media (max-width: 480px){
  .stat-grid{ grid-template-columns: 1fr; }
  .book-grid{ grid-template-columns: 1fr; }
}