:root { --primary: #1B5E20; --primary-dark: #124016; --primary-light: #E8F5E9; }
* { -webkit-tap-highlight-color: transparent; }
body { margin: 0; min-height: 100vh; }
.hidden { display: none !important; }

/* ── Login ── */
.login-wrap { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #f1f8f2, #e8f5e9); overflow: hidden; padding: 20px; }
.login-orb { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .5; }
.orb-1 { width: 320px; height: 320px; background: #66bb6a; top: -80px; left: -60px; }
.orb-2 { width: 280px; height: 280px; background: #a5d6a7; bottom: -70px; right: -50px; }
.login-card { position: relative; z-index: 1; background: #fff; border-radius: 24px; padding: 28px 24px;
  box-shadow: 0 20px 50px rgba(0,0,0,.12); width: 100%; max-width: 380px; }
.login-logo { font-size: 44px; }
.staff-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.staff-card { display: flex; align-items: center; gap: 10px; padding: 12px; border: 1px solid #e2e8f0;
  border-radius: 14px; cursor: pointer; transition: .15s; background: #fff; text-align: left; }
.staff-card:hover { border-color: var(--primary); background: var(--primary-light); }
.staff-av { width: 40px; height: 40px; border-radius: 12px; display: flex; align-items: center;
  justify-content: center; font-size: 20px; color: #fff; flex-shrink: 0; }
.pin-dots { display: flex; gap: 12px; justify-content: center; margin: 14px 0; }
.pin-dot { width: 14px; height: 14px; border-radius: 50%; background: #e2e8f0; transition: .15s; }
.pin-dot.filled { background: var(--primary); transform: scale(1.1); }
.numpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.numkey { padding: 16px; font-size: 20px; font-weight: 600; border: none; border-radius: 14px;
  background: #f1f5f9; cursor: pointer; transition: .12s; }
.numkey:active { background: var(--primary-light); transform: scale(.96); }

/* ── App shell ── */
.app-header { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; background: rgba(255,255,255,.9); backdrop-filter: blur(8px); border-bottom: 1px solid #eef2f6; }
.me-badge { font-size: 13px; font-weight: 600; padding: 5px 10px; background: var(--primary-light);
  color: var(--primary-dark); border-radius: 999px; }
.icon-btn { width: 36px; height: 36px; border-radius: 10px; border: none; background: #f1f5f9; cursor: pointer; font-size: 16px; }
.tabbar { position: sticky; top: 57px; z-index: 19; display: flex; gap: 4px; padding: 8px 12px;
  background: #fff; border-bottom: 1px solid #eef2f6; overflow-x: auto; }
.tab-btn { white-space: nowrap; padding: 8px 14px; border: none; border-radius: 999px; background: transparent;
  font-weight: 600; font-size: 14px; color: #64748b; cursor: pointer; }
.tab-btn.active { background: var(--primary); color: #fff; }
.content { max-width: 880px; margin: 0 auto; padding: 16px; padding-bottom: 60px; }

/* ── Controls ── */
.input { padding: 10px 14px; border: 1px solid #e2e8f0; border-radius: 12px; font-size: 14px; outline: none; background: #fff; }
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.btn-primary { padding: 10px 16px; background: var(--primary); color: #fff; border: none; border-radius: 12px;
  font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap; }
.btn-primary:active { background: var(--primary-dark); }
.btn-ghost { padding: 8px 14px; background: #f1f5f9; color: #475569; border: none; border-radius: 10px; font-weight: 600; cursor: pointer; }
.toolbar { display: flex; gap: 8px; margin-bottom: 12px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.filters select { padding: 7px 10px; border: 1px solid #e2e8f0; border-radius: 10px; font-size: 13px; background: #fff; }

/* ── Cards / dashboard ── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px,1fr)); gap: 12px; margin-bottom: 18px; }
.stat-card { background: #fff; border: 1px solid #eef2f6; border-radius: 16px; padding: 16px; }
.stat-num { font-size: 28px; font-weight: 800; color: var(--primary-dark); }
.stat-label { font-size: 13px; color: #64748b; }
.panel { background: #fff; border: 1px solid #eef2f6; border-radius: 16px; padding: 16px; margin-bottom: 14px; }
.panel h3 { margin: 0 0 10px; font-size: 15px; font-weight: 700; }
.bar-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 13px; }
.bar-row .lbl { width: 130px; flex-shrink: 0; color: #475569; }
.bar-track { flex: 1; height: 8px; background: #f1f5f9; border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--primary); border-radius: 999px; }

/* ── Doc list ── */
.doc-list { display: flex; flex-direction: column; gap: 10px; }
.doc-card { background: #fff; border: 1px solid #eef2f6; border-radius: 14px; padding: 14px; cursor: pointer; transition: .12s; }
.doc-card:hover { border-color: var(--primary); box-shadow: 0 4px 14px rgba(0,0,0,.05); }
.doc-title { font-weight: 700; font-size: 15px; }
.doc-meta { font-size: 12px; color: #94a3b8; margin-top: 2px; }
.doc-summary { font-size: 13px; color: #475569; margin-top: 6px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.chip { font-size: 11px; padding: 3px 9px; border-radius: 999px; background: #f1f5f9; color: #475569; font-weight: 600; }
.chip.umum { background: #e0f2fe; color: #0369a1; }
.chip.terbatas { background: #fef3c7; color: #b45309; }
.chip.rahasia { background: #fee2e2; color: #b91c1c; }
.chip.bidang { background: var(--primary-light); color: var(--primary-dark); }
.chip.tag { background: #f5f3ff; color: #6d28d9; }
.ai-pending { font-size: 11px; color: #f59e0b; font-weight: 600; }
.ai-error { font-size: 11px; color: #ef4444; font-weight: 600; }

/* ── Chat ── */
.chat-log { display: flex; flex-direction: column; gap: 10px; min-height: 50vh; padding-bottom: 12px; }
.msg { max-width: 85%; padding: 10px 14px; border-radius: 16px; font-size: 14px; line-height: 1.45; white-space: pre-wrap; word-break: break-word; }
.msg.user { align-self: flex-end; background: var(--primary); color: #fff; border-bottom-right-radius: 4px; }
.msg.assistant { align-self: flex-start; background: #fff; border: 1px solid #eef2f6; border-bottom-left-radius: 4px; }
.chat-input-row { display: flex; gap: 8px; position: sticky; bottom: 0; background: #f8fafc; padding: 10px 0; }
.chat-confirm { background: #fffbeb; border: 1px solid #fde68a; border-radius: 14px; padding: 12px; margin-bottom: 10px; }
.chat-confirm .actions { display: flex; gap: 8px; margin-top: 10px; }

/* ── Modal ── */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15,23,42,.45); display: flex; align-items: center;
  justify-content: center; z-index: 50; padding: 16px; }
.modal-card { background: #fff; border-radius: 20px; width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto; padding: 20px; }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12px; font-weight: 600; color: #64748b; margin-bottom: 4px; }
.field input, .field select, .field textarea { width: 100%; box-sizing: border-box; padding: 9px 12px;
  border: 1px solid #e2e8f0; border-radius: 10px; font-size: 14px; font-family: inherit; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ── Toast ── */
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #0f172a; color: #fff;
  padding: 12px 20px; border-radius: 12px; font-size: 14px; z-index: 60; box-shadow: 0 10px 30px rgba(0,0,0,.2); }
.spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid #cbd5e1; border-top-color: var(--primary);
  border-radius: 50%; animation: spin .7s linear infinite; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { text-align: center; color: #94a3b8; padding: 40px 0; font-size: 14px; }
