/* ===== SHARED BASE STYLES ===== */
*,*::before,*::after{margin:0;padding:0;box-sizing:border-box}
:root{
  --primary:#1a1050;--sidebar:#1a0a4e;--gold:#e8a820;--gold-btn:#d4920a;
  --white:#fff;--bg:#f5f6fa;--text:#1a1a2e;--muted:#6b7280;--border:#e5e7eb;
  --purple:#7c3aed;--blue:#3b82f6;--green:#22c55e;--orange:#f59e0b;--red:#ef4444;
}
body{font-family:'Poppins',sans-serif;background:var(--bg);color:var(--text);-webkit-font-smoothing:antialiased;overflow-x:hidden}
a{text-decoration:none;color:inherit}
img{max-width:100%;display:block}
button,select,input,textarea{font-family:inherit}
.app{display:flex;min-height:100vh}

/* SIDEBAR */
.sidebar{
  width:230px;background:var(--sidebar);color:#fff;
  display:flex;flex-direction:column;flex-shrink:0;
  position:fixed;top:0;left:0;bottom:0;z-index:200;
  transition:transform .3s ease;
}
.sb-logo{display:flex;align-items:center;gap:10px;padding:18px 16px 16px}
.sb-logo img{width:44px;height:44px;border-radius:50%}
.sb-logo h1{font-size:13px;font-weight:800;line-height:1.2}
.sb-logo p{font-size:8px;color:#c9a84c;font-weight:500;margin-top:1px}
.sb-nav{flex:1;padding:6px 10px;overflow-y:auto}
.sb-nav a{
  display:flex;align-items:center;gap:12px;padding:11px 14px;
  border-radius:10px;font-size:13px;font-weight:500;
  color:rgba(255,255,255,.75);margin-bottom:1px;transition:.15s;
}
.sb-nav a i{width:18px;text-align:center;font-size:14px}
.sb-nav a:hover{background:rgba(255,255,255,.07);color:#fff}
.sb-nav a.active{
  background:linear-gradient(90deg,#e8a820,#d4920a);color:#fff;font-weight:600;
  box-shadow:0 4px 12px rgba(212,146,10,.35);
}
.sb-nav a .badge{
  margin-left:auto;background:#6d28d9;color:#fff;font-size:10px;
  min-width:20px;height:20px;border-radius:10px;display:flex;
  align-items:center;justify-content:center;font-weight:700;
}
.sb-help{
  margin:10px 12px 16px;padding:18px 14px;
  background:linear-gradient(145deg,rgba(109,40,217,.4),rgba(30,10,80,.6));
  border-radius:16px;text-align:center;border:1px solid rgba(255,255,255,.08);
}
.sb-help .hearts{font-size:26px;margin-bottom:4px}
.sb-help h4{font-size:13px;font-weight:700;margin-bottom:2px}
.sb-help p{font-size:11px;opacity:.75;margin-bottom:12px}
.sb-help a{
  display:inline-block;background:#fff;color:var(--primary);
  padding:8px 18px;border-radius:8px;font-size:12px;font-weight:700;
}

/* MAIN + TOPBAR */
.main{flex:1;margin-left:230px;min-width:0;display:flex;flex-direction:column}
.topbar{
  background:#fff;padding:10px 22px;display:flex;align-items:center;gap:14px;
  border-bottom:1px solid var(--border);position:sticky;top:0;z-index:50;
}
.menu-btn{display:none;background:none;border:none;font-size:20px;color:var(--primary);padding:4px;cursor:pointer}
.search-box{
  flex:1;max-width:480px;display:flex;align-items:center;gap:10px;
  background:#f3f4f6;border-radius:24px;padding:0 16px;height:40px;
}
.search-box input{flex:1;border:none;outline:none;background:transparent;font-size:13px;color:#333}
.search-box i{color:#9ca3af;font-size:14px}
.topbar-right{display:flex;align-items:center;gap:12px;margin-left:auto}
.icon-btn{
  position:relative;width:38px;height:38px;border-radius:50%;border:none;
  background:#f3f4f6;display:flex;align-items:center;justify-content:center;
  color:#555;font-size:15px;cursor:pointer;
}
.icon-btn .dot{
  position:absolute;top:2px;right:2px;min-width:16px;height:16px;border-radius:50%;
  background:#ef4444;color:#fff;font-size:9px;font-weight:700;
  display:flex;align-items:center;justify-content:center;padding:0 3px;
}
.user-chip{display:flex;align-items:center;gap:8px;cursor:pointer;padding:4px 8px 4px 4px;border-radius:24px}
.user-chip:hover{background:#f3f4f6}
.user-chip img{width:36px;height:36px;border-radius:50%;object-fit:cover}
.user-chip .info{line-height:1.2}
.user-chip .info strong{font-size:13px;display:block}
.user-chip .info span{font-size:11px;color:var(--muted)}
.user-chip .chev{font-size:10px;color:#9ca3af;margin-left:2px}
.content{padding:22px 24px;flex:1}

.page-hd{display:flex;justify-content:space-between;align-items:center;margin-bottom:20px;flex-wrap:wrap;gap:12px}
.page-hd h2{font-size:22px;font-weight:800;color:#1a1a2e}
.page-hd p{font-size:13px;color:var(--muted);margin-top:3px}
.btn-gold{
  display:inline-flex;align-items:center;gap:6px;background:linear-gradient(90deg,#e8a820,#d4920a);
  color:#fff;border:none;padding:10px 18px;border-radius:10px;font-size:13px;font-weight:700;cursor:pointer;
}
.btn-gold:hover{opacity:.9}
.btn-outline{
  display:inline-flex;align-items:center;gap:6px;background:#fff;color:#5b21b6;
  border:1.5px solid #c4b5fd;padding:8px 16px;border-radius:10px;font-size:12px;font-weight:600;cursor:pointer;
}
.btn-outline:hover{background:#f5f3ff}

.card{background:#fff;border-radius:14px;padding:18px;box-shadow:0 1px 3px rgba(0,0,0,.04);margin-bottom:16px}
.card-hd{display:flex;justify-content:space-between;align-items:center;margin-bottom:14px}
.card-hd h3{font-size:14px;font-weight:700;color:#1a1a2e}
.card-hd a{font-size:12px;color:#6d28d9;font-weight:600}

.data-table{width:100%;border-collapse:collapse;font-size:12px}
.data-table th{
  text-align:left;padding:10px 8px;color:var(--muted);font-weight:600;
  border-bottom:1px solid var(--border);font-size:11px;white-space:nowrap;
}
.data-table td{padding:12px 8px;border-bottom:1px solid #f5f5f5;vertical-align:middle}
.data-table tr:last-child td{border-bottom:none}
.data-table tr:hover td{background:#fafafa}

.tag{display:inline-block;padding:2px 8px;border-radius:6px;font-size:10px;font-weight:600}
.tag.new{background:#ede9fe;color:#6d28d9}
.tag.active{background:#dcfce7;color:#15803d}
.tag.pending{background:#fef3c7;color:#b45309}
.tag.inactive{background:#f3f4f6;color:#6b7280}
.tag.ft{background:#dcfce7;color:#15803d}
.tag.pt{background:#ffedd5;color:#c2410c}
.tag.full{background:#dbeafe;color:#1d4ed8}

.filters{display:flex;gap:10px;flex-wrap:wrap;margin-bottom:16px}
.filters select,.filters input{
  border:1px solid var(--border);border-radius:8px;padding:8px 12px;font-size:12px;background:#fff;
}

.stat-row{display:grid;grid-template-columns:repeat(4,1fr);gap:14px;margin-bottom:16px}
.stat-card{
  background:#fff;border-radius:14px;padding:16px;position:relative;
  box-shadow:0 1px 3px rgba(0,0,0,.04);
}
.stat-card .label{font-size:12px;color:var(--muted);font-weight:500}
.stat-card .value{font-size:22px;font-weight:800;color:#1a1a2e;margin:4px 0 2px}
.stat-card .sub{font-size:11px;color:var(--muted)}
.stat-card .icon-c{
  position:absolute;top:14px;right:14px;width:36px;height:36px;border-radius:50%;
  display:flex;align-items:center;justify-content:center;color:#fff;font-size:14px;
}
.stat-card.p{background:linear-gradient(160deg,#f5f0ff 0%,#fff 60%)}
.stat-card.p .icon-c{background:#7c3aed}
.stat-card.o{background:linear-gradient(160deg,#fff8ee 0%,#fff 60%)}
.stat-card.o .icon-c{background:#f59e0b}
.stat-card.b{background:linear-gradient(160deg,#eef5ff 0%,#fff 60%)}
.stat-card.b .icon-c{background:#3b82f6}
.stat-card.g{background:linear-gradient(160deg,#eefbf3 0%,#fff 60%)}
.stat-card.g .icon-c{background:#22c55e}

.form-grid{display:grid;grid-template-columns:1fr 1fr;gap:14px}
.form-group{margin-bottom:4px}
.form-group.full{grid-column:1/-1}
.form-group label{display:block;font-size:12px;font-weight:600;color:#333;margin-bottom:5px}
.form-group input,.form-group select,.form-group textarea{
  width:100%;border:1.5px solid var(--border);border-radius:10px;padding:10px 12px;
  font-size:13px;outline:none;transition:border-color .2s;
}
.form-group input:focus,.form-group select:focus,.form-group textarea:focus{border-color:var(--gold)}
.form-group textarea{min-height:80px;resize:vertical}

.dash-ft{
  text-align:center;padding:14px 20px;font-size:11px;color:#9ca3af;
  border-top:1px solid var(--border);background:#fff;
}
.dash-ft a{color:#6d28d9}
.overlay{display:none;position:fixed;inset:0;background:rgba(0,0,0,.4);z-index:150}
.overlay.open{display:block}

.empty-state{text-align:center;padding:40px 20px;color:var(--muted)}
.empty-state i{font-size:40px;margin-bottom:12px;opacity:.4}
.empty-state p{font-size:14px}

@media(max-width:1200px){
  .stat-row{grid-template-columns:repeat(2,1fr)}
}
@media(max-width:768px){
  .sidebar{transform:translateX(-100%)}
  .sidebar.open{transform:translateX(0)}
  .main{margin-left:0}
  .menu-btn{display:block}
  .user-chip .info{display:none}
  .stat-row{grid-template-columns:1fr 1fr}
  .content{padding:14px}
  .page-hd h2{font-size:18px}
  .data-table{display:block;overflow-x:auto}
  .form-grid{grid-template-columns:1fr}
}
@media(max-width:480px){
  .stat-row{grid-template-columns:1fr}
  .search-box{max-width:none}
}

/* Toast notifications */
.mc-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #1a1050;
  color: #fff;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(0,0,0,.2);
  z-index: 9999;
  opacity: 0;
  transition: opacity .25s, transform .25s;
  max-width: 90vw;
  text-align: center;
}
.mc-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.mc-toast--success { background: #15803d; }
.mc-toast--error { background: #dc2626; }
.mc-toast--info { background: #1a1050; }

/* Loading state */
.mc-loading { opacity: .6; pointer-events: none; }
.btn-loading { position: relative; color: transparent !important; }
.btn-loading::after {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  left: 50%; top: 50%;
  margin: -9px 0 0 -9px;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Modal */
.mc-modal-backdrop {
  display: none; position: fixed; inset: 0; background: rgba(15,10,40,.45);
  z-index: 500; align-items: center; justify-content: center; padding: 16px;
}
.mc-modal-backdrop.open { display: flex; }
.mc-modal {
  background: #fff; border-radius: 16px; width: 100%; max-width: 520px;
  max-height: 90vh; overflow: auto; box-shadow: 0 20px 50px rgba(0,0,0,.2);
}
.mc-modal-hd {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px; border-bottom: 1px solid var(--border);
}
.mc-modal-hd h3 { font-size: 16px; font-weight: 700; color: var(--primary); }
.mc-modal-hd button {
  border: none; background: #f3f4f6; width: 32px; height: 32px; border-radius: 8px;
  cursor: pointer; color: #555;
}
.mc-modal-bd { padding: 16px 18px; }
.mc-modal-ft {
  padding: 12px 18px 16px; display: flex; gap: 8px; justify-content: flex-end;
  border-top: 1px solid var(--border);
}
.btn-sm {
  padding: 6px 12px; border-radius: 8px; font-size: 11px; font-weight: 600;
  border: 1.5px solid var(--border); background: #fff; cursor: pointer;
}
.btn-sm.ok { background: linear-gradient(90deg,#e8a820,#d4920a); border-color: transparent; color: #fff; }
.btn-sm.danger { border-color: #fecaca; color: #dc2626; }
.btn-sm.primary { border-color: #c4b5fd; color: #5b21b6; }
.detail-grid { display: grid; grid-template-columns: 120px 1fr; gap: 8px 12px; font-size: 13px; }
.detail-grid .lbl { color: var(--muted); font-weight: 500; }

/* Form validation */
input.is-invalid, select.is-invalid, textarea.is-invalid {
  border-color: #dc2626 !important;
  box-shadow: 0 0 0 3px rgba(220,38,38,.12);
}
.field-error { color: #dc2626; font-size: 12px; margin-top: 4px; }

/* State blocks */
.mc-state--error p { color: #dc2626; }
.mc-state--loading p { color: var(--muted); }

/* File upload control */
.file-drop {
  border: 1.5px dashed var(--border);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  background: #fafafa;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
}
.file-drop:hover, .file-drop.drag { border-color: var(--gold); background: #fffbeb; }
.file-drop input[type=file] { display: none; }
.file-name { font-size: 12px; color: var(--primary); margin-top: 6px; font-weight: 600; }

/* OTP boxes */
.otp-row { display: flex; gap: 8px; justify-content: center; margin: 12px 0; }
.otp-row input {
  width: 42px; height: 48px; text-align: center; font-size: 18px; font-weight: 700;
  border: 1.5px solid var(--border); border-radius: 10px;
}
.otp-row input:focus { border-color: var(--gold); outline: none; }
