:root {
  --navy: #0e1b3f;
  --navy-2: #142654;
  --orange: #ff7a1a;
  --orange-glow: rgba(255, 122, 26, 0.18);
  --orange-dark: #e8690c;
  --bg: #f5f6fa;
  --card: #ffffff;
  --border: #e9ebf1;
  --text: #16213e;
  --text-muted: #8891a7;
  --text-soft: #aeb6cc;
  --green: #17a673;
  --red: #e5484d;
  --blue: #2f6fed;
  --purple: #7c5cfc;
  --yellow: #f5b93d;
  --teal: #16b3a3;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 64, 0.04), 0 8px 24px rgba(16, 24, 64, 0.04);
  font-size: 16px;
}

* { box-sizing: border-box; }
button, select, input, textarea { color: inherit; font-family: inherit; }

html {
  overflow-x: hidden;
}

body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

#app {
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
}

/* ---------- Sidebar ---------- */
.sidebar {
  width: 232px;
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--navy) 0%, #0a1330 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 40;
  transition: transform 0.22s ease;
}

.sidebar.collapsed {
  transform: translateX(-100%);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px 22px;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}

.brand-mark {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--text-soft);
  text-decoration: none;
  font-size: 0.89rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-item svg { flex-shrink: 0; opacity: 0.9; }

.nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.nav-item.active {
  background: var(--orange);
  color: #fff;
  box-shadow: 0 4px 14px rgba(255, 122, 26, 0.35);
}

.nav-item.active svg { opacity: 1; }

.sidebar-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 12px;
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding-left: 8px;
  padding-right: 8px;
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #3a4a80;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
  color: #fff;
  flex-shrink: 0;
}

.store-name { font-size: 0.85rem; font-weight: 600; color: #fff; line-height: 1.2; }
.store-role { font-size: 0.72rem; color: var(--text-soft); }
.sidebar-footer svg { margin-left: auto; color: var(--text-soft); }

/* ---------- Main ---------- */
.main {
  margin-left: 232px;
  flex: 1;
  min-width: 0;
  padding: 22px 28px 40px;
  transition: margin-left 0.22s ease;
}

.main.expanded {
  margin-left: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 12px;
}

.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 10px;
}

.menu-toggle {
  display: none;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  width: 38px;
  height: 38px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.topbar-actions { display: flex; align-items: center; gap: 12px; }

.date-picker {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 14px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
  box-shadow: var(--shadow);
  white-space: nowrap;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--card);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: var(--shadow);
  cursor: pointer;
  color: var(--text);
}

.badge-dot {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--orange);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 700;
  border-radius: 999px;
  min-width: 17px;
  height: 17px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg);
}

/* ---------- Grid ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
  margin-bottom: 16px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.stat-card { padding: 16px 16px 14px; }

.stat-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
}

.stat-label { font-size: 0.78rem; color: var(--text-muted); font-weight: 500; margin-bottom: 4px; }
.stat-value { font-size: 1.4rem; font-weight: 700; letter-spacing: -0.01em; margin-bottom: 6px; }
.stat-sub { font-size: 0.74rem; font-weight: 600; }
.stat-sub.up { color: var(--green); }
.stat-sub.link { color: var(--blue); cursor: pointer; }
.stat-sub.warn { color: var(--red); }
.stat-sub.muted { color: var(--text-muted); }

.row-3 {
  display: grid;
  grid-template-columns: 1.15fr 1.15fr 1fr;
  gap: 14px;
  margin-bottom: 16px;
  align-items: stretch;
}

.card-pad { padding: 18px 18px 16px; }

.card-title {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 0 0 14px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.card-title > a { flex-shrink: 0; }
.title-sub { display: block; font-size: 0.72rem; font-weight: 500; color: var(--text-muted); margin-top: 1px; }

.link-orange { color: var(--orange); font-size: 0.78rem; font-weight: 600; cursor: pointer; text-decoration: none; }
.link-blue { color: var(--blue); font-size: 0.78rem; font-weight: 600; cursor: pointer; text-decoration: none; }

/* Donut */
.donut-wrap { display: flex; align-items: center; gap: 14px; }
.donut-svg { flex-shrink: 0; }
.legend { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; flex: 1; min-width: 0; }
.legend li { display: flex; align-items: center; gap: 8px; font-size: 0.8rem; white-space: nowrap; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.legend .amount { margin-left: auto; color: var(--text-muted); font-weight: 600; font-size: 0.78rem; }

.donut-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--border);
  margin-top: 16px;
  padding-top: 14px;
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Activity */
.activity-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.activity-item { display: flex; gap: 10px; }
.activity-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.activity-title { font-size: 0.83rem; font-weight: 600; margin: 0 0 2px; }
.activity-desc { font-size: 0.76rem; color: var(--text-muted); }
.activity-time { font-size: 0.7rem; color: var(--text-soft); margin-left: auto; white-space: nowrap; padding-left: 8px; }
.activity-row-top { display: flex; align-items: flex-start; width: 100%; }

