/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f5f6fa;
  --bg-white: #ffffff;
  --bg-hover: #f0f1f5;
  --border: #e2e5ee;
  --border-light: #eceef4;
  --text: #1a1d26;
  --text-secondary: #5f6577;
  --text-muted: #9098b1;
  --primary: #4c6ef5;
  --primary-light: #eef1ff;
  --primary-dark: #3b5bdb;
  --green: #12b886;
  --green-light: #e6fcf5;
  --red: #fa5252;
  --red-light: #fff5f5;
  --orange: #fd7e14;
  --orange-light: #fff9db;
  --purple: #7950f2;
  --teal: #20c997;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.06);
  --shadow: 0 2px 8px rgba(0,0,0,0.06), 0 0 1px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.08), 0 0 1px rgba(0,0,0,0.08);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  --mono: 'SF Mono', 'Fira Code', 'JetBrains Mono', Consolas, monospace;
  --sidebar-w: 240px;
  --topbar-h: 60px;
}

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

/* ── Layout: Sidebar + Main ── */
.layout {
  display: flex;
  width: 100%;
  min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-white);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
}

.sidebar-brand {
  padding: 20px 20px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border-light);
}

.sidebar-brand .brand-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #4c6ef5, #7950f2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 15px;
}

.sidebar-brand .brand-text {
  font-weight: 700;
  font-size: 16px;
  color: var(--text);
}

.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-section-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 16px 12px 6px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all 0.15s ease;
  cursor: pointer;
}

.sidebar-link:hover {
  background: var(--bg-hover);
  color: var(--text);
  text-decoration: none;
}

.sidebar-link.active {
  background: var(--primary-light);
  color: var(--primary);
}

.sidebar-link svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  opacity: 0.7;
}

.sidebar-link.active svg { opacity: 1; }

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border-light);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: var(--radius-sm);
}

.sidebar-user .avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4c6ef5, #7950f2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 600;
  font-size: 13px;
}

.sidebar-user .user-info {
  flex: 1;
  min-width: 0;
}

.sidebar-user .user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user .user-role {
  font-size: 11px;
  color: var(--text-muted);
}

/* ── Main Content ── */
.main {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-height: 100vh;
}

/* ── Top Bar ── */
.topbar {
  height: var(--topbar-h);
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-left h1 {
  font-size: 20px;
  font-weight: 700;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 13px;
  min-width: 200px;
}

.search-box kbd {
  font-family: var(--font);
  font-size: 11px;
  padding: 2px 6px;
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-muted);
}

.topbar-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s;
}

.topbar-icon:hover { background: var(--bg-hover); }

/* ── Content Area ── */
.content { padding: 32px; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  font-size: 14px;
  font-weight: 500;
  font-family: var(--font);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-white);
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn:hover { background: var(--bg-hover); border-color: #ccc; }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: var(--radius-xs); }
.btn-lg { padding: 12px 24px; font-size: 15px; }

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }

.btn-green {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}
.btn-green:hover { background: #0ca678; }

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover { background: var(--bg-hover); }

.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* ── Cards ── */
.card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s ease;
}

.card:hover { box-shadow: var(--shadow); }

.card-body { padding: 20px; }
.card-body-lg { padding: 24px; }

.card-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
}

/* Gradient card headers (CupixWorks style) */
.card-gradient {
  position: relative;
  overflow: hidden;
}

.card-gradient .card-cover {
  height: 100px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  position: relative;
}

.card-cover .cover-label {
  font-size: 12px;
  opacity: 0.85;
  color: #fff;
}

.card-cover .cover-title {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  margin-top: 2px;
}

.card-cover .cover-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #fff;
  background: rgba(255,255,255,0.2);
  backdrop-filter: blur(8px);
  border-radius: 20px;
}

