/* ==========================================================================
   JOBTRACK — MODERN BLACK & WHITE SAAS DASHBOARD DESIGN
   ========================================================================== */

:root {
  /* Nuance: Black & White / Neutral Minimalist */
  --bg: #f4f5f7;
  --bg-subtle: #eaedf2;
  --card: #ffffff;
  --card-hover: #fafbfc;
  
  /* Sidebar (Deep Dark Rail inspired by Reference Screenshot) */
  --sidebar-bg: #090a0f;
  --sidebar-text: #ffffff;
  --sidebar-muted: #8c93a4;
  --sidebar-active-bg: #222530;
  --sidebar-active-text: #ffffff;
  --sidebar-border: rgba(255, 255, 255, 0.08);

  /* Typography & Text */
  --text: #0f172a;
  --text-muted: #64748b;
  --text-dim: #94a3b8;

  /* Borders & Dividers */
  --border: #e2e8f0;
  --border-light: #f1f5f9;

  /* Accent & Actions (Black primary in light mode) */
  --primary: #000000;
  --primary-hover: #1f242e;
  --primary-text: #ffffff;
  --primary-accent: #2563eb;

  /* Semantics */
  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.1);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.1);
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.1);
  --info: #3b82f6;
  --info-bg: rgba(59, 130, 246, 0.1);

  /* Elevation Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
  --shadow-card: 0 2px 10px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 12px 30px rgba(0, 0, 0, 0.08);

  /* Geometry */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius: 16px;
  --radius-lg: 20px;
  --radius-pill: 9999px;

  /* Sizing */
  --sidebar-w: 250px;
  --sidebar-c: 82px;
  --topbar-h: 70px;
}

/* ================= DARK MODE ================= */
[data-theme="dark"] {
  --bg: #0b0c10;
  --bg-subtle: #13151d;
  --card: #151720;
  --card-hover: #1b1e2a;

  --sidebar-bg: #07080b;
  --sidebar-text: #ffffff;
  --sidebar-muted: #73798c;
  --sidebar-active-bg: #1f2330;
  --sidebar-active-text: #ffffff;
  --sidebar-border: rgba(255, 255, 255, 0.06);

  --text: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --border: #232735;
  --border-light: #1a1c26;

  /* In dark mode, primary buttons flip to crisp white for maximum contrast */
  --primary: #ffffff;
  --primary-hover: #e2e8f0;
  --primary-text: #0b0c10;
  --primary-accent: #3b82f6;

  --success: #34d399;
  --success-bg: rgba(52, 211, 153, 0.15);
  --warning: #fbbf24;
  --warning-bg: rgba(251, 191, 36, 0.15);
  --danger: #f87171;
  --danger-bg: rgba(248, 113, 113, 0.15);
  --info: #60a5fa;
  --info-bg: rgba(96, 165, 250, 0.15);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  --shadow-card: 0 4px 18px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.65);
}

/* ================= GLOBAL BASE ================= */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  transition: background 0.3s ease, color 0.3s ease;
}

a {
  color: inherit;
  text-decoration: none;
}

button, input, select, textarea {
  font-family: inherit;
}

.app-layout {
  display: flex;
  min-height: 100vh;
  position: relative;
}

/* ================= SIDEBAR (DEEP DARK RAIL) ================= */
.sidebar {
  width: var(--sidebar-w);
  height: 100vh;
  position: fixed;
  left: 0;
  top: 0;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 100;
  border-right: 1px solid var(--sidebar-border);
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
  padding: 0 0.5rem;
  min-height: 40px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #ffffff;
  overflow: hidden;
  white-space: nowrap;
}

.brand-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: #ffffff;
  color: #000000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.sidebar-toggle-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--sidebar-muted);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 1.1rem;
}

.sidebar-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

/* Nav Menu */
.nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  overflow-y: auto;
  overflow-x: hidden;
}