/* Attention */
.attn-list { display: flex; flex-direction: column; gap: 10px; }
.attn-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px 12px;
  border-radius: 10px;
}
.attn-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(255,255,255,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.attn-title { font-size: 0.83rem; font-weight: 700; margin: 0 0 1px; }
.attn-desc { font-size: 0.75rem; opacity: 0.85; }
.attn-orange { background: #fdf1e0; color: #8a5a12; }
.attn-blue { background: #e9f1ff; color: #1e4fa8; }
.attn-red { background: #fdeaea; color: #b3282d; }

/* Bottom row */
.row-2 {
  display: grid;
  grid-template-columns: 1.9fr 1.2fr;
  gap: 14px;
  align-items: start;
}

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
thead th {
  text-align: left;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: none;
  padding: 0 10px 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody tr:last-child td { border-bottom: none; }
.order-id { color: var(--blue); font-weight: 600; }
.pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
}
.pill-orange { background: #fdf1e0; color: #b46a10; }
.pill-red { background: #fdeaea; color: #c62e33; }
.pill-green { background: #e6f7f0; color: #128a5c; }
.pill-blue { background: #e9f1ff; color: #2255c4; }
.pill-purple { background: #f1ecff; color: #6b46f0; }
.pill-gray { background: #eef0f5; color: #6b7280; }

.best-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 13px; }
.best-item { display: flex; align-items: center; gap: 12px; }
.best-rank {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  flex-shrink: 0;
}
.best-name { font-size: 0.83rem; font-weight: 600; }
.best-sold { font-size: 0.74rem; color: var(--text-muted); margin-left: auto; white-space: nowrap; }

/* Placeholder page */
.placeholder {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 60px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 14px;
  color: var(--text-muted);
}
.placeholder-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: #fdf1e0;
  color: var(--orange);
  display: flex;
  align-items: center;
  justify-content: center;
}
.placeholder h2 { color: var(--text); margin: 0; font-size: 1.05rem; }
.placeholder p { margin: 0; max-width: 360px; font-size: 0.88rem; line-height: 1.5; }

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10, 15, 35, 0.45);
  z-index: 30;
}

/* =========================================================
   New topbar (search + hamburger + avatar)
   ========================================================= */
.topbar2 {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  position: sticky;
  top: 0;
  z-index: 25;
  background: var(--bg);
  padding: 4px 0 12px;
}

.hamburger-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--card);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text);
  flex-shrink: 0;
}

.topbar-search {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0 14px;
  height: 40px;
  color: var(--text-muted);
}
.topbar-search input {
  border: none;
  outline: none;
  background: transparent;
  font-size: 0.85rem;
  flex: 1;
  min-width: 0;
  color: var(--text);
  font-family: inherit;
}
.topbar-search input::placeholder { color: var(--text-soft); }

.topbar-date {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0 14px;
  height: 40px;
  font-size: 0.83rem;
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
}
.topbar-date-plain {
  font-size: 0.83rem;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
  padding: 0 6px;
  user-select: none;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px 12px 4px 4px;
  height: 40px;
  flex-shrink: 0;
  cursor: pointer;
  color: var(--text);
}
.topbar-user .avatar { width: 30px; height: 30px; background: var(--orange); font-size: 0.72rem; }
.topbar-user .who { line-height: 1.15; }
.topbar-user .who .name { font-size: 0.78rem; font-weight: 600; }
.topbar-user .who .role { font-size: 0.68rem; color: var(--text-muted); }
.topbar-user { border: 1px solid var(--border); font-family: inherit; }

/* ---------- User dropdown (topbar + sidebar) ---------- */
.user-menu-wrap { position: relative; }
.user-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 270px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(10, 15, 35, 0.16);
  z-index: 60;
  overflow: hidden;
}
.user-dropdown.open { display: block; }
.user-dropdown.up { top: auto; bottom: calc(100% + 8px); }
.user-dropdown.left { left: 0; right: auto; }
.ud-head { display: flex; gap: 10px; align-items: center; padding: 14px; border-bottom: 1px solid var(--border); }
.ud-head .avatar { width: 38px; height: 38px; font-size: 0.85rem; }
.ud-head .n { font-weight: 700; font-size: 0.85rem; }
.ud-head .e { font-size: 0.72rem; color: var(--text-muted); }
.ud-section-label { font-size: 0.66rem; font-weight: 700; letter-spacing: 0.04em; color: var(--text-soft); text-transform: uppercase; padding: 10px 14px 4px; }
.ud-user-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
}
.ud-user-item:hover { background: var(--bg); }
.ud-user-item .avatar { width: 28px; height: 28px; font-size: 0.66rem; }
.ud-user-item .n { font-size: 0.8rem; font-weight: 600; color: var(--text); }
.ud-user-item .r { font-size: 0.68rem; color: var(--text-muted); }
.ud-user-item.current { background: rgba(255, 122, 26, 0.12); }
.ud-user-item.current .n { font-weight: 500; }
.ud-foot { border-top: 1px solid var(--border); padding: 8px; display: flex; flex-direction: column; gap: 2px; }
.ud-foot a, .ud-foot button {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 8px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  border: none;
  background: none;
  cursor: pointer;
  width: 100%;
  text-align: left;
  font-family: inherit;
}
.ud-foot a:hover, .ud-foot button:hover { background: var(--bg); }
.ud-foot .danger { color: var(--red); }

/* ---------- Page header (title + subtitle + actions) ---------- */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.page-header .titles h1 {
  font-size: 1.4rem;
  font-weight: 700;
  margin: 0 0 3px;
  letter-spacing: -0.01em;
}
.page-header .titles p { margin: 0; color: var(--text-muted); font-size: 0.83rem; }
.page-header .actions { display: flex; gap: 10px; flex-wrap: wrap; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 0.83rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  white-space: nowrap;
  font-family: inherit;
}
.btn-orange { background: var(--orange); color: #fff; }
.btn-orange:hover { background: var(--orange-dark); }
.btn-blue-outline { background: var(--card); color: var(--blue); border-color: var(--border); }
.btn-outline { background: var(--card); color: var(--text); border-color: var(--border); }
.btn-green { background: var(--green); color: #fff; }
.btn-red-outline { background: #fff; color: var(--red); border-color: #f3caca; }
.btn-blue { background: var(--blue); color: #fff; }
.btn-sm { padding: 7px 12px; font-size: 0.78rem; }
.btn-block { width: 100%; justify-content: center; }

/* ---------- Filter bar ---------- */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}
.filter-search {
  flex: 1;
  min-width: 200px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0 12px;
  height: 38px;
  color: var(--text-muted);
}
.filter-search input { border: none; outline: none; background: transparent; font-size: 0.82rem; flex: 1; color: var(--text); font-family: inherit; }
.filter-select {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0 12px;
  height: 38px;
  font-size: 0.8rem;
  color: var(--text);
  white-space: nowrap;
  cursor: pointer;
}
.filter-select svg { color: var(--text-muted); }

/* ---------- Tabs (status counters) ---------- */
.status-tabs {
  display: flex;
  gap: 26px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
  overflow-x: auto;
}
.status-tab {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0 2px 12px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  font-family: inherit;
  display: flex;
  align-items: center;
  gap: 6px;
}
.status-tab .count { font-weight: 700; }
.status-tab.active { color: var(--orange); border-bottom-color: var(--orange); }

/* ---------- Split layout (list + detail) ---------- */
.split-layout {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 16px;
  align-items: start;
}
.split-list { display: flex; flex-direction: column; gap: 12px; }

/* ---------- Generic list-detail (table page + right drawer) ---------- */
.list-detail-layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 16px;
  align-items: start;
}
.list-detail-layout.no-detail { grid-template-columns: 1fr; }
#orderLayout { grid-template-columns: 1fr 280px; }
#produkLayout, #kemasanLayout, #pembayaranLayout, #customerLayout, #penggunaLayout { grid-template-columns: 1fr 300px; }
#produkLayout .detail-panel, #kemasanLayout .detail-panel, #customerLayout .detail-panel, #penggunaLayout .detail-panel {
  padding: 16px;
}
#produkLayout .btn-block, #kemasanLayout .btn-block, #customerLayout .detail-panel .btn-block, #penggunaLayout .detail-panel .btn-block {
  font-size: 0.78rem;
  padding: 8px 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#pembayaranLayout table { font-size: 0.76rem; }
#pembayaranLayout th, #pembayaranLayout td { padding: 8px 6px; }
#orderLayout table { font-size: 0.73rem; table-layout: fixed; width: 100%; }
#orderLayout th, #orderLayout td { padding: 8px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#orderLayout .truncate-cell { max-width: none; }
#orderLayout .pill { font-size: 0.68rem; padding: 3px 7px; }
#orderLayout .action-icons { gap: 6px; }
#orderLayout .action-icons a { width: 24px; height: 24px; }
#orderLayout th:nth-child(1), #orderLayout td:nth-child(1) { width: 26px; }
#orderLayout th:nth-child(2), #orderLayout td:nth-child(2) { width: 62px; }
#orderLayout th:nth-child(3), #orderLayout td:nth-child(3) { width: 82px; }
#orderLayout th:nth-child(4), #orderLayout td:nth-child(4) { width: 70px; }
#orderLayout th:nth-child(5), #orderLayout td:nth-child(5) { width: 80px; }
#orderLayout th:nth-child(6), #orderLayout td:nth-child(6) { width: 62px; }
#orderLayout th:nth-child(7), #orderLayout td:nth-child(7) { width: 62px; }
#orderLayout th:nth-child(8), #orderLayout td:nth-child(8) { width: 62px; }
#orderLayout th:nth-child(9), #orderLayout td:nth-child(9) { width: 72px; }
#orderLayout th:nth-child(10), #orderLayout td:nth-child(10) { width: 78px; }
#orderLayout th:nth-child(11), #orderLayout td:nth-child(11) { width: 66px; }

.detail-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}
.detail-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 14px;
}
.detail-panel-head h3 { margin: 0; font-size: 1rem; font-weight: 700; }
.detail-close {
  width: 26px; height: 26px; border-radius: 8px; border: none; background: var(--bg);
  color: var(--text-muted); cursor: pointer; display: flex; align-items: center; justify-content: center;
}

