:root {
  --bg: #f6f3ed;
  --surface: #ffffff;
  --surface-alt: #faf8f4;
  --border: #e4ded3;
  --text: #1f1b16;
  --text-secondary: #6b6359;
  --accent: #9a2b1c;
  --accent-soft: #fdf2f0;
  --green-bg: #eef7f1;
  --green-text: #1f5e3b;
  --amber-bg: #fef7e6;
  --amber-text: #8a5300;
  --red-bg: #fef2f2;
  --red-text: #991b1b;
  --radius: 10px;
  --serif: Georgia, "Times New Roman", serif;
  --sans: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Topbar */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 4px 24px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
}

.brand-logo {
  height: 120px;
  width: auto;
  display: block;
  object-fit: contain;
  margin: -16px 0;
}

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

.main-wrap {
  padding-top: 20px;
  padding-bottom: 44px;
}

/* Coffee Banner (Sidebar Sticky on Desktop, Always on Top on Mobile) */
.sidebar-col {
  display: block;
  align-self: stretch;
}

.coffee-banner {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}

.coffee-sidebar {
  position: sticky;
  top: 18px;
  z-index: 30;
}

.coffee-copy h2 {
  margin: 0 0 4px;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}

.coffee-copy p {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.4;
  color: var(--text-secondary);
}

.coffee-actions {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.coffee-qris {
  width: 84px;
  height: 84px;
  object-fit: contain;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #ffffff;
  cursor: pointer;
}

.btn-zoom-qris {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  border-radius: 6px;
  width: 28px;
  height: 28px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.btn-zoom-qris svg {
  width: 15px;
  height: 15px;
}

.btn-zoom-qris:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.modal-qris-content {
  max-width: 400px;
}

.modal-qris-body {
  padding: 20px;
  text-align: center;
}

.modal-qris-img {
  width: 100%;
  max-width: 300px;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  display: block;
  margin: 0 auto 12px;
}

.modal-qris-body p {
  margin: 0;
  font-size: 0.84rem;
  color: var(--text-secondary);
}

.section-rule {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 20px 0 22px;
}

/* Content 2 Columns */
.content-grid {
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

@media (max-width: 900px) {
  body {
    padding-top: 58px;
  }
  .content-grid {
    grid-template-columns: 1fr;
  }
  .sidebar-col {
    align-self: auto;
  }
  .coffee-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 80;
    border-radius: 0;
    border-top: 0;
    border-left: 0;
    border-right: 0;
    padding: 8px 14px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    gap: 10px;
  }
  .coffee-sidebar .coffee-copy h2 {
    font-size: 0.86rem;
    margin: 0 0 1px;
  }
  .coffee-sidebar .coffee-copy p {
    font-size: 0.75rem;
    line-height: 1.25;
  }
  .coffee-sidebar .coffee-actions {
    flex-direction: row;
    gap: 8px;
  }
  .coffee-sidebar .coffee-qris {
    width: 38px;
    height: 38px;
  }
  .coffee-sidebar .btn-zoom-qris {
    width: 30px;
    height: 30px;
    padding: 0;
  }
}

/* Left Filter Sidebar */
.filters-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 16px;
}

.filters-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.filters-head h2 {
  margin: 0;
  font-size: 0.96rem;
  font-weight: 700;
}

.link-reset {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
}

.link-reset:hover {
  text-decoration: underline;
}

.field {
  margin-bottom: 12px;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 5px;
}

.input-icon-wrap {
  position: relative;
}

.input-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: var(--text-secondary);
  pointer-events: none;
}

.input-icon-wrap input {
  padding-left: 32px;
}

input[type="text"],
input[type="number"],
select {
  width: 100%;
  padding: 8px 10px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.86rem;
}

input:focus,
select:focus {
  outline: 1.5px solid var(--accent);
  border-color: var(--accent);
}

.accordion-btn {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: none;
  border: none;
  border-top: 1px solid var(--border);
  padding: 12px 0 10px;
  margin-top: 4px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
}

.checks-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 8px 0 12px;
}

.check-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.83rem;
  font-weight: 400;
  color: var(--text);
  margin: 0;
  cursor: pointer;
}

.check-item input {
  accent-color: var(--accent);
  width: 15px;
  height: 15px;
}

/* Special SKD Box */
.skd-special-box {
  margin-top: 12px;
  padding: 11px 12px;
  border-radius: 8px;
  background: var(--accent-soft);
  border: 1px solid #ecc6bf;
}

