:root {
  --brand: #173b6d;
  --brand-2: #0f2748;
  --brand-3: #10233f;
  --accent: #967f65;
  --accent-2: #b99f7d;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --text: #111827;
  --muted: #667085;
  --border: #e5e7eb;
  --success: #16a34a;
  --warning: #f59e0b;
  --danger: #dc2626;
  --info: #2563eb;
  --radius: 18px;
  --shadow: 0 12px 34px rgba(15, 23, 42, 0.08);
  --sidebar-width: 292px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: linear-gradient(180deg, #f7f9fc 0%, #eef3f9 100%);
  font-family: Inter, Arial, sans-serif;
  color: var(--text);
  font-size: 15px;
}

a {
  text-decoration: none;
}

.container,
.container-fluid {
  max-width: 1440px;
}

/* General */
.page-title {
  font-weight: 800;
  color: #101828;
  letter-spacing: -0.03em;
}

.page-subtitle,
.small-muted {
  color: var(--muted);
  font-size: 0.92rem;
}

.card {
  border: 1px solid rgba(226, 232, 240, 0.85);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  background: rgba(255, 255, 255, 0.96);
}

.card-soft {
  background: linear-gradient(135deg, #fff, #f8fafc);
}

.card-header {
  background: transparent;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
}

/* Buttons */
.btn {
  border-radius: 12px;
  font-weight: 700;
  padding: 0.62rem 1rem;
}

.btn-sm {
  border-radius: 10px;
  padding: 0.4rem 0.7rem;
}

.btn-primary {
  background: linear-gradient(#003C50);
  border: 0;
}

.btn-primary:hover {
  background: linear-gradient(#967F65);
}

.btn-success {
  background: var(--success);
  border-color: var(--success);
}

.btn-outline-secondary {
  border-color: #cbd5e1;
  color: #344054;
  background: #fff;
}

.btn-outline-secondary:hover {
  background: #f1f5f9;
  color: #111827;
}

/* Forms */
.form-control,
.form-select {
  border-radius: 13px;
  border: 1px solid #d7dde8;
  padding: 0.72rem 0.85rem;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 0.2rem rgba(23, 59, 109, 0.12);
}

label.form-label {
  font-weight: 700;
  color: #344054;
}

/* Tables */
.table-card {
  overflow: hidden;
}

.table {
  --bs-table-bg: transparent;
}

.table thead th {
  background: #f3f6fb;
  color: #344054;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid #e5e7eb;
  white-space: nowrap;
}

.table tbody td {
  vertical-align: middle;
  border-color: #edf1f5;
}

.table tbody tr:hover {
  background: #fbfdff;
}

/* Badges */
.status,
.badge-available,
.badge-borrowed,
.badge-maintenance {
  border-radius: 999px;
  padding: 0.33rem 0.65rem;
  font-size: 0.78rem;
  font-weight: 800;
  display: inline-block;
}

.status.Available,
.badge-available {
  background: #dcfce7;
  color: #166534;
}

.status.Borrowed,
.badge-borrowed {
  background: #ffedd5;
  color: #9a3412;
}

.status.Maintenance,
.badge-maintenance {
  background: #fef3c7;
  color: #92400e;
}

.status.Retired,
.status.Returned {
  background: #e5e7eb;
  color: #374151;
}

.status.Overdue {
  background: #fee2e2;
  color: #991b1b;
}

.brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: #eef4ff;
  color: var(--brand);
  border: 1px solid #dbeafe;
  border-radius: 999px;
  padding: 0.38rem 0.85rem;
  font-weight: 800;
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.text-brand {
  color: var(--brand) !important;
}

.link-muted {
  color: var(--muted);
}

.link-muted:hover {
  color: var(--brand);
}

/* Login Page */
.login-page {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at center, rgba(37, 99, 235, 0.14), transparent 35%),
    linear-gradient(135deg, #003C50 0%, #003C50 55%, #003C50 100%);
}

.login-wrapper {
  width: 100%;
}

.login-box {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
}

.login-box .card {
  width: 100%;
  background: #ffffff;
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: 24px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.25);
  color: #111827;
}

.login-box .card-body {
  padding: 2.6rem;
  text-align: center;
}

.login-logo {
  width: 74px;
  height: 74px;
  border-radius: 50%;
  margin: 0 auto 1.4rem;
  background: rgba(37, 99, 235, 0.12);
  border: 1px solid rgba(96, 165, 250, 0.35);
  color: #2563eb;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 1.6rem;
}

.login-box h1,
.login-box h2 {
  color: #111827;
  font-weight: 900;
  font-size: 2rem;
  margin-bottom: 1rem;
}

.login-box p,
.login-box .small-muted,
.login-box .footer-note {
  color: #667085;
}

.login-box label {
  color: #344054;
  text-align: left;
  display: block;
  font-weight: 800;
}

.login-box .form-control {
  height: 56px;
  background: #ffffff;
  border: 1px solid #cfd8e3;
  color: #111827;
  border-radius: 14px;
}

.login-box .form-control::placeholder {
  color: #98a2b3;
}

.login-box .form-control:focus {
  background: #ffffff;
  color: #111827;
  border-color: #2563eb;
  box-shadow: 0 0 0 0.22rem rgba(37, 99, 235, 0.16);
}

.login-box .btn-primary {
  width: 100%;
  height: 54px;
  border-radius: 999px;
  background: linear-gradient(135deg, #003C50, #336373);
  border: 0;
  color: #ffffff;
  font-weight: 900;
  box-shadow: none;
}

.login-box .btn-primary:hover {
  background: linear-gradient(135deg, #967F65, #ab9984);
}

.login-box a {
  color: #2563eb;
  font-weight: 800;
}

/* Login Hero Left */
.hero-brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.apsh-logo {
  width: 320px;
  height: auto;
  margin-bottom: 20px;
  display: block;
}

.hero-title {
  color: #ffffff;
  font-size: 2.45rem;
  font-weight: 800;
  line-height: 1.16;
  margin: 0 0 1rem;
  letter-spacing: -0.03em;
  max-width: 650px;
}

.login-page .lead {
  font-size: 1.13rem;
  line-height: 1.55;
  max-width: 620px;
}

/* Centralized Footer */
.login-footer,
.site-footer {
  width: 100%;
  text-align: center;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.8rem;
}

.login-footer,
.login-page .site-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 20px;
  z-index: 5;
  padding: 0 16px;
}

.login-footer a,
.site-footer a {
  color: #6ee7b7;
  font-weight: 800;
  text-decoration: none;
}

.login-footer a:hover,
.site-footer a:hover {
  color: #a7f3d0;
}

.admin-body .site-footer,
.public-body .site-footer {
  color: #667085;
  padding: 18px 16px;
}

/* Public */
.public-shell,
.public-body {
  min-height: 100vh;
}

.public-body {
  background: #f5f7fb;
  overflow-x: hidden;
}

.hero-card {
  border-radius: 28px;
  background: linear-gradient(135deg, #fff, #f8fbff);
  position: relative;
  overflow: hidden;
}

.hero-card::before {
  content: "";
  position: absolute;
  right: -80px;
  top: -80px;
  width: 220px;
  height: 220px;
  border-radius: 999px;
  background: rgba(150, 127, 101, 0.13);
}

.action-tile {
  display: block;
  color: inherit;
  border: 1px solid #e5e7eb;
  border-radius: 20px;
  padding: 1.1rem;
  background: #fff;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
  transition: 0.2s;
}

.action-tile:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.11);
  color: inherit;
}

.action-icon {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background: #eef4ff;
  color: var(--brand);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  margin-bottom: 0.8rem;
}

.footer-note {
  color: #94a3b8;
  font-size: 0.85rem;
}

/* Sidebar Shared */
.admin-body {
  background: #f5f7fb;
  min-height: 100vh;
  overflow-x: hidden;
}

.admin-shell,
.public-sidebar-layout {
  min-height: 100vh;
  display: flex;
}

.admin-sidebar,
.public-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: linear-gradient(180deg, #003C50 0%, #003C50 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  z-index: 1040;
  box-shadow: 18px 0 45px rgba(15, 23, 42, 0.18);
}

.sidebar-brand {
  padding: 1.35rem 1.15rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  color: #fff !important;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 900;
  flex: 0 0 42px;
}

.brand-title {
  display: block;
  font-weight: 900;
  letter-spacing: 0.05em;
  line-height: 1;
}

.brand-subtitle {
  display: block;
  margin-top: 0.24rem;
  font-size: 0.72rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.62);
}

.sidebar-user {
  margin: 1rem 1rem 0.8rem;
  padding: 0.9rem;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(255, 255, 255, 0.055);
  border-radius: 18px;
  display: flex;
  align-items: center;
  gap: 0.72rem;
}

.user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 14px;
  background: #eef4ff;
  color: var(--brand);
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-name {
  font-weight: 800;
  font-size: 0.88rem;
  max-width: 170px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.75rem;
}

.sidebar-nav {
  padding: 0.35rem 0.75rem 1rem;
  overflow-y: auto;
  flex: 1;
}

.sidebar-section {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  color: rgba(255, 255, 255, 0.38);
  font-weight: 800;
  padding: 1.05rem 0.75rem 0.45rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  color: rgba(255, 255, 255, 0.78) !important;
  padding: 0.72rem 0.78rem;
  border-radius: 14px;
  font-weight: 700;
  margin: 0.12rem 0;
  transition: 0.18s;
}

.sidebar-link:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff !important;
}

.sidebar-link.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff !important;
  box-shadow: 0 10px 24px rgba(150, 127, 101, 0.28);
}

