:root {
  --bg: #f8f9fa;
  --surface: #ffffff;
  --border: #e2e8f0;
  --text: #1a202c;
  --text-muted: #718096;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --open: #16a34a;
  --open-bg: #dcfce7;
  --closed: #dc2626;
  --closed-bg: #fee2e2;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}

/* ── Header ── */
.header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 16px;
  height: 60px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  flex-shrink: 0;
}

.brand-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  color: #fff;
  background: var(--accent);
  letter-spacing: 0.5px;
}

.brand-name {
  font-weight: 600;
  font-size: 16px;
}

.search-wrap {
  flex: 1;
  max-width: 400px;
  margin-left: auto;
  position: relative;
}

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

#search {
  width: 100%;
  padding: 8px 12px 8px 34px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  font-size: 13px;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}

#search:focus {
  border-color: var(--accent);
  background: #fff;
}

/* ── Main layout ── */
.main {
  max-width: 1200px;
  margin: 28px auto;
  padding: 0 24px 80px;
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 24px;
  align-items: start;
}

.content-area {
  min-width: 0;
}

/* ── Sidebar ── */
.sidebar {
  position: sticky;
  top: 76px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-height: calc(100vh - 96px - 56px);
  overflow-y: auto;
}

.sidebar-title {
  padding: 12px 16px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--surface);
}

.sidebar-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 16px;
  font-size: 13px;
  color: var(--text);
  text-decoration: none;
  border-left: 2px solid transparent;
  cursor: pointer;
  transition: background 0.1s, border-color 0.1s, color 0.1s;
}

.sidebar-item:hover {
  background: var(--bg);
  color: var(--accent);
}

.sidebar-item.active {
  border-left-color: var(--accent);
  color: var(--accent);
  background: var(--bg);
  font-weight: 500;
}

.sidebar-item-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-badge {
  font-size: 11px;
  font-weight: 500;
  padding: 1px 7px;
  border-radius: 20px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-muted);
  flex-shrink: 0;
}

/* ── Stats bar ── */
.stats-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  font-size: 13px;
  color: var(--text-muted);
  align-items: center;
  flex-wrap: wrap;
}

.stats-bar strong {
  color: var(--text);
}

.dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--border);
}

/* ── Category block ── */
.category {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
  overflow: hidden;
}

.category-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  cursor: pointer;
  user-select: none;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}

.category-header:hover {
  background: var(--bg);
}

.category-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.3px;
}

.category-badge {
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 20px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.chevron {
  transition: transform 0.2s;
  color: var(--text-muted);
  flex-shrink: 0;
}

.chevron.open {
  transform: rotate(180deg);
}

/* ── Table ── */
.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead th {
  text-align: left;
  padding: 9px 14px;
  font-weight: 500;
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  white-space: nowrap;
}

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}

tbody tr:last-child {
  border-bottom: none;
}

tbody tr:hover {
  background: #f8faff;
}

tbody td {
  padding: 10px 14px;
  vertical-align: middle;
  white-space: nowrap;
}

.nama {
  font-weight: 500;
  color: var(--text);
}

.kode {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.keterangan {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
}

.nominal {
  color: var(--text-muted);
}

.harga {
  font-weight: 600;
  color: var(--text);
}

.jenis {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 20px;
}

.status-badge.open {
  color: var(--open);
  background: var(--open-bg);
}

.status-badge.closed {
  color: var(--closed);
  background: var(--closed-bg);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* ── State: Loading / Error / Empty ── */
.state-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 24px;
  color: var(--text-muted);
  gap: 12px;
}

.state-wrap svg {
  opacity: 0.4;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

.state-wrap p {
  font-size: 14px;
}

.retry-btn {
  margin-top: 4px;
  padding: 7px 18px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s;
}

.retry-btn:hover {
  background: var(--accent-hover);
}

/* ── No results ── */
.no-results {
  padding: 28px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

/* ── Landing page ── */
.landing {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 40px;
  padding: 40px 24px;
}

.landing-title {
  text-align: center;
}

.landing-title h1 {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}

.landing-title p {
  color: var(--text-muted);
  font-size: 15px;
}

.company-cards {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  justify-content: center;
}

.company-card {
  text-decoration: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  min-width: 200px;
  transition: box-shadow 0.15s, transform 0.15s, border-color 0.15s;
  box-shadow: var(--shadow);
}

.company-card:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
  border-color: var(--accent);
}

.company-card .card-icon {
  width: 64px;
  height: 64px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 1px;
}

.company-card .card-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.company-card .card-desc {
  font-size: 12px;
  color: var(--text-muted);
}

/* ── Company accent colors ── */
body.h2h {
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
}

body.mai {
  --accent: #16a34a;
  --accent-hover: #15803d;
}

/* ── Scroll to top ── */
.scroll-top {
  position: fixed;
  bottom: 72px;
  right: 28px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s, background 0.15s;
  z-index: 200;
}

.scroll-top.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.scroll-top:hover {
  background: var(--accent-hover);
}

/* ── Contact footer ── */
.contact-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 12px 24px;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 150;
  box-shadow: 0 -1px 6px rgba(0, 0, 0, 0.06);
}

.contact-footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.contact-footer-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  flex-shrink: 0;
}

.contact-list {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.contact-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.contact-item:hover {
  background: var(--surface);
  border-color: var(--accent);
}

/* ── Sidebar toggle (mobile only) ── */
.sidebar-toggle {
  display: none;
}

/* ── Responsive ── */
@media (max-width: 900px) {
  .main {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto 1fr;
  }

  .sidebar-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    cursor: pointer;
    text-align: left;
    box-shadow: var(--shadow);
    transition: background 0.15s;
    grid-column: 1;
    grid-row: 1;
  }

  .sidebar-toggle:hover {
    background: var(--bg);
  }

  .toggle-chevron {
    margin-left: auto;
    color: var(--text-muted);
    transition: transform 0.2s;
  }

  .sidebar-toggle[aria-expanded="true"] .toggle-chevron {
    transform: rotate(180deg);
  }

  .sidebar {
    display: none;
    position: static;
    max-height: none;
    grid-column: 1;
    grid-row: 2;
  }

  .sidebar.open {
    display: block;
  }

  .content-area {
    grid-column: 1;
    grid-row: 3;
  }
}

@media (max-width: 640px) {
  .header-inner { height: 56px; }
  .brand-name { font-size: 14px; }
  .main { padding: 0 16px 80px; margin: 20px auto; }
  .search-wrap { max-width: none; }
  .company-card { min-width: 160px; padding: 24px 28px; }

  thead th:nth-child(4),
  tbody td:nth-child(4) { display: none; }
}
