:root {
      --bg: #FFFFFF;
      --bg-subtle: #F8FAFC;
      --border: #E2E8F0;
      --border-focus: #94A3B8;
      --text-main: #0F172A;
      --text-muted: #64748B;
      --text-light: #94A3B8;
      --primary: #1E293B;
      --primary-hover: #0F172A;
      --accent: #2563EB;
      --danger: #EF4444;
      --success: #10B981;
      --radius: 8px;
    }

    * { box-sizing: border-box; margin: 0; padding: 0; }
    body {
      font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
      background-color: var(--bg);
      color: var(--text-main);
      line-height: 1.5;
      -webkit-font-smoothing: antialiased;
    }

    .container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

    /* Navbar */
    header {
      background: var(--bg);
      border-bottom: 1px solid var(--border);
      position: sticky;
      top: 0;
      z-index: 100;
    }

    .nav-wrap {
      display: flex;
      align-items: center;
      justify-content: space-between;
      height: 68px;
      gap: 20px;
    }

    .brand {
      display: flex;
      align-items: center;
      gap: 8px;
      text-decoration: none;
      color: var(--text-main);
      font-weight: 700;
      font-size: 20px;
      letter-spacing: -0.5px;
    }
    .brand span { color: var(--accent); }

    .search-bar {
      flex: 1;
      max-width: 440px;
      position: relative;
    }
    .search-bar input {
      width: 100%;
      padding: 10px 16px 10px 38px;
      border: 1px solid var(--border);
      border-radius: var(--radius);
      font-size: 14px;
      outline: none;
      background: var(--bg-subtle);
      transition: all 0.15s ease;
      font-family: inherit;
    }
    .search-bar input:focus {
      background: var(--bg);
      border-color: var(--border-focus);
    }
    .search-icon {
      position: absolute;
      left: 12px;
      top: 50%;
      transform: translateY(-50%);
      color: var(--text-light);
      pointer-events: none;
    }

    .nav-actions { display: flex; align-items: center; gap: 10px; }

    .btn {
      padding: 8px 16px;
      border-radius: var(--radius);
      font-size: 14px;
      font-weight: 600;
      text-decoration: none;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      gap: 6px;
      transition: all 0.15s ease;
      font-family: inherit;
      border: 1px solid transparent;
    }
    .btn-sm { padding: 6px 12px; font-size: 13px; }
    .btn-outline {
      border-color: var(--border);
      background: var(--bg);
      color: var(--text-main);
    }
    .btn-outline:hover { background: var(--bg-subtle); border-color: var(--border-focus); }
    .btn-primary { background: var(--primary); color: #FFF; }
    .btn-primary:hover { background: var(--primary-hover); }
    .btn-danger { background: #FEF2F2; color: var(--danger); border-color: #FECACA; }
    .btn-danger:hover { background: #FEE2E2; }
    .btn-success { background: #ECFDF5; color: var(--success); border-color: #A7F3D0; }
    .btn-success:hover { background: #D1FAE5; }

    /* User Profile Chip */
    .user-profile {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 4px 8px;
      border: 1px solid var(--border);
      border-radius: var(--radius);
      cursor: pointer;
      background: var(--bg);
    }
    .user-avatar { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }
    .user-name { font-size: 13px; font-weight: 600; color: var(--text-main); }

    /* Category Nav with Smooth Auto-Scroll & Manual Touch/Drag */
    .category-nav {
      border-bottom: 1px solid var(--border);
      background: linear-gradient(180deg, #FFFFFF 0%, #F8FAFC 100%);
      padding: 12px 0;
      position: relative;
      overflow: hidden;
    }
    .category-nav::before,
    .category-nav::after {
      content: "";
      position: absolute;
      top: 0;
      bottom: 0;
      width: 24px;
      z-index: 2;
      pointer-events: none;
    }
    .category-nav::before {
      left: 0;
      background: linear-gradient(90deg, var(--bg) 20%, rgba(255,255,255,0) 100%);
    }
    .category-nav::after {
      right: 0;
      background: linear-gradient(-90deg, var(--bg) 20%, rgba(255,255,255,0) 100%);
    }
    .cat-scroll-container {
      display: flex;
      overflow-x: auto;
      overflow-y: hidden;
      scroll-behavior: auto;
      -webkit-overflow-scrolling: touch;
      scrollbar-width: none;
      user-select: none;
      cursor: grab;
      position: relative;
      padding: 2px 20px;
    }
    .cat-scroll-container::-webkit-scrollbar {
      display: none;
    }
    .cat-scroll-container.is-dragging {
      cursor: grabbing;
      scroll-behavior: auto !important;
    }
    .cat-marquee-wrapper {
      display: flex;
      width: max-content;
      will-change: transform;
    }
    .cat-list {
      display: flex;
      align-items: center;
      gap: 10px;
      list-style: none;
      margin: 0;
      padding: 0 6px;
    }
    .cat-chip {
      padding: 7px 16px;
      border-radius: 24px;
      background: #FFFFFF;
      border: 1px solid var(--border);
      font-size: 13px;
      font-weight: 500;
      color: var(--text-main);
      white-space: nowrap;
      cursor: pointer;
      box-shadow: 0 1px 3px rgba(0,0,0,0.03);
      transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
      display: inline-flex;
      align-items: center;
      gap: 6px;
      user-select: none;
    }
    
    .cat-chip svg {
      flex-shrink: 0;
      color: #6366F1;
      transition: color 0.15s ease;
    }
    .cat-chip:hover svg, .cat-chip.active svg {
      color: currentColor;
    }
  
    .cat-chip:hover {
      background: #EEF2FF;
      color: var(--primary);
      border-color: #C7D2FE;
      transform: translateY(-2px);
      box-shadow: 0 4px 10px rgba(79, 70, 229, 0.12);
    }
    .cat-chip.active {
      background: var(--primary);
      color: #FFFFFF;
      border-color: var(--primary);
      font-weight: 600;
      box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
      transform: translateY(-1px);
    }

    /* Views Container (Tabs) */
    .view-panel { display: none; padding: 32px 0 60px; }
    .view-panel.active { display: block; }

    /* Hero / Headings */
    .view-header {
      display: flex;
      justify-content: space-between;
      align-items: flex-end;
      border-bottom: 1px solid var(--border);
      padding-bottom: 20px;
      margin-bottom: 24px;
    }
    .view-header h1 {
      font-size: 24px;
      font-weight: 700;
      letter-spacing: -0.5px;
      color: var(--text-main);
    }
    .view-header p {
      font-size: 14px;
      color: var(--text-muted);
      margin-top: 4px;
    }

    /* Grid Ads (Public) */
    .ads-grid {
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      gap: 20px;
    }
    @media (max-width: 992px) { .ads-grid { grid-template-columns: repeat(3, 1fr); } }
    @media (max-width: 768px) {
      .ads-grid { grid-template-columns: repeat(2, 1fr); gap: 14px; }
      .search-bar { display: none; }
      .view-header h1 { font-size: 20px; }
    }
    @media (max-width: 480px) { .ads-grid { grid-template-columns: 1fr; } }

    .ad-card {
      border: 1px solid var(--border);
      border-radius: var(--radius);
      background: var(--bg);
      overflow: hidden;
      display: flex;
      flex-direction: column;
      transition: transform 0.15s ease, box-shadow 0.15s ease;
    }
    .ad-card:hover {
      transform: translateY(-2px);
      box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05);
      border-color: var(--border-focus);
    }
    .ad-thumb {
      width: 100%;
      height: 180px;
      background: var(--bg-subtle);
      object-fit: cover;
      border-bottom: 1px solid var(--border);
    }
    .ad-body {
      padding: 14px;
      display: flex;
      flex-direction: column;
      flex: 1;
    }
    .ad-cat {
      font-size: 11px;
      text-transform: uppercase;
      font-weight: 700;
      color: var(--accent);
      letter-spacing: 0.5px;
      margin-bottom: 4px;
    }
    .ad-title {
      font-size: 15px;
      font-weight: 600;
      color: var(--text-main);
      line-height: 1.35;
      margin-bottom: 8px;
      display: -webkit-box;
      -webkit-line-clamp: 2;
      -webkit-box-orient: vertical;
      overflow: hidden;
    }
    .ad-price {
      font-size: 16px;
      font-weight: 700;
      color: var(--text-main);
      margin-top: auto;
      padding-top: 8px;
    }
    .ad-footer {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-top: 8px;
      font-size: 12px;
      color: var(--text-light);
      border-top: 1px solid var(--border);
      padding-top: 8px;
    }

    /* Form Card (Post Ad) */
    .form-card {
      max-width: 680px;
      margin: 0 auto;
      background: var(--bg);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      padding: 28px;
    }
    .form-group { margin-bottom: 20px; }
    .form-group label {
      display: block;
      font-size: 13px;
      font-weight: 600;
      color: var(--text-main);
      margin-bottom: 6px;
    }
    .form-control {
      width: 100%;
      padding: 10px 14px;
      border: 1px solid var(--border);
      border-radius: var(--radius);
      font-size: 14px;
      font-family: inherit;
      outline: none;
      background: var(--bg);
      transition: border-color 0.15s ease;
    }
    .form-control:focus { border-color: var(--border-focus); }
    textarea.form-control { min-height: 110px; resize: vertical; }

    /* Upload Box */
    .upload-zone {
      border: 2px dashed var(--border);
      border-radius: var(--radius);
      padding: 24px;
      text-align: center;
      cursor: pointer;
      background: var(--bg-subtle);
      transition: all 0.15s ease;
    }
    .upload-zone:hover { border-color: var(--border-focus); background: var(--bg); }
    .preview-grid {
      display: flex;
      gap: 10px;
      flex-wrap: wrap;
      margin-top: 12px;
    }
    .preview-item {
      position: relative;
      width: 80px;
      height: 80px;
      border-radius: 6px;
      overflow: hidden;
      border: 1px solid var(--border);
    }
    .preview-item img { width: 100%; height: 100%; object-fit: cover; }

    /* Table Clean (Dashboard Admin & User) */
    .table-wrap {
      overflow-x: auto;
      border: 1px solid var(--border);
      border-radius: var(--radius);
      background: var(--bg);
    }
    table {
      width: 100%;
      border-collapse: collapse;
      text-align: left;
      font-size: 14px;
    }
    th {
      background: var(--bg-subtle);
      padding: 12px 16px;
      font-size: 12px;
      font-weight: 600;
      color: var(--text-muted);
      border-bottom: 1px solid var(--border);
      text-transform: uppercase;
      letter-spacing: 0.5px;
    }
    td {
      padding: 14px 16px;
      border-bottom: 1px solid var(--border);
      color: var(--text-main);
      vertical-align: middle;
    }
    tr:last-child td { border-bottom: none; }

    /* Badges */
    .badge {
      display: inline-flex;
      align-items: center;
      padding: 3px 8px;
      border-radius: 12px;
      font-size: 12px;
      font-weight: 600;
    }
    .badge-pending { background: #FEF3C7; color: #92400E; }
    .badge-active { background: #DCFCE7; color: #166534; }
    .badge-rejected { background: #FEE2E2; color: #991B1B; }

    .badge-tier-free { background: #F1F5F9; color: #475569; border: 1px solid #E2E8F0; font-weight: 600; gap: 4px; }
    .badge-tier-silver { background: #F8FAFC; color: #334155; border: 1px solid #CBD5E1; font-weight: 700; gap: 4px; }
    .badge-tier-gold { background: #FFFBEB; color: #B45309; border: 1px solid #FCD34D; font-weight: 700; gap: 4px; }
    .badge-tier-platinum { background: #EFF6FF; color: #1D4ED8; border: 1px solid #BFDBFE; font-weight: 700; gap: 4px; }


    /* Modal Backdrop */
    .modal-backdrop {
      display: none;
      position: fixed;
      inset: 0;
      background: rgba(15, 23, 42, 0.4);
      backdrop-filter: blur(2px);
      align-items: center;
      justify-content: center;
      z-index: 200;
    }
    .modal-box {
      background: var(--bg);
      border-radius: 12px;
      border: 1px solid var(--border);
      padding: 32px 28px;
      width: 100%;
      max-width: 400px;
      text-align: center;
      box-shadow: 0 20px 40px rgba(15, 23, 42, 0.1);
    }
    .close-modal { float: right; cursor: pointer; font-size: 18px; color: var(--text-light); }

    /* Footer */
    footer {
      border-top: 1px solid var(--border);
      padding: 32px 0;
      background: var(--bg);
      color: var(--text-muted);
      font-size: 13px;
    }
    .footer-wrap {
      display: flex;
      justify-content: space-between;
      align-items: center;
    }
    .footer-links a {
      color: var(--text-muted);
      text-decoration: none;
      margin-left: 16px;
    }
    .footer-links a:hover { color: var(--text-main); }
  
    /* ─── Mobile First Enhancements ─── */
    input, select, textarea {
      font-size: 16px !important; /* Mencegah auto zoom pada iOS */
    }

    /* ─── Mobile Header Drawer Navigation ─── */
    .btn-hamburger {
      display: none;
      background: none;
      border: none;
      color: var(--text-main);
      padding: 6px;
      cursor: pointer;
      border-radius: 6px;
      align-items: center;
      justify-content: center;
    }
    .btn-hamburger:hover {
      background: var(--bg-subtle);
    }

    .drawer-overlay {
      display: none;
      position: fixed;
      inset: 0;
      background: rgba(15, 23, 42, 0.45);
      backdrop-filter: blur(3px);
      z-index: 1000;
      opacity: 0;
      transition: opacity 0.25s ease;
    }
    .drawer-overlay.active {
      display: block;
      opacity: 1;
    }

    .mobile-drawer {
      position: fixed;
      top: 0;
      right: -300px;
      width: 280px;
      height: 100%;
      background: #FFFFFF;
      z-index: 1001;
      box-shadow: -4px 0 24px rgba(15, 23, 42, 0.15);
      transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
      display: flex;
      flex-direction: column;
      padding: 20px;
      box-sizing: border-box;
    }
    .mobile-drawer.active {
      right: 0;
    }

    .drawer-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding-bottom: 16px;
      border-bottom: 1px solid var(--border);
      margin-bottom: 16px;
    }
    .drawer-close {
      background: none;
      border: none;
      font-size: 24px;
      line-height: 1;
      color: var(--text-light);
      cursor: pointer;
      padding: 4px;
    }

    .drawer-user-info {
      display: flex;
      align-items: center;
      gap: 12px;
      padding: 12px;
      background: var(--bg-subtle);
      border-radius: var(--radius);
      border: 1px solid var(--border);
      margin-bottom: 18px;
    }

    .drawer-nav-list {
      list-style: none;
      display: flex;
      flex-direction: column;
      gap: 6px;
      margin: 0;
      padding: 0;
      flex: 1;
      overflow-y: auto;
    }
    .drawer-nav-item {
      display: flex;
      align-items: center;
      gap: 12px;
      padding: 12px 14px;
      border-radius: 8px;
      font-size: 14px;
      font-weight: 600;
      color: var(--text-main);
      text-decoration: none;
      cursor: pointer;
      transition: background 0.15s ease;
      border: none;
      background: none;
      width: 100%;
      text-align: left;
    }
    .drawer-nav-item:hover, .drawer-nav-item:active {
      background: var(--bg-subtle);
      color: var(--accent);
    }
    .drawer-nav-item.highlight {
      background: var(--primary);
      color: #FFF;
      justify-content: center;
      margin-top: 8px;
    }
    .drawer-nav-item.highlight:hover {
      background: var(--primary-hover);
      color: #FFF;
    }

    @media (max-width: 768px) {
      .btn-hamburger {
        display: inline-flex;
      }
      .nav-actions {
        display: none !important;
      }
    }

    /* Bottom Navigation Bar (Khusus Mobile) */
    .mobile-bottom-nav {
      display: none;
      position: fixed;
      bottom: 0;
      left: 0;
      right: 0;
      height: 60px;
      background: #FFFFFF;
      border-top: 1px solid var(--border);
      z-index: 999;
      justify-content: space-around;
      align-items: center;
      padding-bottom: env(safe-area-inset-bottom);
      box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.04);
    }

    .mobile-nav-item {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      font-size: 10px;
      font-weight: 600;
      color: var(--text-muted);
      text-decoration: none;
      gap: 3px;
      background: none;
      border: none;
      cursor: pointer;
      font-family: inherit;
      padding: 6px;
      flex: 1;
    }

    .mobile-nav-item.active, .mobile-nav-item:active {
      color: var(--primary);
    }

    .mobile-nav-item svg {
      width: 20px;
      height: 20px;
    }

    .mobile-nav-item.highlight-post {
      color: #FFF;
      background: var(--primary);
      border-radius: 20px;
      padding: 6px 12px;
      margin: 0 4px;
      font-size: 11px;
    }

    @media (max-width: 768px) {
      body {
        padding-bottom: 70px; /* Ruang untuk bottom bar */
      }

      .mobile-bottom-nav {
        display: flex;
      }

      .nav-wrap {
        height: 58px;
      }

      .brand {
        font-size: 18px;
      }

      /* Sembunyikan tombol navigasi desktop yang redundant */
      .nav-actions .btn {
        padding: 6px 10px;
        font-size: 12px;
      }
      #btnPostAdDesktop {
        display: none;
      }
      #btnMyAdsDesktop {
        display: none;
      }

      /* Kategori scrollbar lebih halus di mobile */
      .category-nav {
        padding: 8px 0;
      }
      .cat-chip {
        padding: 5px 12px;
        font-size: 12px;
      }

      /* Card Grid Mobile: 2 kolom compact & rapi */
      .ads-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
      }

      .ad-thumb {
        height: 125px !important;
      }

      .ad-body {
        padding: 10px !important;
      }

      .ad-title {
        font-size: 13px !important;
        margin-bottom: 4px !important;
        line-height: 1.3 !important;
      }

      .ad-price {
        font-size: 14px !important;
        padding-top: 4px !important;
      }

      .ad-footer {
        font-size: 11px !important;
        margin-top: 6px !important;
        padding-top: 6px !important;
      }
      .ad-footer .btn {
        padding: 2px 6px !important;
        font-size: 10px !important;
      }

      /* Form Card Mobile */
      .form-card {
        padding: 16px !important;
        border-radius: 0;
        border-left: none;
        border-right: none;
      }

      .view-header h1 {
        font-size: 18px !important;
      }

      /* Table horizontal scroll hint */
      .table-wrap {
        border-radius: 0;
        border-left: none;
        border-right: none;
      }
      table {
        font-size: 12px !important;
      }
      th, td {
        padding: 10px 8px !important;
      }
    }

  
    .btn-bump {
      background: #EEF2FF;
      color: #4F46E5;
      border: 1px solid #C7D2FE;
      padding: 6px 12px;
      font-size: 12px;
      font-weight: 600;
      border-radius: 6px;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      gap: 4px;
      transition: all 0.2s ease;
    }
    .btn-bump:hover {
      background: #4F46E5;
      color: #FFFFFF;
    }
    .btn-bump:disabled {
      background: #F1F5F9;
      color: #94A3B8;
      border-color: #E2E8F0;
      cursor: not-allowed;
    }
    .badge-bump {
      background: #F0FDF4;
      color: #166534;
      border: 1px solid #BBF7D0;
      font-size: 11px;
      font-weight: 600;
      padding: 2px 6px;
      border-radius: 4px;
      display: inline-flex;
      align-items: center;
      gap: 3px;
    }
    .toggle-switch {
      position: relative;
      display: inline-block;
      width: 38px;
      height: 20px;
    }
    .toggle-switch input {
      opacity: 0;
      width: 0;
      height: 0;
    }
    .toggle-slider {
      position: absolute;
      cursor: pointer;
      top: 0; left: 0; right: 0; bottom: 0;
      background-color: #CBD5E1;
      transition: .3s;
      border-radius: 20px;
    }
    .toggle-slider:before {
      position: absolute;
      content: "";
      height: 14px;
      width: 14px;
      left: 3px;
      bottom: 3px;
      background-color: white;
      transition: .3s;
      border-radius: 50%;
    }
    input:checked + .toggle-slider {
      background-color: #4F46E5;
    }
    input:checked + .toggle-slider:before {
      transform: translateX(18px);
    }