:root {
  --bg: #f0f4ff;
  --white: #ffffff;
  --accent: #2d70ff;
  --accent-dark: #264fd4;
  --accent-light: #dbeafe;
  --text: #0d1321;
  --sub: #5a6782;
  --muted: #9ba8bf;
  --border: #dde3f3;
  --urgent-red: #ef4444;
  --radius: 18px;
  --radius-sm: 12px;
  --card-shadow: 0 4px 20px -6px rgba(37, 99, 235, 0.12);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html,
body {
  overflow-x: hidden;
}

body {
  font-family: "Plus Jakarta Sans", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ================== HEADER ================== */
header {
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 0 20px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-family: "Syne", sans-serif;
  font-weight: 800;
  font-size: 1.3rem;
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
}

.header-search-wrap {
  flex: 1;
  max-width: 420px;
  margin: 0 20px;
  position: relative;
}

.header-search-input {
  width: 100%;
  padding: 10px 12px 10px 44px;
  border: 1.5px solid var(--border);
  border-radius: 9999px;
  font-size: 0.95rem;
  background: var(--white);
  outline: none;
  transition: all 0.2s;
}

.header-search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(45, 112, 255, 0.15);
}

.header-search-wrap svg {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.header-date {
  color: var(--sub);
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
}

/* ================== HEADER MOBILE - STREAK TENGAH, SEARCH KANAN KECIL ================== */
@media (max-width: 640px) {
  header {
    padding: 20px 20px;
    height: auto;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
  }

  .logo {
    order: 1;
    font-size: 1.15rem;
    gap: 7px;
  }

  .header-search-wrap {
    order: 2;
    flex: 1;
    max-width: 100%;
    margin: 0;
  }

  .header-search-input::placeholder {
    content: "Search Jobs...";
  }

  .header-right {
    order: 3;
    margin-left: auto;
    padding-right: 10px;
  }

  .header-search-input {
    height: 46px;
    padding: 8px 12px 8px 38px;
    font-size: 0.85rem;
    border-radius: 999px;
  }

  .header-search-wrap svg {
    width: 15px;
    height: 15px;
    left: 12px;
  }

  .header-date {
    display: none !important;
  }

  .streak-container {
    padding: 6px 12px;
    font-size: 0.85rem;
  }

  .streak-fire {
    font-size: 1.1rem;
  }
  .chart-card h3 {
    margin-bottom: 14px;
    font-size: 1.05rem;
  }

  .field input[type="date"] {
    -webkit-appearance: none;
    appearance: none;
    height: 36px;
    padding: 6px 10px;
    font-size: 14px;
    line-height: 1;
    display: flex;
    align-items: center;
  }
}

/* Untuk HP sangat kecil */
@media (max-width: 380px) {
  .header-search-wrap {
    max-width: 170px;
  }
}

/* ================== STREAK ================== */
.streak-container {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  padding: 6px 14px;
  border-radius: 9999px;
  border: 2px solid #ff9500;
  font-weight: 700;
  font-size: 0.95rem;
  color: #ff9500;
  box-shadow: 0 2px 8px rgba(255, 149, 0, 0.15);
}

.streak-fire {
  font-size: 1.35rem;
  animation: fire 1.5s infinite alternate;
}

@keyframes fire {
  from {
    transform: scale(1);
  }
  to {
    transform: scale(1.15);
  }
}

/* ================== HERO ================== */
.hero {
  max-width: 1320px;
  margin: 0 auto;
  padding: 32px 20px 0;
}

.hero h1 {
  font-family: "Syne", sans-serif;
  font-size: clamp(1.7rem, 4.5vw, 2.7rem);
  font-weight: 800;
  letter-spacing: -1.5px;
  color: var(--text);
}

.hero-sub {
  color: var(--sub);
  margin-top: 6px;
  font-size: 0.97rem;
}

/* ================== MAIN ================== */
.main {
  max-width: 1320px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

/* Progress Card */
.progress-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px 24px;
  border: 1px solid var(--border);
  box-shadow: var(--card-shadow);
  margin-bottom: 24px;
}

.progress-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-size: 1.1rem !important;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.3px;
}

.progress-bar-track {
  height: 11px;
  background: #e8edff;
  border-radius: 99px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #6b85f7);
  border-radius: 99px;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-footer {
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
  font-size: 0.88rem;
  font-weight: 500;
}

/* Charts */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.chart-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 24px;
  border: 1px solid var(--border);
  box-shadow: var(--card-shadow);
}

.chart-container {
  position: relative;
  height: 260px;
}

.chart-card.funnel-card .chart-container {
  height: 320px;
}

/* Stats Row */
.stats-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  align-items: center;
}

