@import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap");

:root {
  --primary: #c8956c;
  --primary-dark: #a8714a;
  --primary-light: #e0b08a;
  --success: #7cb87a;
  --warning: #e8b86d;
  --danger: #d97068;
  --info: #7aabcc;

  --bg-primary: #1a1208;
  --bg-secondary: #221a0e;
  --bg-tertiary: #2e2213;
  --bg-card: rgba(200, 149, 108, 0.06);
  --bg-card-hover: rgba(200, 149, 108, 0.11);

  --glass-bg: rgba(30, 20, 10, 0.6);
  --glass-border: rgba(200, 149, 108, 0.18);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  --glass-blur: blur(22px);

  --text-primary: #f5ede4;
  --text-secondary: #c4a882;
  --text-muted: #8a7060;

  --sidebar-width: 262px;
  --sidebar-collapsed: 72px;
  --navbar-height: 64px;

  --border-color: rgba(200, 149, 108, 0.15);
  --border-radius: 16px;
  --border-radius-sm: 10px;
  --border-radius-lg: 24px;

  --transition: all 0.32s cubic-bezier(0.4, 0, 0.2, 1);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 4px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 8px 44px rgba(0, 0, 0, 0.45);
  --shadow-glow: 0 0 32px rgba(200, 149, 108, 0.3);

  --gradient-primary: linear-gradient(135deg, #c8956c, #a8714a);
  --gradient-success: linear-gradient(135deg, #7cb87a, #4e9c5a);
  --gradient-warning: linear-gradient(135deg, #e8b86d, #c8904a);
  --gradient-danger: linear-gradient(135deg, #d97068, #b84a42);
  --gradient-info: linear-gradient(135deg, #7aabcc, #4a80aa);
  --gradient-bg:
    radial-gradient(
      ellipse at top left,
      rgba(200, 149, 108, 0.18) 0%,
      transparent 55%
    ),
    radial-gradient(
      ellipse at bottom right,
      rgba(168, 113, 74, 0.12) 0%,
      transparent 55%
    ),
    var(--bg-primary);
}

[data-theme="light"] {
  --bg-primary: #fdf6ee;
  --bg-secondary: #f5ead8;
  --bg-tertiary: #ecddc8;
  --bg-card: rgba(255, 255, 255, 0.78);
  --bg-card-hover: rgba(255, 255, 255, 0.95);
  --glass-bg: rgba(255, 248, 240, 0.75);
  --glass-border: rgba(200, 149, 108, 0.28);
  --glass-shadow: 0 8px 32px rgba(120, 80, 40, 0.12);
  --text-primary: #2c1a08;
  --text-secondary: #7a5030;
  --text-muted: #b08060;
  --border-color: rgba(168, 113, 74, 0.18);
  --shadow-sm: 0 2px 8px rgba(120, 80, 40, 0.08);
  --shadow-md: 0 4px 20px rgba(120, 80, 40, 0.13);
  --shadow-lg: 0 8px 40px rgba(120, 80, 40, 0.18);
  --shadow-glow: 0 0 30px rgba(200, 149, 108, 0.22);
  --gradient-bg:
    radial-gradient(
      ellipse at top left,
      rgba(200, 149, 108, 0.1) 0%,
      transparent 55%
    ),
    radial-gradient(
      ellipse at bottom right,
      rgba(168, 113, 74, 0.07) 0%,
      transparent 55%
    ),
    var(--bg-primary);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
html {
  scroll-behavior: smooth;
}
body {
  font-family:
    "Inter",
    -apple-system,
    BlinkMacSystemFont,
    sans-serif;
  background: var(--gradient-bg);
  color: var(--text-primary);
  min-height: 100vh;
  transition:
    background 0.4s ease,
    color 0.3s ease;
  overflow-x: hidden;
}

::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--primary);
  border-radius: 10px;
}

/* ── GLASS CARD ───────────────── */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-md);
  transition: var(--transition);
}
.glass-card:hover {
  background: var(--bg-card-hover);
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

/* ── LAYOUT ───────────────────── */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ── SIDEBAR ──────────────────── */
.sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-right: 1px solid var(--border-color);
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1040;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.sidebar.collapsed {
  width: var(--sidebar-collapsed);
}

@media (max-width: 768px) {
  .sidebar {
    left: -100%;
    width: var(--sidebar-width) !important;
    box-shadow: none;
  }
  .sidebar.mobile-open {
    left: 0;
    box-shadow: 0 0 60px rgba(0, 0, 0, 0.55);
  }
}

/* overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1039;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.sidebar-overlay.show {
  display: block;
}

/* logo */
.sidebar-logo {
  height: var(--navbar-height);
  display: flex;
  align-items: center;
  padding: 0 18px;
  gap: 12px;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
  overflow: hidden;
  flex-shrink: 0;
}
.sidebar-logo .logo-icon {
  width: 38px;
  height: 38px;
  background: var(--gradient-primary);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  box-shadow: var(--shadow-glow);
}
.sidebar-logo .logo-text {
  font-size: 16px;
  font-weight: 800;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  white-space: nowrap;
  transition: var(--transition);
}
.sidebar.collapsed .logo-text {
  opacity: 0;
  width: 0;
  pointer-events: none;
}

/* nav */
.sidebar-nav {
  flex: 1;
  padding: 10px 0;
  overflow-y: auto;
  overflow-x: hidden;
}
.nav-section-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 10px 20px 4px;
  white-space: nowrap;
  transition: var(--transition);
}
.sidebar.collapsed .nav-section-title {
  opacity: 0;
  height: 0;
  padding: 0;
  pointer-events: none;
}

.nav-item {
  padding: 2px 10px;
}
.nav-link-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--border-radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  transition: var(--transition);
  white-space: nowrap;
  overflow: hidden;
  position: relative;
  cursor: pointer;
}
.nav-link-item:hover {
  background: rgba(200, 149, 108, 0.12);
  color: var(--primary-light);
  transform: translateX(3px);
}
.nav-link-item.active {
  background: rgba(200, 149, 108, 0.18);
  color: var(--primary);
  font-weight: 600;
}
.nav-link-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 18%;
  height: 64%;
  width: 3px;
  background: var(--gradient-primary);
  border-radius: 0 4px 4px 0;
}
.nav-link-item .nav-icon {
  font-size: 17px;
  flex-shrink: 0;
  width: 22px;
  text-align: center;
}
.nav-link-item .nav-label {
  font-size: 14px;
  transition: var(--transition);
}
.sidebar.collapsed .nav-label {
  opacity: 0;
  width: 0;
  overflow: hidden;
}

