:root{
  --bg: #0d0f14;
  --panel: #12151c;
  --card: #161a23;
  --border: #232836;
  --border-soft: #1c212c;
  --text: #e6e8ee;
  --text-dim: #8891a3;
  --text-faint: #5b6377;
  --accent: #3b5bdb;
  --accent-soft: rgba(59, 91, 219, 0.14);
  --accent-hover: #4a6aef;
  --danger: #e0393e;
  --danger-soft: rgba(224, 57, 62, 0.12);
  --radius: 10px;
  font-family: -apple-system, "Inter", "Segoe UI", Roboto, sans-serif;
}

*{ box-sizing: border-box; }
html,body{ height:100%; }
body{
  margin:0;
  background: var(--bg);
  color: var(--text);
  display:flex;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Sidebar ---------- */
.sidebar{
  width: 244px;
  flex-shrink:0;
  background: var(--panel);
  border-right: 1px solid var(--border-soft);
  display:flex;
  flex-direction:column;
  padding: 18px 12px;
}
.brand{
  display:flex;
  align-items:center;
  gap:10px;
  padding: 6px 10px 20px 10px;
}
.brand-mark{
  width:26px; height:26px;
  border-radius:7px;
  background: linear-gradient(135deg, var(--accent), #6d8bff);
  display:flex; align-items:center; justify-content:center;
  font-weight:700; font-size:13px; color:white;
}
.brand-name{ font-weight:600; font-size:14.5px; letter-spacing:0.2px; }

.nav-section{ margin-bottom: 18px; }
.nav-heading{
  font-size: 11px;
  color: var(--text-faint);
  padding: 0 10px 6px 10px;
  font-weight: 600;
  letter-spacing: 0.4px;
}
.nav-item{
  display:flex;
  align-items:center;
  gap:10px;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--text-dim);
  text-decoration:none;
  cursor:pointer;
  font-size: 13.5px;
  margin-bottom: 2px;
  transition: background .12s ease, color .12s ease;
}
.nav-item svg{ width:16px; height:16px; flex-shrink:0; opacity:.85; }
.nav-item:hover{ background: var(--card); color: var(--text); }
.nav-item.active{
  background: var(--accent-soft);
  color: #adbcff;
}
.nav-item.active svg{ opacity:1; }

/* ---------- Main ---------- */
.main{
  flex:1;
  min-width:0;
  padding: 28px 34px;
  overflow-y:auto;
}

/* ---------- Views (tabs) ---------- */
.view{ display:none; }
.view.active{ display:block; }

/* ---------- Profile ---------- */
.profile-row{ display:flex; align-items:center; gap:12px; }
.profile-avatar{
  width:42px; height:42px; border-radius:50%;
  background: linear-gradient(135deg, var(--accent), #6d8bff);
  display:flex; align-items:center; justify-content:center;
  font-weight:700; font-size:16px; color:white; flex-shrink:0;
}
.profile-name{ font-weight:600; font-size:14px; }
.profile-sub{ font-size:12.5px; color: var(--text-dim); }

/* ---------- Progress bar ---------- */
.progress-wrap{
  display:none;
  align-items:center;
  gap:10px;
  margin-top: 14px;
}
.progress-wrap.show{ display:flex; }
.progress-track{
  flex:1;
  height:8px;
  border-radius: 20px;
  background: var(--panel);
  border: 1px solid var(--border);
  overflow:hidden;
}
.progress-fill{
  height:100%;
  width:0%;
  background: linear-gradient(90deg, var(--accent), #6d8bff);
  border-radius: 20px;
  transition: width .15s ease;
}
.progress-label{
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  width: 38px;
  text-align:right;
  flex-shrink:0;
}
.page-header{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  margin-bottom: 22px;
  gap: 16px;
  flex-wrap: wrap;
}
.page-title{ font-size: 20px; font-weight:600; margin:0 0 4px 0; }
.page-sub{ color: var(--text-dim); font-size: 13px; margin:0; }

.btn{
  border:none;
  border-radius: 8px;
  padding: 9px 15px;
  font-size: 13px;
  font-weight: 600;
  cursor:pointer;
  display:inline-flex;
  align-items:center;
  gap:7px;
  transition: background .12s ease, opacity .12s ease;
}
.btn-primary{ background: var(--accent); color:white; }
.btn-primary:hover{ background: var(--accent-hover); }
.btn-danger{ background: var(--danger-soft); color:#ff8a8d; border:1px solid rgba(224,57,62,0.35); }
.btn-danger:hover{ background: rgba(224,57,62,0.2); }
.btn-ghost{ background: var(--card); color: var(--text-dim); border:1px solid var(--border); }
.btn-ghost:hover{ color: var(--text); border-color:#2d3444; }
.btn:disabled{ opacity:.5; cursor:not-allowed; }

/* ---------- Cards ---------- */
.card{
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}
.card-title{ font-size: 14.5px; font-weight:600; margin: 0 0 3px 0; }
.card-sub{ font-size: 12.5px; color: var(--text-dim); margin: 0 0 16px 0; }

.grid-2{ display:grid; grid-template-columns: 1.3fr 1fr; gap: 18px; align-items:start; }
@media (max-width: 980px){ .grid-2{ grid-template-columns: 1fr; } }

/* ---------- Dropzone ---------- */
.dropzone{
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  padding: 30px 18px;
  text-align:center;
  color: var(--text-dim);
  font-size: 13px;
  cursor:pointer;
  transition: border-color .12s ease, background .12s ease;
}
.dropzone:hover, .dropzone.drag{
  border-color: var(--accent);
  background: var(--accent-soft);
}
.dropzone svg{ width:26px; height:26px; margin-bottom:8px; opacity:.6; }
.dropzone .fname{ color: var(--text); font-weight:600; margin-top: 6px; }

/* ---------- Form fields ---------- */
.field{ margin-bottom: 14px; }
.field label{
  display:block;
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 6px;
  font-weight: 600;
}
select, input[type="text"]{
  width:100%;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 9px 11px;
  border-radius: 8px;
  font-size: 13px;
  outline:none;
}
select:focus, input[type="text"]:focus{ border-color: var(--accent); }
.preset-row{ display:grid; grid-template-columns: 1fr 1fr; gap:12px; }

.field-row{ display:flex; align-items:center; gap:10px; }
.switch{
  width:36px; height:20px; border-radius:20px;
  background: var(--border); position:relative; cursor:pointer;
  flex-shrink:0; transition: background .15s ease;
}
.switch.on{ background: var(--accent); }
.switch::after{
  content:""; position:absolute; top:2px; left:2px;
  width:16px; height:16px; border-radius:50%; background:white;
  transition: transform .15s ease;
}
.switch.on::after{ transform: translateX(16px); }
.hint{ font-size:11.5px; color: var(--text-faint); margin-top:4px; }

/* ---------- Table ---------- */
table{ width:100%; border-collapse: collapse; font-size: 13px; }
thead th{
  text-align:left;
  color: var(--text-faint);
  font-weight: 600;
  font-size: 11.5px;
  letter-spacing: 0.3px;
  padding: 0 12px 10px 12px;
  border-bottom: 1px solid var(--border);
}
tbody td{
  padding: 12px;
  border-bottom: 1px solid var(--border-soft);
  color: var(--text);
  vertical-align: middle;
}
tbody tr:last-child td{ border-bottom:none; }
tbody tr:hover{ background: rgba(255,255,255,0.015); }

.fname-cell{ display:flex; align-items:center; gap:9px; }
.fname-cell svg{ width:15px; height:15px; color: var(--text-faint); flex-shrink:0; }

.pill{
  display:inline-block;
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 20px;
  border: 1px solid var(--border);
  color: var(--text-dim);
  background: var(--panel);
}
.pill.blue{ color:#adbcff; border-color: rgba(59,91,219,0.4); background: var(--accent-soft); }

.row-actions{ display:flex; gap:8px; }
.icon-btn{
  width:28px; height:28px;
  display:flex; align-items:center; justify-content:center;
  border-radius:7px;
  border:1px solid var(--border);
  background: var(--panel);
  color: var(--text-dim);
  cursor:pointer;
}
.icon-btn:hover{ color: var(--text); border-color:#2d3444; }
.icon-btn.danger:hover{ color:#ff8a8d; border-color: rgba(224,57,62,0.4); background: var(--danger-soft); }
.icon-btn svg{ width:14px; height:14px; }

.empty-row td{ text-align:center; color: var(--text-faint); padding: 30px 0; }

/* ---------- Toast ---------- */
.toast{
  position:fixed; bottom:22px; right:22px;
  background: var(--card); border:1px solid var(--border);
  padding: 12px 16px; border-radius: 9px; font-size:13px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
  opacity:0; transform: translateY(8px);
  transition: opacity .18s ease, transform .18s ease;
  pointer-events:none;
  z-index: 50;
}
.toast.show{ opacity:1; transform: translateY(0); }
.toast.error{ border-color: rgba(224,57,62,0.4); color:#ff8a8d; }

/* ---------- Confirm modal ---------- */
.modal-overlay{
  position:fixed; inset:0; background: rgba(6,8,12,0.6);
  display:none; align-items:center; justify-content:center; z-index: 40;
}
.modal-overlay.show{ display:flex; }
.modal{
  background: var(--card); border:1px solid var(--border);
  border-radius: var(--radius); padding: 22px; width: 360px;
}
.modal h3{ margin:0 0 8px 0; font-size:15px; }
.modal p{ margin:0 0 18px 0; color: var(--text-dim); font-size: 13px; line-height:1.5; }
.modal-actions{ display:flex; justify-content:flex-end; gap:10px; }

::placeholder{ color: var(--text-faint); }