.stat-chip {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: 99px;
  padding: 8px 16px;
  font-size: 0.875rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.stat-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-2px);
}

.stat-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.chip-count {
  font-weight: 800;
  font-size: 1rem;
  min-width: 22px;
  text-align: center;
}

.clear-filter-btn {
  background: var(--white);
  border: 1.5px solid var(--border);
  color: var(--sub);
  padding: 8px 16px;
  border-radius: 99px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

/* Delete Bar */
.del-bar {
  background: #fff5f5;
  border: 1px solid #fecaca;
  border-radius: var(--radius);
  padding: 12px 20px;
  margin-bottom: 20px;
  display: none;
  align-items: center;
  gap: 12px;
}

.del-bar.show {
  display: flex;
}

.del-info {
  font-weight: 700;
  color: #ef4444;
  font-size: 0.95rem;
  flex: 1;
}

.del-btn {
  background: #ef4444;
  color: #fff;
  border: none;
  padding: 9px 22px;
  border-radius: 99px;
  font-weight: 700;
  cursor: pointer;
}

.cancel-sel {
  background: none;
  border: 1.5px solid var(--border);
  color: var(--sub);
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 99px;
  cursor: pointer;
}

/* Toolbar */
.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.search-wrap {
  flex: 1;
  min-width: 260px;
  position: relative;
}

.search-wrap svg {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 12px 16px 12px 46px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  background: var(--white);
  outline: none;
}

.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59, 95, 240, 0.12);
}

.sort-select {
  padding: 12px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  background: var(--white);
  outline: none;
  cursor: pointer;
}

.add-btn {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: #fff;
  border: none;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
}

.export-btn {
  background: var(--white);
  color: var(--accent);
  border: 1.5px solid var(--accent-light);
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.export-btn:hover {
  background: var(--accent-light);
  transform: translateY(-1px);
}

/* Grid & Card */
.grid-wrap {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 18px;
}

/* Card (consolidated: was redefined 3x, this reflects the final cascaded look) */
.card {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: 20px;
  padding: 20px;
  box-shadow: var(--card-shadow);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  cursor: pointer;
}

.card:hover {
  transform: translateY(-6px);
  box-shadow: 0 20px 50px -10px rgba(45, 112, 255, 0.18);
  border-color: #c5d0ff;
}

.card.urgent::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 5px;
  height: 100%;
  background: var(--urgent-red);
  border-radius: 18px 0 0 18px;
}

.card.urgent {
  background: linear-gradient(160deg, #fff8f8 0%, #fff 50%);
}

.card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59, 95, 240, 0.14);
  background: #f5f7ff;
}

.card-top {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding-right: 30px; /* keep clear of the selection checkbox */
}

.card > input[type="checkbox"] {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--accent);
}

.co-logo {
  width: 50px;
  height: 50px;
  background: var(--accent-light);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
  padding: 6px;
}

.co-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.card-identity {
  flex: 1;
  min-width: 0;
}

.card-company {
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: var(--muted);
  text-transform: uppercase;
}

.card-title {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text);
  margin-top: 2px;
}

