:root {
  --bg: #fff8f2;
  --card: rgba(255,255,255,.82);
  --text: #261737;
  --muted: #7c6c8f;
  --orange: #ff8f1f;
  --orange-soft: #fff1df;
  --purple: #7c4dff;
  --purple-soft: #efe9ff;
  --line: rgba(124,77,255,.12);
  --success: #13a35f;
  --danger: #d23a3a;
  --warning: #e78a16;
  --shadow: 0 18px 50px rgba(70, 29, 114, .10);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 18px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: radial-gradient(circle at top left, #fff5ea, #fff 45%, #f8f2ff); color: var(--text); font-family: 'Inter', sans-serif; overscroll-behavior-y: contain; }
button, input, select, textarea { font-family: inherit; }
body { min-height: 100vh; }
.screen { display: none; min-height: 100vh; }
.screen.active { display: block; }
.glass { background: rgba(255,255,255,.72); backdrop-filter: blur(16px); }
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: min(100%, 430px); background: linear-gradient(180deg, rgba(255,255,255,.95), rgba(255,255,255,.78)); border: 1px solid rgba(255,255,255,.88); border-radius: 34px; padding: 24px; box-shadow: var(--shadow); }
.pill { display: inline-flex; align-items: center; gap: 8px; min-height: 34px; padding: 8px 14px; border-radius: 999px; background: linear-gradient(135deg, var(--orange-soft), var(--purple-soft)); color: var(--purple); font-size: 12px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.login-card h1 { margin: 16px 0 6px; font-size: 34px; line-height: 1.05; }
.subcopy { margin: 0 0 22px; color: var(--muted); font-size: 14px; }
.login-actions { display: grid; gap: 14px; }
.role-btn { border: 0; padding: 18px; width: 100%; border-radius: 26px; display: flex; align-items: center; gap: 14px; text-align: left; cursor: pointer; box-shadow: var(--shadow); color: #fff; transition: transform .16s ease, filter .2s ease; }
.role-btn span { display: block; }
.role-btn b { display: block; font-size: 17px; margin-bottom: 4px; }
.role-btn small { display: block; line-height: 1.45; opacity: .92; }
.role-admin { background: linear-gradient(135deg, #6f40fb, #9e74ff); }
.role-sales { background: linear-gradient(135deg, #ff8b1c, #ffb145); }
.role-btn:active, .icon-btn:active, .menu-btn:active, .bottom-item:active, .action-btn:active, .primary-btn:active, .soft-btn:active, .ghost-btn:active { transform: scale(.97); }
.app-shell { max-width: 560px; margin: 0 auto; min-height: 100vh; position: relative; padding-bottom: 96px; }
.app-header { position: sticky; top: 0; z-index: 15; padding: 16px; border-bottom: 1px solid rgba(255,255,255,.6); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.header-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.header-left h2 { margin: 4px 0 2px; font-size: 24px; line-height: 1.1; }
.header-left p { margin: 0; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.eyebrow { font-size: 11px; font-weight: 800; color: var(--orange); letter-spacing: .14em; text-transform: uppercase; }
.header-actions { display: flex; gap: 8px; }
.icon-btn { width: 46px; height: 46px; border-radius: 18px; border: 0; background: #fff; box-shadow: var(--shadow); display: grid; place-items: center; cursor: pointer; flex: 0 0 auto; }
.app-main { display: grid; gap: 16px; padding: 14px 16px 28px; }
.view { display: none; }
.view.active { display: grid; gap: 16px; }
.card { background: var(--card); border: 1px solid rgba(255,255,255,.95); border-radius: var(--radius-xl); padding: 16px; box-shadow: var(--shadow); }
.section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.section-head h3 { margin: 0; font-size: 18px; }
.section-head p { margin: 4px 0 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.badge { display: inline-flex; align-items: center; padding: 7px 12px; border-radius: 999px; background: var(--purple-soft); color: var(--purple); font-size: 11px; font-weight: 800; white-space: nowrap; }
.summary-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
.summary-card { background: linear-gradient(180deg, #fff, #fff7ff); border: 1px solid rgba(124,77,255,.08); border-radius: 24px; padding: 16px; box-shadow: var(--shadow); }
.summary-kicker { font-size: 12px; color: var(--muted); font-weight: 700; }
.summary-value { font-size: 28px; line-height: 1.05; font-weight: 900; margin: 8px 0 6px; }
.summary-sub { font-size: 12px; color: var(--muted); }
.menu-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 10px; }
.menu-btn { border: 0; background: linear-gradient(180deg, #fff, #fff9f4); border-radius: 22px; padding: 14px 10px; cursor: pointer; box-shadow: inset 0 0 0 1px rgba(124,77,255,.08); text-align: center; }
.menu-btn span:last-child { display: block; margin-top: 8px; font-size: 11px; font-weight: 700; color: var(--text); line-height: 1.35; }
.double-stack { display: grid; gap: 16px; }
.stack-list, .card-list { display: grid; gap: 10px; }
.stack-item, .list-card { background: linear-gradient(180deg, #fff, #fff8f6); border: 1px solid rgba(124,77,255,.08); border-radius: 22px; padding: 14px; }
.stack-title, .list-card h4 { margin: 0; font-size: 15px; }
.stack-meta, .muted { margin-top: 6px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.charts-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
.mini-chart-card { background: linear-gradient(180deg, #fff, #fff8ff); border-radius: 22px; padding: 14px; border: 1px solid rgba(124,77,255,.08); }
.mini-chart-card.wide { grid-column: 1 / -1; }
.chart-label { font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 10px; }
.bars { height: 96px; display: flex; align-items: end; gap: 8px; padding-bottom: 18px; }
.bar { flex: 1; min-width: 0; border-radius: 12px 12px 6px 6px; background: linear-gradient(180deg, var(--orange), var(--purple)); position: relative; }
.bar-label { position: absolute; bottom: -18px; left: 50%; transform: translateX(-50%); font-size: 10px; color: var(--muted); }
.ring-wrap { height: 96px; display: grid; place-items: center; }
.ring { width: 92px; height: 92px; border-radius: 50%; background: conic-gradient(var(--orange) 0 68%, var(--purple-soft) 68% 100%); display: grid; place-items: center; }
.ring span { width: 62px; height: 62px; background: #fff; border-radius: 50%; display: grid; place-items: center; font-size: 16px; font-weight: 800; }
.progress-list { display: grid; gap: 10px; }
.progress-row { display: grid; gap: 6px; }
.progress-head { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; }
.progress-track { height: 10px; border-radius: 999px; background: #f0eaff; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--purple), var(--orange)); }
.list-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.status { display: inline-flex; align-items: center; padding: 7px 10px; border-radius: 999px; font-size: 11px; font-weight: 800; white-space: nowrap; }
.status-baru, .status-prospek, .status-segera, .status-draft, .status-terjadwal { background: #fff1de; color: #b46200; }
.status-dihubungi, .status-negosiasi, .status-presentation, .status-terkirim, .status-maintenance { background: #efe9ff; color: #6c3ef1; }
.status-deal, .status-lunas, .status-hari-ini, .status-aktif, .status-onboarding, .status-renewal { background: #e8fff3; color: #0d8b52; }
.status-gagal, .status-overdue { background: #ffe8e8; color: #cb2d2d; }
.meta-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; margin-top: 10px; }
.meta-chip { background: rgba(124,77,255,.05); border-radius: 16px; padding: 10px; font-size: 12px; word-break: break-word; }
.action-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.action-btn, .soft-btn, .ghost-btn, .primary-btn, .logout-btn { border: 0; border-radius: 16px; padding: 12px 14px; cursor: pointer; font-size: 13px; font-weight: 700; }
.primary-btn { background: linear-gradient(135deg, var(--purple), #9e74ff); color: #fff; }
.soft-btn { background: linear-gradient(135deg, var(--orange-soft), #fff4e7); color: #a55c07; }
.ghost-btn { background: #fff; color: var(--text); box-shadow: inset 0 0 0 1px rgba(124,77,255,.12); }
.toolbar { display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; }
input, select, textarea { width: 100%; border: 1px solid rgba(124,77,255,.12); background: #fff; min-height: 50px; border-radius: 18px; padding: 14px 16px; outline: none; color: var(--text); font-size: 14px; }
textarea { min-height: 110px; resize: vertical; }
.form-grid { display: grid; gap: 12px; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0,1fr)); }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.empty-state { padding: 28px 18px; text-align: center; background: linear-gradient(180deg, #fff, #fff8f8); border: 1px dashed rgba(124,77,255,.18); border-radius: 22px; color: var(--muted); }
.bottom-nav { position: fixed; left: 0; right: 0; bottom: 0; max-width: 560px; margin: 0 auto; padding: 10px 14px 16px; display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; border-top: 1px solid rgba(255,255,255,.7); }
.bottom-item { border: 0; border-radius: 20px; padding: 10px 4px; background: #fff; box-shadow: var(--shadow); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; cursor: pointer; font-size: 11px; font-weight: 700; color: var(--text); }
.bottom-item.active { outline: 2px solid rgba(124,77,255,.14); }
.drawer, .modal { display: none; position: fixed; inset: 0; z-index: 40; }
.drawer.open, .modal.open { display: block; }
.drawer-backdrop, .modal-backdrop { position: absolute; inset: 0; background: rgba(33, 16, 58, .28); backdrop-filter: blur(4px); }
.drawer-panel { position: absolute; left: 0; top: 0; bottom: 0; width: min(88vw, 360px); background: #fff; border-radius: 0 30px 30px 0; padding: 18px; box-shadow: 14px 0 50px rgba(0,0,0,.16); overflow: auto; animation: slideInLeft .18s ease; }
.drawer-top, .modal-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.drawer-menu { display: grid; gap: 10px; }
.drawer-link { border: 0; background: linear-gradient(180deg, #fff, #fff8ff); border-radius: 20px; padding: 14px; text-align: left; box-shadow: inset 0 0 0 1px rgba(124,77,255,.08); cursor: pointer; display: flex; align-items: center; gap: 12px; font-weight: 700; }
.logout-btn { width: 100%; margin-top: 14px; background: linear-gradient(135deg, #231834, #4b356a); color: #fff; display: flex; align-items: center; justify-content: center; gap: 8px; }
.modal-panel { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(94vw, 520px); max-height: 88vh; overflow: auto; background: #fff; border-radius: 28px; padding: 18px; box-shadow: 0 20px 60px rgba(18, 12, 28, .18); animation: popIn .18s ease; }
.modal-body { display: grid; gap: 12px; }
.detail-box { background: linear-gradient(180deg, #fff, #faf6ff); border: 1px solid rgba(124,77,255,.08); border-radius: 18px; padding: 12px; }
.detail-box b { display: block; margin-bottom: 4px; }
.toast { position: fixed; top: 14px; left: 50%; transform: translateX(-50%) translateY(-12px); padding: 12px 16px; border-radius: 16px; background: #231838; color: #fff; z-index: 60; opacity: 0; pointer-events: none; transition: .22s ease; font-size: 13px; font-weight: 700; box-shadow: var(--shadow); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.skeleton-list { display: grid; gap: 10px; }
.skeleton-card { min-height: 92px; border-radius: 22px; background: #f2ecff; position: relative; overflow: hidden; }
.skeleton-card::after { content: ''; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255,255,255,.85), transparent); animation: shimmer 1.2s infinite; }
.icon { width: 22px; height: 22px; display: inline-block; background-repeat: no-repeat; background-size: contain; background-position: center; }
.role-icon { width: 48px; height: 48px; border-radius: 18px; background-color: rgba(255,255,255,.18); background-size: 24px; flex: 0 0 48px; }
.icon.menu { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23261737' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M4 7h16M4 12h16M4 17h16'/%3E%3C/svg%3E"); }
.icon.close { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23261737' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 6l12 12M18 6L6 18'/%3E%3C/svg%3E"); }
.icon.bell { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23261737' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 8a6 6 0 1112 0c0 7 3 8 3 8H3s3-1 3-8'/%3E%3Cpath d='M10 20a2 2 0 004 0'/%3E%3C/svg%3E"); }
.icon.user { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23261737' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 21a8 8 0 10-16 0'/%3E%3Ccircle cx='12' cy='8' r='4'/%3E%3C/svg%3E"); }
.icon.home { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23261737' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 11l9-7 9 7'/%3E%3Cpath d='M5 10v10h14V10'/%3E%3C/svg%3E"); }
.icon.leads { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23261737' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='10' cy='10' r='6'/%3E%3Cpath d='M21 21l-5.2-5.2'/%3E%3C/svg%3E"); }
.icon.pipeline { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23261737' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6h16M4 12h10M4 18h7'/%3E%3Ccircle cx='17' cy='12' r='2'/%3E%3Ccircle cx='14' cy='18' r='2'/%3E%3C/svg%3E"); }
.icon.invoice { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23261737' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 3h10l2 2v16l-3-2-2 2-2-2-2 2-3-2V5l2-2z'/%3E%3Cpath d='M9 9h6M9 13h6'/%3E%3C/svg%3E"); }
.icon.dashboard { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='7' height='7' rx='2'/%3E%3Crect x='14' y='3' width='7' height='12' rx='2'/%3E%3Crect x='3' y='14' width='7' height='7' rx='2'/%3E%3Crect x='14' y='18' width='7' height='3' rx='1'/%3E%3C/svg%3E"); }
.icon.users { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M17 21v-2a4 4 0 00-4-4H5a4 4 0 00-4 4v2'/%3E%3Ccircle cx='9' cy='7' r='4'/%3E%3Cpath d='M23 21v-2a4 4 0 00-3-3.87'/%3E%3Cpath d='M16 3.13a4 4 0 010 7.75'/%3E%3C/svg%3E"); }
.icon.logout { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 21H5a2 2 0 01-2-2V5a2 2 0 012-2h4'/%3E%3Cpath d='M16 17l5-5-5-5'/%3E%3Cpath d='M21 12H9'/%3E%3C/svg%3E"); }
@keyframes shimmer { to { transform: translateX(100%); } }
@keyframes slideInLeft { from { transform: translateX(-100%); } to { transform: translateX(0); } }
@keyframes popIn { from { opacity: 0; transform: translate(-50%, -46%); } to { opacity: 1; transform: translate(-50%, -50%); } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.fade-up { animation: fadeUp .28s ease both; }
@media (max-width: 430px) {
  .menu-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .toolbar { grid-template-columns: 1fr; }
  .form-grid.two, .meta-grid, .summary-grid, .charts-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 360px) {
  .summary-grid, .charts-grid, .form-grid.two, .meta-grid { grid-template-columns: 1fr; }
  .app-header { padding: 14px; }
  .header-left p { max-width: 150px; }
}