.nav-icon {
  width: 26px;
  height: 26px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 0.9rem;
  flex: 0 0 26px;
}

.sidebar-link.active .nav-icon {
  background: rgba(255, 255, 255, 0.22);
}

.sidebar-footer {
  padding: 0.8rem 0.75rem 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.logout-link {
  color: #fecaca !important;
}

.logout-link:hover {
  background: rgba(220, 38, 38, 0.15);
  color: #fff !important;
}

/* Main Layout */
.admin-main,
.public-main {
  margin-left: var(--sidebar-width);
  width: calc(100% - var(--sidebar-width));
  min-height: 100vh;
}

.admin-topbar,
.public-topbar {
  height: 74px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(226, 232, 240, 0.9);
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 1.45rem;
  position: sticky;
  top: 0;
  z-index: 1020;
}

.topbar-title {
  font-weight: 900;
  color: #101828;
  letter-spacing: -0.02em;
}

.topbar-subtitle {
  font-size: 0.82rem;
  color: var(--muted);
}

.topbar-spacer {
  flex: 1;
}

.sidebar-toggle {
  display: none;
  border: 1px solid #d7dde8;
  background: #fff;
  color: #0f2748;
  border-radius: 12px;
  width: 42px;
  height: 42px;
  font-size: 1.25rem;
  font-weight: 900;
}

.admin-content,
.public-content {
  padding: 1.6rem 1.45rem 2.2rem;
  max-width: 1480px;
  margin: 0 auto;
}

.sidebar-backdrop {
  display: none;
}

/* Info / Success */
.min-w-0 {
  min-width: 0;
}

.info-list {
  display: grid;
  gap: 0.75rem;
}

.info-list > div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid #eef2f7;
  padding-bottom: 0.75rem;
}