.card-field-tag {
  display: inline-block;
  margin-top: 8px;
  padding: 3px 10px;
  background: #eef2ff;
  color: #4f46e5;
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: 9999px;
  letter-spacing: 0.3px;
}

.edit-btn {
  width: 34px;
  height: 34px;
  border: 1.5px solid var(--border);
  background: var(--white);
  border-radius: 10px;
  font-size: 1rem;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Badges row: status pill + (optional) follow-up badge + mark-as-applied action.
   Left-aligned with a natural gap instead of space-between, so items stay
   close together instead of splitting to opposite edges of the card. */
.card-badges {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.status-pill {
  padding: 6px 14px;
  border-radius: 9999px;
  font-size: 0.82rem;
  font-weight: 700;
  flex-shrink: 0;
}

.applied-badge {
  background: #ecfdf5;
  color: #059669;
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 0.78rem;
  font-weight: 600;
}

.followup-badge {
  background: #fef3c7;
  color: #b45309;
  padding: 5px 12px;
  border-radius: 9999px;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
  border: 1px solid #fde68a;
}

/* Mark as Applied button: pushed to the end of the row via margin-left:auto,
   but no longer fighting a parent space-between rule, so the gap to the
   status pill scales naturally instead of stretching edge-to-edge. */
.mark-applied-btn {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
  border: none;
  padding: 7px 16px;
  border-radius: 9999px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.25);
  transition: all 0.2s ease;
}

.mark-applied-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
}

@media (max-width: 480px) {
  .card-badges {
    /* On very small cards, let the action button take its own row so it
       doesn't get squeezed next to the pill. */
    row-gap: 10px;
  }
  .mark-applied-btn {
    width: 100%;
    justify-content: center;
    margin-left: 0;
    padding: 9px 14px;
    font-size: 0.85rem;
  }
}

/* Meta (location + deadline): left-aligned with consistent gap instead of
   space-between, so a short "No deadline" label doesn't get stranded far
   away from the location on the right edge. */
.card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  font-size: 0.88rem;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--sub);
  font-size: 0.87rem;
}

.meta-icon {
  font-size: 1.05rem;
}

.deadline-text {
  font-weight: 500;
}

.urgent-text {
  color: #ef4444;
  font-weight: 700;
}

.meta-item.urgent-dl {
  color: var(--urgent-red);
  font-weight: 700;
}

.urgent-dl .deadline-text {
  color: #ef4444;
  font-weight: 600;
}

.card-salary {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.88rem;
  font-weight: 700;
  color: #059669;
  background: #ecfdf5;
  padding: 8px 12px;
  border-radius: 10px;
}

/* Notes */
.notes-box {
  font-size: 0.85rem;
  background: #fffbeb;
  color: #92400e;
  padding: 10px 14px;
  border-radius: 12px;
  border-left: 4px solid #fbbf24;
}

/* Tracking Button (consolidated) */
.tracking-btn {
  background: #f0f4ff;
  color: var(--accent);
  border: none;
  padding: 12px 16px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s;
  width: 100%;
}

.tracking-btn:hover {
  background: #dbeafe;
  transform: translateY(-1px);
}

/* ================== MODALS ================== */
.overlay,
.event-overlay,
.tracking-overlay {
  position: fixed;
  inset: 0;
  background: rgba(13, 19, 33, 0.75);
  backdrop-filter: blur(8px);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.overlay.open,
.event-overlay.open,
.tracking-overlay.open {
  display: flex;
}

/* Modal (consolidated: final width/height rules from the last override) */
.modal {
  background: var(--white);
  border-radius: var(--radius);
  width: 92vw;
  max-width: 920px;
  max-height: 90vh;
  padding: 32px 28px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.18);
  overflow-y: auto;
}

.modal-title {
  font-family: "Syne", sans-serif;
  font-size: 1.45rem;
  font-weight: 800;
  margin-bottom: 24px;
  color: var(--text);
  display: flex;
  align-items: center;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 24px;
}

.field.full {
  grid-column: 1 / -1;
}