.detail-section { margin-bottom: 16px; }
.detail-section:last-child { margin-bottom: 0; }
.detail-section-title { font-size: 0.75rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.03em; margin: 0 0 10px; }

.info-row { display: flex; justify-content: space-between; gap: 10px; font-size: 0.82rem; padding: 7px 0; border-bottom: 1px solid var(--border); }
.info-row:last-child { border-bottom: none; }
.info-row .label { color: var(--text-muted); }
.info-row .value { font-weight: 600; text-align: right; }
.info-row .value.pos { color: var(--green); }
.info-row .value.neg { color: var(--red); }

.meta-list { display: flex; flex-direction: column; gap: 9px; }
.meta-item { display: flex; gap: 9px; font-size: 0.8rem; }
.meta-item svg { color: var(--text-muted); flex-shrink: 0; margin-top: 1px; }
.meta-item .meta-label { color: var(--text-muted); font-size: 0.72rem; }
.meta-item .meta-value { font-weight: 600; }

.mini-stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mini-stat {
  background: var(--bg);
  border-radius: 10px;
  padding: 12px;
  text-align: center;
}
.mini-stat .v { font-size: 1.05rem; font-weight: 700; }
.mini-stat .l { font-size: 0.68rem; color: var(--text-muted); margin-top: 2px; }