.nav::-webkit-scrollbar {
  width: 4px;
}
.nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.75rem 0.875rem;
  border-radius: var(--radius-md);
  color: var(--sidebar-muted);
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  white-space: nowrap;
}

.nav-link i {
  font-size: 1.35rem;
  line-height: 1;
  flex-shrink: 0;
  transition: transform 0.2s;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.nav-link:hover i {
  transform: scale(1.08);
}

.nav-link.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-text);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

/* Sidebar Footer */
.sidebar-footer {
  padding-top: 1rem;
  margin-top: 0.5rem;
  border-top: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.theme-toggle-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--sidebar-muted);
  padding: 0.75rem 0.875rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.875rem;
  font-size: 0.875rem;
  font-weight: 600;
  transition: all 0.2s;
}

.theme-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.theme-toggle-btn i {
  font-size: 1.25rem;
}

.btn-logout {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.75rem 0.875rem;
  background: rgba(239, 68, 68, 0.12);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.875rem;
  transition: all 0.2s;
  width: 100%;
}

.btn-logout:hover {
  background: var(--danger);
  color: #ffffff;
  border-color: var(--danger);
}

.btn-logout i {
  font-size: 1.25rem;
}

/* ================= SIDEBAR COLLAPSED (SLIM RAIL LIKE SCREENSHOT) ================= */
.sidebar.collapsed {
  width: var(--sidebar-c);
  padding: 1.5rem 0.75rem;
}

.sidebar.collapsed .brand-text,
.sidebar.collapsed .nav-link span,
.sidebar.collapsed .theme-toggle-btn span,
.sidebar.collapsed .btn-logout span {
  display: none !important;
}

.sidebar.collapsed .sidebar-header {
  justify-content: center;
  padding: 0;
}

.sidebar.collapsed .brand {
  display: none;
}

.sidebar.collapsed .sidebar-toggle-btn {
  margin: 0 auto;
}

.sidebar.collapsed .nav-link {
  justify-content: center;
  padding: 0.875rem 0;
  width: 100%;
}

.sidebar.collapsed .theme-toggle-btn,
.sidebar.collapsed .btn-logout {
  justify-content: center;
  padding: 0.875rem 0;
}

/* ================= MAIN AREA & TOPBAR ================= */
.main-area {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  background: var(--bg);
}

.sidebar.collapsed ~ .main-area {
  margin-left: var(--sidebar-c);
}

.topbar {
  height: var(--topbar-h);
  background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  position: sticky;
  top: 0;
  z-index: 90;
  box-shadow: var(--shadow-sm);
  transition: background 0.3s ease, border-color 0.3s ease;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex: 1;
  max-width: 500px;
}

/* Modern Topbar Search Bar */
.topbar-search {
  position: relative;
  width: 100%;
  max-width: 360px;
  display: flex;
  align-items: center;
}

.topbar-search .search-icon {
  position: absolute;
  left: 1rem;
  color: var(--text-muted);
  font-size: 1.2rem;
  pointer-events: none;
}

.topbar-search input {
  width: 100%;
  padding: 0.6rem 1rem 0.6rem 2.6rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 0.875rem;
  outline: none;
  transition: all 0.2s ease;
}

.topbar-search input:focus {
  border-color: var(--text);
  background: var(--card);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .topbar-search input:focus {
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.1);
}

/* Topbar Right Controls */
.topbar-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.topbar-icon-btn {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-pill);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
  font-size: 1.15rem;
}

.topbar-icon-btn:hover {
  background: var(--card-hover);
  color: var(--text);
  border-color: var(--text-dim);
}

.notif-dot {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--danger);
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.35rem 0.75rem 0.35rem 0.35rem;
  border-radius: var(--radius-pill);
  background: var(--bg);
  border: 1px solid var(--border);
}

.user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--primary-text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.user-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.content-area {
  padding: 2rem;
  flex: 1;
}

