:root {
  --purple: #180052;
  --purple-2: #23006d;
  --tan: #d4aa91;
  --tan-2: #ead0bf;
  --ink: #201a2d;
  --muted: #766f82;
  --line: #d8c3e8;
  --soft: #fbf8fd;
  --white: #ffffff;
  --danger: #e94b5f;
  --success: #228760;
  --shadow: 0 16px 40px rgba(24, 0, 82, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--white);
  font-family: Inter, Arial, sans-serif;
  letter-spacing: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  display: block;
}

button,
input,
select,
textarea {
  font: inherit;
}

label {
  display: grid;
  gap: 9px;
  color: var(--purple);
  font-weight: 600;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #ded5e8;
  border-radius: 8px;
  background: var(--white);
  color: var(--ink);
  padding: 12px 14px;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(24, 0, 82, 0.12);
}

input:disabled {
  color: var(--muted);
  background: #f1edf5;
}

.auth-page {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.auth-header {
  height: 110px;
  padding: 15px 22px;
  background: var(--purple);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 26px;
  color: var(--white);
  font-size: clamp(20px, 2.2vw, 30px);
}

.brand img {
  width: 120px;
  height: 80px;
  object-fit: contain;
  background: var(--white);
}

.auth-switch {
  display: flex;
  align-items: center;
  gap: 22px;
}

.auth-switch a {
  min-width: 150px;
  text-align: center;
  color: var(--white);
  border: 5px solid var(--tan);
  border-radius: 32px;
  padding: 17px 28px;
  font-size: 28px;
  font-weight: 800;
}

.auth-switch a.active {
  background: var(--tan);
  border-color: var(--white);
}

.auth-main {
  display: grid;
  place-items: center;
  padding: 64px 20px;
}

.auth-card {
  width: min(704px, 100%);
  border: 2px solid var(--tan);
  border-radius: 8px;
  padding: 28px 24px 31px;
  background: var(--purple);
  color: var(--white);
  display: grid;
  gap: 24px;
}

.auth-card label {
  color: var(--white);
}

.auth-card input {
  height: 42px;
}

.auth-links {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  text-decoration: underline;
}

.auth-note {
  text-align: center;
}

.auth-note a {
  text-decoration: underline;
  font-weight: 700;
}

.divider {
  display: flex;
  align-items: center;
  gap: 44px;
  justify-content: center;
}

.divider::before,
.divider::after {
  content: "";
  height: 1px;
  width: 34%;
  background: rgba(255, 255, 255, 0.8);
}

.btn {
  border: 0;
  border-radius: 8px;
  min-height: 40px;
  padding: 11px 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  cursor: pointer;
  font-weight: 700;
  transition: transform .2s, box-shadow .2s, background-color .2s;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(24, 0, 82, 0.16);
}

.btn-primary,
.btn-accent,
.btn-accent-outline {
  color: var(--white);
  background: var(--tan);
}

.btn-primary {
  background: var(--purple);
}

.btn-ghost {
  color: var(--purple);
  background: var(--white);
  border: 1px solid var(--purple);
}

.app-shell {
  min-height: calc(100vh - 120px);
  display: grid;
  grid-template-columns: 270px 1fr;
}

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  background: var(--purple);
  color: var(--white);
  padding-top: 22px;
  z-index: 20;
}

.sidebar-close {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  margin: 0 18px 34px auto;
  border: 0;
  background: transparent;
  color: var(--white);
  font-size: 24px;
  cursor: pointer;
}

.side-nav {
  display: grid;
}

.side-nav a {
  min-height: 60px;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 10px 18px;
  font-size: 23px;
  font-weight: 800;
}

.side-nav a:hover,
.side-nav a.active {
  background: var(--tan);
}

.side-nav i {
  width: 20px;
  text-align: center;
}

.app-main {
  min-width: 0;
  padding: 0 42px 38px;
}

.app-topbar {
  min-height: 98px;
  display: flex;
  align-items: center;
  gap: 20px;
  margin: 0 -42px 28px;
  padding: 12px 42px;
  color: var(--white);
  background: var(--purple);
}