.progress-track {
  background: #eef0f5;
  border-radius: 999px;
  height: 6px;
  overflow: hidden;
  margin-top: 6px;
}
.progress-fill { height: 100%; border-radius: 999px; }

/* ---------- Data table page shell ---------- */
.table-card { padding: 0; overflow: hidden; }
.table-card-head { padding: 16px 18px 0; }
.table-scroll { overflow-x: auto; }
.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  font-size: 0.78rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 10px;
}
.pager { display: flex; align-items: center; gap: 4px; }
.pager button {
  width: 28px; height: 28px; border-radius: 8px; border: 1px solid var(--border); background: var(--card);
  font-size: 0.78rem; color: var(--text); cursor: pointer; font-family: inherit;
}
.pager button.active { background: var(--orange); color: #fff; border-color: var(--orange); }
.pager button.nav { color: var(--text-muted); border-color: transparent; background: transparent; }

table td, table th { vertical-align: middle; }
.cell-primary { display: flex; align-items: center; gap: 10px; }
.cell-primary img, .cell-primary .thumb {
  width: 38px; height: 38px; border-radius: 9px; object-fit: cover; flex-shrink: 0; background: #eef0f5;
}
.cell-primary .name { font-weight: 600; font-size: 0.82rem; }
.cell-primary .sub { font-size: 0.72rem; color: var(--text-muted); }

.avatar-xs {
  width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem; font-weight: 700; color: #fff; flex-shrink: 0;
}

.action-icons { display: flex; align-items: center; gap: 10px; }
.action-icons button, .action-icons a {
  width: 28px; height: 28px; border-radius: 7px; border: 1px solid var(--border); background: var(--card);
  display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text-muted);
}
.link-cell { color: var(--blue); font-weight: 600; cursor: pointer; }
.truncate-cell {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: help;
}

