 :root {
  --bg: #f5f2ee;
  --panel: #ffffff;
  --text: #161616;
  --muted: #77716a;
  --line: #e4ddd5;
  --accent: #c94c4c;
  --accent-soft: #fff0f0;
  --dark: #171717;
  --shadow: 0 18px 50px rgba(25, 24, 23, 0.10);
}

* {
  box-sizing: border-box;
}
/* WAJIB: supaya pesan kosong tidak menutupi PDF ketika PDF aktif */
[hidden] {
  display: none !important;
}


html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Georgia, "Times New Roman", serif;
  color: var(--text);
  background: radial-gradient(circle at top right, #ffffff 0, var(--bg) 36%, #eee7df 100%);
}

.app {
  display: grid;
  grid-template-columns: 330px 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 26px 20px;
  background: rgba(255, 255, 255, 0.94);
  border-right: 1px solid var(--line);
  overflow-y: auto;
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.logo-text span {
  display: block;
  letter-spacing: 8px;
  font-size: 29px;
  line-height: 1;
}

.logo-text small {
  display: block;
  margin-top: 4px;
  letter-spacing: 7px;
  color: var(--accent);
  font-size: 12px;
  text-align: center;
}

.close-sidebar,
.menu-btn {
  display: none;
  border: 0;
  background: var(--dark);
  color: #fff;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 22px;
}

.sidebar-head {
  padding: 24px 0 16px;
}

.eyebrow {
  margin: 0 0 8px;
  letter-spacing: 2.2px;
  text-transform: uppercase;
  font-size: 11px;
  color: var(--accent);
  font-weight: 700;
}

h1,
h2 {
  margin: 0;
  line-height: 1.1;
}

h1 {
  font-size: 34px;
}

h2 {
  font-size: 28px;
}

.muted {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.search-wrap {
  position: sticky;
  top: -26px;
  padding: 0 0 16px;
  background: rgba(255, 255, 255, 0.96);
  z-index: 3;
}

.search-wrap input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 12px 16px;
  font: inherit;
  outline: none;
  background: #fff;
}

.search-wrap input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.sop-list {
  display: grid;
  gap: 9px;
}

.sop-item {
  width: 100%;
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 12px;
  align-items: center;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 18px;
  padding: 12px;
  cursor: pointer;
  text-align: left;
  color: var(--text);
  transition: 0.2s ease;
}

.sop-item:hover,
.sop-item.active {
  background: var(--dark);
  color: #fff;
  box-shadow: 0 12px 30px rgba(0,0,0,0.12);
}

.sop-num {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  font-size: 12px;
}

.sop-item.active .sop-num,
.sop-item:hover .sop-num {
  background: #fff;
  color: var(--dark);
}

.sop-name,
.sop-dept {
  display: block;
}

.sop-name {
  font-weight: 700;
  font-size: 14px;
  line-height: 1.25;
}

.sop-dept {
  margin-top: 3px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.3;
}

.sop-item.active .sop-dept,
.sop-item:hover .sop-dept {
  color: rgba(255,255,255,0.72);
}

.content {
  padding: 28px;
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  border-radius: 28px;
  padding: 20px 22px;
  margin-bottom: 22px;
}

.topbar-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 18px;
  border-radius: 999px;
  background: var(--dark);
  color: #fff;
  text-decoration: none;
  border: 1px solid var(--dark);
  font-size: 14px;
  font-weight: 700;
}

.btn.ghost {
  background: #fff;
  color: var(--dark);
}

.viewer-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 28px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.viewer-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.viewer-info > div {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}

.status {
  font-size: 12px;
  font-weight: 700;
  color: #0b7a35;
  background: #eaf8ef;
  padding: 8px 12px;
  border-radius: 999px;
}

.status.error {
  color: #a30f0f;
  background: #ffe9e9;
}

.pdf-frame-wrap {
  position: relative;
  min-height: calc(100vh - 170px);
  background: #ececec;
}

iframe {
  width: 100%;
  min-height: calc(100vh - 170px);
  border: 0;
  background: #fff;
}

.empty-state {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 28px;
  background: #fff;
}

.empty-state h3 {
  margin: 0 0 8px;
  font-size: 28px;
}

.empty-state p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

@media (max-width: 900px) {
  .app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(88vw, 340px);
    transform: translateX(-105%);
    transition: 0.25s ease;
    box-shadow: 20px 0 60px rgba(0,0,0,0.18);
  }

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

  .close-sidebar,
  .menu-btn {
    display: inline-grid;
    place-items: center;
  }

  .content {
    padding: 16px;
  }

  .topbar {
    align-items: flex-start;
    border-radius: 22px;
    flex-direction: column;
  }

  .topbar h2 {
    font-size: 23px;
  }

  .topbar-actions {
    width: 100%;
  }

  .btn {
    flex: 1;
  }

  .viewer-info {
    align-items: flex-start;
    flex-direction: column;
  }

  .pdf-frame-wrap,
  iframe {
    min-height: 72vh;
  }
}