.app-topbar h1 {
  margin: 0;
  flex: 1;
  font-size: clamp(28px, 3vw, 42px);
  line-height: 1.08;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 8px;
  display: inline-grid;
  place-items: center;
  color: var(--purple);
  background: var(--white);
  cursor: pointer;
}

.icon-btn.danger {
  color: var(--danger);
}

.icon-btn.success {
  color: var(--success);
}

.mobile-menu {
  display: none;
}

.back-btn {
  color: var(--white);
  background: transparent;
  font-size: 24px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
}

.avatar {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border: 4px solid rgba(255, 255, 255, 0.78);
  border-radius: 50%;
  color: var(--white);
  background: linear-gradient(135deg, var(--tan), #6d3cab);
  font-weight: 900;
}

.avatar-large {
  width: 112px;
  height: 112px;
  margin: 0 auto;
  font-size: 42px;
}

.search-bar {
  width: min(720px, 100%);
  margin: 0 auto 35px;
  display: grid;
  grid-template-columns: 1fr 62px;
  background: var(--purple);
  border-radius: 28px;
  overflow: hidden;
}

.search-bar input {
  height: 56px;
  border: 0;
  color: var(--white);
  background: transparent;
  padding-left: 24px;
}

.search-bar input::placeholder {
  color: rgba(255, 255, 255, 0.86);
}

.search-bar button {
  border: 0;
  color: var(--white);
  background: transparent;
  font-size: 22px;
  cursor: pointer;
}

.filter-panel,
.panel {
  border: 1.5px solid var(--purple);
  border-radius: 14px;
  background: var(--white);
  padding: 22px;
  box-shadow: 0 0 0 transparent;
}

.filter-panel {
  display: grid;
  gap: 22px;
  margin-bottom: 32px;
}

.filter-panel h2,
.filter-panel p,
.panel h2,
.panel h3 {
  margin: 0;
  color: var(--purple);
}

.filter-panel p {
  margin-top: 10px;
}

.segmented,
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.segmented a,
.tabs a {
  min-height: 42px;
  padding: 11px 18px;
  border-radius: 24px;
  color: var(--purple);
  background: var(--tan);
  font-weight: 700;
}

.segmented a.active,
.tabs a.active {
  color: var(--white);
  background: var(--purple);
}

.compact-tabs {
  justify-content: flex-end;
}

.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 48px;
}

.book-card {
  min-height: 350px;
  border: 1.5px solid var(--tan);
  border-radius: 8px;
  padding: 18px 22px 22px;
  display: grid;
  align-content: start;
  gap: 14px;
  transition: transform .2s, box-shadow .2s;
}

.book-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

.book-cover {
  height: 165px;
  display: grid;
  place-items: center;
}

.book-cover img {
  height: 162px;
  width: auto;
  object-fit: contain;
}