/* ================= COMPONENTS & BUTTONS ================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-pill);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  outline: none;
  text-decoration: none;
  white-space: nowrap;
}

.btn i {
  font-size: 1.15rem;
}

/* Primary Button: Solid Black in light mode / Solid White in dark mode */
.btn-primary {
  background: var(--primary);
  color: var(--primary-text);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
}

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

.btn-sm {
  padding: 0.45rem 0.85rem;
  font-size: 0.775rem;
  border-radius: var(--radius-sm);
}

.icon-btn-round {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s ease;
}

.icon-btn-round:hover {
  background: var(--primary);
  color: var(--primary-text);
  border-color: var(--primary);
}

/* Card Component */
.card {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  transition: background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

/* Badges / Status Pills (matching • Active in Screenshot) */
.badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.badge-pill::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.badge-pill.active, .badge-pill.diterima {
  background: var(--success-bg);
  color: var(--success);
}

.badge-pill.pending, .badge-pill.wawancara, .badge-pill.tes {
  background: var(--warning-bg);
  color: var(--warning);
}

.badge-pill.closed, .badge-pill.tidak-diterima, .badge-pill.mengundurkan-diri {
  background: var(--danger-bg);
  color: var(--danger);
}

.badge-pill.neutral, .badge-pill.pendaftaran {
  background: var(--info-bg);
  color: var(--info);
}

/* Segmented Control / Pill Tabs */
.segmented-tabs {
  display: inline-flex;
  background: var(--bg-subtle);
  padding: 0.3rem;
  border-radius: var(--radius-pill);
  gap: 0.25rem;
}

.tab-btn {
  padding: 0.45rem 1rem;
  border-radius: var(--radius-pill);
  font-size: 0.825rem;
  font-weight: 600;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab-btn:hover {
  color: var(--text);
}

.tab-btn.active {
  background: var(--primary);
  color: var(--primary-text);
  box-shadow: var(--shadow-sm);
}

/* Form Styles */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg);
  color: var(--text);
  font-size: 0.9rem;
  outline: none;
  transition: all 0.2s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--text);
  background: var(--card);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .form-group input:focus,
[data-theme="dark"] .form-group select:focus,
[data-theme="dark"] .form-group textarea:focus {
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.1);
}

/* ================= MODAL & OVERLAY ================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1.5rem;
  animation: fadeIn 0.2s ease;
}

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

.modal-box {
  background: var(--card);
  padding: 2rem;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  animation: scaleUp 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  transition: max-width 0.25s ease;
}

.modal-box.modal-lg {
  max-width: 960px;
  width: 95%;
}

/* 2-Column Form Layout (Left: Standard inputs, Right: Long text areas) */
.form-2col {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 1.75rem;
}

.form-row-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.preview-tiles-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

.form-col-left {
  display: flex;
  flex-direction: column;
}

.form-col-right {
  display: flex;
  flex-direction: column;
}

.form-col-right .form-group {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.form-col-right textarea {
  flex: 1;
  min-height: 130px;
  resize: vertical;
}

/* Stage Selector List with Material Icons */
.stage-selector-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 0.5rem;
  margin-top: 0.35rem;
}

.stage-pill-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.stage-pill-option i {
  font-size: 1.15rem;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.stage-pill-option:hover {
  background: var(--card);
  color: var(--text);
  border-color: var(--text-dim);
}

.stage-pill-option.active {
  background: var(--card);
  color: var(--text);
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary);
  font-weight: 700;
}

.stage-pill-option.active i {
  transform: scale(1.15);
}

/* Preview Modal Layout */
.preview-grid-2col {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 1.75rem;
}

