:root {
  --brand-900: #0e2650;
  --brand-800: #143570;
  --brand-700: #1a4699; /* primary — sampled from the ANNISA logo */
  --brand-600: #2c56ac;
  --brand-500: #4a72c4;
  --brand-300: #7b95d6;
  --brand-100: #eef2fa;
  --text-on-brand: #ffffff;

  --accent: #d99a2b;
  --accent-bg: #fdf3e3;
  --success: #1e8a5b;
  --success-bg: #e6f5ee;
  --danger: #d64545;
  --danger-bg: #fbeaea;
  --warning-bg: #fdf3e3;
  --info: #2c87c4;

  --ink: #0f172a;
  --muted: #64748b;
  --border: #e7eaf0;
  --page-bg: #f3f5fa;

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;

  --shadow-xs: 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-sm: 0 2px 8px rgba(16, 24, 40, .05), 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-md: 0 8px 24px rgba(16, 40, 90, .08), 0 2px 6px rgba(16, 40, 90, .05);
  --shadow-lg: 0 20px 48px rgba(14, 38, 80, .16), 0 4px 12px rgba(14, 38, 80, .06);
  --shadow-brand: 0 10px 24px rgba(26, 70, 153, .28);

  --ease: cubic-bezier(.4, 0, .2, 1);
  --sidebar-w: 268px;
}

* { box-sizing: border-box; }

html { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }

body {
  background: var(--page-bg);
  color: var(--ink);
  font-family: 'Plus Jakarta Sans', 'Segoe UI', system-ui, -apple-system, Arial, sans-serif;
  letter-spacing: -.01em;
}

a { text-decoration: none; }

h1, h2, h3, h4, h5, h6 { letter-spacing: -.02em; }

::selection { background: var(--brand-300); color: #fff; }

/* subtle scrollbar, premium apps never leave this default */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d3dae6; border-radius: 999px; border: 2px solid var(--page-bg); }
::-webkit-scrollbar-thumb:hover { background: #b9c3d6; }

/* ---------- App shell ---------- */

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

.app-sidebar {
  width: var(--sidebar-w);
  background:
    radial-gradient(1100px 420px at -10% -20%, rgba(255, 255, 255, .08), transparent),
    linear-gradient(180deg, var(--brand-800), var(--brand-900));
  color: #fff;
  display: flex;
  flex-direction: column;
  box-shadow: 4px 0 24px rgba(9, 22, 48, .18);
}

.app-sidebar .brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .7rem;
  padding: 1.1rem 1.2rem;
  border-bottom: 1px solid rgba(255, 255, 255, .1);
}

.app-sidebar .brand img { height: 44px; width: auto; background: #fff; border-radius: 10px; padding: 5px 10px; box-shadow: var(--shadow-sm); }
.app-sidebar .brand-text { font-weight: 800; font-size: .92rem; line-height: 1.2; letter-spacing: -.01em; }

.app-sidebar .nav-section-label {
  font-size: .68rem;
  letter-spacing: .1em;
  color: rgba(255, 255, 255, .45);
  text-transform: uppercase;
  font-weight: 700;
  padding: 1.35rem 1.2rem .5rem;
}

.app-sidebar nav.nav { padding: 0 .7rem; gap: .15rem; display: flex; }

.app-sidebar .nav-link {
  color: rgba(255, 255, 255, .82);
  padding: .62rem .8rem;
  display: flex;
  align-items: center;
  gap: .75rem;
  font-size: .89rem;
  font-weight: 500;
  border-radius: 12px;
  transition: background .16s var(--ease), color .16s var(--ease), transform .16s var(--ease);
}

.app-sidebar .nav-link i {
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 9px;
  background: rgba(255, 255, 255, .06);
  font-size: .95rem;
  flex: none;
  transition: background .16s var(--ease);
}

.app-sidebar .nav-link:hover { background: rgba(255, 255, 255, .08); color: #fff; transform: translateX(1px); }
.app-sidebar .nav-link:hover i { background: rgba(255, 255, 255, .12); }

.app-sidebar .nav-link.active {
  background: linear-gradient(135deg, rgba(255, 255, 255, .16), rgba(255, 255, 255, .08));
  color: #fff;
  font-weight: 700;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .1);
}

.app-sidebar .nav-link.active i { background: var(--accent); color: var(--brand-900); }

.app-sidebar .nav-link.disabled { color: rgba(255, 255, 255, .38); cursor: default; }
.app-sidebar .nav-link.disabled:hover { transform: none; background: transparent; }

.app-sidebar .nav-link .badge-soon {
  margin-left: auto;
  font-size: .6rem;
  background: rgba(255, 255, 255, .1);
  color: rgba(255, 255, 255, .68);
  padding: .18rem .45rem;
  border-radius: 999px;
  font-weight: 600;
  letter-spacing: .02em;
}

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

/* ---------- Topbar ---------- */

.app-topbar {
  background: rgba(255, 255, 255, .82);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
  padding: .8rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 20;
}

.app-topbar .page-title { font-weight: 800; color: var(--brand-800); font-size: 1.05rem; letter-spacing: -.02em; }

.store-switch {
  display: inline-flex;
  background: var(--brand-100);
  border-radius: 999px;
  padding: 4px;
  gap: 2px;
}

.store-switch a {
  padding: .45rem 1rem;
  border-radius: 999px;
  font-size: .82rem;
  font-weight: 600;
  color: var(--brand-700);
  white-space: nowrap;
  transition: background .18s var(--ease), color .18s var(--ease), box-shadow .18s var(--ease);
}

.store-switch a:hover { background: rgba(26, 70, 153, .08); }

.store-switch a.active {
  background: var(--brand-700);
  color: #fff;
  box-shadow: var(--shadow-brand);
}

.store-switch a.active:hover { background: var(--brand-700); }

.user-chip {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-size: .85rem;
  font-weight: 600;
  color: var(--ink);
}

.user-chip .avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-600), var(--brand-800));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .85rem;
  box-shadow: var(--shadow-brand);
}