.nav-badge {
  margin-left: auto;
  background: var(--primary);
  color: white;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 20px;
  min-width: 18px;
  text-align: center;
  flex-shrink: 0;
  transition: var(--transition);
}
.sidebar.collapsed .nav-badge {
  opacity: 0;
  width: 0;
  padding: 0;
  margin: 0;
}

.sidebar-footer {
  padding: 12px 10px;
  border-top: 1px solid var(--border-color);
  flex-shrink: 0;
}

/* ── MAIN WRAPPER ─────────────── */
.main-wrapper {
  flex: 1;
  margin-left: var(--sidebar-width);
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.main-wrapper.sidebar-collapsed {
  margin-left: var(--sidebar-collapsed);
}
@media (max-width: 768px) {
  .main-wrapper {
    margin-left: 0 !important;
  }
}

/* ── TOP NAVBAR ───────────────── */
.top-navbar {
  height: var(--navbar-height);
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 999;
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 10px;
  flex-shrink: 0;
}
.navbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}
.navbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.sidebar-toggle-btn {
  background: none;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  font-size: 17px;
  flex-shrink: 0;
}
.sidebar-toggle-btn:hover {
  background: rgba(200, 149, 108, 0.12);
  color: var(--primary);
  border-color: var(--primary);
}

.search-wrapper {
  position: relative;
  max-width: 300px;
  width: 100%;
}
@media (max-width: 576px) {
  .search-wrapper {
    max-width: 150px;
  }
}
@media (max-width: 380px) {
  .search-wrapper {
    display: none;
  }
}