.field label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--sub);
  display: block;
  margin-bottom: 5px;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 11px 13px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  outline: none;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59, 95, 240, 0.08);
}

.field textarea {
  min-height: 72px;
  resize: vertical;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 24px;
}

.btn-cancel {
  padding: 11px 22px;
  border: 1.5px solid var(--border);
  background: #fff;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s ease;
}

.btn-save {
  padding: 11px 28px;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark)) !important;
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 700;
  transition: all 0.2s ease;
}

/* Tracking Modal */
.tracking-modal {
  background: var(--white);
  border-radius: var(--radius);
  width: 100%;
  max-width: 620px;
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: 0 25px 70px rgba(0, 0, 0, 0.22);
  display: flex;
  flex-direction: column;
}

.tracking-header {
  padding: 24px 28px 16px 28px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.tracking-job-info {
  flex: 1;
  min-width: 0;
}

.tracking-company {
  font-weight: 800;
  font-size: 1.35rem;
  line-height: 1.3;
  color: var(--text);
}

.tracking-title {
  color: var(--sub);
  font-size: 0.98rem;
  margin-top: 4px;
  font-weight: 500;
}

.tracking-close-btn {
  width: 36px;
  height: 36px;
  font-size: 1.6rem;
  background: #f8fafc;
  border: 1.5px solid var(--border);
  color: var(--muted);
  cursor: pointer;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.tracking-close-btn:hover {
  background: #fee2e2;
  color: #ef4444;
  border-color: #fecaca;
}

.tracking-body {
  padding: 20px 28px 28px;
  flex: 1;
  overflow-y: auto;
}

.last-updated {
  color: var(--sub);
  font-size: 0.9rem;
  margin-bottom: 24px;
  font-weight: 500;
}

.pipeline-section {
  margin-bottom: 28px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.add-event-btn {
  padding: 8px 18px;
  font-size: 0.87rem;
  background: var(--accent-light);
  color: var(--accent);
  border: none;
  border-radius: 9999px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.add-event-btn:hover {
  background: #d4dcfb;
  transform: translateY(-1px);
}

/* ==================================================================
   PIPELINE (Pipeline Progress)
   ------------------------------------------------------------------
   Each node now shows a single emoji icon (from STAGES) instead of
   the full text label, so a small fixed circle fits cleanly. The
   label is still available on hover via the title attribute.
   ================================================================== */
.pipeline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 6px;
  padding: 12px 0;
}

.pipe-step {
  display: flex;
  align-items: center;
  gap: 6px;
}

.pipe-node {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  line-height: 1;
  border: 3px solid var(--border);
  background: var(--bg);
  color: var(--muted);
  flex-shrink: 0;
  cursor: default;
}

.pipe-node.done {
  background: #ecfdf5;
  border-color: #6ee7b7;
  color: #059669;
}

.pipe-node.current {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 0 0 3px rgba(59, 95, 240, 0.15);
}

.pipe-node.failed {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #ef4444;
}

.pipe-connector {
  width: 22px;
  height: 3px;
  background: var(--border);
  flex-shrink: 0;
  border-radius: 999px;
}

.pipe-connector.done {
  background: #6ee7b7;
}

@media (max-width: 480px) {
  .pipe-node {
    width: 38px;
    height: 38px;
    font-size: 1rem;
  }
  .pipe-connector {
    width: 16px;
  }
}

.timeline-section {
  flex: 1;
}

.timeline {
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: relative;
  padding-left: 28px;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 11px;
  top: 6px;
  bottom: 6px;
  width: 3px;
  background: linear-gradient(to bottom, var(--border), var(--accent-light));
  border-radius: 999px;
}

.tl-item {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  position: relative;
}

.tl-dot-col {
  flex-shrink: 0;
  z-index: 2;
}

.tl-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  border: 3px solid var(--white);
  box-shadow: 0 0 0 3px rgba(59, 95, 240, 0.2);
}

.tl-body {
  flex: 1;
  background: #f8fafd;
  padding: 14px 18px;
  border-radius: 14px;
  border: 1px solid var(--border);
}

.tl-stage {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.tl-meta {
  font-size: 0.83rem;
  color: var(--muted);
  margin-top: 3px;
}

.tl-note {
  margin-top: 10px;
  font-size: 0.87rem;
  color: #475569;
  font-style: italic;
  line-height: 1.4;
}

/* Event modal (consolidated) */
.event-modal {
  background: #ffffff;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  max-width: 640px;
  width: 92vw;
  max-height: 90vh;
  overflow-y: auto;
  padding: 32px;
}

/* Stage grid (consolidated) */
.stage-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 14px;
  margin-top: 4px;
}

/* Stage button (consolidated) */
.stage-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 8px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: #fff;
  font-size: 0.82rem;
  font-weight: 600;
  color: #374151;
  text-align: center;
  cursor: pointer;
  transition: 0.15s;
}

.stage-btn:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.stage-btn.sel {
  background: #eef2ff;
  border-color: #3b5ff0;
  color: #3b5ff0;
}

.stage-btn.fail {
  border-color: #e5e7eb;
  color: #6b7280;
}

.stage-btn.fail.sel {
  background: #fef2f2;
  border-color: #ef4444;
  color: #ef4444;
}

.stage-icon {
  font-size: 0.85em;
  opacity: 0.55;
}

.stage-btn.sel .stage-icon {
  opacity: 1;
}

/* Mobile Form Fix */
@media (max-width: 640px) {
  * {
    max-width: 100%;
  }
  .grid-wrap {
    grid-template-columns: 1fr;
  }
  .chart-container {
    width: 100%;
    overflow: hidden;
  }
  .modal {
    height: 94vh;
    max-height: 94vh;
    border-radius: 20px 20px 0 0;
    padding: 24px 20px 20px;
    margin: 0;
    width: 100%;
  }

  .form-grid {
    grid-template-columns: 1fr !important;
    gap: 18px;
  }

  .field input,
  .field select,
  .field textarea {
    font-size: 16px !important;
    padding: 14px 16px;
  }

  .field textarea {
    min-height: 100px;
  }

  .modal-actions {
    flex-direction: column;
    gap: 12px;
    margin-top: 32px;
    padding-bottom: env(safe-area-inset-bottom, 20px);
  }

  .btn-cancel,
  .btn-save {
    width: 100%;
    padding: 16px 20px;
    font-size: 1rem;
    font-weight: 700;
    border-radius: 14px;
  }

  .btn-cancel {
    order: 2;
  }
  .btn-save {
    order: 1;
  }
  .toolbar {
    overflow-x: hidden;
  }

  .export-btn {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 640px) {
  .charts-grid {
    grid-template-columns: 1fr;
  }
  .chart-container {
    width: 100%;
    overflow: hidden;
  }

  .chart-container canvas {
    max-width: 100% !important;
  }
}

/* Pagination Wrapper */
#pagination {
  margin-top: 24px;
  display: flex;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
}

.page-btn {
  min-width: 36px;
  height: 36px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: var(--white);
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--sub);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.18s ease;
}