.app-content { padding: 1.5rem; flex: 1; }

/* ---------- KPI cards ---------- */

.kpi-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.3rem 1.4rem;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: .35rem;
  box-shadow: var(--shadow-xs);
  transition: transform .2s var(--ease), box-shadow .2s var(--ease), border-color .2s var(--ease);
  position: relative;
  overflow: hidden;
}

.kpi-card::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--brand-500);
  opacity: 0;
  transition: opacity .2s var(--ease);
}

.kpi-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: transparent; }
.kpi-card:hover::before { opacity: 1; }

.kpi-card:has(.kpi-icon.success)::before { background: var(--success); }
.kpi-card:has(.kpi-icon.danger)::before { background: var(--danger); }
.kpi-card:has(.kpi-icon.warning)::before { background: var(--accent); }

.kpi-card .kpi-icon {
  width: 44px; height: 44px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  margin-bottom: .4rem;
}

.kpi-card .kpi-label { font-size: .74rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.kpi-card .kpi-value { font-size: 1.65rem; font-weight: 800; color: var(--ink); line-height: 1.2; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi-card .kpi-sub { font-size: .78rem; color: var(--muted); }

.kpi-icon.brand { background: linear-gradient(135deg, var(--brand-100), #e2e9fa); color: var(--brand-700); }
.kpi-icon.success { background: linear-gradient(135deg, var(--success-bg), #d9f2e6); color: var(--success); }
.kpi-icon.danger { background: linear-gradient(135deg, var(--danger-bg), #fadfdf); color: var(--danger); }
.kpi-icon.warning { background: linear-gradient(135deg, var(--warning-bg), #fbe8c8); color: var(--accent); }

.panel {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.4rem 1.5rem;
  box-shadow: var(--shadow-xs);
}

.panel-title {
  font-weight: 800;
  color: var(--brand-800);
  font-size: .98rem;
  letter-spacing: -.01em;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .6rem;
}

.panel-title > span:first-child::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 16px;
  border-radius: 999px;
  background: var(--brand-500);
  margin-right: .65rem;
  vertical-align: -2px;
}

.badge-store {
  font-size: .68rem;
  font-weight: 700;
  padding: .25rem .55rem;
  border-radius: 999px;
  letter-spacing: .01em;
}

.badge-store.apotek { background: var(--brand-100); color: var(--brand-700); }
.badge-store.cosmetics { background: var(--accent-bg); color: #93670f; }

table.table-clean thead th {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  border-bottom: 2px solid var(--border);
  font-weight: 700;
  padding-bottom: .7rem;
}

table.table-clean td, table.table-clean th { vertical-align: middle; padding-top: .65rem; padding-bottom: .65rem; }
table.table-clean tbody tr { transition: background .14s var(--ease); }
table.table-clean tbody tr:hover { background: var(--brand-100); }
table.table-clean tbody tr td { border-bottom-color: var(--border); }

.empty-note {
  color: var(--muted);
  font-size: .86rem;
  padding: 2.2rem 0;
  text-align: center;
}

.empty-note i {
  display: block;
  font-size: 1.6rem;
  color: var(--success);
  background: var(--success-bg);
  width: 52px; height: 52px;
  border-radius: 50%;
  align-items: center; justify-content: center;
  display: flex;
  margin: 0 auto .7rem;
}

.btn-brand {
  background: linear-gradient(135deg, var(--brand-600), var(--brand-800));
  border-color: transparent;
  color: #fff;
  font-weight: 700;
  box-shadow: var(--shadow-brand);
  transition: transform .16s var(--ease), box-shadow .16s var(--ease), filter .16s var(--ease);
}
.btn-brand:hover { color: #fff; filter: brightness(1.06); transform: translateY(-1px); box-shadow: 0 14px 28px rgba(26, 70, 153, .32); }
.btn-brand:active { transform: translateY(0); }

.btn-outline-secondary {
  border-color: var(--border);
  color: var(--muted);
  font-weight: 600;
  transition: all .16s var(--ease);
}
.btn-outline-secondary:hover { background: var(--brand-100); border-color: var(--brand-300); color: var(--brand-700); }

.summary-strip { display: flex; flex-wrap: wrap; gap: 1.5rem; }
.summary-strip .item { min-width: 150px; }
.summary-strip .item .label { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; }
.summary-strip .item .value { font-size: 1.35rem; font-weight: 800; color: var(--brand-800); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }

.form-control, .form-select {
  border-color: var(--border);
  font-size: .88rem;
}
.form-control:focus, .form-select:focus {
  border-color: var(--brand-500);
  box-shadow: 0 0 0 .2rem rgba(26, 70, 153, .12);
}

.dropdown-menu {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  padding: .5rem;
}
.dropdown-menu .dropdown-item { border-radius: 8px; font-size: .88rem; padding: .5rem .7rem; }
.dropdown-menu .dropdown-item:hover { background: var(--brand-100); }

@media (max-width: 991.98px) {
  .app-content { padding: 1.1rem; }
  .app-topbar .page-title { display: none; }
}

@media (max-width: 575.98px) {
  .store-switch a { padding: .38rem .65rem; font-size: .74rem; }
  .kpi-card .kpi-value { font-size: 1.3rem; }
  .app-content { padding: .85rem; }
  .panel { padding: 1.1rem 1.15rem; }
}