.grad-teal { background: linear-gradient(135deg, #12b886, #20c997); }
.grad-blue { background: linear-gradient(135deg, #4c6ef5, #5c7cfa); }
.grad-purple { background: linear-gradient(135deg, #7950f2, #9775fa); }
.grad-orange { background: linear-gradient(135deg, #fd7e14, #ffa94d); }
.grad-pink { background: linear-gradient(135deg, #e64980, #f06595); }
.grad-green { background: linear-gradient(135deg, #2b8a3e, #51cf66); }

.card-gradient .card-meta {
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 13px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-light);
}

.card-gradient .card-meta svg { width: 14px; height: 14px; }

.card-gradient .card-actions {
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-muted);
}

.card-gradient .card-actions .arrow {
  color: var(--text-muted);
  transition: transform 0.2s;
}

.card-gradient:hover .card-actions .arrow { transform: translateX(4px); }

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 20px;
}

.badge-L1 { background: #dbeafe; color: #1d4ed8; }
.badge-L2 { background: #fef3c7; color: #b45309; }
.badge-L3 { background: #fce7f3; color: #be185d; }
.badge-admin { background: #ede9fe; color: var(--purple); }
.badge-revealed { background: var(--green-light); color: #087f5b; }
.badge-pending { background: var(--orange-light); color: #e67700; }
.badge-submitted { background: #dbeafe; color: #1d4ed8; }

/* ── Info Banner ── */
.info-banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 18px;
  background: var(--primary-light);
  border: 1px solid #d0d7ff;
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.info-banner svg { flex-shrink: 0; color: var(--primary); margin-top: 2px; }

/* ── Tabs (pill-style) ── */
.tabs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 24px;
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.tab:hover { color: var(--text); background: var(--bg-white); }
.tab.active { color: var(--text); background: var(--bg-white); box-shadow: var(--shadow-sm); }

.tab svg { width: 16px; height: 16px; }
.tab .tab-count { font-size: 12px; color: var(--text-muted); }

/* ── Tables ── */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th, td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border-light);
}

th {
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  background: var(--bg);
}

tr:hover td { background: #fafbfd; }

/* ── Forms ── */
.form-group { margin-bottom: 20px; }

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}

.form-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

input[type="text"],
input[type="number"],
input[type="date"],
input[type="password"],
textarea,
select {
  width: 100%;
  padding: 10px 14px;
  font-size: 14px;
  font-family: var(--font);
  background: var(--bg-white);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(76, 110, 245, 0.1);
}

textarea { min-height: 120px; resize: vertical; }

/* ── Code blocks ── */
pre {
  background: #1e1e2e;
  border-radius: var(--radius-sm);
  padding: 20px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.6;
  color: #cdd6f4;
  margin: 0;
}

code {
  font-family: var(--mono);
  font-size: 13px;
  background: var(--bg);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--primary);
}

pre code { background: none; padding: 0; color: inherit; }

/* ── Modal ── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  z-index: 200;
  align-items: center;
  justify-content: center;
}

.modal-overlay.active { display: flex; }

.modal {
  background: var(--bg-white);
  border-radius: var(--radius);
  padding: 28px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
}

.modal h2 { font-size: 18px; margin-bottom: 20px; }
.modal .error { color: var(--red); font-size: 13px; margin-top: 8px; }

/* ── Grid ── */
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }

/* ── Stats Row ── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
}

.stat-card .stat-value {
  font-size: 32px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.stat-card .stat-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ── Progress bar ── */
.progress-bar {
  height: 6px;
  background: var(--bg);
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar .fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease;
}

.fill-green { background: var(--green); }
.fill-orange { background: var(--orange); }
.fill-red { background: var(--red); }
.fill-blue { background: var(--primary); }

/* ── Loading ── */
.loading {
  text-align: center;
  padding: 48px;
  color: var(--text-muted);
}

.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 0 auto 12px;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Alerts ── */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.alert-info { background: var(--primary-light); border: 1px solid #d0d7ff; color: #3b5bdb; }
.alert-success { background: var(--green-light); border: 1px solid #96f2d7; color: #087f5b; }
.alert-warning { background: var(--orange-light); border: 1px solid #ffe8a3; color: #e67700; }
.alert-error { background: var(--red-light); border: 1px solid #ffc9c9; color: #c92a2a; }

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: 64px 24px;
  color: var(--text-muted);
}

.empty-state h3 { color: var(--text); margin-bottom: 8px; font-size: 18px; }
.empty-state p { max-width: 400px; margin: 0 auto; }

/* ── Section heading ── */
.section-heading {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 16px;
}

/* ── Two-column form grid ── */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* ── Quick Action Buttons Row ── */
.quick-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* ── Metric item ── */
.meta-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* ── Drop Zone ── */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 40px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.drop-zone:hover,
.drop-zone.dragover {
  border-color: var(--primary);
  background: var(--primary-light);
}

/* ── File Item ── */
.file-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}

.file-item .file-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.file-icon-md { background: #dbeafe; color: #1d4ed8; }
.file-icon-pdf { background: #fce7f3; color: #be185d; }
.file-icon-tf { background: #ede9fe; color: #7950f2; }

.file-item .file-info { flex: 1; min-width: 0; }
.file-item .file-name { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-item .file-size { font-size: 12px; color: var(--text-muted); }

.file-item .file-remove {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  transition: background 0.15s, color 0.15s;
  border: none;
  background: none;
}

.file-item .file-remove:hover { background: var(--red-light); color: var(--red); }

/* ── Step panels ── */
.step-panel { margin-bottom: 20px; }

/* ── Responsive ── */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .main { margin-left: 0; }
  .content { padding: 20px 16px; }
  .topbar { padding: 0 16px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .stats-row { grid-template-columns: 1fr 1fr; }
  .tabs { flex-wrap: wrap; }
}
