* { box-sizing: border-box; }

body {
  margin: 0;
  background: #f6f8fb;
  color: #071936;
  font-family: Arial, "Helvetica Neue", sans-serif;
}

.shell { min-height: 100vh; display: flex; }
.sidebar {
  background: #eef2f7;
  border-right: 1px solid #d9e1ee;
  flex: 0 0 252px;
  min-height: 100vh;
  padding: 28px 18px;
  position: sticky;
  top: 0;
}

.brand {
  color: #27348b;
  font-size: 42px;
  font-style: italic;
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1;
}

.brand span { color: #27aee4; }
.brand-dot {
  background: #ed1c24;
  border-radius: 50%;
  height: 18px;
  margin: 0 0 4px 20px;
  width: 18px;
}

.side-nav { display: grid; gap: 9px; margin: 22px 0; }
.side-link {
  align-items: center;
  color: #172033;
  display: flex;
  gap: 8px;
  text-decoration: none;
}
.side-link::before {
  border: 1px solid #a7b0bf;
  border-radius: 50%;
  content: "";
  flex: 0 0 16px;
  height: 16px;
  width: 16px;
}
.side-link.active::before { background: #ff4b55; border-color: #ff4b55; }

.sidebar-user {
  background: #d8efe5;
  border-radius: 8px;
  color: #00805c;
  margin: 18px 0 8px;
  padding: 16px;
  overflow-wrap: anywhere;
}

.container { margin: 0 auto; max-width: 1220px; min-width: 0; padding: 24px 16px; width: 100%; }
.auth-container { display: grid; min-height: 100vh; place-items: center; padding: 18px; }
.card, .page-title {
  background: white;
  border-radius: 18px;
  box-shadow: 0 8px 28px rgba(11, 47, 107, .08);
  margin-bottom: 20px;
  padding: 24px;
}
.auth-card { max-width: 460px; width: 100%; }
.grid { display: grid; gap: 20px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }

h1, h2 { margin-top: 0; }
.muted { color: #64748b; }
label { display: block; font-weight: 700; margin: 14px 0 6px; }
input, select {
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  font-size: 16px;
  padding: 12px 14px;
  width: 100%;
}

.btn {
  background: #e2e8f0;
  border: 0;
  border-radius: 12px;
  color: #102a43;
  cursor: pointer;
  display: inline-block;
  font-weight: 800;
  margin-top: 14px;
  padding: 12px 18px;
  text-align: center;
  text-decoration: none;
}
.primary { background: #0b7a3b; color: white; }
.danger { background: #fee2e2; color: #991b1b; }
.compact { margin-top: 0; padding: 9px 12px; }

.alert {
  border-radius: 12px;
  margin-bottom: 16px;
  padding: 14px 16px;
}
.success { background: #dcfce7; color: #166534; }
.warning { background: #fef3c7; color: #92400e; }
.error { background: #fee2e2; color: #991b1b; }

.badge {
  border-radius: 999px;
  display: inline-block;
  font-size: 13px;
  font-weight: 900;
  padding: 8px 13px;
}

.stat { color: #0b2f6b; font-size: 42px; font-weight: 900; }
.center { text-align: center; }
.qr-box {
  background: white;
  display: inline-grid;
  margin: 10px auto;
  min-height: 260px;
  min-width: 260px;
  padding: 12px;
  place-items: center;
}

.employee-row { display: grid; gap: 8px; grid-template-columns: 88px 1fr; }
.employee-prefix {
  align-items: center;
  background: #eef2f7;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  color: #0b2f6b;
  display: flex;
  font-weight: 900;
  justify-content: center;
}

.scroll-five {
  max-height: 360px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  margin-bottom: 14px;
}

table { border-collapse: collapse; min-width: 760px; width: 100%; }
.table-wrap { overflow-x: auto; }
th, td { border-bottom: 1px solid #e5e7eb; font-size: 14px; padding: 12px; text-align: left; }
th { background: #f8fafc; }

.condition-grid { display: grid; gap: 14px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.condition-item {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 16px;
  padding: 16px;
}
.condition-item.done { background: #dcfce7; border-color: #86efac; }
.condition-count { color: #0b2f6b; font-size: 28px; font-weight: 900; }

.scanner { max-width: 100%; width: 360px; }
.popup-backdrop {
  align-items: center;
  background: rgba(15, 23, 42, .48);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 18px;
  position: fixed;
  z-index: 1000;
}
.popup {
  background: white;
  border-radius: 18px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, .28);
  max-width: 420px;
  padding: 28px;
  text-align: center;
  width: 100%;
}

@media (max-width: 820px) {
  .shell { display: block; }
  .sidebar { min-height: auto; position: static; width: 100%; }
  .side-nav { display: flex; overflow-x: auto; }
  .side-link { background: #f8fafc; border: 1px solid #dbe3ef; border-radius: 999px; flex: 0 0 auto; padding: 9px 12px; }
  .side-link::before { display: none; }
  .grid.two, .grid.four, .condition-grid { grid-template-columns: 1fr; }
}


/* Admin dashboard style matched closer to Flask template */
.dashboard-title {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 16px;
}
.stat-card {
  min-height: 132px;
  text-align: left;
  position: relative;
  overflow: hidden;
}
.stat-card::after {
  content: "";
  position: absolute;
  right: -36px;
  top: -36px;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  opacity: .12;
  background: currentColor;
}
.stat-card p { color: #64748b; font-weight: 800; margin: 8px 0 0; }
.accent-blue { color: #27348b; }
.accent-green { color: #0b7a3b; }
.accent-red { color: #ed1c24; }
.accent-cyan { color: #27aee4; }
.chart-card { min-height: 360px; }
.section-heading { align-items: center; display: flex; justify-content: space-between; gap: 12px; }
.bar-chart, .station-bars { display: grid; gap: 14px; }
.bar-row { align-items: center; display: grid; grid-template-columns: 150px 1fr 42px; gap: 12px; }
.bar-label { color: #26364d; font-weight: 800; }
.bar-track { background: #e8eef7; border-radius: 999px; height: 14px; overflow: hidden; }
.bar-fill { border-radius: 999px; height: 100%; min-width: 4px; }
.category-fill { background: linear-gradient(90deg, #27348b, #27aee4); }
.station-fill { background: linear-gradient(90deg, #0b7a3b, #83d6aa); }
.bar-value { color: #0b2f6b; font-weight: 900; text-align: right; }
.donut-wrap { align-items: center; display: flex; gap: 28px; flex-wrap: wrap; justify-content: center; }
.donut-chart { border-radius: 50%; display: grid; height: 190px; place-items: center; width: 190px; }
.donut-center { background: white; border-radius: 50%; display: grid; height: 112px; place-items: center; text-align: center; width: 112px; box-shadow: inset 0 0 0 1px #e5e7eb; }
.donut-center strong { color: #0b2f6b; font-size: 30px; line-height: 1; }
.donut-center span { color: #64748b; font-size: 13px; font-weight: 800; }
.legend-list { display: grid; gap: 10px; min-width: 130px; }
.legend-dot { border-radius: 50%; display: inline-block; height: 12px; margin-right: 8px; width: 12px; }
.admin-dot { background: #27348b; }
.staff-dot { background: #0b7a3b; }
.guest-dot { background: #27aee4; }
.mini-bar { display: grid; gap: 8px; }
.mini-meta { align-items: center; display: flex; justify-content: space-between; gap: 14px; }
.mini-meta span { color: #26364d; font-weight: 800; }
.mini-meta strong { color: #0b2f6b; }
@media (max-width: 820px) {
  .dashboard-title { align-items: flex-start; flex-direction: column; }
  .bar-row { grid-template-columns: 1fr; gap: 6px; }
  .bar-value { text-align: left; }
}


.brand-logo { display:block; width: 132px; max-width: 100%; margin: 0 0 8px; }
.login-logo { display:block; width: 132px; max-width: 100%; margin: 0 auto 10px; }
.section-heading { align-items: flex-start; display: flex; gap: 16px; justify-content: space-between; }
.button-row { display: flex; flex-wrap: wrap; gap: 10px; }
.secondary { background: #e2e8f0; color: #102a43; }
.inline-form { align-items: center; display: flex; gap: 10px; margin: 14px 0; }
.inline-form input, .inline-form select { width: auto; min-width: 140px; }
.user-filter-form input { flex: 1; min-width: 260px; }
.add-mail-form input:nth-of-type(1) { min-width: 190px; }
.add-mail-form input:nth-of-type(2) { min-width: 260px; }
.mail-groups { display: grid; gap: 24px; margin-top: 24px; }
.mail-group h3 { margin: 0 0 12px; }
.mail-scroll { max-height: 360px; overflow: auto; padding-right: 4px; }
.mail-row { align-items: center; display: grid; gap: 10px; grid-template-columns: 78px minmax(160px, 1fr) minmax(220px, 1.2fr) 140px minmax(160px, 1fr) 64px 76px; margin-bottom: 10px; }
.mail-row input { min-width: 0; width: 100%; }
.badge.role { background: #dbeafe; color: #1d4ed8; text-align: center; }
.badge.role.staff { background:#dff7ed; color:#047857; }
.badge.role.guest { background:#fef3c7; color:#92400e; }
@media (max-width: 1100px) {
  .inline-form { align-items: stretch; flex-direction: column; }
  .inline-form input, .inline-form select { width: 100%; }
  .mail-row { grid-template-columns: 1fr; }
  .section-heading { display: block; }
}
/* Guest station list and stamp history */
.station-list-card,
.stamp-history-card {
  margin-top: 18px;
}

.station-category {
  margin-top: 18px;
}

.station-category h2 {
  margin: 0 0 14px;
  font-size: 20px;
}

.station-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 16px;
}

.station-card {
  border: 1px solid #d9e3f0;
  background: #ffffff;
  border-radius: 12px;
  padding: 16px;
  min-height: 84px;
}

.station-card.stamped {
  background: #dcfce7;
  border-color: #69e08f;
}

.station-card strong {
  display: block;
  margin-bottom: 4px;
}

@media (max-width: 900px) {
  .station-grid {
    grid-template-columns: 1fr;
  }
}
