:root {
  --blue-900: #0B2559;
  --blue-700: #1E4FD9;
  --blue-600: #2F6FED;
  --blue-500: #4C7EF3;
  --blue-300: #A9C4FF;
  --blue-100: #EAF1FF;
  --blue-50: #F5F9FF;
  --white: #FFFFFF;
  --ink: #101828;
  --ink-soft: #667085;
  --border: #E7ECF6;
  --success: #12B76A;
  --success-bg: #ECFDF3;
  --danger: #F04438;
  --danger-bg: #FEF3F2;
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --shadow-card: 0 10px 30px rgba(11, 37, 89, 0.06);
  --shadow-pop: 0 20px 50px rgba(11, 37, 89, 0.16);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--white);
  color: var(--ink);
  font-family: 'Inter', -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .brand, .nav-item, .btn, .stat-value {
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
}

button, input, select { font-family: inherit; }

a { color: inherit; text-decoration: none; }

/* ---------- Blob decorations ---------- */
.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(0px);
  pointer-events: none;
  z-index: 0;
}
.blob-soft { filter: blur(60px); opacity: 0.55; }

/* ---------- Login page ---------- */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  background: var(--white);
}
.login-screen .blob-a {
  width: 620px; height: 620px;
  top: -220px; right: -180px;
  background: radial-gradient(circle at 30% 30%, var(--blue-600), var(--blue-900));
}
.login-screen .blob-b {
  width: 420px; height: 420px;
  bottom: -180px; left: -140px;
  background: radial-gradient(circle at 60% 40%, var(--blue-300), var(--blue-600));
}
.login-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 400px;
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop);
  padding: 44px 40px;
  border: 1px solid var(--border);
}
.login-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
}
.login-logo .mark {
  width: 38px; height: 38px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
}
.login-logo span {
  font-weight: 800;
  font-size: 20px;
  color: var(--blue-900);
}
.login-card h1 {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 6px;
  color: var(--ink);
}
.login-card p.sub {
  color: var(--ink-soft);
  font-size: 14px;
  margin: 0 0 28px;
}
.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 6px;
}
.field input, .field select {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  font-size: 14px;
  color: var(--ink);
  background: var(--blue-50);
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}
.field input:focus, .field select:focus {
  border-color: var(--blue-600);
  background: var(--white);
}
.search-input {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  font-size: 14px;
  color: var(--ink);
  background: var(--blue-50);
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}
.search-input:focus {
  border-color: var(--blue-600);
  background: var(--white);
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.15s, opacity 0.15s;
}
.btn:active { transform: scale(0.98); }
.btn-primary {
  background: linear-gradient(135deg, var(--blue-600), var(--blue-900));
  color: var(--white);
  width: 100%;
  box-shadow: 0 10px 24px rgba(47, 111, 237, 0.28);
}
.btn-primary:hover { opacity: 0.94; }
.btn-secondary {
  background: var(--blue-100);
  color: var(--blue-700);
}
.btn-ghost {
  background: transparent;
  color: var(--ink-soft);
  border: 1.5px solid var(--border);
}
.btn-danger { background: var(--danger-bg); color: var(--danger); }
.btn-sm { padding: 8px 14px; font-size: 13px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.error-box {
  background: var(--danger-bg);
  color: var(--danger);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 16px;
}

/* ---------- App shell ---------- */
.app-shell { display: flex; min-height: 100vh; background: var(--blue-50); }












.nav-group-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--ink-soft); opacity: 0.6;
  padding: 18px 14px 6px;
}



.user-chip .info { min-width: 0; }
.user-chip .name { font-size: 13px; font-weight: 700; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip .logout { font-size: 12px; color: var(--danger); cursor: pointer; font-weight: 600; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 16px 32px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
}
.topbar h2 { margin: 0; font-size: 19px; font-weight: 700; }
.company-switcher { position: relative; }
.company-pill {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 16px;
  border-radius: 999px;
  background: var(--blue-100);
  color: var(--blue-700);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  border: none;
}
.company-dropdown {
  position: fixed; top: 48px; right: 8px;
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius-md); box-shadow: var(--shadow-pop);
  width: 260px; padding: 8px; z-index: 9999;
  max-height: 80vh; overflow-y: auto;
}
.company-option {
  padding: 10px 12px; border-radius: var(--radius-sm);
  cursor: pointer; font-size: 13px; font-weight: 600;
  display: flex; justify-content: space-between; align-items: center;
}
.company-option:hover { background: var(--blue-50); }
.company-option.current { color: var(--blue-700); background: var(--blue-50); }