.page-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}

.page-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 4px 12px rgba(45, 112, 255, 0.25);
}

.page-btn.disabled {
  opacity: 0.4;
  pointer-events: none;
}

/* ================== EXPIRED JOBS ================== */
.card.expired {
  opacity: 0.85;
  background: linear-gradient(160deg, #f8f9fc 0%, #f1f3f9 100%);
  border-color: #cbd5e1;
}

.card.expired .card-title,
.card.expired .card-company {
  color: #64748b;
}

.expired-badge {
  background: #f1f5f9;
  color: #64748b;
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 0.78rem;
  font-weight: 700;
  border: 1px solid #e2e8f0;
}

.meta-item.expired-dl {
  color: #64748b;
  font-weight: 500;
}

.meta-item.expired-dl span:last-child {
  text-decoration: line-through;
}

/* ================== STATUS ROW ================== */
.status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.status-row .status-pill {
  flex-shrink: 0;
}

.card-actions {
  margin-top: 6px;
}

/* ================== JOB DETAIL MODAL ================== */
.detail-overlay {
  position: fixed;
  inset: 0;
  background: rgba(13, 19, 33, 0.75);
  backdrop-filter: blur(8px);
  z-index: 300;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

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

.detail-modal {
  background: var(--white);
  border-radius: 20px;
  width: 100%;
  max-width: 520px;
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: 0 25px 70px rgba(0, 0, 0, 0.25);
}

.detail-header {
  padding: 24px 28px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
}

.detail-logo {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: var(--accent-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  flex-shrink: 0;
}

.detail-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 16px;
}

.detail-company {
  font-weight: 800;
  font-size: 1.35rem;
  color: var(--text);
}

.detail-title {
  color: var(--sub);
  font-size: 1rem;
  margin-top: 4px;
}

.detail-close-btn {
  margin-left: auto;
  width: 40px;
  height: 40px;
  border: none;
  background: #f8fafc;
  border-radius: 12px;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--muted);
}

.detail-body {
  padding: 24px 28px;
}

.detail-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.detail-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.detail-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--sub);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.detail-value {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.notes-section {
  margin: 20px 0;
}

.notes-title {
  font-weight: 700;
  color: var(--text);
  margin-bottom: 10px;
  font-size: 1.05rem;
}

.notes-content {
  background: #f8fafd;
  padding: 16px 18px;
  border-radius: 14px;
  border: 1px solid var(--border);
  white-space: pre-wrap;
  line-height: 1.6;
  font-size: 0.95rem;
  color: #334155;
  min-height: 80px;
}

.notes-content ul,
.notes-content ol {
  padding-left: 22px;
}

.tracking-btn-full {
  width: 100%;
  padding: 14px;
  background: var(--accent-light);
  color: var(--accent);
  border: none;
  border-radius: 14px;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
}

.detail-divider {
  height: 1px;
  background: var(--border);
  margin: 20px 0;
}

.urgent-badge {
  background: #ef4444;
  color: white;
  font-weight: 700;
  font-size: 0.82rem;
  padding: 2px 9px;
  border-radius: 9999px;
  margin-left: 6px;
  display: inline-block;
}

@media (max-width: 640px) {
  body {
    font-size: 16px;
  }

  .card-title {
    font-size: 1.07rem;
  }

  .card-company {
    font-size: 0.8rem;
  }

  .status-pill,
  .meta-item,
  .detail-label {
    font-size: 0.88rem;
  }

  .field label {
    font-size: 0.85rem;
  }
}

/* ============================================= */
/*               IPAD SPECIFIC FIXES             */
/* ============================================= */

@media only screen and (min-device-width: 768px) and (max-device-width: 1366px) and (-webkit-min-device-pixel-ratio: 2) {
  html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }

  body {
    font-size: 17px;
  }

  .card-title {
    font-size: 1.15rem;
  }

  .card-company,
  .status-pill,
  .meta-item,
  .detail-label {
    font-size: 0.95rem;
  }

  .hero h1 {
    font-size: 2.8rem;
  }

  .modal-title {
    font-size: 1.6rem;
  }

  .grid-wrap {
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 22px;
  }

  .chart-container {
    height: 300px;
  }

  .modal,
  .detail-modal,
  .tracking-modal {
    max-width: 580px;
    border-radius: 24px;
  }

  .form-grid {
    grid-template-columns: 1fr 1fr;
    gap: 18px;
  }

  .chart-card h3 {
    margin-bottom: 24px !important;
    font-size: 1.1rem !important;
    font-weight: 700;
  }

  .chart-card {
    padding: 28px 24px !important;
  }

  .chart-container {
    margin-top: 8px;
    height: 320px !important;
  }

  .form-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 18px;
  }

  .field:has(#fAppliedDate),
  .field:has(#fDeadline) {
    grid-column: span 1 !important;
  }

  #fAppliedDate,
  #fDeadline {
    width: 100%;
    padding: 12px 14px;
    font-size: 17px;
    background: white !important;
    border: 1.5px solid var(--border);
    border-radius: 12px;
  }

  .field:has(#fAppliedDate) label,
  .field:has(#fDeadline) label {
    margin-bottom: 6px;
  }

  .modal-actions .btn-cancel,
  .modal-actions .btn-save {
    padding: 14px 28px !important;
    font-size: 1.05rem !important;
    font-weight: 700 !important;
    border-radius: 14px !important;
    min-height: 52px;
  }

  @media only screen and (min-device-width: 1024px) and (orientation: landscape) {
    .chart-card h3 {
      margin-bottom: 28px !important;
    }

    .chart-container {
      height: 340px !important;
    }

    .modal-actions .btn-cancel,
    .modal-actions .btn-save {
      font-size: 0.8rem !important;
      padding: 15px 32px !important;
    }
  }
}