.row-more-wrap { position: relative; display: inline-block; }
.row-more-btn {
  width: 28px; height: 28px; border-radius: 7px; border: 1px solid var(--border); background: var(--card);
  display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text-muted); font-family: inherit;
}
.row-more-menu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 180px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(10, 15, 35, 0.15);
  z-index: 50;
  padding: 6px;
}
.row-more-menu.open { display: block; }
.row-more-menu button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 9px;
  border: none;
  background: none;
  border-radius: 7px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
}
.row-more-menu button:hover { background: var(--bg); }
.row-more-menu button.danger { color: var(--red); }

/* ---------- PO cards (list) ---------- */
.po-card {
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.po-card.active { border-color: var(--orange); box-shadow: 0 0 0 3px var(--orange-glow); }
.po-card:hover { border-color: #d9ddea; }
.po-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.po-date-block { display: flex; gap: 12px; align-items: baseline; }
.po-date-block .day { font-size: 1.4rem; font-weight: 800; color: var(--text); }
.po-date-block .month-year { font-size: 0.72rem; color: var(--text-muted); line-height: 1.3; }
.po-date-block .weekday { font-size: 0.72rem; color: var(--text-muted); }
.po-summary { font-size: 0.78rem; color: var(--text-muted); margin-bottom: 10px; }
.po-summary b { color: var(--text); font-weight: 700; }
.po-substats { display: flex; gap: 18px; margin-bottom: 8px; }
.po-substats .item { font-size: 0.72rem; color: var(--text-muted); }
.po-substats .item b { display: block; font-size: 0.9rem; color: var(--text); font-weight: 700; }
.po-capacity { margin-bottom: 10px; }
.po-capacity-top { display: flex; justify-content: space-between; font-size: 0.72rem; color: var(--text-muted); margin-bottom: 5px; }
.po-capacity-top b { font-size: 0.78rem; }
.po-deadline { font-size: 0.72rem; color: var(--text-soft); border-top: 1px solid var(--border); padding-top: 8px; }

.keterangan-box { display: flex; flex-direction: column; gap: 12px; padding: 4px 2px; }
.keterangan-item { display: flex; gap: 10px; font-size: 0.76rem; }
.keterangan-item svg { flex-shrink: 0; margin-top: 2px; }
.keterangan-item b { display: block; font-size: 0.8rem; margin-bottom: 2px; }
.keterangan-item span { color: var(--text-muted); }

/* ---------- PO capacity progress list ---------- */
.capacity-list { display: flex; flex-direction: column; gap: 12px; }
.capacity-row { display: grid; grid-template-columns: 140px 1fr 90px 100px; align-items: center; gap: 12px; }
.capacity-name { font-size: 0.82rem; font-weight: 600; }
.capacity-bar-track { background: #eef0f5; border-radius: 999px; height: 8px; overflow: hidden; }
.capacity-bar-fill { height: 100%; border-radius: 999px; }
.capacity-count { font-size: 0.76rem; color: var(--text-muted); text-align: right; white-space: nowrap; }

/* ---------- Rekap: fulfillment status ---------- */
.fulfillment-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.fulfillment-group { border: 1px solid var(--border); border-radius: 12px; padding: 14px; }
.fulfillment-group-label { display: flex; align-items: center; gap: 7px; font-size: 0.78rem; font-weight: 700; color: var(--text-muted); margin-bottom: 12px; }
.fulfillment-overall { border-top: 1px solid var(--border); padding-top: 14px; }

/* ---------- Actionable alert banner ---------- */
.alert-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fdf1e0;
  border: 1px solid #f3d9ad;
  color: #8a5a12;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 14px;
  font-size: 0.8rem;
}
.alert-banner svg { flex-shrink: 0; color: #e07a1f; }

/* ---------- Settings ---------- */
.settings-tabs {
  display: flex;
  gap: 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 18px;
  overflow-x: auto;
}
.settings-tab {
  background: none; border: none; cursor: pointer; padding: 0 2px 12px; font-size: 0.85rem;
  font-weight: 600; color: var(--text-muted); border-bottom: 2px solid transparent; white-space: nowrap; font-family: inherit;
}
.settings-tab.active { color: var(--orange); border-bottom-color: var(--orange); }

.settings-grid { display: grid; grid-template-columns: 1fr 1fr 300px; gap: 14px; align-items: start; margin-bottom: 14px; }
.field-group { margin-bottom: 14px; }
.field-group:last-child { margin-bottom: 0; }
.field-label { font-size: 0.76rem; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; display: block; }
.password-field-wrap { position: relative; }
.password-field-wrap .field-input { padding-right: 40px; width: 100%; }
.password-toggle-btn {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  color: var(--text-soft);
  display: flex;
  align-items: center;
  justify-content: center;
}
.password-toggle-btn:hover { color: var(--text-muted); }

.field-select, .field-input {
  width: 100%; border: 1px solid var(--border); border-radius: 9px; padding: 9px 12px; font-size: 0.82rem;
  color: var(--text); font-family: inherit; background: var(--card);
}
.field-input.field-error { border-color: var(--red); background: #fff8f8; }

/* ---------- Login screen ---------- */
.login-screen {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: linear-gradient(180deg, var(--navy) 0%, #0a1330 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-card {
  background: var(--card);
  border-radius: 18px;
  padding: 32px 28px;
  width: 100%;
  max-width: 380px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}
.login-logo { display: flex; justify-content: center; margin-bottom: 14px; }
.login-card h1 { font-size: 1.2rem; font-weight: 800; margin: 0 0 4px; }
.login-card p#loginStoreTagline { font-size: 0.78rem; color: var(--text-muted); margin: 0; }
.login-card .field-group { text-align: left; }

.upload-preview-box {
  height: 160px;
  border: 2px dashed var(--border);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text-soft);
  font-size: 0.78rem;
  margin-bottom: 14px;
  overflow: hidden;
  background: var(--bg);
}
.upload-preview-box img { width: 100%; height: 100%; object-fit: cover; }
.field-row { display: flex; gap: 10px; }
.field-row > div { flex: 1; }

.toggle-switch { position: relative; display: inline-block; width: 38px; height: 21px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; inset: 0; background: #d5d9e3; border-radius: 999px; transition: 0.15s; cursor: pointer; }
.toggle-slider::before { content: ""; position: absolute; width: 15px; height: 15px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: 0.15s; }
.toggle-switch input:checked + .toggle-slider { background: var(--green); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(17px); }

.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.toggle-row:last-child { margin-bottom: 0; }
.toggle-row .t { font-size: 0.82rem; font-weight: 500; }

.checkbox-row { display: flex; align-items: center; gap: 9px; font-size: 0.82rem; margin-bottom: 10px; }
.checkbox-row input { width: 16px; height: 16px; accent-color: var(--orange); }

.info-box {
  background: rgba(47, 111, 237, 0.08);
  border: 1px solid rgba(47, 111, 237, 0.18);
  border-radius: var(--radius);
  padding: 16px;
}
.info-box h4 { margin: 0 0 10px; font-size: 0.88rem; display: flex; align-items: center; gap: 8px; }
.info-box a { display: flex; align-items: center; gap: 8px; color: var(--blue); text-decoration: none; font-size: 0.8rem; font-weight: 600; padding: 6px 0; }

.sysinfo-row { display: flex; justify-content: space-between; font-size: 0.78rem; padding: 6px 0; color: var(--text-muted); }
.sysinfo-row b { color: var(--text); font-weight: 600; }

.color-swatches { display: flex; gap: 8px; }
.swatch { width: 24px; height: 24px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; }
.swatch.selected { border-color: var(--text); }

.radio-row { display: flex; gap: 18px; align-items: center; }
.radio-row label { display: flex; align-items: center; gap: 6px; font-size: 0.82rem; cursor: pointer; }

/* ---------- Ringkasan cepat strip ---------- */
.quick-strip {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.quick-strip .item { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 140px; }
.quick-strip .qicon { width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.quick-strip .qv { font-weight: 700; font-size: 0.95rem; }
.quick-strip .ql { font-size: 0.68rem; color: var(--text-muted); }

.note-item { display: flex; gap: 9px; font-size: 0.78rem; margin-bottom: 12px; }
.note-item:last-child { margin-bottom: 0; }
.note-item svg { flex-shrink: 0; margin-top: 1px; }
.note-item .muted { color: var(--text-muted); }

.wa-icon { color: #25d366; }
.wa-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #e9fbf1;
  flex-shrink: 0;
  transition: background 0.15s ease, transform 0.1s ease;
}
.wa-icon-btn:hover { background: #d3f7e0; transform: scale(1.05); }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 15, 35, 0.5);
  z-index: 100;
  display: none;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
  padding: 40px 16px;
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: var(--card);
  border-radius: var(--radius);
  width: 100%;
  max-width: 560px;
  box-shadow: 0 20px 60px rgba(10, 15, 35, 0.3);
  margin: auto;
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-head h3 { margin: 0; font-size: 1.02rem; font-weight: 700; }
.modal-body { padding: 20px; max-height: 65vh; overflow-y: auto; }
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}

.product-pick-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.product-pick-row:last-child { border-bottom: none; }
.product-pick-row input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--orange); flex-shrink: 0; }
.product-pick-row .pname { flex: 1; font-size: 0.83rem; font-weight: 600; }
.product-pick-row input.field-input { width: 90px; padding: 6px 10px; font-size: 0.78rem; }

.checkbox-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 8px;
  cursor: pointer;
}
.checkbox-card input { width: 16px; height: 16px; accent-color: var(--orange); margin-top: 2px; flex-shrink: 0; }
.checkbox-card b { display: block; font-size: 0.83rem; margin-bottom: 2px; }
.checkbox-card span { font-size: 0.74rem; color: var(--text-muted); }

.paymethod-detail {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  margin: 4px 0 10px 26px;
}

.color-combo-row { display: flex; gap: 10px; flex-wrap: wrap; }
.color-combo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
  flex: 1;
  min-width: 90px;
}
.color-combo input { position: absolute; opacity: 0; pointer-events: none; }
.color-combo.selected { border-color: var(--orange); background: rgba(255, 122, 26, 0.1); }
.combo-dots { display: flex; }
.combo-dots span { width: 18px; height: 18px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--border); }
.combo-dots span:last-child { margin-left: -8px; }
.combo-label { font-size: 0.74rem; font-weight: 600; text-align: center; }

/* ---------- Ongkir rows ---------- */
.ongkir-head {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 32px;
  gap: 10px;
  margin-bottom: 6px;
}
.ongkir-head span { font-size: 0.72rem; font-weight: 600; color: var(--text-muted); }
.ongkir-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 32px;
  gap: 10px;
  margin-bottom: 8px;
  align-items: center;
}
.ongkir-remove {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--red);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ongkir-remove:hover { background: #fdeaea; }

/* ---------- Map picker ---------- */
#mapPicker {
  height: 360px;
  width: 100%;
  background: #eef0f5;
}
.map-fallback {
  height: 360px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 0.82rem;
  padding: 20px;
  text-align: center;
}

.map-search-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 12px;
  border: none;
  border-bottom: 1px solid var(--border);
  background: var(--card);
  cursor: pointer;
  font-size: 0.79rem;
  font-family: inherit;
  color: var(--text);
}
.map-search-item:last-child { border-bottom: none; }
.map-search-item:hover { background: var(--bg); }

