:root {
  --bg-deep: #061a33;
  --bg-mid: #103a67;
  --bg-soft: #315b86;
  --gold: #d8b34a;
  --gold-strong: #ffcf40;
  --text-light: #e8f1ff;
  --text-dim: #a8c0df;
  --panel: rgba(9, 29, 52, 0.78);
  --panel-edge: rgba(255, 207, 64, 0.34);
  --danger: #ff6a78;
  --success: #39da9d;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  color: var(--text-light);
  background: radial-gradient(circle at 10% 20%, #184e85 0%, #0a2746 40%, #041325 100%);
  min-height: 100vh;
}

.auth-bg {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-wrapper {
  width: 100%;
  max-width: 520px;
}

.auth-card,
.card,
.data-table-wrap {
  background: linear-gradient(135deg, rgba(8, 28, 49, 0.9), rgba(17, 52, 88, 0.85));
  border: 1px solid var(--panel-edge);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 0 22px rgba(255, 207, 64, 0.12);
  backdrop-filter: blur(4px);
}

.auth-title {
  margin: 0 0 10px;
  font-size: 28px;
  letter-spacing: 1px;
}

.auth-subtitle {
  margin: 0 0 18px;
  color: var(--text-dim);
}

.input-group {
  margin-bottom: 14px;
}

label {
  display: block;
  font-size: 13px;
  margin-bottom: 6px;
  color: var(--text-dim);
}

input,
select,
textarea {
  width: 100%;
  padding: 11px 12px;
  border-radius: 10px;
  border: 1px solid rgba(216, 179, 74, 0.35);
  background: rgba(0, 16, 35, 0.65);
  color: var(--text-light);
  outline: none;
  transition: border 0.25s ease, box-shadow 0.25s ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--gold-strong);
  box-shadow: 0 0 10px rgba(255, 207, 64, 0.4);
}

textarea {
  min-height: 90px;
  resize: vertical;
}

.neon-btn,
button,
.btn {
  display: inline-block;
  border: 1px solid var(--gold-strong);
  background: linear-gradient(120deg, #15426f, #2a6296);
  color: #fff9e0;
  padding: 10px 14px;
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.2s ease, box-shadow 0.3s ease, background 0.3s ease;
}

.neon-btn:hover,
button:hover,
.btn:hover {
  transform: translateY(-1px);
  background: linear-gradient(120deg, #24639f, #3e7fb9);
  box-shadow: 0 0 16px rgba(255, 207, 64, 0.55), 0 0 28px rgba(81, 157, 229, 0.36);
}

.btn.btn-delete {
  background: linear-gradient(120deg, #4a0f0f, #661616);
  border-color: #b14a4a;
  color: #ffe8e8;
}

.btn.btn-delete:hover {
  background: linear-gradient(120deg, #6a1a1a, #842121);
  box-shadow: 0 0 16px rgba(255, 76, 76, 0.7), 0 0 30px rgba(255, 76, 76, 0.4);
}

.btn.btn-suspend {
  background: linear-gradient(120deg, #2e1449, #3f1c61);
  border-color: #8c68d9;
  color: #f2eaff;
}

.btn.btn-suspend:hover {
  background: linear-gradient(120deg, #472070, #5a2991);
  box-shadow: 0 0 16px rgba(170, 117, 255, 0.72), 0 0 30px rgba(122, 68, 206, 0.45);
}

.btn.btn-idcard {
  background: linear-gradient(120deg, #114023, #1b5a31);
  border-color: #57c67d;
  color: #e9ffef;
}

.btn.btn-idcard:hover {
  background: linear-gradient(120deg, #1a5a30, #257744);
  box-shadow: 0 0 16px rgba(87, 212, 132, 0.75), 0 0 30px rgba(66, 170, 110, 0.42);
}

.link-btn {
  color: var(--gold-strong);
  text-decoration: none;
}

.alert {
  padding: 12px 14px;
  border-radius: 10px;
  margin-bottom: 14px;
}

.alert.success {
  background: rgba(57, 218, 157, 0.16);
  border: 1px solid rgba(57, 218, 157, 0.5);
}

.alert.error {
  background: rgba(255, 106, 120, 0.16);
  border: 1px solid rgba(255, 106, 120, 0.5);
}

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

.sidebar {
  width: 290px;
  min-width: 290px;
  padding: 20px 16px;
  border-right: 1px solid rgba(255, 207, 64, 0.28);
  background: linear-gradient(170deg, rgba(11, 36, 63, 0.96), rgba(9, 24, 43, 0.98));
  overflow-y: auto;
  transition: transform 0.28s ease, width 0.28s ease, min-width 0.28s ease, padding 0.28s ease, border 0.28s ease;
}

.app-shell.sidebar-collapsed .sidebar {
  width: 0;
  min-width: 0;
  padding: 0;
  border-right: 0;
  overflow: hidden;
  transform: translateX(-100%);
}

.brand h1 {
  margin: 0;
  color: var(--gold-strong);
  letter-spacing: 2px;
}

.brand p {
  margin: 6px 0 18px;
  color: var(--text-dim);
  font-size: 13px;
}

.nav-link {
  display: block;
  color: #d4e4ff;
  text-decoration: none;
  padding: 9px 11px;
  border-radius: 8px;
  margin-bottom: 7px;
  border: 1px solid transparent;
  transition: all 0.22s ease;
}

.nav-link:hover,
.nav-link.active {
  border-color: rgba(255, 207, 64, 0.45);
  box-shadow: inset 0 0 18px rgba(255, 207, 64, 0.2);
  color: #ffffff;
}

.main-content {
  flex: 1;
  padding: 16px;
}

.topbar {
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: 14px;
  padding: 12px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 8px;
}

.notification-bell-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid rgba(255, 207, 64, 0.65);
  color: #fff9e0;
  text-decoration: none;
  background: linear-gradient(120deg, #133c67, #255f96);
  box-shadow: 0 0 10px rgba(255, 207, 64, 0.28);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.notification-bell-link:hover {
  transform: translateY(-1px);
  background: linear-gradient(120deg, #1d588f, #3171ad);
  box-shadow: 0 0 14px rgba(255, 207, 64, 0.5);
}

.notification-bell-icon {
  font-size: 19px;
  line-height: 1;
}

.notification-bell-count {
  position: absolute;
  top: -5px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 999px;
  background: #ff3c3c;
  color: #ffffff;
  font-size: 11px;
  line-height: 18px;
  text-align: center;
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, 0.7);
}

.menu-btn {
  display: inline-block;
}

.role-chip {
  background: rgba(255, 207, 64, 0.18);
  border: 1px solid rgba(255, 207, 64, 0.6);
  border-radius: 16px;
  padding: 4px 9px;
  margin-left: 8px;
  font-size: 11px;
}

.page-content {
  display: grid;
  gap: 14px;
}

.grid,
.grid-2,
.grid-3 {
  display: grid;
  gap: 12px;
}

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

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

.stat-card {
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: 14px;
  padding: 14px;
}

.stat-card h3 {
  margin: 0;
  font-size: 14px;
  color: var(--text-dim);
}

.stat-card p {
  margin: 8px 0 0;
  font-size: 25px;
  font-weight: 700;
  color: var(--gold-strong);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  padding: 9px;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--gold-strong);
  background: rgba(255, 207, 64, 0.08);
}

.small {
  font-size: 12px;
  color: var(--text-dim);
}

.badge {
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.badge.present,
.badge.approved,
.badge.in {
  background: rgba(57, 218, 157, 0.2);
}

.badge.absent,
.badge.rejected,
.badge.out {
  background: rgba(255, 106, 120, 0.2);
}

.badge.pending,
.badge.leave,
.badge.late {
  background: rgba(255, 207, 64, 0.2);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.collapsed-block {
  display: none;
}

.member-actions-wrap {
  min-width: 220px;
}

.member-detail-card {
  margin: 10px;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 207, 64, 0.35);
  background: linear-gradient(145deg, rgba(7, 26, 47, 0.9), rgba(14, 46, 77, 0.9));
}

.member-detail-header {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
  align-items: center;
}

.member-thumb {
  width: 100px;
  height: 100px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid rgba(255, 207, 64, 0.6);
  background: rgba(0, 0, 0, 0.25);
}

.member-thumb-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: var(--text-dim);
}

.member-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
  font-size: 13px;
  align-items: start;
}

.member-detail-grid > div {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  column-gap: 8px;
  align-items: start;
  line-height: 1.35;
}

.member-detail-grid > div > strong {
  display: inline-block;
  white-space: nowrap;
}

.member-detail-grid > div > span {
  min-width: 0;
  word-break: break-word;
}

.member-detail-grid > div[style*="grid-column"] {
  grid-template-columns: 170px minmax(0, 1fr);
}

.idcard-layout {
  display: grid;
  grid-template-columns: minmax(280px, 380px) minmax(280px, 1fr);
  gap: 14px;
  align-items: start;
}

.idcard-modern {
  position: relative;
  width: 360px;
  min-height: 560px;
  margin: 0 auto;
  overflow: hidden;
  border-radius: 10px;
  background: #f7f8fb;
  color: #101522;
  border: 2px solid #1b2e64;
  box-shadow: 0 16px 30px rgba(4, 15, 36, 0.35);
}

.idcard-modern::before {
  content: "";
  position: absolute;
  top: -190px;
  left: -30px;
  width: 420px;
  height: 340px;
  background: #11295f;
  border-radius: 48%;
  z-index: 0;
}

.idcard-modern::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(120% 70% at -5% -5%, transparent 64%, #ff7a00 65%, #ff7a00 69%, transparent 70%),
    radial-gradient(160% 100% at 100% 110%, transparent 62%, #ff7a00 63%, #ff7a00 67%, transparent 68%),
    radial-gradient(170% 105% at 102% 108%, transparent 66%, #11295f 67%);
  pointer-events: none;
  z-index: 0;
}

.idcard-top {
  position: relative;
  z-index: 2;
  padding: 22px 22px 12px;
}

.idcard-brand {
  color: #ffffff;
  display: flex;
  gap: 10px;
  align-items: center;
}

.idcard-logo {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 2px solid #ff7a00;
  color: #ff7a00;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.idcard-brand h3 {
  margin: 0;
  letter-spacing: 0.4px;
  font-size: 26px;
  line-height: 1;
  font-weight: 700;
}

.idcard-brand p {
  margin: 2px 0 0;
  font-size: 12px;
  opacity: 0.92;
}

.idcard-photo {
  position: relative;
  z-index: 3;
  margin: 70px auto 0;
  width: 196px;
  height: 196px;
  border-radius: 50%;
  border: 10px solid #11295f;
  overflow: hidden;
  background: #d7dde9;
}

.idcard-photo img,
.idcard-photo-placeholder {
  width: 100%;
  height: 100%;
}

.idcard-photo img {
  object-fit: cover;
  display: block;
}

.idcard-photo-placeholder {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #4a5672;
  font-weight: 700;
  letter-spacing: 1px;
}

.idcard-grade {
  position: absolute;
  left: 22px;
  top: 300px;
  width: 94px;
  height: 94px;
  z-index: 3;
  border-radius: 50%;
  border: 6px double #11295f;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #11295f;
}

.idcard-grade span {
  font-size: 12px;
  font-weight: 700;
}

.idcard-grade strong {
  font-size: 34px;
  line-height: 1;
}

.idcard-details {
  position: relative;
  z-index: 2;
  margin: 26px 130px 0 36px;
  padding-left: 12px;
  border-left: 6px solid #ff7a00;
}

.idcard-row {
  margin-bottom: 18px;
}

.idcard-row label {
  display: block;
  margin-bottom: 2px;
  color: #303744;
  font-size: 13px;
}

.idcard-row strong {
  display: block;
  font-size: 14px;
  line-height: 1.12;
  color: #131b2b;
  font-weight: 700;
}

.idcard-qr {
  position: absolute;
  right: 20px;
  bottom: 20px;
  z-index: 3;
  width: 96px;
  height: 96px;
  background: #ffffff;
  border: 3px solid #11295f;
  border-radius: 6px;
  padding: 4px;
}

.idcard-qr img {
  width: 100%;
  height: 100%;
  display: block;
}

@media (max-width: 960px) {
  .idcard-layout {
    grid-template-columns: 1fr;
  }

  .idcard-modern {
    width: min(100%, 360px);
  }

  .member-detail-grid {
    grid-template-columns: 1fr;
  }
}

@media print {
  .sidebar,
  .topbar,
  .alert,
  .idcard-layout > .card,
  .idcard-layout form,
  .idcard-layout .toolbar {
    display: none !important;
  }

  .main-content,
  .page-content,
  .idcard-layout,
  .idcard-print-area {
    margin: 0 !important;
    padding: 0 !important;
    display: block !important;
  }

  .idcard-modern {
    box-shadow: none;
    margin: 0 auto;
  }
}

.kv {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.qr-scan-block {
  border: 1px solid rgba(255, 207, 64, 0.4);
  border-radius: 12px;
  padding: 10px;
  margin-bottom: 12px;
  background: rgba(5, 24, 45, 0.55);
}

.qr-video {
  display: none;
  width: 100%;
  max-width: 460px;
  border-radius: 10px;
  margin-top: 10px;
  border: 1px solid rgba(255, 207, 64, 0.45);
  background: #000000;
}

.qr-scan-block.active .qr-video {
  display: block;
}

.btn.btn-gate-in {
  background: linear-gradient(120deg, #115132, #1b7346);
  border-color: #52d587;
  color: #effff4;
}

.btn.btn-gate-in:hover {
  background: linear-gradient(120deg, #1b6c44, #2a905c);
  box-shadow: 0 0 16px rgba(90, 221, 143, 0.8), 0 0 30px rgba(59, 173, 109, 0.45);
}

.btn.btn-gate-out {
  background: linear-gradient(120deg, #4c1d13, #6a2a1b);
  border-color: #e08f65;
  color: #fff1e8;
}

.btn.btn-gate-out:hover {
  background: linear-gradient(120deg, #6a2a1b, #8b3925);
  box-shadow: 0 0 16px rgba(255, 148, 96, 0.78), 0 0 30px rgba(196, 106, 63, 0.45);
}

@media (max-width: 960px) {
  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }

  .topbar {
    gap: 10px;
    flex-wrap: wrap;
  }

  .topbar-right {
    width: 100%;
    justify-content: space-between;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 30;
    transform: translateX(-105%);
    width: 290px;
    min-width: 290px;
    border-right: 1px solid rgba(255, 207, 64, 0.28);
    padding: 20px 16px;
  }

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

  .app-shell.sidebar-collapsed .sidebar {
    width: 290px;
    min-width: 290px;
    padding: 20px 16px;
    border-right: 1px solid rgba(255, 207, 64, 0.28);
  }

  .main-content {
    width: 100%;
    padding: 12px;
  }
}
