:root {
  --bg: #F6F3EC;
  --surface: #FFFFFF;
  --ink: #1C2321;
  --muted: #5B6663;
  --border: #E7E2D4;
  --primary: #0B6E4F;
  --primary-dark: #0B3B2E;
  --sidebar-hover: #153F32;
  --sidebar-muted: #CFE0D6;
  --warn-bg: #FCE9D2;
  --warn-text: #8A4B12;
  --danger-bg: #F3E4E1;
  --danger-text: #B42318;
  --danger-border: #C4453B;
  --ok-bg: #DEEFE6;
  --pending-bg: #E7E2FB;
  --pending-text: #4B3FA3;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Public Sans', system-ui, sans-serif;
  font-size: 14px;
}

h1, h2, h3, .serif { font-family: 'Source Serif 4', Georgia, serif; }

a { color: inherit; }

button {
  font-family: inherit;
  cursor: pointer;
}

input, select, textarea {
  font-family: inherit;
  font-size: 14px;
}

.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 248px;
  flex-shrink: 0;
  background: var(--primary-dark);
  box-sizing: border-box;
  padding: 28px 20px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar .brand-title { color: #F6F3EC; font-size: 20px; font-weight: 600; }
.sidebar .brand-sub { color: #8FB5A6; font-size: 12px; }
.sidebar nav { display: flex; flex-direction: column; gap: 4px; }
.sidebar nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 8px;
  color: var(--sidebar-muted); font-size: 14px; font-weight: 500;
  text-decoration: none;
}
.sidebar nav a.active { background: var(--sidebar-hover); color: #fff; font-weight: 600; }
.sidebar nav a svg { flex-shrink: 0; }
.badge-count {
  margin-left: auto; background: #C97A2B; color: #fff;
  font-size: 11px; font-weight: 700; border-radius: 999px; padding: 1px 7px;
}
.sidebar .user {
  margin-top: auto; display: flex; align-items: center; gap: 10px;
  padding-top: 16px; border-top: 1px solid #1C4B3C;
}
.sidebar .user .avatar {
  width: 36px; height: 36px; border-radius: 999px; background: #C97A2B;
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px;
}
.sidebar .user .name { color: #fff; font-size: 13px; font-weight: 600; }
.sidebar .user .role { color: #8FB5A6; font-size: 11.5px; }
.sidebar .logout {
  background: none; border: none; color: #8FB5A6; font-size: 12px;
  text-align: left; padding: 0; margin-top: 2px;
}

.main { flex: 1; padding: 32px 40px; display: flex; flex-direction: column; gap: 24px; min-width: 0; }

.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.page-header h1 { margin: 0; font-size: 26px; font-weight: 600; }
.page-header .sub { color: var(--muted); font-size: 14px; margin-top: 4px; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  border-radius: 8px; font-size: 13.5px; font-weight: 600;
  padding: 10px 16px; border: 1px solid transparent; text-decoration: none;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-secondary { background: #fff; border-color: #D8D2C2; color: var(--ink); }
.btn-danger { background: #fff; border-color: var(--danger-border); color: var(--danger-text); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

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

.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.stat-label { color: var(--muted); font-size: 13px; font-weight: 600; }
.stat-value { font-size: 32px; font-weight: 600; margin-top: 6px; font-family: 'Source Serif 4', Georgia, serif; }

.badge {
  display: inline-block; font-size: 11.5px; font-weight: 700;
  padding: 3px 9px; border-radius: 999px;
}
.badge-draft { background: #EDE9DD; color: #5B6663; }
.badge-menunggu_persetujuan { background: var(--pending-bg); color: var(--pending-text); }
.badge-berlaku { background: var(--ok-bg); color: var(--primary); }
.badge-ditolak { background: var(--danger-bg); color: var(--danger-text); }
.badge-kedaluwarsa { background: var(--danger-bg); color: var(--danger-text); }
.badge-review { background: var(--warn-bg); color: var(--warn-text); }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead th {
  text-align: left; padding: 12px 20px; background: #FBF9F4;
  border-bottom: 1px solid var(--border); font-size: 12px; font-weight: 700;
  color: var(--muted); text-transform: uppercase; letter-spacing: .03em;
}
tbody td { padding: 14px 20px; border-bottom: 1px solid #F0EDE3; }
tbody tr:last-child td { border-bottom: none; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: #FBF9F4; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 600; }
.field input, .field select, .field textarea {
  border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px;
}
.field textarea { resize: vertical; }

.editor-toolbar { display: flex; gap: 6px; margin-bottom: 8px; flex-wrap: wrap; }
.editor-toolbar button {
  background: #fff; border: 1px solid var(--border); border-radius: 6px;
  padding: 6px 11px; font-size: 12.5px; color: var(--ink); font-family: inherit;
}
.editor-toolbar button:hover { background: #FBF9F4; }

.rich-editor {
  border: 1px solid var(--border); border-radius: 8px; padding: 14px 16px;
  min-height: 320px; font-size: 13.5px; line-height: 1.7; outline: none;
  background: #fff;
}
.rich-editor:focus { border-color: var(--primary); }
.rich-editor p, .rich-content p { margin: 0 0 10px; }
.rich-content { font-size: 13.5px; line-height: 1.7; color: #3A423F; }
.sop-heading {
  display: block; font-weight: 700; font-size: 16px; margin: 16px 0 8px;
  font-family: 'Source Serif 4', Georgia, serif; color: var(--ink);
}
.rich-editor .sop-heading:first-child, .rich-content .sop-heading:first-child { margin-top: 0; }

.error-text { color: var(--danger-text); font-size: 13px; }
.empty-state { color: var(--muted); font-size: 13.5px; padding: 24px; text-align: center; }

.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--bg);
}
.login-card {
  width: 380px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 36px; display: flex; flex-direction: column; gap: 18px;
}
