:root{
  --bg:#f3f6fb;
  --bg-soft:#eef3f8;
  --card:#ffffff;
  --card-soft:#fbfdff;
  --line:#dbe4ee;
  --line-strong:#c8d4e0;
  --text:#162231;
  --text-soft:#435266;
  --muted:#6e8095;
  --primary:#28cdc9;
  --primary-strong:#1ea9a6;
  --accent:#a9ca21;
  --accent-strong:#8daa14;
  --success:#1f9d63;
  --danger:#d64745;
  --warning:#d08b12;
  --shadow-xs:0 4px 12px rgba(17,24,39,.04);
  --shadow-sm:0 10px 24px rgba(17,24,39,.05);
  --shadow-md:0 18px 42px rgba(17,24,39,.08);
  --radius-sm:14px;
  --radius:20px;
  --radius-lg:28px;
}
*{box-sizing:border-box}
html,body{min-height:100%}
body{
  margin:0;
  font-family:Arial,Helvetica,sans-serif;
  color:var(--text);
  background:linear-gradient(180deg,#f8fbff 0%,var(--bg) 100%);
}
a{text-decoration:none;color:inherit}
img{max-width:100%}
.app-shell{display:flex;min-height:100vh}
.sidebar{
  width:292px;
  background:linear-gradient(180deg,#0f1d2b 0%,#14273a 100%);
  color:#fff;
  padding:22px 18px 18px;
  position:sticky;
  top:0;
  height:100vh;
  overflow:auto;
  display:flex;
  flex-direction:column;
  border-right:1px solid rgba(255,255,255,.05);
  box-shadow:24px 0 40px rgba(15,29,43,.08);
}
.sidebar::before{
  content:"";
  position:absolute;
  inset:0 0 auto 0;
  height:4px;
  background:linear-gradient(90deg,var(--primary),var(--accent));
}
.brand{
  display:flex;
  align-items:center;
  gap:14px;
  padding:12px;
  margin-bottom:16px;
  background:rgba(255,255,255,.05);
  border:1px solid rgba(255,255,255,.08);
  border-radius:22px;
}
.brand-logo{
  width:58px;height:58px;flex:0 0 auto;
  border-radius:18px;
  background:#fff;
  display:flex;align-items:center;justify-content:center;
  box-shadow:0 10px 24px rgba(0,0,0,.18);
  overflow:hidden;
}
.brand-logo img{width:46px;height:46px;object-fit:contain;display:block}
.brand-title{font-size:17px;font-weight:800;line-height:1.25;letter-spacing:.1px}
.brand-sub{margin-top:4px;font-size:12px;line-height:1.5;color:rgba(255,255,255,.72)}
.nav{display:grid;gap:8px}
.nav a{
  position:relative;
  padding:13px 15px;
  border-radius:16px;
  color:rgba(255,255,255,.82);
  background:transparent;
  border:1px solid transparent;
  font-size:14px;
  font-weight:700;
  transition:.18s ease;
}
.nav a:hover{
  color:#fff;
  background:rgba(255,255,255,.06);
  border-color:rgba(255,255,255,.08);
}
.nav a.active{
  color:#fff;
  background:linear-gradient(90deg,rgba(40,205,201,.18),rgba(169,202,33,.14));
  border-color:rgba(40,205,201,.24);
  box-shadow:inset 3px 0 0 var(--primary);
}
.sidebar-credit{
  margin-top:auto;
  padding:18px 12px 8px;
  font-size:12px;
  color:rgba(255,255,255,.68);
  line-height:1.65;
}
.sidebar-credit a{color:#9ef1ee;font-weight:800}
.sidebar-credit a:hover{text-decoration:underline}
.main{flex:1;padding:22px}
.topbar{
  display:flex;
  align-items:center;
  gap:14px;
  justify-content:space-between;
  margin-bottom:18px;
  padding:18px 22px;
  background:rgba(255,255,255,.84);
  border:1px solid rgba(219,228,238,.9);
  border-radius:24px;
  box-shadow:var(--shadow-sm);
  backdrop-filter:blur(6px);
}
.topbar h1{margin:0;font-size:28px;line-height:1.15;letter-spacing:-.4px}
.muted{color:var(--muted);font-size:13px;line-height:1.6}
.menu-toggle{
  display:none;
  border:1px solid var(--line);
  border-radius:14px;
  width:44px;height:44px;
  align-items:center;justify-content:center;
  background:#fff;
  box-shadow:var(--shadow-xs);
  cursor:pointer;
}
.grid{display:grid;gap:18px}
.grid-2{grid-template-columns:repeat(2,minmax(0,1fr))}
.grid-3{grid-template-columns:repeat(3,minmax(0,1fr))}
.grid-4{grid-template-columns:repeat(4,minmax(0,1fr))}
.grid-5{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:18px}
.card{
  background:linear-gradient(180deg,var(--card) 0%,var(--card-soft) 100%);
  border-radius:var(--radius);
  box-shadow:var(--shadow-sm);
  padding:20px;
  border:1px solid rgba(219,228,238,.95);
}
.stat{position:relative;overflow:hidden}
.stat::after{
  content:"";
  position:absolute;
  right:-40px;top:-40px;
  width:120px;height:120px;
  border-radius:50%;
  background:radial-gradient(circle,rgba(40,205,201,.12) 0%, rgba(40,205,201,0) 70%);
}
.stat .label{font-size:12px;color:var(--muted);font-weight:800;text-transform:uppercase;letter-spacing:.55px}
.stat .value{font-size:31px;font-weight:800;margin-top:10px;letter-spacing:-.4px}
.accent-line{height:4px;border-radius:999px;background:linear-gradient(90deg,var(--primary),var(--accent));margin-top:16px}
.table-wrap{
  overflow:auto;
  border-radius:18px;
  background:#fff;
  border:1px solid #e5edf4;
  box-shadow:var(--shadow-xs);
}
table{width:100%;border-collapse:collapse;background:#fff}
th,td{padding:14px 15px;border-bottom:1px solid #ecf1f6;text-align:left;font-size:14px;vertical-align:top}
th{background:#f7fafc;color:#55657a;font-size:12px;text-transform:uppercase;letter-spacing:.45px}
tr:hover td{background:#fbfdff}
.form-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}
.form-group{display:grid;gap:8px}
.form-group.full{grid-column:1/-1}
label{font-weight:800;font-size:13px;color:#334155}
input,select,textarea{
  width:100%;padding:12px 14px;border:1px solid var(--line-strong);
  border-radius:15px;background:#fff;font-size:14px;outline:none;color:var(--text);
  transition:.18s ease;box-shadow:inset 0 1px 2px rgba(15,23,42,.02)
}
input:focus,select:focus,textarea:focus{
  border-color:var(--primary);
  box-shadow:0 0 0 4px rgba(40,205,201,.11);
}
textarea{min-height:110px;resize:vertical}
.btn-row{display:flex;flex-wrap:wrap;gap:10px}
.btn{
  display:inline-flex;align-items:center;justify-content:center;gap:8px;
  border:1px solid transparent;padding:12px 16px;border-radius:14px;cursor:pointer;
  font-weight:800;font-size:14px;transition:.16s ease;
}
.btn:hover{transform:translateY(-1px)}
.btn-primary{background:linear-gradient(135deg,var(--primary),var(--primary-strong));color:#062b2a;box-shadow:0 12px 24px rgba(40,205,201,.18)}
.btn-accent{background:linear-gradient(135deg,var(--accent),var(--accent-strong));color:#233000;box-shadow:0 12px 24px rgba(169,202,33,.20)}
.btn-danger{background:linear-gradient(135deg,var(--danger),#bf3634);color:#fff;box-shadow:0 12px 24px rgba(214,71,69,.18)}
.btn-light{background:#f3f7fb;color:#223548;border-color:#dee7ef}
.btn-outline{background:#fff;color:#223548;border-color:#d3dfe8}
.alert{padding:14px 16px;border-radius:16px;margin-bottom:16px;border:1px solid}
.alert.success{background:#edf9f3;color:#186a47;border-color:#c5ead4}
.alert.error{background:#fff3f4;color:#9f1d2d;border-color:#f3c6cd}
.badge{display:inline-flex;align-items:center;padding:6px 11px;border-radius:999px;font-size:11px;font-weight:900;letter-spacing:.35px;text-transform:uppercase}
.badge.green{background:#ebf8f1;color:#156b49}
.badge.red{background:#fff2f2;color:#a52424}
.search-row{display:flex;gap:10px;flex-wrap:wrap}
.search-row input{max-width:320px}
.mobile-list{display:none;gap:14px}
.mobile-card{background:#fff;padding:16px;border-radius:18px;box-shadow:var(--shadow-xs);border:1px solid #e7edf4}
.mobile-card h3{margin:0 0 10px;font-size:16px}
.mobile-meta{display:grid;gap:8px;font-size:14px}
.small{font-size:12px}
.login-wrap{min-height:100vh;display:grid;place-items:center;padding:20px}
.login-card{width:min(440px,100%);background:#fff;border-radius:26px;box-shadow:var(--shadow-md);padding:28px;border:1px solid #e5edf4}
.login-logo{width:76px;height:76px;border-radius:24px;display:grid;place-items:center;font-size:26px;font-weight:800;background:linear-gradient(135deg,var(--primary),var(--accent));margin:0 auto 14px;color:#112}
.login-card h1{text-align:center;margin:0 0 8px;font-size:28px}
.footer-note{margin-top:14px;text-align:center;color:var(--muted);font-size:13px}
hr.sep{border:none;border-top:1px solid #edf2f7;margin:16px 0}
.image-preview-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}
.image-preview-box{border:1px solid #e7edf4;border-radius:16px;padding:12px;background:#fff}
.image-preview-box img{width:100%;max-height:220px;object-fit:cover;border-radius:12px;display:block;background:#f7fafc}
.storage-pill{display:inline-flex;align-items:center;gap:8px;padding:8px 12px;border-radius:999px;background:#eefaf9;border:1px solid #d3efed;font-size:13px;font-weight:800;color:#0f766e}
.danger-soft{background:#fff4f4;border-color:#f3d1d1;color:#b42318}
.help-text{font-size:12px;color:var(--muted);line-height:1.55}
.member-search{position:relative}
.member-search select.member-native{position:absolute!important;left:-9999px!important;width:1px!important;height:1px!important;opacity:0!important;pointer-events:none!important}
.member-search-input{width:100%;padding:12px 13px;border:1px solid var(--line-strong);border-radius:15px;background:#fff;font-size:14px;outline:none}
.member-search-input:focus{border-color:var(--primary);box-shadow:0 0 0 4px rgba(40,205,201,.12)}
.member-search-dropdown{position:absolute;left:0;right:0;top:calc(100% + 8px);background:#fff;border:1px solid #dbe5ee;border-radius:16px;box-shadow:0 18px 36px rgba(34,48,60,.13);max-height:280px;overflow:auto;z-index:50;display:none}
.member-search.open .member-search-dropdown{display:block}
.member-search-item{padding:12px 14px;border-bottom:1px solid #edf2f7;cursor:pointer}
.member-search-item:last-child{border-bottom:none}
.member-search-item:hover,.member-search-item.active{background:#f6fbfc}
.member-search-title{font-weight:800;font-size:14px}
.member-search-meta{font-size:12px;color:var(--muted);margin-top:3px;line-height:1.45}
.member-search-empty{padding:12px 14px;color:var(--muted);font-size:13px}
.mobile-list .btn-row{margin-top:12px}.mobile-card .badge{margin-top:4px}.stack-fields{display:grid;gap:6px}.stack-fields div{font-size:14px;line-height:1.45}.stack-fields strong{display:inline-block;min-width:88px}.search-row select{min-width:170px}
@media (max-width:1200px){.grid-5{grid-template-columns:repeat(3,minmax(0,1fr))}}
@media (max-width:980px){.grid-4,.grid-3,.grid-2,.form-grid,.image-preview-grid{grid-template-columns:1fr}}
@media (max-width:860px){
  .menu-toggle{display:inline-flex}
  .sidebar{position:fixed;left:-310px;z-index:99;transition:left .25s ease}
  body.sidebar-open .sidebar{left:0}
  .main{padding:14px}
  .topbar{padding:16px 18px}
}
@media (max-width:768px){.brand{gap:10px;padding:12px 10px}.brand-logo{width:48px;height:48px;border-radius:14px}.brand-logo img{width:38px;height:38px}.brand-title{font-size:14px}.brand-sub{font-size:11px}.grid-5{grid-template-columns:1fr}}
@media (max-width:760px){.table-wrap{display:none}.mobile-list{display:grid}.topbar h1{font-size:22px}.search-row input,.search-row select,.search-row .btn{width:100%;max-width:none}.card{padding:16px}.member-search-dropdown{max-height:240px}}


/* Distinct luxury member tiers */
.tier-badge,.tier-chip{display:inline-flex;align-items:center;gap:8px;padding:7px 12px;border-radius:999px;font-size:11px;font-weight:900;letter-spacing:.4px;text-transform:uppercase;border:1px solid transparent;box-shadow:inset 0 1px 0 rgba(255,255,255,.55)}
.tier-badge::before,.tier-chip::before{content:"";width:8px;height:8px;border-radius:50%;flex:0 0 auto}
.tier-silver{background:linear-gradient(135deg,#f7f8fb 0%,#e8edf4 100%);border-color:#d5dde8;color:#475467}
.tier-silver::before{background:#98a2b3;box-shadow:0 0 0 5px rgba(152,162,179,.15)}
.tier-gold{background:linear-gradient(135deg,#fff8d8 0%,#f2df8f 100%);border-color:#e7ca5d;color:#8a6408}
.tier-gold::before{background:#c79105;box-shadow:0 0 0 5px rgba(199,145,5,.13)}
.tier-platinum{background:linear-gradient(135deg,#f4f7fb 0%,#d9e1eb 100%);border-color:#bcc8d7;color:#24384d}
.tier-platinum::before{background:#64748b;box-shadow:0 0 0 5px rgba(100,116,139,.13)}
.tier-panel{position:relative;overflow:hidden;border-radius:24px;padding:20px;border:1px solid #e3eaf2;box-shadow:var(--shadow-sm);background:linear-gradient(180deg,#fff 0%,#f9fbfd 100%)}
.tier-panel::after{content:"";position:absolute;inset:auto -30px -35px auto;width:120px;height:120px;border-radius:50%;opacity:.7}
.tier-panel-silver{background:linear-gradient(180deg,#ffffff 0%,#f6f8fb 100%);border-color:#dbe3ec}
.tier-panel-silver::after{background:radial-gradient(circle,rgba(152,162,179,.18),rgba(152,162,179,0) 70%)}
.tier-panel-gold{background:linear-gradient(180deg,#fffdf4 0%,#fff6d7 100%);border-color:#ecd682}
.tier-panel-gold::after{background:radial-gradient(circle,rgba(231,183,44,.22),rgba(231,183,44,0) 70%)}
.tier-panel-platinum{background:linear-gradient(180deg,#fbfcfe 0%,#edf2f7 100%);border-color:#d3dbe6}
.tier-panel-platinum::after{background:radial-gradient(circle,rgba(100,116,139,.20),rgba(100,116,139,0) 70%)}
.tier-title{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:10px}
.tier-note{font-size:13px;color:var(--muted);line-height:1.6}
.member-row-luxury td{vertical-align:middle}
.member-lux-card{position:relative;overflow:hidden}
.member-lux-card::before{content:"";position:absolute;inset:0 auto 0 0;width:5px;border-radius:18px 0 0 18px;background:#d0d5dd}
.member-lux-card.tone-silver::before{background:linear-gradient(180deg,#c0c8d2,#98a2b3)}
.member-lux-card.tone-gold::before{background:linear-gradient(180deg,#f1d66b,#c79105)}
.member-lux-card.tone-platinum::before{background:linear-gradient(180deg,#cbd5e1,#64748b)}
.lux-balance{display:inline-flex;align-items:center;padding:7px 11px;border-radius:12px;background:#f8fafc;border:1px solid #e5edf4;font-weight:800}
.qr-preview-lux{background:linear-gradient(180deg,#fff 0%,#f8fbfd 100%);border:1px solid #e7edf4;border-radius:22px;padding:16px}
.stat.tier-stat-silver::after{background:radial-gradient(circle,rgba(152,162,179,.20) 0%, rgba(152,162,179,0) 70%)}
.stat.tier-stat-gold::after{background:radial-gradient(circle,rgba(231,183,44,.22) 0%, rgba(231,183,44,0) 70%)}
.stat.tier-stat-platinum::after{background:radial-gradient(circle,rgba(100,116,139,.20) 0%, rgba(100,116,139,0) 70%)}
.tier-kpi-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:16px}
@media (max-width:980px){.tier-kpi-grid{grid-template-columns:1fr}}

.members-table-wrap{
  overflow:hidden;
}
.members-table{
  width:100%;
  table-layout:fixed;
  border-collapse:separate;
  border-spacing:0;
}
.members-table th,
.members-table td{
  vertical-align:middle;
  padding:12px 14px;
}
.members-table th{
  white-space:nowrap;
}
.members-table tbody td{
  line-height:1.3;
  background:#fff;
}
.members-table tbody tr:hover td{
  background:#fbfdff;
}
.members-table .member-col-card{width:12%}
.members-table .member-col-name{width:17%}
.members-table .member-col-shop{width:21%}
.members-table .member-col-phone{width:13%}
.members-table .member-col-type{width:14%}
.members-table .member-col-balance{width:9%}
.members-table .member-col-action{width:14%}
.members-table th.member-col-type,
.members-table th.member-col-balance,
.members-table th.member-col-action,
.members-table td.member-col-type,
.members-table td.member-col-balance,
.members-table td.member-col-action{
  text-align:center;
}
.members-table td.member-col-card,
.members-table td.member-col-phone{
  white-space:nowrap;
}
.members-table td.member-col-name,
.members-table td.member-col-shop{
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.members-table td.member-col-card{
  font-weight:700;
}
.members-table td.member-col-type .tier-badge,
.members-table td.member-col-balance .lux-balance{
  margin:0 auto;
}
.members-table td.member-col-action .btn-row{
  justify-content:center;
  align-items:center;
  gap:8px;
  flex-wrap:nowrap;
}
.members-table td.member-col-action .btn{
  min-width:0;
  padding:8px 10px;
  white-space:nowrap;
}
.members-table .lux-balance{
  min-width:54px;
  justify-content:center;
}