/* Khusus Landscape iPad (lebih lebar) */
@media only screen and (min-device-width: 1024px) and (max-device-width: 1366px) and (orientation: landscape) and (-webkit-min-device-pixel-ratio: 2) {
  .main {
    padding: 32px 40px 80px;
  }

  .charts-grid {
    grid-template-columns: 1fr 1fr;
  }

  .grid-wrap {
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  }
}

/* iPad Mini / iPad biasa (lebih kecil) */
@media only screen and (min-device-width: 768px) and (max-device-width: 1024px) and (-webkit-min-device-pixel-ratio: 2) {
  .card-title {
    font-size: 1.1rem;
  }

  .hero h1 {
    font-size: 2.4rem;
  }

  input[type="text"],
  input[type="url"],
  input[type="date"],
  select,
  textarea {
    font-size: 17px;
  }
}

/* Umum - Pastikan date picker tidak aneh */
input[type="date"] {
  -webkit-appearance: none;
  appearance: none;
  background: white;
  color: var(--text);
}

input[type="date"]::-webkit-calendar-picker-indicator {
  opacity: 0.7;
  cursor: pointer;
}

/* ================== WELCOME MODAL ================== */
.welcome-overlay {
  position: fixed;
  inset: 0;
  background: rgba(13, 19, 33, 0.85);
  backdrop-filter: blur(12px);
  z-index: 500;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.welcome-overlay.show {
  display: flex;
}

.welcome-modal {
  background: white;
  border-radius: 28px;
  width: 100%;
  max-width: 450px;
  padding: 40px 40px;
  text-align: center;
  box-shadow: 0 25px 70px rgba(0, 0, 0, 0.25);
}

.welcome-emoji {
  font-size: 4.5rem;
  margin-bottom: 16px;
  animation: bounce 2s infinite;
}

@keyframes bounce {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-12px);
  }
}