.skd-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.skd-head label {
  margin: 0;
  color: var(--accent);
  font-weight: 700;
  font-size: 0.82rem;
}

.help-btn {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid var(--accent);
  background: var(--surface);
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.help-btn:hover {
  background: var(--accent);
  color: #ffffff;
}

.skd-tooltip {
  margin-bottom: 8px;
  padding: 7px 9px;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid #ecc6bf;
  color: var(--text);
  font-size: 0.78rem;
  line-height: 1.4;
}

/* Right Results Column */
.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.results-header h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
}

.sort-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sort-wrap label {
  margin: 0;
  white-space: nowrap;
}

.sort-wrap select {
  width: auto;
  min-width: 210px;
}

/* Unified 4-Column Stats Strip */
.stats-strip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 16px;
  overflow: hidden;
}

@media (max-width: 640px) {
  .stats-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.stat-cell {
  padding: 14px 18px;
  border-right: 1px solid var(--border);
}

.stat-cell:last-child {
  border-right: none;
}

.stat-num {
  display: block;
  font-family: var(--serif);
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}

.stat-num.stat-accent {
  color: var(--accent);
}

.stat-label {
  display: block;
  margin-top: 3px;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

/* Formation Cards */
.results-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
}

.card:hover {
  border-color: #cfc6b6;
}

.card-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
}

.card-left {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  min-width: 0;
  flex: 1;
}

.agency-logo {
  width: 38px;
  height: 38px;
  border-radius: 7px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.agency-logo svg {
  width: 20px;
  height: 20px;
  display: block;
}

.card-agency {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 2px;
}

.card-title {
  margin: 0;
  font-size: 1.04rem;
  font-weight: 700;
  color: var(--text);
}

.card-unit {
  margin: 3px 0 10px;
  font-size: 0.84rem;
  color: var(--text-secondary);
}

.card-right-quota {
  text-align: right;
  flex-shrink: 0;
}

.quota-num {
  display: block;
  font-family: var(--serif);
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.quota-label {
  display: block;
  font-size: 0.74rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 5px;
  font-size: 0.74rem;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--text-secondary);
}

.pill-green { background: var(--green-bg); color: var(--green-text); border-color: #cbe6d5; }
.pill-amber { background: var(--amber-bg); color: var(--amber-text); border-color: #f4dfae; }
.pill-red { background: var(--red-bg); color: var(--red-text); border-color: #f6c9c9; }
.pill-neutral { background: var(--surface-alt); color: var(--text-secondary); border-color: var(--border); }

.skd-bar {
  margin-top: 10px;
  padding: 7px 10px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.79rem;
  color: var(--text-secondary);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.card-actions {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
}

.majors-toggle {
  font-size: 0.81rem;
  color: var(--accent);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-weight: 600;
}

.majors-toggle.opt-toggle {
  color: var(--amber-text);
}

.majors-toggle:hover {
  text-decoration: underline;
}

.opt-box {
  margin-top: 8px;
  padding: 10px 12px;
  background: var(--surface-alt);
  border-radius: 7px;
  border: 1px solid #f4dfae;
  max-height: 230px;
  overflow-y: auto;
}

.opt-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem;
}

.opt-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.opt-unit-name {
  color: var(--text);
}

.opt-meta {
  color: var(--text-secondary);
  font-size: 0.75rem;
  white-space: nowrap;
}

.majors-box {
  margin-top: 8px;
  padding: 10px;
  background: var(--surface-alt);
  border-radius: 7px;
  border: 1px solid var(--border);
  font-size: 0.79rem;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.major-tag {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 4px;
}

.major-tag.highlight {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: #e6aba1;
  font-weight: 600;
}

.btn {
  padding: 7px 13px;
  border-radius: 7px;
  font-size: 0.83rem;
  font-weight: 600;
  cursor: pointer;
}

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

.btn-outline:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-outline:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 14px;
  margin-top: 18px;
}

.page-info {
  font-size: 0.84rem;
  color: var(--text-secondary);
}

.hidden {
  display: none !important;
}

.empty-state {
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 36px 20px;
  text-align: center;
  color: var(--text-secondary);
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(31, 27, 22, 0.45);
}

.modal-content {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 980px;
  width: 100%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}

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

.modal-header h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.15rem;
}

.modal-body {
  padding: 16px 18px;
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}

th, td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

th {
  color: var(--text-secondary);
  font-weight: 600;
  background: var(--surface-alt);
}

.footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 16px 0;
  color: var(--text-secondary);
  font-size: 0.78rem;
  text-align: center;
}
