:root {
  --bg: #f5f7fb;
  --panel: #fff;
  --text: #1f2937;
  --muted: #6b7280;
  --line: #d9e2ef;
  --primary: #0f766e;
  --primary-dark: #115e59;
  --danger: #b91c1c;
  --danger-soft: #fee2e2;
  --warn: #b45309;
  --warn-soft: #fef3c7;
  --ok: #047857;
  --ok-soft: #ccfbf1;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }

.layout { min-height: 100vh; display: grid; grid-template-columns: 250px 1fr; }
.side { background: #102a43; color: #fff; padding: 22px 16px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.mark { width: 42px; height: 42px; border-radius: 8px; background: #2dd4bf; color: #083344; display: grid; place-items: center; font-weight: 800; }
.brand h1 { margin: 0; font-size: 18px; line-height: 1.2; }
.brand p { margin: 2px 0 0; color: #bfd3e6; font-size: 13px; }
.nav { display: grid; gap: 8px; }
.nav a { border-radius: 8px; padding: 12px 14px; color: #e5edf7; }
.nav a.active, .nav a:hover { background: rgba(255,255,255,.12); color: #fff; }
.main { padding: 24px; min-width: 0; }
.head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; margin-bottom: 18px; }
.head h2 { margin: 0; font-size: 28px; }
.head p { margin: 6px 0 0; color: var(--muted); }
.grid { display: grid; gap: 16px; }
.two { grid-template-columns: minmax(0, 1fr) 380px; align-items: start; }
.stats { grid-template-columns: repeat(4, minmax(0,1fr)); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 18px; box-shadow: 0 18px 45px rgba(15,23,42,.08); }
.stat strong { display: block; font-size: 30px; margin-top: 8px; }
.muted { color: var(--muted); }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; align-items: end; }
.field, label { display: grid; gap: 7px; color: var(--muted); font-size: 13px; }
.field { flex: 1 1 220px; }
input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 8px; min-height: 44px; padding: 10px 12px; background: #fff; color: var(--text); }
.btn { display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 8px; min-height: 44px; padding: 10px 15px; background: var(--primary); color: #fff; font-weight: 700; cursor: pointer; }
.btn:hover { background: var(--primary-dark); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.secondary { background: #e7edf5; color: #223449; }
.btn.danger { background: var(--danger); color: #fff; }
.field-note { min-height: 20px; font-size: 13px; font-weight: 800; }
.field-note.ok { color: #047857; }
.field-note.error { color: #b91c1c; }
.field-note.checking { color: #b45309; }
.phone-alert { border-radius: 8px; padding: 15px 16px; font-size: 15px; font-weight: 800; border: 2px solid var(--line); display: grid; gap: 5px; box-shadow: 0 10px 22px rgba(15,23,42,.08); }
.phone-alert strong { display: block; font-size: 18px; line-height: 1.25; }
.phone-alert span { display: block; font-size: 14px; line-height: 1.45; font-weight: 700; }
.phone-alert.d-none { display: none; }
.phone-alert.ok { background: #ecfdf5; border-color: #10b981; color: #065f46; }
.phone-alert.error { background: #fff; border-color: #dc2626; color: #dc2626; border-width: 3px; }
.phone-alert.checking { background: #fffbeb; border-color: #f59e0b; color: #92400e; }
input.input-error { border: 2px solid #dc2626; background: #fff1f2; box-shadow: 0 0 0 4px rgba(220,38,38,.12); }
input.input-ok { border-color: #10b981; background: #f0fdf4; box-shadow: 0 0 0 4px rgba(16,185,129,.12); }
.form { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
.full { grid-column: 1 / -1; }
.quick { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 8px; }
.checkin { max-width: 900px; margin: 0 auto; }
.checkin-card { padding: 28px; }
.phone-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.phone-row input, .phone-row .btn { min-height: 68px; font-size: 28px; }
.phone-row input { font-weight: 800; letter-spacing: 0; }
.phone-row .btn { padding-left: 28px; padding-right: 28px; }
.message { border-radius: 8px; padding: 16px 18px; margin-bottom: 16px; border: 2px solid var(--line); background: #fff; font-size: 17px; font-weight: 800; }
.message.ok { background: #ecfdf5; border-color: #10b981; color: #065f46; }
.message.error { background: #fef2f2; border-color: #ef4444; color: #991b1b; }
.checkin-result { margin-top: 18px; border: 3px solid #14b8a6; background: #d1fae5; padding: 24px; }
.checkin-result h3 { margin: 0; font-size: 34px; line-height: 1.1; color: #065f46; text-align: center; }
.checkin-result .member-name { font-size: 42px; line-height: 1.15; font-weight: 900; margin: 12px 0 20px; text-align: center; color: #102a43; }
.checkin-result.soon { border-color: #f59e0b; background: #fef3c7; }
.checkin-result.soon h3 { color: #92400e; }
.checkin-result.expired { border-color: #ef4444; background: #fee2e2; }
.checkin-result.expired h3 { color: #991b1b; }
.result-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 10px; }
.result-box { border: 2px solid #99f6e4; border-radius: 8px; padding: 18px; background: #fff; text-align: center; }
.checkin-result.soon .result-box { border-color: #fbbf24; }
.checkin-result.expired .result-box { border-color: #fca5a5; }
.result-box span { display: block; color: #475569; font-size: 16px; margin-bottom: 8px; font-weight: 700; }
.result-box strong { display: block; font-size: 30px; line-height: 1.1; color: #0f172a; }
.result-days strong { color: #047857; font-size: 36px; }
.result-time strong { color: #115e59; font-size: 36px; }
.checkin-result.soon .result-days strong,
.checkin-result.soon .result-box:first-child strong { color: #b45309; }
.checkin-result.expired .result-days strong,
.checkin-result.expired .result-box:first-child strong { color: #b91c1c; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { padding: 12px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { background: #f8fafc; color: var(--muted); font-size: 12px; }
.badge { display: inline-flex; border-radius: 999px; padding: 5px 10px; font-size: 12px; font-weight: 800; white-space: nowrap; }
.badge.active { background: var(--ok-soft); color: var(--ok); }
.badge.soon { background: var(--warn-soft); color: var(--warn); }
.badge.expired { background: var(--danger-soft); color: var(--danger); }
.cards { display: none; gap: 12px; }
.member-card, .visit-row { border: 1px solid var(--line); border-radius: 8px; padding: 14px; background: #fff; display: grid; gap: 10px; }
.member-card header, .visit-row { display: flex; justify-content: space-between; gap: 10px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.meta { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; margin: 12px 0; }
.meta div { border: 1px solid var(--line); border-radius: 8px; padding: 12px; background: #fff; }
.meta span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.bottom { display: none; position: fixed; left: 0; right: 0; bottom: 0; grid-template-columns: repeat(5,1fr); background: #fff; border-top: 1px solid var(--line); }
.bottom a { min-height: 60px; display: grid; place-items: center; color: var(--muted); font-size: 12px; }
.bottom a.active { color: var(--primary); font-weight: 800; }
.admin-link { position: fixed; right: 12px; bottom: 10px; color: #94a3b8; font-size: 12px; padding: 6px 8px; opacity: .55; }
.admin-link:hover { opacity: 1; color: #334155; }
.package-summary { border: 2px solid var(--line); border-radius: 8px; padding: 14px; background: #f8fafc; font-size: 18px; }
.label-title { display: block; color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.package-buttons { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 10px; }
.package-choice { border: 2px solid var(--line); border-radius: 8px; background: #fff; padding: 16px 12px; display: grid; gap: 6px; text-align: center; cursor: pointer; color: var(--text); min-height: 118px; }
.package-choice:hover, .package-choice.selected { border-color: var(--primary); background: #ecfdf5; box-shadow: 0 10px 24px rgba(15,118,110,.14); }
.package-choice strong { font-size: 20px; line-height: 1.15; }
.package-choice span { color: var(--muted); font-weight: 700; }
.package-choice b { color: var(--primary); font-size: 22px; }
.payment-card { display: grid; gap: 18px; }
.payment-summary { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
.payment-summary div { border: 1px solid var(--line); border-radius: 8px; padding: 14px; background: #f8fafc; }
.payment-summary span, .payment-amount span { display: block; color: var(--muted); font-size: 13px; font-weight: 700; margin-bottom: 4px; }
.payment-summary strong { font-size: 20px; line-height: 1.2; }
.payment-amount { border: 3px solid #14b8a6; background: #d1fae5; border-radius: 8px; padding: 18px; text-align: center; }
.payment-amount strong { display: block; font-size: 42px; line-height: 1.1; color: #065f46; }
.qr-box { display: grid; place-items: center; padding: 16px; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.qr-svg, .qr-image { width: min(320px, 100%); height: auto; display: block; }
.payment-note { text-align: center; }
.payment-actions { justify-content: center; }
.payment-confirm-form { margin-top: 8px; }
.payment-confirm-form input[type="file"] { padding-top: 11px; }

@media (max-width: 1023px) {
  .layout { display: block; }
  .side { display: none; }
  .main { padding: 18px 18px 86px; }
  .bottom { display: grid; }
  .two { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, minmax(0,1fr)); }
}

@media (max-width: 639px) {
  .main { padding: 14px 14px 86px; }
  .head { display: block; }
  .head h2 { font-size: 23px; }
  .stats, .form, .meta, .quick, .phone-row, .result-grid, .package-buttons, .payment-summary { grid-template-columns: 1fr; }
  .phone-row input, .phone-row .btn { font-size: 22px; }
  .checkin-result h3 { font-size: 28px; }
  .checkin-result .member-name { font-size: 32px; }
  .result-box strong, .result-days strong, .result-time strong { font-size: 30px; }
  .members-table { display: none; }
  .cards { display: grid; }
  .toolbar .btn { width: 100%; }
}

@media print {
  .side, .bottom, .toolbar, .actions, .btn { display: none !important; }
  .layout { display: block; }
  .main { padding: 0; }
  body { background: #fff; }
  .card { box-shadow: none; border: 0; padding: 0; }
  table { min-width: 0; font-size: 12px; }
}

.admin-coreui {
  background: var(--cui-body-bg);
}

.admin-coreui .brand-mark-coreui {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: #2dd4bf;
  color: #083344;
  display: inline-grid;
  place-items: center;
  font-weight: 900;
}

.admin-coreui .nav-dot::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: currentColor;
  opacity: .72;
  display: inline-block;
}

.admin-coreui .wrapper {
  width: 100%;
  padding-left: var(--cui-sidebar-occupy-start, 16rem);
  will-change: auto;
  transition: padding .15s;
}

.sidebar.hide:not(.sidebar-end) ~ .wrapper,
.sidebar.sidebar-narrow:not(.sidebar-end) ~ .wrapper {
  padding-left: var(--cui-sidebar-narrow-width, 4rem);
}

.admin-coreui .admin-content {
  max-width: 1320px;
}

.admin-coreui .head {
  align-items: center;
}

.admin-coreui .card {
  border: 1px solid var(--cui-border-color);
  box-shadow: var(--cui-box-shadow-sm);
}

.admin-coreui .btn.secondary {
  background: var(--cui-secondary-bg);
  color: var(--cui-body-color);
  border: 1px solid var(--cui-border-color);
}

.admin-coreui .btn.secondary:hover {
  background: var(--cui-tertiary-bg);
}

.admin-coreui table {
  background: var(--cui-body-bg);
}

.admin-coreui th {
  background: var(--cui-tertiary-bg);
}

@media (max-width: 991.98px) {
  .admin-coreui .wrapper {
    padding-left: 0;
  }
}

.phone-alert.error strong { color: #dc2626; }