.welcome-modal h2 {
  font-family: "Syne", sans-serif;
  font-size: 1.9rem;
  font-weight: 800;
  margin-bottom: 12px;
  color: var(--text);
}

.welcome-text {
  color: var(--sub);
  font-size: 1.02rem;
  line-height: 1.5;
  margin-bottom: 32px;
}

.welcome-stats {
  display: flex;
  gap: 20px;
  justify-content: center;
  margin-bottom: 32px;
}

.stat-item {
  text-align: center;
}

.stat-number {
  display: block;
  font-size: 2.1rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 600;
  margin-top: 4px;
}

.welcome-btn {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: white;
  border: none;
  padding: 16px 40px;
  font-size: 1.1rem;
  font-weight: 700;
  border-radius: 16px;
  cursor: pointer;
  width: 100%;
  transition: all 0.3s ease;
}

.welcome-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 15px 30px rgba(45, 112, 255, 0.3);
}

/* WELCOME LOGO PNG */
.welcome-logo {
  width: 90px;
  height: 90px;
  margin: 0 auto 20px auto;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.welcome-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

@media (max-width: 480px) {
  .welcome-logo {
    width: 80px;
    height: 80px;
    margin-bottom: 16px;
  }
}

/* PIN 6 KOTAK DI WELCOME MODAL (consolidated) */
.pin-section {
  margin-top: 24px;
  text-align: center;
}

.pin-label {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}

.pin-sub {
  color: var(--sub);
  font-size: 0.88rem;
  margin-bottom: 20px;
}

.pin-inputs {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 16px;
}

.pin-inputs input {
  width: 52px;
  height: 62px;
  text-align: center;
  font-size: 1.85rem;
  font-weight: 700;
  border: 2.5px solid var(--border);
  border-radius: 14px;
  background: #fff;
  outline: none;
  transition: all 0.25s ease;
}

.pin-inputs input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 5px rgba(45, 112, 255, 0.2);
  transform: scale(1.05);
}