.info-list > div:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.info-list span {
  color: var(--muted);
  font-size: 0.9rem;
}

.info-list strong {
  text-align: right;
  color: #101828;
}

.success-wrap {
  min-height: calc(100vh - 160px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.success-card {
  max-width: 560px;
  width: 100%;
}

.success-icon {
  width: 74px;
  height: 74px;
  border-radius: 24px;
  background: #dcfce7;
  color: #166534;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 2.4rem;
  font-weight: 900;
  margin-bottom: 1rem;
}

/* Responsive */
@media (max-width: 991.98px) {
  .admin-sidebar,
  .public-sidebar {
    transform: translateX(-105%);
    transition: transform 0.22s ease;
    width: 286px;
  }

  .sidebar-open .admin-sidebar,
  .sidebar-open .public-sidebar {
    transform: translateX(0);
  }

  .admin-main,
  .public-main {
    margin-left: 0;
    width: 100%;
  }

  .sidebar-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.48);
    z-index: 1030;
    opacity: 0;
    pointer-events: none;
    transition: 0.22s;
  }

  .sidebar-open .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .admin-topbar,
  .public-topbar {
    height: 68px;
    padding: 0 1rem;
  }

  .admin-content,
  .public-content {
    padding: 1rem;
  }

  .table-responsive {
    border-radius: 16px;
  }

  .card-body {
    padding: 1.1rem !important;
  }

  .page-title {
    font-size: 1.55rem;
  }

  .mobile-full,
  .hero-card .btn {
    width: 100%;
  }

  .info-list > div {
    display: block;
  }

  .info-list strong {
    display: block;
    text-align: left;
    margin-top: 0.15rem;
  }

  .hero-title {
    font-size: 2.1rem;
  }

  .apsh-logo {
    width: 280px;
  }
}

