body {
  background: linear-gradient(180deg, #fff7ed 0%, #e0ecff 100%);
  background-attachment: fixed;
}

.main {
  max-width: 1200px;
  margin: 0 auto;
}

/* subnav */
.dashboard-subnav {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 34px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(31, 41, 55, 0.08);
}

.dashboard-tab {
  background: none;
  border: none;
  color: var(--text-main);
  font-family: 'Syne', sans-serif;
  font-weight: 600;
  font-size: 0.98rem;
  padding: 6px 0;
  cursor: pointer;
  position: relative;
  transition: color 0.2s ease;
}

.dashboard-tab::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -3px;
  width: 0;
  height: 2px;
  background: var(--accent);
  transition: width 0.2s ease;
}

.dashboard-tab:hover {
  color: var(--primary);
}

.dashboard-tab:hover::after,
.dashboard-tab.active::after {
  width: 100%;
}

.dashboard-tab.active {
  color: var(--accent);
}

/* titles */
.page-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 32px;
}

.page-title h1 {
  font-size: 2.3rem;
  line-height: 1.05;
  letter-spacing: -1px;
  color: var(--text-main);
}

.page-title h1 span {
  color: var(--accent);
}

.subtitle {
  font-size: 1rem;
  color: #4b5563;
  margin-top: 8px;
  font-family: Arial, sans-serif;
}

.timestamp {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: #6b7280;
  margin-top: 10px;
  white-space: nowrap;
}

/* shared card look */
.stat-card,
.section-card,
.table-wrap,
.lening-card {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(229, 231, 235, 0.95);
  border-radius: 24px;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.04);
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.stat-card:hover,
.lening-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 26px rgba(0, 0, 0, 0.07);
  border-color: #dbe3ee;
}

/* stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 20px;
  margin-bottom: 36px;
}

.stat-card {
  padding: 24px 22px;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 18px;
  right: 18px;
  height: 4px;
  border-radius: 999px;
}

.stat-card.blue::before { background: #1e3a8a; }
.stat-card.amber::before { background: #b45309; }
.stat-card.red::before { background: #b91c1c; }

.stat-label {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #6b7280;
  margin-bottom: 10px;
}

.stat-value {
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 8px;
}

.stat-sub {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  color: #6b7280;
}

.stat-card.blue .stat-value { color: #1e3a8a; }
.stat-card.amber .stat-value { color: #b45309; }
.stat-card.red .stat-value { color: #b91c1c; }

/* section cards */
.section-card {
  overflow: hidden;
  margin-bottom: 32px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 22px 14px;
  gap: 12px;
  flex-wrap: wrap;
}

.section-label {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #6b7280;
  margin-bottom: 6px;
}

.section-title {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text-main);
}

/* controls */
.controls {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.search-input,
.filter-select {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid #d1d5db;
  border-radius: 12px;
  padding: 10px 12px;
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  color: var(--text-main);
  outline: none;
}

.search-input {
  min-width: 220px;
}

.search-input::placeholder {
  color: #9ca3af;
}

.search-input:focus,
.filter-select:focus {
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.08);
}

/* active cards grid */
.active-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
  padding: 0 22px 22px;
}

/* lening cards */
.lening-card {
  overflow: hidden;
}

.lening-card.te-laat-card {
  background: #fffafa;
}

.lening-card.bijna-card {
  background: #fffaf3;
}

.lening-card-img {
  width: 100%;
  height: 130px;
  object-fit: cover;
  display: block;
}

.lening-card-img-placeholder {
  width: 100%;
  height: 130px;
  background: #f3f4f6;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: #6b7280;
}

.lening-card-body {
  padding: 16px 16px 12px;
}