.empty-state-mini {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 50px 20px;
  color: var(--text-soft);
  gap: 10px;
}
.empty-state-mini svg { opacity: 0.5; }
.empty-state-mini p { font-size: 0.82rem; margin: 0; max-width: 220px; }

.empty-state-row td {
  text-align: center;
  padding: 48px 20px !important;
  color: var(--text-soft);
}
.empty-state-row .es-icon {
  width: 48px; height: 48px; border-radius: 14px; background: var(--bg);
  display: flex; align-items: center; justify-content: center; margin: 0 auto 12px;
  color: var(--text-soft);
}
.empty-state-row .es-title { font-size: 0.88rem; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.empty-state-row .es-sub { font-size: 0.8rem; color: var(--text-muted); }

.bulk-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: rgba(255, 122, 26, 0.12);
  border: 1px solid #ffdcae;
  border-radius: 10px;
  padding: 10px 16px;
  margin: 0 18px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #8a5a12;
}

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .stat-grid { grid-template-columns: repeat(3, 1fr); }
  .row-3 { grid-template-columns: 1fr 1fr; }
  .row-3 > :nth-child(3) { grid-column: span 2; }
}

@media (max-width: 860px) {
  .sidebar {
    transform: translateX(-100%);
    width: 240px;
  }
  .sidebar.open { transform: translateX(0); box-shadow: 20px 0 40px rgba(0,0,0,0.2); }
  .main { margin-left: 0; padding: 16px 16px 32px; }
  .menu-toggle { display: flex; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .row-3 { grid-template-columns: 1fr; }
  .row-3 > :nth-child(3) { grid-column: span 1; }
  .row-2 { grid-template-columns: 1fr; }
  .sidebar-backdrop.show { display: block; }
  .date-picker span { display: none; }
  .page-title { font-size: 1.25rem; }
}

@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .card-pad { padding: 15px; }
}