.content { padding: 28px 32px; flex: 1; }

/* ---------- Cards ---------- */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  padding: 24px;
  position: relative;
  overflow: hidden;
  margin-bottom: 20px;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 18px; gap: 12px; flex-wrap: wrap;
}
.card-header h3 { margin: 0; font-size: 16px; font-weight: 700; }
.card-header .desc { font-size: 12.5px; color: var(--ink-soft); margin-top: 2px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat-card {
  background: var(--white);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  padding: 20px;
  position: relative; overflow: hidden;
}
.stat-card .blob { width: 130px; height: 130px; top: -50px; right: -50px; background: radial-gradient(circle, var(--blue-100), transparent 70%); }
.stat-card .label { font-size: 12.5px; color: var(--ink-soft); font-weight: 600; position: relative; z-index: 1; }
.stat-value { font-size: 24px; font-weight: 800; color: var(--blue-900); margin-top: 6px; position: relative; z-index: 1; }
.stat-card.accent { background: linear-gradient(135deg, var(--blue-600), var(--blue-900)); border: none; }
.stat-card.accent .label { color: rgba(255,255,255,0.75); }
.stat-card.accent .stat-value { color: white; }

/* ---------- Tables ---------- */
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th { text-align: left; color: var(--ink-soft); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; padding: 10px 12px; border-bottom: 1.5px solid var(--border); }
td { padding: 12px; border-bottom: 1px solid var(--border); color: var(--ink); }
tr:last-child td { border-bottom: none; }
tr.clickable { cursor: pointer; }
tr.clickable:hover { background: var(--blue-50); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.text-right { text-align: right; }

.badge {
  display: inline-flex; align-items: center; padding: 4px 10px;
  border-radius: 999px; font-size: 11.5px; font-weight: 700;
}
.badge-draft { background: var(--blue-100); color: var(--blue-700); }
.badge-posted { background: var(--success-bg); color: var(--success); }
.badge-void { background: var(--danger-bg); color: var(--danger); }

.empty-state { text-align: center; padding: 48px 20px; color: var(--ink-soft); }
.empty-state .blob { width: 160px; height: 160px; left: 50%; top: 0; transform: translateX(-50%); background: radial-gradient(circle, var(--blue-100), transparent 70%); }
.empty-state p { position: relative; z-index: 1; font-size: 14px; margin: 8px 0 0; }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.line-row { display: grid; grid-template-columns: 2fr 1fr 1fr 1.4fr auto; gap: 10px; align-items: end; margin-bottom: 10px; }
.tabs { display: flex; gap: 6px; margin-bottom: 20px; background: var(--blue-50); padding: 5px; border-radius: 999px; width: fit-content; }
.tab {
  padding: 9px 18px; border-radius: 999px; font-size: 13px; font-weight: 700;
  cursor: pointer; color: var(--ink-soft);
}
.tab.active { background: var(--white); color: var(--blue-700); box-shadow: var(--shadow-card); }

.modal-overlay {
  position: fixed; inset: 0; background: rgba(11, 37, 89, 0.35);
  display: flex; align-items: center; justify-content: center; z-index: 100;
  padding: 20px;
}
.modal {
  background: var(--white); border-radius: var(--radius-lg);
  padding: 28px; width: 100%; max-width: 680px;
  max-height: 88vh; overflow-y: auto;
  box-shadow: var(--shadow-pop);
}
.modal h3 { margin: 0 0 18px; font-size: 17px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; }

.toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 200;
  background: var(--ink); color: white; padding: 12px 18px;
  border-radius: var(--radius-sm); font-size: 13.5px; font-weight: 600;
  box-shadow: var(--shadow-pop);
}
.toast.error { background: var(--danger); }
.toast.success { background: var(--success); }

.balance-check { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; padding: 6px 12px; border-radius: 999px; }
.balance-ok { background: var(--success-bg); color: var(--success); }
.balance-bad { background: var(--danger-bg); color: var(--danger); }

.hint { font-size: 12px; color: var(--ink-soft); margin-top: 4px; }

@media (max-width: 860px) {
  
  .content { padding: 20px; }
  .topbar { padding: 14px 20px; }
  .line-row { grid-template-columns: 1fr; }
}

.sidebar { width: 52px; background: #1e293b; display: flex; flex-direction: column; align-items: center; padding: 0; position: relative; overflow: visible; z-index: 100; flex-shrink: 0; }
.sidebar .blob { display: none; }
.sidebar-inner { display: flex; flex-direction: column; align-items: center; height: 100%; width: 100%; }
.brand { display: flex; align-items: center; justify-content: center; width: 52px; height: 56px; padding: 0; border-bottom: 1px solid rgba(255,255,255,0.08); flex-shrink: 0; }
.brand span { display: none; }
.brand .mark { width: 30px; height: 30px; border-radius: 8px; object-fit: cover; }
#navList { display: flex; flex-direction: column; align-items: center; width: 100%; padding: 8px 0; flex: 1; }
.nav-item { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 10px; margin: 2px 0; cursor: pointer; position: relative; color: rgba(255,255,255,0.5); transition: background 0.15s, color 0.15s; font-size: 20px; }
.nav-item:hover { background: rgba(255,255,255,0.1); color: #fff; }
.nav-item.active { background: #3b82f6; color: #fff; }
.nav-dot { display: none; }
.nav-flyout { position: fixed; left: 52px; top: 56px; height: calc(100vh - 56px); width: 300px; background: #fff; box-shadow: 4px 0 24px rgba(0,0,0,0.12); z-index: 99; padding: 20px 16px; overflow-y: auto; display: none; }
.nav-flyout.open { display: block; }
.nav-flyout h3 { font-size: 15px; font-weight: 700; color: #1e293b; margin: 0 0 14px 0; padding-bottom: 10px; border-bottom: 2px solid #f43f5e; }
.flyout-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.flyout-item { display: flex; flex-direction: column; align-items: center; padding: 12px 6px; border-radius: 10px; cursor: pointer; border: 1px solid #e5e7eb; text-align: center; transition: background 0.15s; gap: 6px; }
.flyout-item:hover { background: #f0f9ff; border-color: #93c5fd; }
.flyout-item.active { background: #eff6ff; border-color: #3b82f6; }
.flyout-icon { width: 44px; height: 44px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 20px; }
.flyout-label { font-size: 11px; font-weight: 600; color: #374151; line-height: 1.3; }
.icon-blue { background: #dbeafe; } .icon-green { background: #dcfce7; } .icon-orange { background: #ffedd5; }
.icon-purple { background: #f3e8ff; } .icon-pink { background: #fce7f3; } .icon-teal { background: #ccfbf1; }
.icon-yellow { background: #fef9c3; } .icon-red { background: #fee2e2; }
.flyout-overlay { position: fixed; inset: 0; z-index: 98; display: none; }
.flyout-overlay.open { display: block; }
.sidebar-footer { margin-top: auto; padding: 12px 0; border-top: 1px solid rgba(255,255,255,0.08); width: 100%; display: flex; justify-content: center; }
.user-chip { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 4px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg, #3b82f6, #1d4ed8); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; color: #fff; cursor: pointer; }
.user-chip .info { display: none; }
.logout { display: none; }

/* === KILOLA TABBAR === */
.kilola-tabbar {
  display: flex;
  align-items: center;
  background: #f1f5f9;
  border-bottom: 1px solid #e2e8f0;
  padding: 0 8px;
  height: 40px;
  overflow-x: auto;
  flex-shrink: 0;
  gap: 2px;
}
.kilola-tabbar::-webkit-scrollbar { height: 3px; }
.kilola-tabbar::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
.kilola-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  height: 32px;
  border-radius: 6px 6px 0 0;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: #64748b;
  background: #e2e8f0;
  border: 1px solid #cbd5e1;
  border-bottom: none;
  white-space: nowrap;
  transition: background 0.15s;
  flex-shrink: 0;
}
.kilola-tab:hover { background: #dde4ef; color: #374151; }
.kilola-tab.active {
  background: #fff;
  color: #1e293b;
  font-weight: 600;
  border-color: #e2e8f0;
  position: relative;
  z-index: 1;
}
.tab-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  color: #94a3b8;
  padding: 0 2px;
  line-height: 1;
  border-radius: 3px;
  display: flex;
  align-items: center;
}
.tab-close:hover { background: #cbd5e1; color: #374151; }
.kilola-tabbar .company-switcher { margin-left: auto; flex-shrink: 0; }
.main { display: flex; flex-direction: column; flex: 1; overflow: hidden; }
.content { flex: 1; overflow-y: auto; padding: 24px; }

/* === KILOLA TABBAR === */
.kilola-tabbar { display:flex;align-items:center;background:#f1f5f9;border-bottom:1px solid #e2e8f0;padding:0 8px;height:40px;overflow-x:auto;flex-shrink:0;gap:2px; }
.kilola-tabbar::-webkit-scrollbar { height:3px; }
.kilola-tabbar::-webkit-scrollbar-thumb { background:#cbd5e1;border-radius:3px; }
.kilola-tab { display:flex;align-items:center;gap:6px;padding:0 12px;height:32px;border-radius:6px 6px 0 0;cursor:pointer;font-size:13px;font-weight:500;color:#64748b;background:#e2e8f0;border:1px solid #cbd5e1;border-bottom:none;white-space:nowrap;transition:background 0.15s;flex-shrink:0; }
.kilola-tab:hover { background:#dde4ef;color:#374151; }
.kilola-tab.active { background:#fff;color:#1e293b;font-weight:600;border-color:#e2e8f0;position:relative;z-index:1; }
.tab-close { background:none;border:none;cursor:pointer;font-size:14px;color:#94a3b8;padding:0 2px;line-height:1;border-radius:3px; }
.tab-close:hover { background:#cbd5e1;color:#374151; }
.kilola-tabbar .company-switcher { margin-left:auto;flex-shrink:0; }
.main { display:flex;flex-direction:column;flex:1;overflow:hidden; }
.content { flex:1;overflow-y:auto;padding:24px; }

/* === KILOLA SUB-TABBAR === */
.kilola-subtabbar {
  display:flex;align-items:center;background:#fff;border-bottom:2px solid #e2e8f0;
  padding:0 12px;height:36px;overflow-x:auto;flex-shrink:0;gap:2px;
}
.kilola-subtab {
  display:flex;align-items:center;gap:6px;padding:0 12px;height:28px;
  border-radius:4px 4px 0 0;cursor:pointer;font-size:12px;font-weight:500;
  color:#64748b;background:transparent;border:1px solid transparent;
  border-bottom:none;white-space:nowrap;flex-shrink:0;
}
.kilola-subtab:hover { background:#f1f5f9;color:#374151; }
.kilola-subtab.active {
  background:#fff;color:#e11d48;font-weight:700;
  border-color:#e2e8f0;border-bottom:2px solid #e11d48;
  margin-bottom:-2px;
}

/* Warehouse modal — wider, no padding override */
.modal-wide {
  max-width: 700px !important;
  padding: 0 !important;
  overflow: visible !important;
}

/* Override modal untuk tampilan professional */
.modal-overlay {
  position: fixed !important;
  inset: 0 !important;
  background: rgba(0,0,0,0.5) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  z-index: 1000 !important;
  padding: 24px !important;
  overflow: hidden !important;
}
.modal {
  background: #fff !important;
  border-radius: 8px !important;
  padding: 0 !important;
  width: 660px !important;
  max-width: min(720px, calc(100vw - 48px)) !important;
  max-height: calc(100vh - 48px) !important;
  overflow: hidden !important;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2) !important;
  display: flex !important;
  flex-direction: column !important;
}
.modal > div {
  overflow-y: auto;
  max-height: calc(100vh - 48px);
}

/* Warehouse modal structure */
.modal-body-scroll {
  overflow-y: auto;
  flex: 1;
}
.modal-footer-fixed {
  flex-shrink: 0;
  padding: 12px 18px;
  border-top: 1px solid var(--border, #e5e7eb);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  background: #f9fafb;
  border-radius: 0 0 8px 8px;
}