.pin-inputs input::-webkit-outer-spin-button,
.pin-inputs input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.attempts {
  font-size: 0.92rem;
  color: #ef4444;
  margin-bottom: 20px;
  font-weight: 600;
}

.pin-verify-btn {
  width: 100%;
  padding: 16px 20px;
  font-size: 1.05rem;
  font-weight: 700;
  border-radius: 16px;
  background: linear-gradient(135deg, #2d70ff, #1e5be6);
}

/* ================== DETAIL LINKS ================== */
.detail-links-section {
  margin: 20px 0;
}

.detail-links {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.detail-link-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: #f8fafd;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  text-decoration: none;
  color: var(--text);
  transition: all 0.2s;
}

.detail-link-item:hover {
  background: #dbeafe;
  border-color: var(--accent);
  transform: translateY(-1px);
}

.detail-link-item span {
  flex: 1;
  font-size: 0.95rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.detail-link-item .link-icon {
  font-size: 1.2rem;
  color: var(--accent);
}

/* ================== NOTES RICH TEXT EDITOR (consolidated) ================== */
.notes-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 6px;
}

.notes-toolbar button,
.notes-toolbar select {
  padding: 4px 8px;
  font-size: 0.78rem;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  line-height: 1.2;
}

.notes-toolbar button:hover {
  background: #f3f4f6;
}

.notes-editor {
  min-height: 70px;
  max-height: 130px;
  overflow-y: auto;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  outline: none;
  font-size: 0.9rem;
}

.notes-editor:empty:before {
  content: attr(placeholder);
  color: var(--muted);
}

.notes-editor ul,
.notes-editor ol {
  padding-left: 22px;
  margin: 6px 0;
}

.pin-digit {
  width: 42px;
  height: 52px;
  text-align: center;
  font-size: 1.4rem;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  margin: 0 4px;
}

.pin-digit:focus {
  border-color: var(--accent, #3b5ff0);
  outline: none;
}

.stage-option {
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  text-align: center;
  cursor: pointer;
  transition: 0.15s;
}

.stage-option.selected {
  background: #f0f4ff;
  font-weight: 700;
}

.docs-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.doc-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: #f8fafd;
}

.doc-name {
  flex: 1;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.doc-size {
  font-size: 0.78rem;
  color: var(--muted);
}

.doc-del-btn {
  border: none;
  background: none;
  cursor: pointer;
  font-size: 0.95rem;
}

.btn-upload-doc {
  padding: 10px 16px;
  border: 1.5px dashed var(--accent);
  border-radius: 12px;
  background: #fff;
  color: var(--accent);
  font-weight: 600;
  cursor: pointer;
}

.doc-del-btn {
  border: none;
  background: none;
  cursor: pointer;
  color: #ef4444;
  font-size: 1rem;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.15s ease;
}

.doc-del-btn:hover {
  background: #fee2e2;
}