.lening-card-name {
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 6px;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lening-card-owner {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.lening-card-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.lening-meta-item {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  color: #6b7280;
}

.lening-meta-val {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--text-main);
  font-weight: 500;
  margin-top: 2px;
}

.lening-card-footer {
  border-top: 1px solid #f3f4f6;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* countdown */
.countdown {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: 999px;
  display: inline-block;
}

.countdown.ok {
  color: #166534;
  background: #dcfce7;
}

.countdown.soon {
  color: #b45309;
  background: #fef3c7;
}

.countdown.overdue {
  color: #b91c1c;
  background: #fee2e2;
}

/* chat button */
.btn-chat {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #e0ecff;
  color: #1e3a8a;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  font-weight: 500;
  padding: 6px 11px;
  cursor: pointer;
  transition: 0.2s ease;
  text-decoration: none;
}

.btn-chat:hover {
  transform: translateY(-1px);
}

/* timeline */
.timeline {
  padding: 0 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 80px 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 12px 10px;
  border-radius: 14px;
  transition: background 0.12s;
}

.timeline-item:hover {
  background: #fffdfa;
}

.tl-date {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--text-muted);
  text-align: right;
}

.tl-body {
  min-width: 0;
}

.tl-name {
  font-weight: 600;
  font-size: 13px;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tl-sub {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  color: #6b7280;
  margin-top: 2px;
}

.deadline-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  padding: 5px 10px;
  border-radius: 999px;
  font-weight: 500;
  white-space: nowrap;
}

.deadline-pill.ok {
  background: #dcfce7;
  color: #166534;
}

.deadline-pill.soon {
  background: #fef3c7;
  color: #b45309;
}

.deadline-pill.overdue {
  background: #fee2e2;
  color: #b91c1c;
}

/* borg */
.borg-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 22px;
  border-top: 1px solid #f3f4f6;
  gap: 12px;
}

.borg-row:first-child {
  border-top: none;
}

.borg-tool {
  font-weight: 600;
  font-size: 13px;
  color: var(--text-main);
}

.borg-owner {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.borg-amount {
  font-family: 'DM Mono', monospace;
  font-size: 15px;
  font-weight: 500;
  color: #b45309;
}

/* tables */
.table-wrap {
  overflow: hidden;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead {
  background: transparent;
}

th {
  padding: 18px 16px 12px;
  text-align: left;
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #6b7280;
  white-space: nowrap;
}

td {
  padding: 18px 16px;
  font-size: 13px;
  border-top: 1px solid #f3f4f6;
  vertical-align: middle;
}

tbody tr:hover td {
  background: #fffdfa;
}

.mono {
  font-family: 'DM Mono', monospace;
  font-size: 12px;
}

.muted {
  color: var(--text-muted);
}

.tool-name {
  font-weight: 700;
  color: var(--text-main);
}

.tool-name small {
  display: block;
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  color: #6b7280;
  margin-top: 2px;
}

/* badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  font-weight: 500;
  white-space: nowrap;
  border: 1px solid transparent;
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.badge.beschikbaar {
  background: #dcfce7;
  color: #166534;
  border-color: #bbf7d0;
}
.badge.beschikbaar .badge-dot {
  background: #166534;
}

.badge.uitgeleend {
  background: #fff1e8;
  color: var(--accent);
  border-color: #fdba74;
}
.badge.uitgeleend .badge-dot {
  background: var(--accent);
}

.badge.te-laat {
  background: #fee2e2;
  color: #b91c1c;
  border-color: #fecaca;
}
.badge.te-laat .badge-dot {
  background: #b91c1c;
}

.badge.pending {
  background: #fef3c7;
  color: #b45309;
  border-color: #fde68a;
}
.badge.pending .badge-dot {
  background: #b45309;
}

.badge.teruggegeven {
  background: #e0ecff;
  color: #1e3a8a;
  border-color: #bfdbfe;
}
.badge.teruggegeven .badge-dot {
  background: #1e3a8a;
}

/* tabs */
.tab-bar {
  display: flex;
  gap: 4px;
}

.tab {
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  background: #ffffff;
  border-radius: 10px;
  color: var(--text-muted);
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  cursor: pointer;
  transition: 0.2s ease;
}

.tab.active {
  background: #e0ecff;
  color: #1e3a8a;
  border-color: #bfdbfe;
}

/* pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-top: 1px solid #e5e7eb;
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: #6b7280;
  flex-wrap: wrap;
  gap: 8px;
  background: #f9fafb;
}

.pagination-btns {
  display: flex;
  gap: 6px;
}

.page-btn {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid #d1d5db;
  background: #ffffff;
  color: var(--text-main);
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  cursor: pointer;
}

.page-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* empty state */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 20px;
  gap: 10px;
}

.empty-icon {
  font-size: 32px;
  opacity: 0.4;
}

.empty-text {
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  color: #6b7280;
}

/* toast */
#toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #ffffff;
  border: 1px solid #e5e7eb;
  color: var(--text-main);
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  padding: 10px 18px;
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(0,0,0,0.08);
  opacity: 0;
  transition: opacity .2s, transform .2s;
  pointer-events: none;
  z-index: 9999;
  white-space: nowrap;
}

#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 700px) {
  .main {
    padding: 20px 14px 48px;
  }

  .active-grid {
    grid-template-columns: 1fr;
    padding: 0 14px 14px;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-subnav {
    flex-direction: column;
    align-items: stretch;
  }

  .dashboard-tab {
    width: 100%;
    text-align: center;
  }
}