@media (max-width: 575.98px) {
  body {
    font-size: 14px;
  }

  .login-page {
    justify-content: flex-start;
    padding: 80px 24px 32px;
  }

  .login-wrapper {
    width: 100%;
  }

  .container {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .card {
    border-radius: 16px;
  }

  .login-box {
    max-width: 100%;
  }

  .login-box .card {
    border-radius: 22px;
  }

  .login-box .card-body {
    padding: 2rem 1.6rem !important;
  }

  .login-box h1,
  .login-box h2 {
    font-size: 1.75rem;
  }

  .login-box .form-control {
    height: 58px;
    font-size: 1rem;
  }

  .login-box .btn {
    height: 56px;
    font-size: 1.05rem;
  }

  .login-footer,
  .login-page .site-footer {
    position: static !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    width: 100%;
    margin-top: 28px;
    padding: 0 12px;
    display: block;
    text-align: center;
    font-size: 0.9rem;
  }

  .table {
    font-size: 0.86rem;
  }

  .brand-title {
    font-size: 1rem;
  }

  .brand-subtitle,
  .topbar-subtitle {
    display: none;
  }

  .admin-content,
  .public-content {
    padding: 0.85rem;
  }

  .hero-title {
    font-size: 1.9rem;
  }

  .apsh-logo {
    width: 240px;
  }
}

/* ================================
   In / Out History Table Width Fix
   ================================ */

.admin-content,
.public-content {
  max-width: none;
  width: 100%;
  margin: 0;
  padding-left: 2rem;
  padding-right: 2rem;
}

.table-card {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.table {
  width: 100%;
  margin-bottom: 0;
}

.admin-content .table {
  min-width: 1280px;
}

.table thead th,
.table tbody td {
  padding-left: 0.85rem;
  padding-right: 0.85rem;
}

.table tbody td {
  white-space: nowrap;
}

.table tbody td:last-child {
  white-space: normal;
  min-width: 180px;
}

/* Search bar full width */
.admin-content form,
.public-content form {
  width: 100%;
}

/* Better spacing for desktop */
@media (min-width: 1200px) {
  .admin-content,
  .public-content {
    padding-left: 2.6rem;
    padding-right: 2.6rem;
  }
}

/* Mobile/tablet still responsive */
@media (max-width: 991.98px) {
  .admin-content,
  .public-content {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .admin-content .table {
    min-width: 1150px;
  }
}