.search-input {
  width: 100%;
  padding: 8px 50px 8px 36px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 25px;
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  transition: var(--transition);
}
.search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(200, 149, 108, 0.15);
}
.search-input::placeholder {
  color: var(--text-muted);
}
.search-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 13px;
}
.search-ai-badge {
  position: absolute;
  right: 11px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--gradient-primary);
  color: white;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  letter-spacing: 0.5px;
}

.nav-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  font-size: 15px;
  position: relative;
}
.nav-btn:hover {
  background: rgba(200, 149, 108, 0.12);
  color: var(--primary);
  border-color: var(--primary);
}

.notification-dot {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 8px;
  height: 8px;
  background: var(--danger);
  border-radius: 50%;
  border: 2px solid var(--bg-primary);
  animation: blink 2s infinite;
}
@keyframes blink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.4;
  }
}

.branch-select {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 6px 10px;
  border-radius: 10px;
  font-size: 12px;
  outline: none;
  cursor: pointer;
  transition: var(--transition);
  max-width: 140px;
}
@media (max-width: 640px) {
  .branch-select {
    display: none;
  }
}

/* user area */
.user-info-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: 8px;
  border-left: 1px solid var(--border-color);
  position: relative;
  cursor: pointer;
}
@media (max-width: 480px) {
  .user-info-nav .user-text {
    display: none;
  }
}
.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
  transition: var(--transition);
}
.user-avatar:hover {
  box-shadow: var(--shadow-glow);
}

/* user dropdown */
.user-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 200px;
  background: var(--bg-secondary);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-lg);
  z-index: 1100;
  overflow: hidden;
  animation: dropIn 0.2s ease;
}
.user-dropdown-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
}
.user-dropdown-item {
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}
.user-dropdown-item:hover {
  background: rgba(200, 149, 108, 0.08);
  color: var(--primary);
}
.user-dropdown-item.danger {
  color: var(--danger);
}
.user-dropdown-item.danger:hover {
  background: rgba(217, 112, 104, 0.08);
}

/* notification dropdown */
.notification-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 310px;
  background: var(--bg-secondary);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-lg);
  z-index: 1100;
  overflow: hidden;
  animation: dropIn 0.2s ease;
}
@media (max-width: 420px) {
  .notification-dropdown {
    width: 270px;
    right: -50px;
  }
}
.notification-header {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.notification-header h6 {
  font-weight: 700;
  margin: 0;
  font-size: 14px;
}
.notif-item {
  padding: 11px 16px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  gap: 10px;
  align-items: flex-start;
  cursor: pointer;
  transition: var(--transition);
}
.notif-item:hover {
  background: rgba(200, 149, 108, 0.06);
}
.notif-icon-wrap {
  width: 33px;
  height: 33px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}
.notif-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2px;
}
.notif-msg {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-bottom: 2px;
}
.notif-time {
  font-size: 10px;
  color: var(--text-muted);
}

@keyframes dropIn {
  from {
    opacity: 0;
    transform: translateY(-10px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ── MAIN CONTENT ─────────────── */
.main-content {
  flex: 1;
  padding: 24px 24px 40px;
  animation: fadeInUp 0.4s ease;
}
@media (max-width: 768px) {
  .main-content {
    padding: 16px 14px 32px;
  }
}
@media (max-width: 480px) {
  .main-content {
    padding: 12px 10px 28px;
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.page-header {
  margin-bottom: 22px;
}
.page-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.page-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
}
@media (max-width: 480px) {
  .page-title {
    font-size: 20px;
  }
}

/* ── ANIMATED STAT CARDS ──────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
@media (max-width: 1100px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
}

.stat-card {
  border-radius: var(--border-radius);
  padding: 20px 18px 16px;
  position: relative;
  overflow: hidden;
  cursor: default;
  border: 1px solid var(--border-color);
  animation: cardPop 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease;
}
.stat-card:nth-child(1) {
  animation-delay: 0.05s;
}
.stat-card:nth-child(2) {
  animation-delay: 0.12s;
}
.stat-card:nth-child(3) {
  animation-delay: 0.19s;
}
.stat-card:nth-child(4) {
  animation-delay: 0.26s;
}
.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

@keyframes cardPop {
  from {
    opacity: 0;
    transform: translateY(22px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
.stat-card::before {
  content: "";
  position: absolute;
  top: -50px;
  right: -50px;
  width: 130px;
  height: 130px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
  pointer-events: none;
}
.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  margin-bottom: 13px;
  animation: iconBounce 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.35s both;
}
@keyframes iconBounce {
  from {
    transform: scale(0) rotate(-15deg);
  }
  to {
    transform: scale(1) rotate(0);
  }
}
.stat-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 4px;
  animation: fadeInUp 0.5s ease 0.4s both;
}
.stat-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 10px;
}
.stat-trend {
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}
.stat-trend.up {
  color: var(--success);
}
.stat-trend.down {
  color: var(--danger);
}
.stat-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: 0 0 var(--border-radius) var(--border-radius);
  overflow: hidden;
}
.stat-bar-fill {
  height: 100%;
  border-radius: inherit;
  animation: barGrow 1.2s ease 0.6s both;
}
@keyframes barGrow {
  from {
    width: 0;
  }
}

/* ── CHARTS GRID ──────────────── */
.charts-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 18px;
  margin-bottom: 20px;
}
@media (max-width: 992px) {
  .charts-grid {
    grid-template-columns: 1fr;
  }
}

.chart-card {
  padding: 20px;
}

/* ── TABLE ────────────────────── */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--border-radius);
  border: 1px solid var(--border-color);
}
.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 560px;
}
.data-table thead th {
  background: rgba(200, 149, 108, 0.08);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}