.stat-grid-6 { grid-template-columns: repeat(6, 1fr); }

@media (max-width: 1180px) {
  .split-layout { grid-template-columns: 1fr; }
  .list-detail-layout { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr 1fr; }
  .settings-grid > :nth-child(3) { grid-column: span 2; }
  .stat-grid-6 { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 860px) {
  .topbar-date span { display: inline; }
  .topbar-user .who { display: none; }
  .page-header { flex-direction: column; }
  .settings-grid { grid-template-columns: 1fr; }
  .settings-grid > :nth-child(3) { grid-column: span 1; }
  .quick-strip { flex-direction: column; }
  .stat-grid-6 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .topbar-date, .topbar-date-plain { display: none; }
  .filter-bar { flex-direction: column; }
  .filter-select, .filter-search { width: 100%; }
  .ongkir-head { display: none; }
  .ongkir-row { grid-template-columns: 1fr 1fr; grid-template-areas: "a b" "c d"; }
  .capacity-row { grid-template-columns: 1fr; gap: 6px; }
  .capacity-count { text-align: left; }
  .fulfillment-grid { grid-template-columns: 1fr; }
}

/* ---------- Pengaturan Tampilan: Tema Gelap ---------- */
body.theme-dark {
  --bg: #10131f;
  --card: #1a1e2e;
  --border: #2a2f42;
  --text: #eef0f6;
  --text-muted: #9aa1b9;
  --text-soft: #6b7290;
}
body.theme-dark .login-screen { background: #0a0c14; }
body.theme-dark .sidebar { background: #0a0c14; }

/* ---------- Pengaturan Tampilan: Kombinasi Warna ---------- */
/* Sidebar/login selalu pakai teks putih, jadi --navy harus tetap gelap & pekat agar kontras terjaga */
body.theme-blossom { --orange: #EC4899; --orange-dark: #db2777; --navy: #4a1942; --navy-2: #5b2150; --orange-glow: rgba(236, 72, 153, 0.18); }
body.theme-earth-tone { --orange: #C08552; --orange-dark: #9c6a3f; --navy: #2d3320; --navy-2: #33392a; --orange-glow: rgba(192, 133, 82, 0.18); }

@keyframes spin-sync {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