.book-card-body {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.book-card h3 {
  min-height: 56px;
  margin: 0 0 8px;
  font-size: 24px;
  line-height: 1.15;
}

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

.accent-text,
.synopsis {
  color: var(--tan);
}

.synopsis {
  margin: 0;
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.heart-btn {
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 24px;
  cursor: pointer;
}

.heart-btn.active {
  color: var(--danger);
}

.detail-layout,
.form-layout,
.profile-layout {
  display: grid;
  grid-template-columns: 330px 1fr;
  gap: 28px;
  align-items: start;
}

.detail-cover,
.summary-card,
.profile-card {
  border: 1.5px solid var(--tan);
  border-radius: 10px;
  background: var(--white);
  padding: 28px;
  text-align: center;
  box-shadow: var(--shadow);
}

.detail-cover img,
.summary-card img {
  height: 310px;
  width: auto;
  object-fit: contain;
  margin: 0 auto;
}

.detail-content {
  display: grid;
  gap: 18px;
}

.detail-content h2 {
  margin: 0;
  color: var(--purple);
  font-size: clamp(34px, 4vw, 58px);
  line-height: 1.05;
}

.lead {
  color: var(--purple);
  font-size: 24px;
  font-weight: 700;
}

.pill,
.status {
  width: fit-content;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 6px 12px;
  border-radius: 20px;
  color: var(--purple);
  background: var(--tan-2);
  font-weight: 800;
}

.status-pending,
.status-menunggu {
  color: #7c5300;
  background: #ffe7b2;
}

.status-disetujui,
.status-terkonfirmasi,
.status-aktif {
  color: #0e6c48;
  background: #ccefdc;
}

.status-ditolak,
.status-nonaktif {
  color: #a0172a;
  background: #ffd2d8;
}

.meta-grid,
.mini-stat-grid,
.stat-grid,
.chart-grid,
.form-grid {
  display: grid;
  gap: 22px;
}

.meta-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
}

.meta-grid div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.meta-grid dt {
  color: var(--muted);
  font-weight: 700;
}

.meta-grid dd {
  margin: 6px 0 0;
  color: var(--purple);
  font-weight: 800;
}

.actions-row,
.page-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.page-actions {
  justify-content: flex-end;
  margin-bottom: 24px;
}

.form-panel {
  display: grid;
  gap: 20px;
}

.wide-form {
  max-width: 980px;
}

.form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.summary-card h2,
.profile-card h2 {
  color: var(--purple);
  margin: 18px 0 8px;
}

.tabs {
  margin-bottom: 24px;
}

.transaction-list {
  display: grid;
  gap: 18px;
}

.transaction-card {
  border: 1.5px solid var(--tan);
  border-radius: 10px;
  padding: 18px;
  display: grid;
  grid-template-columns: 90px 1fr auto;
  gap: 18px;
  align-items: center;
}

.transaction-card img {
  width: 80px;
  height: 110px;
  object-fit: contain;
}

.transaction-card h2 {
  margin: 8px 0;
  color: var(--purple);
}

.top-books {
  border: 10px solid var(--tan);
  border-radius: 20px;
  padding: 12px 24px 18px;
  background: var(--purple);
  color: var(--tan);
  text-align: center;
  margin-bottom: 28px;
}

.top-books h2 {
  margin: 0 0 12px;
  font-size: 28px;
}

.top-books div {
  display: grid;
  grid-template-columns: repeat(10, minmax(54px, 1fr));
  gap: 18px;
  align-items: end;
}

.top-books img {
  height: 100px;
  width: 100%;
  object-fit: contain;
  background: var(--white);
  border-radius: 8px;
  padding: 5px;
}

.stat-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 34px;
}

.stat-card,
.mini-stat {
  min-height: 122px;
  border-radius: 16px;
  padding: 22px;
  text-align: center;
  color: var(--purple);
  background: var(--tan);
  display: grid;
  place-items: center;
}

.stat-card.dark,
.mini-stat.dark {
  color: var(--tan);
  background: var(--purple);
}

.stat-card span,
.mini-stat span {
  color: var(--white);
  font-size: 22px;
  font-weight: 800;
}

.stat-card strong {
  font-size: clamp(30px, 3.6vw, 50px);
}

.mini-stat-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 24px 0;
}

.mini-stat strong {
  font-size: 42px;
}

.chart-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.chart-grid > div {
  border: 1.5px solid var(--purple);
  border-radius: 14px;
  padding: 18px;
  height: 320px;
  min-height: 320px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
  overflow: hidden;
}

.chart-grid canvas {
  width: 100% !important;
  height: 240px !important;
  max-height: 240px;
  display: block;
}

.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.toolbar-actions,
.inline-search {
  display: flex;
  align-items: center;
  gap: 12px;
}

.inline-search input {
  min-width: 280px;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  border: 1px solid rgba(24, 0, 82, 0.28);
  padding: 13px 14px;
  vertical-align: middle;
}

th {
  color: var(--white);
  background: var(--purple);
}

td {
  background: var(--white);
}

.tan-panel {
  background: var(--tan);
}

.table-cover {
  width: 48px;
  height: 68px;
  object-fit: contain;
}

.book-mini {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 220px;
}