.preview-info-tile {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.preview-info-tile .tile-label {
  font-size: 0.725rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.03em;
}

.preview-info-tile .tile-value {
  font-size: 0.925rem;
  font-weight: 700;
  color: var(--text);
}

.preview-text-block {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.15rem;
  margin-bottom: 1rem;
}

.preview-text-block h4 {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.03em;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.preview-text-content {
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--text);
  white-space: pre-wrap;
}

@media (max-width: 820px) {
  .form-2col,
  .preview-grid-2col {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
}

.modal-close-btn {
  background: transparent;
  border: none;
  font-size: 1.35rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.modal-close-btn:hover {
  background: var(--bg);
  color: var(--text);
}

.modal-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: 1.75rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes scaleUp {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* ================= TOAST ================= */
#toastContainer {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.toast {
  background: var(--card);
  color: var(--text);
  padding: 0.85rem 1.4rem;
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.875rem;
  font-weight: 600;
  animation: slideInRight 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ================= LOADER ================= */
.loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 40vh;
  color: var(--text-muted);
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
  margin-bottom: 1rem;
}

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

/* ================= LOGIN PAGE ================= */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at center, #181920 0%, #08090d 100%);
  min-height: 100vh;
  padding: 20px;
}

.login-card {
  background: rgba(20, 22, 30, 0.75);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
}

.login-card .logo {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: #ffffff;
  color: #000000;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 2rem;
  margin: 0 auto 20px auto;
  box-shadow: 0 6px 20px rgba(255, 255, 255, 0.2);
}

.login-card h1 {
  text-align: center;
  color: #ffffff;
  font-size: 1.75rem;
  font-weight: 800;
  margin-bottom: 6px;
}

.login-card p {
  text-align: center;
  color: #8c93a4;
  font-size: 0.875rem;
  margin-bottom: 25px;
}

.input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-icon i {
  position: absolute;
  left: 1rem;
  color: #717789;
  font-size: 1.15rem;
}

.input-with-icon input {
  width: 100%;
  padding: 0.75rem 2.5rem 0.75rem 2.6rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
  color: #ffffff;
  font-size: 0.95rem;
  outline: none;
  transition: all 0.2s ease;
}

.input-with-icon input:focus {
  border-color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

.login-btn {
  width: 100%;
  padding: 0.85rem;
  margin-top: 1rem;
  background: #ffffff;
  color: #000000;
  font-size: 0.95rem;
  border-radius: var(--radius-pill);
}

.login-btn:hover {
  background: #f1f5f9;
}

.error-msg {
  display: none;
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  padding: 0.75rem;
  border-radius: var(--radius-md);
  margin-top: 15px;
  font-size: 0.85rem;
  text-align: center;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

/* ================= RESPONSIVE & MOBILE ================= */
.mobile-menu-btn {
  display: none;
}
.sidebar-overlay {
  display: none;
}

@media (max-width: 900px) {
  .topbar-search {
    max-width: 200px;
  }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    width: 270px !important;
    z-index: 1000;
    box-shadow: 4px 0 25px rgba(0, 0, 0, 0.5);
    padding: 1.5rem 1rem !important;
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

  .sidebar.collapsed {
    width: 270px !important;
    padding: 1.5rem 1rem !important;
  }

  /* Header Brand & Toggle in Mobile Drawer */
  .sidebar .sidebar-header,
  .sidebar.collapsed .sidebar-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 0 0.5rem !important;
    margin-bottom: 1.5rem !important;
  }

  .sidebar .brand,
  .sidebar.collapsed .brand {
    display: flex !important;
    align-items: center !important;
    gap: 0.75rem !important;
  }

  .sidebar .brand-text,
  .sidebar.collapsed .brand-text {
    display: inline !important;
  }

  .sidebar .sidebar-toggle-btn,
  .sidebar.collapsed .sidebar-toggle-btn {
    margin: 0 !important;
  }

  /* Menu Navigation List (Left-aligned / Rata Kiri) */
  .sidebar .nav,
  .sidebar.collapsed .nav {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.4rem !important;
  }

  .sidebar .nav-link,
  .sidebar.collapsed .nav-link {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    text-align: left !important;
    padding: 0.75rem 1rem !important;
    gap: 0.875rem !important;
    width: 100% !important;
  }

  .sidebar .nav-link span,
  .sidebar.collapsed .nav-link span {
    display: inline !important;
    text-align: left !important;
  }

  .sidebar .nav-link i,
  .sidebar.collapsed .nav-link i {
    font-size: 1.35rem !important;
    margin: 0 !important;
    flex-shrink: 0 !important;
  }

  /* Footer Buttons (Left-aligned / Rata Kiri) */
  .sidebar .sidebar-footer,
  .sidebar.collapsed .sidebar-footer {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.5rem !important;
  }

  .sidebar .theme-toggle-btn,
  .sidebar.collapsed .theme-toggle-btn,
  .sidebar .btn-logout,
  .sidebar.collapsed .btn-logout {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    text-align: left !important;
    padding: 0.75rem 1rem !important;
    gap: 0.875rem !important;
    width: 100% !important;
  }

  .sidebar .theme-toggle-btn span,
  .sidebar.collapsed .theme-toggle-btn span,
  .sidebar .btn-logout span,
  .sidebar.collapsed .btn-logout span {
    display: inline !important;
  }

  .main-area {
    margin-left: 0 !important;
    width: 100%;
  }

  .sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 999;
  }

  .sidebar-overlay.active {
    display: block;
  }

  .mobile-menu-btn {
    display: flex !important;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: var(--text);
    cursor: pointer;
    padding: 0.25rem;
  }

  .topbar {
    padding: 0 1rem;
  }

  .topbar-search {
    display: none;
  }

  .content-area {
    padding: 1.25rem 1rem;
  }

  /* Mobile Modal & Popup Responsiveness */
  .modal-overlay {
    padding: 0.5rem !important;
    align-items: center !important;
  }

  .modal-box {
    padding: 1.25rem 1rem !important;
    width: 100% !important;
    max-width: 100% !important;
    max-height: calc(100dvh - 1rem) !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    box-sizing: border-box !important;
    border-radius: var(--radius-lg) !important;
  }

  .modal-box.modal-lg {
    width: 100% !important;
    max-width: 100% !important;
  }

  .modal-header {
    margin-bottom: 1rem !important;
    padding-bottom: 0.5rem !important;
  }

  .modal-header h2 {
    font-size: 1.15rem !important;
    line-height: 1.3 !important;
  }

  .modal-actions {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    gap: 0.5rem !important;
    margin-top: 1.25rem !important;
    padding-top: 0.75rem !important;
  }

  .modal-actions button,
  .modal-actions .btn {
    width: 100% !important;
    justify-content: center !important;
    padding: 0.75rem 1rem !important;
    font-size: 0.9rem !important;
  }

  /* Form Grids on Mobile */
  .form-2col,
  .form-row-2col,
  .preview-grid-2col {
    grid-template-columns: 1fr !important;
    gap: 0.75rem !important;
  }

  .preview-tiles-grid {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.5rem !important;
  }

  .stage-selector-list {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.4rem !important;
  }

  .stage-pill-option {
    padding: 0.5rem 0.6rem !important;
    font-size: 0.75rem !important;
    min-width: 0 !important;
  }

  .stage-pill-option span {
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  .form-group input,
  .form-group select,
  .form-group textarea {
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  .preview-info-tile {
    padding: 0.65rem 0.75rem !important;
  }

  .preview-info-tile .tile-label {
    font-size: 0.65rem !important;
  }

  .preview-info-tile .tile-value {
    font-size: 0.85rem !important;
    word-break: break-word !important;
  }

  .preview-text-block {
    padding: 0.85rem !important;
    margin-bottom: 0.75rem !important;
  }
}

/* ================= MDI SPIN ANIMATION (FOR BUTTON LOADERS) ================= */
@keyframes mdi-spin-animation {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
.mdi-spin {
  animation: mdi-spin-animation 0.85s linear infinite;
  display: inline-block;
  line-height: 1;
}

/* Button size helper */
.btn-sm {
  padding: 0.45rem 0.85rem;
  font-size: 0.8rem;
  gap: 0.35rem;
}