.data-table tbody tr {
  transition: var(--transition);
}
.data-table tbody tr:hover {
  background: rgba(200, 149, 108, 0.05);
}
.data-table tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  font-size: 13px;
  color: var(--text-primary);
  vertical-align: middle;
}
.data-table tbody tr:last-child td {
  border-bottom: none;
}

/* ── BADGES ───────────────────── */
.badge {
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  display: inline-block;
  white-space: nowrap;
}
.badge-success {
  background: rgba(124, 184, 122, 0.15);
  color: #7cb87a;
}
.badge-warning {
  background: rgba(232, 184, 109, 0.15);
  color: #e8b86d;
}
.badge-danger {
  background: rgba(217, 112, 104, 0.15);
  color: #d97068;
}
.badge-info {
  background: rgba(122, 171, 204, 0.15);
  color: #7aabcc;
}
.badge-primary {
  background: rgba(200, 149, 108, 0.15);
  color: #c8956c;
}
.badge-muted {
  background: rgba(138, 112, 96, 0.15);
  color: #c4a882;
}

/* ── BUTTONS ──────────────────── */
.btn-primary {
  background: var(--gradient-primary);
  color: white;
  border: none;
  padding: 9px 18px;
  border-radius: var(--border-radius-sm);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  box-shadow: 0 4px 14px rgba(200, 149, 108, 0.3);
  transition: var(--transition);
  white-space: nowrap;
  text-decoration: none;
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 22px rgba(200, 149, 108, 0.5);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  padding: 9px 18px;
  border-radius: var(--border-radius-sm);
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: var(--transition);
  white-space: nowrap;
  text-decoration: none;
}
.btn-secondary:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--primary);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

/* ── ACTION BUTTONS ───────────── */
.action-btns {
  display: flex;
  gap: 5px;
  flex-wrap: nowrap;
}
.action-btn {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  font-size: 12px;
  text-decoration: none;
  flex-shrink: 0;
}
.action-btn:hover {
  background: rgba(200, 149, 108, 0.1);
  color: var(--primary);
}
.action-btn.del:hover {
  background: rgba(217, 112, 104, 0.1);
  color: var(--danger);
  border-color: var(--danger);
}
.action-btn.edit:hover {
  background: rgba(232, 184, 109, 0.1);
  color: var(--warning);
  border-color: var(--warning);
}

/* ── FORM CONTROLS ────────────── */
.form-control {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: var(--border-radius-sm);
  padding: 9px 13px;
  font-size: 13px;
  transition: var(--transition);
  width: 100%;
  outline: none;
  font-family: inherit;
}
.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(200, 149, 108, 0.15);
  background: var(--bg-card-hover);
}
.form-control::placeholder {
  color: var(--text-muted);
}
select.form-control option {
  background: var(--bg-secondary);
  color: var(--text-primary);
}
.form-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 5px;
  display: block;
}