.book-mini img {
  width: 42px;
  height: 62px;
  object-fit: contain;
}

.table-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.pagination {
  margin-top: 18px;
  display: flex;
  gap: 20px;
  justify-content: center;
  align-items: center;
}

.pagination strong {
  color: var(--white);
  background: var(--purple);
  border-radius: 8px;
  padding: 8px 14px;
}

.profile-card {
  display: grid;
  justify-items: center;
}

.logout-panel {
  max-width: 560px;
  margin: 80px auto;
  text-align: center;
  display: grid;
  justify-items: center;
  gap: 14px;
}

.logout-panel > i {
  width: 80px;
  height: 80px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--white);
  background: var(--purple);
  font-size: 32px;
}

.empty-state {
  min-height: 280px;
  border: 1.5px dashed var(--tan);
  border-radius: 14px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  color: var(--purple);
  text-align: center;
  padding: 32px;
}

.empty-state i {
  font-size: 46px;
  color: var(--tan);
}

.toast {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 100;
  max-width: min(420px, calc(100vw - 36px));
  display: flex;
  align-items: center;
  gap: 12px;
  border-radius: 10px;
  padding: 14px 16px;
  color: var(--white);
  background: var(--purple);
  box-shadow: var(--shadow);
}

.toast-error {
  background: var(--danger);
}

.toast-success {
  background: var(--success);
}

.toast button {
  margin-left: auto;
  border: 0;
  color: inherit;
  background: transparent;
  cursor: pointer;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: none;
  place-items: center;
  background: rgba(16, 0, 46, 0.58);
  padding: 20px;
}

.modal.open {
  display: grid;
}

.modal-card {
  width: min(460px, 100%);
  border-radius: 14px;
  background: var(--white);
  padding: 28px;
  box-shadow: var(--shadow);
}

.modal-card h2 {
  margin: 0 0 10px;
  color: var(--purple);
}

.site-footer {
  color: var(--white);
  background: var(--purple);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 36px;
}

.footer-contact,
.footer-social {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 24px;
}

.footer-social {
  justify-content: flex-end;
}

.field-error {
  border-color: var(--danger) !important;
  box-shadow: 0 0 0 3px rgba(233, 75, 95, 0.16) !important;
}

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 280px;
    transform: translateX(-100%);
    transition: transform .24s ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .mobile-menu {
    display: inline-grid;
  }

  .stat-grid,
  .mini-stat-grid,
  .chart-grid,
  .detail-layout,
  .form-layout,
  .profile-layout {
    grid-template-columns: 1fr 1fr;
  }

  .top-books div {
    grid-template-columns: repeat(5, 1fr);
  }
}

@media (max-width: 760px) {
  .auth-header,
  .site-footer,
  .table-toolbar,
  .auth-links,
  .transaction-card {
    flex-direction: column;
    align-items: stretch;
  }

  .auth-header {
    height: auto;
  }

  .auth-switch a {
    min-width: 0;
    font-size: 18px;
    padding: 12px 18px;
  }

  .brand {
    gap: 14px;
    font-size: 18px;
  }

  .brand img {
    width: 90px;
    height: 60px;
  }

  .app-main {
    padding: 0 18px 26px;
  }

  .app-topbar {
    margin: 0 -18px 24px;
    padding: 14px 18px;
  }

  .user-chip span {
    display: none;
  }

  .search-bar {
    grid-template-columns: 1fr 52px;
  }

  .book-grid,
  .stat-grid,
  .mini-stat-grid,
  .chart-grid,
  .detail-layout,
  .form-layout,
  .profile-layout,
  .form-grid,
  .meta-grid {
    grid-template-columns: 1fr;
  }

  .book-grid {
    gap: 18px;
  }

  .transaction-card {
    display: flex;
  }

  .card-actions {
    width: 100%;
  }

  .card-actions .btn {
    width: 100%;
  }

  .inline-search {
    width: 100%;
  }

  .inline-search input {
    min-width: 0;
  }

  .top-books div {
    grid-template-columns: repeat(2, 1fr);
  }
}