/* input with icon */
.input-icon-wrap {
  position: relative;
}
.input-icon-wrap .icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 14px;
}
.input-icon-wrap .form-control {
  padding-left: 37px;
}
.input-icon-wrap .toggle-pass {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
}

/* ── MODAL ────────────────────── */
.modal .modal-content {
  background: var(--bg-secondary);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.5);
  color: var(--text-primary);
}
.modal .modal-header {
  border-bottom: 1px solid var(--border-color);
  padding: 18px 22px;
}
.modal .modal-title {
  font-weight: 700;
  font-size: 16px;
}
.modal .modal-footer {
  border-top: 1px solid var(--border-color);
  padding: 14px 22px;
}
.modal .btn-close {
  filter: invert(1) sepia(1) saturate(2) hue-rotate(10deg);
}
[data-theme="light"] .modal .btn-close {
  filter: none;
}

/* ── AVATAR ───────────────────── */
.avatar-sm {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--gradient-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

/* ── TOAST ────────────────────── */
.toast-container {
  position: fixed;
  top: 70px;
  right: 16px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  padding: 12px 16px;
  min-width: 250px;
  max-width: 330px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.3s ease;
  cursor: pointer;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(100px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}
.toast.hiding {
  animation: slideOut 0.3s ease forwards;
}
@keyframes slideOut {
  to {
    opacity: 0;
    transform: translateX(100px);
  }
}
.toast-icon {
  font-size: 16px;
  flex-shrink: 0;
  margin-top: 1px;
}
.toast-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2px;
}
.toast-msg {
  font-size: 12px;
  color: var(--text-secondary);
}

/* ── AI CHATBOT ───────────────── */
.ai-chatbot {
  position: fixed;
  bottom: 22px;
  right: 22px;
  z-index: 9998;
}
.ai-chat-btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--gradient-primary);
  border: none;
  color: white;
  font-size: 20px;
  cursor: pointer;
  box-shadow: 0 8px 28px rgba(200, 149, 108, 0.5);
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 2;
}
.ai-chat-btn:hover {
  transform: scale(1.1);
}
.ai-pulse {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--primary);
  opacity: 0.25;
  animation: aiPulse 2s ease-out infinite;
  z-index: 1;
}
@keyframes aiPulse {
  0% {
    transform: scale(1);
    opacity: 0.25;
  }
  100% {
    transform: scale(1.9);
    opacity: 0;
  }
}
.ai-panel {
  position: absolute;
  bottom: 66px;
  right: 0;
  width: 290px;
  height: 380px;
  background: var(--bg-secondary);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-lg);
  display: none;
  flex-direction: column;
  overflow: hidden;
}
@media (max-width: 480px) {
  .ai-panel {
    width: 260px;
    right: -6px;
  }
}
.ai-panel.open {
  display: flex;
  animation: dropIn 0.3s ease;
}
.ai-panel-header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(200, 149, 108, 0.08);
  flex-shrink: 0;
}
.ai-messages {
  flex: 1;
  padding: 10px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ai-msg {
  max-width: 86%;
  padding: 9px 13px;
  border-radius: 13px;
  font-size: 12px;
  line-height: 1.55;
}
.ai-msg.bot {
  background: rgba(200, 149, 108, 0.12);
  color: var(--text-primary);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}
.ai-msg.user {
  background: var(--gradient-primary);
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.ai-input-wrap {
  padding: 10px;
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: 7px;
  flex-shrink: 0;
}
.ai-input {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 25px;
  padding: 7px 13px;
  color: var(--text-primary);
  font-size: 12px;
  outline: none;
  font-family: inherit;
}
.ai-input:focus {
  border-color: var(--primary);
}
.ai-send {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--gradient-primary);
  border: none;
  color: white;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  flex-shrink: 0;
}
.ai-send:hover {
  transform: scale(1.1);
}

/* ── FOOTER ───────────────────── */
.footer-bar {
  padding: 14px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  font-size: 11px;
  color: var(--text-muted);
  flex-wrap: wrap;
  gap: 6px;
  flex-shrink: 0;
}
@media (max-width: 480px) {
  .footer-bar {
    padding: 10px 14px;
    font-size: 10px;
  }
}

/* ── PAGE HEADER ROW ──────────── */
.page-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 22px;
}

/* ── MINI STATS ROW ───────────── */
.mini-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}
@media (max-width: 900px) {
  .mini-stats {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 480px) {
  .mini-stats {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
}

.mini-stat {
  padding: 16px 14px;
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  text-align: center;
  transition: var(--transition);
}
.mini-stat:hover {
  background: var(--bg-card-hover);
  transform: translateY(-2px);
}
.mini-stat .ms-val {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 3px;
}
.mini-stat .ms-label {
  font-size: 11px;
  color: var(--text-secondary);
}

/* ── FILTER ROW ───────────────── */
.filter-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.filter-row .form-control {
  width: auto;
  min-width: 140px;
}

/* ── PROGRESS BAR ─────────────── */
.progress-wrap {
  height: 6px;
  border-radius: 10px;
  background: var(--bg-tertiary);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: 10px;
  transition: width 1s ease;
}

/* ── RIPPLE ───────────────────── */
.ripple {
  position: relative;
  overflow: hidden;
}
.ripple::after {
  content: "";
  position: absolute;
  width: 0;
  height: 0;
  background: rgba(255, 255, 255, 0.22);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition:
    width 0.5s,
    height 0.5s,
    opacity 0.5s;
  opacity: 0;
}
.ripple:active::after {
  width: 200px;
  height: 200px;
  opacity: 1;
  transition: 0s;
}

/* ── QUICK ACTIONS ────────────── */
.quick-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}
.quick-btn {
  padding: 13px 8px;
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
  text-decoration: none;
  display: block;
}
.quick-btn:hover {
  background: rgba(200, 149, 108, 0.1);
  color: var(--primary);
  border-color: var(--primary);
  transform: translateY(-2px);
}
.quick-btn .q-icon {
  font-size: 20px;
  margin-bottom: 5px;
  display: block;
}
.quick-btn .q-label {
  font-size: 11px;
  font-weight: 500;
  display: block;
}

/* ── DASHBOARD BOTTOM ─────────── */
.dash-bottom {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-top: 20px;
}
@media (max-width: 992px) {
  .dash-bottom {
    grid-template-columns: 1fr;
  }
}

/* ── BOOK CARD (digital lib) ──── */
.book-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}
@media (max-width: 992px) {
  .book-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 560px) {
  .book-grid {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 380px) {
  .book-grid {
    grid-template-columns: 1fr;
  }
}

.book-card {
  border-radius: var(--border-radius);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  overflow: hidden;
  transition: var(--transition);
}
.book-card:hover {
  background: var(--bg-card-hover);
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary);
}
.book-cover {
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  position: relative;
  overflow: hidden;
}
.book-body {
  padding: 14px;
}
.book-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 3px;
  line-height: 1.4;
}
.book-author {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.book-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 10px;
}
.book-tag {
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
  background: rgba(200, 149, 108, 0.12);
  color: var(--primary);
}

/* ── SETTINGS TAB ─────────────── */
.settings-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 20px;
  align-items: start;
}
@media (max-width: 768px) {
  .settings-layout {
    grid-template-columns: 1fr;
  }
}

.settings-nav {
  position: sticky;
  top: 80px;
  padding: 10px;
  border-radius: var(--border-radius);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
}
@media (max-width: 768px) {
  .settings-nav {
    position: static;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 8px;
  }
  .settings-nav .s-nav-item {
    flex: 1;
    min-width: 120px;
    justify-content: center;
    text-align: center;
  }
}

.s-nav-section {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 8px 12px 4px;
}
@media (max-width: 768px) {
  .s-nav-section {
    display: none;
  }
}

.s-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--border-radius-sm);
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  text-decoration: none;
}
.s-nav-item:hover {
  background: rgba(200, 149, 108, 0.1);
  color: var(--primary);
}
.s-nav-item.active {
  background: rgba(200, 149, 108, 0.15);
  color: var(--primary);
  font-weight: 600;
}
.s-nav-item.danger {
  color: var(--danger);
}
.s-nav-item.danger:hover {
  background: rgba(217, 112, 104, 0.08);
}

.settings-tab {
  animation: fadeInUp 0.3s ease;
}
