/*
 * SUPERAPP design system (navy + maroon, 2026-11-08)
 *
 * Principles: dark navy for structure (sidebar, phone header, highlight
 * card), maroon as the single action/accent colour, cool grey-white
 * surfaces. Soft rounded cards (10px) with light shadows, pill tags,
 * thumb-friendly controls. Data first: tabular numerals, clear hierarchy.
 * Red for errors is brighter than the maroon accent so the two never mix.
 *
 * Layers: tokens -> Bootstrap overrides -> shell -> components -> pages.
 * Breakpoint rules live in responsive.css.
 */

/* ------------------------------------------------------------------ tokens */
:root {
  --c-text: #142039;
  --c-muted: #5d6880;
  --c-faint: #8a93a8;
  --c-line: #dfe4ee;
  --c-line-soft: #edf0f6;
  --c-bg: #f2f4f8;
  --c-surface: #ffffff;
  --c-surface-2: #f7f8fb;

  /* navy (structure) */
  --c-navy: #0b1530;
  --c-navy-2: #13224a;
  --c-navy-3: #1c2f5e;
  --c-navy-line: #1f3263;
  --c-navy-text: #aab6cf;
  --c-navy-strong: #ffffff;

  /* maroon (action + accent) */
  --c-accent: #8c1d33;
  --c-accent-hover: #731729;
  --c-accent-soft: #f7e9ec;
  --c-accent-line: #ebc9d0;
  --c-accent-bright: #e0607a; /* accent on navy backgrounds */

  --c-ok: #15803d;
  --c-ok-soft: #e8f5ec;
  --c-ok-line: #b9e0c6;
  --c-warn: #9a5800;
  --c-warn-soft: #fdf4e3;
  --c-warn-line: #f0d9a8;
  --c-danger: #d42a2a;
  --c-danger-soft: #fdecec;
  --c-danger-line: #f5c2c2;

  --radius: 10px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(11, 21, 48, 0.05), 0 1px 3px rgba(11, 21, 48, 0.06);
  --shadow-md: 0 10px 30px rgba(11, 21, 48, 0.12);
  --ring: 0 0 0 3px rgba(140, 29, 51, 0.18);

  --sidebar-w: 236px;
  --topbar-h: 60px;

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ---------------------------------------------------- Bootstrap overrides */
:root {
  --bs-body-font-family: var(--font);
  --bs-body-font-size: 0.9rem;
  --bs-body-color: var(--c-text);
  --bs-body-bg: var(--c-bg);
  --bs-border-color: var(--c-line);
  --bs-border-radius: var(--radius-sm);
  --bs-border-radius-sm: var(--radius-sm);
  --bs-border-radius-lg: var(--radius);
  --bs-link-color: var(--c-accent);
  --bs-link-color-rgb: 140, 29, 51;
  --bs-link-hover-color: var(--c-accent-hover);
  --bs-link-hover-color-rgb: 115, 23, 41;
  --bs-secondary-color: var(--c-muted);
  --bs-primary: var(--c-accent);
  --bs-primary-rgb: 140, 29, 51;
}

body {
  font-family: var(--font);
  color: var(--c-text);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

h1, h2, h3, h4, h5, h6 { font-weight: 650; letter-spacing: -0.01em; color: var(--c-text); }

.btn {
  --bs-btn-border-radius: var(--radius-sm);
  --bs-btn-padding-y: 0.5rem;
  --bs-btn-padding-x: 1rem;
  --bs-btn-font-size: 0.875rem;
  --bs-btn-font-weight: 600;
  transition: background-color 0.12s, border-color 0.12s, color 0.12s, box-shadow 0.12s;
}
.btn-sm { --bs-btn-padding-y: 0.32rem; --bs-btn-padding-x: 0.75rem; --bs-btn-font-size: 0.8125rem; }

.btn-primary {
  --bs-btn-bg: var(--c-accent);
  --bs-btn-border-color: var(--c-accent);
  --bs-btn-hover-bg: var(--c-accent-hover);
  --bs-btn-hover-border-color: var(--c-accent-hover);
  --bs-btn-active-bg: var(--c-accent-hover);
  --bs-btn-active-border-color: var(--c-accent-hover);
  --bs-btn-disabled-bg: var(--c-accent);
  --bs-btn-disabled-border-color: var(--c-accent);
  --bs-btn-focus-shadow-rgb: 140, 29, 51;
  box-shadow: 0 1px 2px rgba(140, 29, 51, 0.25);
}
.btn-outline-secondary {
  --bs-btn-color: var(--c-text);
  --bs-btn-bg: var(--c-surface);
  --bs-btn-border-color: var(--c-line);
  --bs-btn-hover-bg: var(--c-surface-2);
  --bs-btn-hover-color: var(--c-text);
  --bs-btn-hover-border-color: #c9d1e0;
  --bs-btn-active-bg: var(--c-line-soft);
  --bs-btn-active-color: var(--c-text);
  --bs-btn-active-border-color: #c9d1e0;
}
.btn-outline-danger { --bs-btn-color: var(--c-danger); --bs-btn-border-color: var(--c-danger-line); --bs-btn-hover-bg: var(--c-danger); --bs-btn-hover-border-color: var(--c-danger); --bs-btn-hover-color: #fff; }
.btn-outline-primary { --bs-btn-color: var(--c-accent); --bs-btn-border-color: var(--c-accent-line); --bs-btn-hover-bg: var(--c-accent); --bs-btn-hover-border-color: var(--c-accent); --bs-btn-hover-color: #fff; --bs-btn-active-bg: var(--c-accent-hover); --bs-btn-active-border-color: var(--c-accent-hover); }
.btn-outline-success { --bs-btn-color: var(--c-ok); --bs-btn-border-color: var(--c-ok-line); --bs-btn-hover-bg: var(--c-ok); --bs-btn-hover-border-color: var(--c-ok); --bs-btn-hover-color: #fff; }
.btn-outline-warning { --bs-btn-color: var(--c-warn); --bs-btn-border-color: var(--c-warn-line); --bs-btn-hover-bg: var(--c-warn); --bs-btn-hover-border-color: var(--c-warn); --bs-btn-hover-color: #fff; }
.btn-warning { --bs-btn-bg: var(--c-warn); --bs-btn-border-color: var(--c-warn); --bs-btn-color: #fff; --bs-btn-hover-bg: #7c4700; --bs-btn-hover-border-color: #7c4700; --bs-btn-hover-color: #fff; }

.form-control, .form-select {
  border-radius: var(--radius-sm);
  border-color: var(--c-line);
  background-color: var(--c-surface);
  font-size: 0.9rem;
  padding: 0.55rem 0.8rem;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.form-control::placeholder { color: var(--c-faint); }
.form-control:hover, .form-select:hover { border-color: #c9d1e0; }
.form-control:focus, .form-select:focus { border-color: var(--c-accent); box-shadow: var(--ring); }
.form-control-sm, .form-select-sm { padding: 0.38rem 0.65rem; font-size: 0.8125rem; }
.form-label { font-weight: 600; font-size: 0.8125rem; margin-bottom: 0.35rem; color: var(--c-text); }
.form-text { font-size: 0.78rem; color: var(--c-muted); }
.input-group > .btn { border-color: var(--c-line); }

.alert { border-radius: var(--radius-sm); font-size: 0.875rem; padding: 0.7rem 0.95rem; border-width: 1px; border-left-width: 4px; }
.alert-success { background: var(--c-ok-soft); border-color: var(--c-ok-line); border-left-color: var(--c-ok); color: #14532d; }
.alert-danger { background: var(--c-danger-soft); border-color: var(--c-danger-line); border-left-color: var(--c-danger); color: #8a1414; }
.alert-warning { background: var(--c-warn-soft); border-color: var(--c-warn-line); border-left-color: var(--c-warn); color: #5c3500; }
.alert-info { background: #eef2fa; border-color: #d3dcef; border-left-color: var(--c-navy-3); color: var(--c-navy-2); }

.modal { --bs-modal-bg: var(--c-surface); }
.modal-content { background: var(--c-surface); border-radius: var(--radius-lg); border: 0; box-shadow: var(--shadow-md); }
.modal-header, .modal-footer { border-color: var(--c-line-soft); padding-left: 1.25rem; padding-right: 1.25rem; }
.modal-body { padding: 1.1rem 1.25rem; }
.modal-title { font-size: 1.0625rem; font-weight: 650; }
.modal-backdrop.show { opacity: 0.55; }
.modal-backdrop { background-color: var(--c-navy); }
.dropdown-menu { border-radius: var(--radius); border-color: var(--c-line); font-size: 0.875rem; box-shadow: var(--shadow-md); padding: 0.35rem; }
.dropdown-item { padding: 0.5rem 0.75rem; border-radius: 6px; }
.dropdown-item:hover { background: var(--c-surface-2); }
.dropdown-item:active { background: var(--c-accent); color: #fff; }

/* -------------------------------------------------------------- app shell */
.app-sidebar {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  width: var(--sidebar-w);
  background: var(--c-navy);
  color: var(--c-navy-text);
  display: flex;
  flex-direction: column;
  z-index: 1040;
  overflow-y: auto;
}

.brand {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0 1.25rem;
  color: var(--c-navy-strong);
  font-weight: 750;
  letter-spacing: 0.06em;
  font-size: 0.98rem;
  flex: none;
}
.brand-mark {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: var(--c-accent);
  flex: none;
  position: relative;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}
.brand-mark::after {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 3px;
  background: #fff;
  opacity: 0.92;
}

.nav-groups { padding: 0.4rem 0.75rem 1rem; flex: 1; }
.nav-group-title {
  padding: 1rem 0.6rem 0.4rem;
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #6f7d9c;
  font-weight: 700;
}
.side-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.55rem 0.7rem;
  margin: 1px 0;
  color: var(--c-navy-text);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: background-color 0.12s, color 0.12s;
}
.side-link:hover { background: var(--c-navy-2); color: var(--c-navy-strong); }
.side-link.is-active {
  background: var(--c-navy-3);
  color: var(--c-navy-strong);
  font-weight: 600;
}
.side-link.is-active::before {
  content: "";
  position: absolute;
  left: -0.75rem;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--c-accent-bright);
}
.side-link.is-active .icon { color: var(--c-accent-bright); }
.side-link.is-disabled { color: #56638a; cursor: default; }
.side-link.is-disabled:hover { background: transparent; color: #56638a; }
.side-link .icon { width: 18px; height: 18px; flex: none; }
.side-soon {
  margin-left: auto;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: #7f8cab;
  background: var(--c-navy-2);
  border-radius: 999px;
  padding: 1px 7px;
  white-space: nowrap;
}
.sidebar-foot { padding: 0.9rem 1.25rem; border-top: 1px solid var(--c-navy-line); font-size: 0.7rem; color: #6f7d9c; }

.app-topbar {
  position: fixed;
  top: 0;
  left: var(--sidebar-w);
  right: 0;
  height: var(--topbar-h);
  background: rgba(255, 255, 255, 0.92);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--c-line);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0 1.75rem;
  z-index: 1030;
}
.topbar-title { font-weight: 650; font-size: 1rem; margin: 0; }
.topbar-brand { display: none; align-items: center; gap: 0.55rem; font-weight: 750; letter-spacing: 0.06em; font-size: 0.95rem; }
.topbar-spacer { flex: 1; }
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid transparent;
  border-radius: 50%;
  background: transparent;
  color: var(--c-text);
  padding: 0;
  transition: background-color 0.12s;
}
.icon-btn:hover { background: var(--c-line-soft); }
.icon-btn .icon { width: 19px; height: 19px; }
.menu-btn { display: none; }

.user-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 999px;
  padding: 0.2rem 0.75rem 0.2rem 0.2rem;
  color: var(--c-text);
  text-align: left;
  transition: background-color 0.12s;
}
.user-btn:hover { background: var(--c-line-soft); }
.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--c-accent);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.user-meta { line-height: 1.2; }
.user-name { font-size: 0.8125rem; font-weight: 650; display: block; }
.user-role { font-size: 0.66rem; color: var(--c-muted); letter-spacing: 0.06em; font-weight: 600; }

.app-main {
  margin-left: var(--sidebar-w);
  padding: calc(var(--topbar-h) + 1.75rem) 1.75rem 2.5rem;
  min-height: 100vh;
}
.app-main-inner { max-width: 1280px; margin: 0 auto; }
/* Loading: the frame (sidebar + top bar) is visible at once; the content area
   shows a spinner until the page has its data. Pure CSS, so it paints before
   any JavaScript or network call finishes. */
body.is-loading .app-main-inner { visibility: hidden; }
body.is-loading .app-main::before {
  content: "";
  position: fixed;
  top: 50%;
  left: calc(50% + var(--sidebar-w) / 2);
  width: 30px;
  height: 30px;
  margin: -15px 0 0 -15px;
  border: 3px solid var(--c-line);
  border-top-color: var(--c-accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
body.is-loading .app-main::after {
  content: "Memuat...";
  position: fixed;
  top: calc(50% + 28px);
  left: calc(50% + var(--sidebar-w) / 2);
  transform: translateX(-50%);
  color: var(--c-muted);
  font-size: 0.8125rem;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
body:not(.is-loading) .app-main-inner { animation: rise 0.22s ease-out; }
.sidebar-scrim { display: none; }

/* -------------------------------------------------------------- components */
.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 1.4rem;
}
.page-title { font-size: 1.5rem; font-weight: 700; margin: 0; letter-spacing: -0.02em; }
.page-sub { color: var(--c-muted); font-size: 0.85rem; margin: 0.25rem 0 0; }
.page-tools { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.page-tools .form-control { width: auto; }
.page-tools .form-select { width: auto; }

.panel {
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.panel:has(.dropdown-menu.show) { overflow: visible; }
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.9rem 1.2rem;
  border-bottom: 1px solid var(--c-line-soft);
}
.panel-title { font-size: 0.95rem; font-weight: 650; margin: 0; }
.panel-note { font-size: 0.75rem; color: var(--c-muted); }
.panel-body { padding: 1.2rem; }
.panel-foot { padding: 0.7rem 1.2rem; border-top: 1px solid var(--c-line-soft); font-size: 0.78rem; color: var(--c-muted); background: var(--c-surface-2); }
.stack > * + * { margin-top: 1rem; }

/* KPI cards */
.kpi-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.9rem;
}
.kpi {
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 1rem 1.15rem;
  min-width: 0;
}
.kpi-label { font-size: 0.75rem; color: var(--c-muted); font-weight: 600; letter-spacing: 0.01em; }
.kpi-value {
  font-size: clamp(1.1rem, 1.7vw, 1.5rem);
  font-weight: 700;
  line-height: 1.25;
  margin-top: 0.3rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  white-space: nowrap;
}
.kpi-value.is-primary { font-size: clamp(1.15rem, 1.9vw, 1.7rem); }
.kpi-value.is-empty { color: var(--c-faint); font-weight: 500; }
.kpi-meta { font-size: 0.74rem; color: var(--c-muted); margin-top: 0.2rem; }
.progress-track { height: 6px; background: var(--c-line-soft); border-radius: 999px; margin-top: 0.65rem; overflow: hidden; }
.progress-fill { height: 100%; background: var(--c-accent); width: 0; border-radius: 999px; transition: width 0.4s ease-out; }

/* realisation card: one card for realisasi, pencapaian, sisa target and sources */
.real-card {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, var(--c-navy) 0%, var(--c-navy-3) 100%);
  color: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 1.5rem 1.6rem 1.25rem;
}
.real-card::after {
  content: "";
  position: absolute;
  right: -70px;
  top: -70px;
  width: 210px;
  height: 210px;
  border-radius: 50%;
  background: var(--c-accent);
  opacity: 0.38;
  pointer-events: none;
}
.real-card > * { position: relative; z-index: 1; }
.real-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.real-label { font-size: 0.8rem; font-weight: 600; color: var(--c-navy-text); letter-spacing: 0.02em; }
.real-amount {
  font-size: clamp(2rem, 5.2vw, 3rem);
  font-weight: 750;
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin-top: 0.35rem;
  white-space: nowrap;
}
.real-amount.is-empty { color: rgba(255, 255, 255, 0.55); }
.real-sub { font-size: 0.85rem; color: var(--c-navy-text); margin-top: 0.3rem; min-height: 1.2em; }
.real-sub a { color: #fff; text-decoration: underline; }
.real-percent {
  font-size: clamp(1.4rem, 3vw, 2rem);
  font-weight: 750;
  letter-spacing: -0.02em;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  padding: 0.25rem 0.9rem;
  white-space: nowrap;
}
.real-progress {
  height: 12px;
  margin-top: 1.1rem;
  background: rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  overflow: hidden;
}
.real-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--c-accent-bright), #ff9db0);
  transition: width 0.5s ease-out;
}
.real-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem 1rem;
  margin-top: 1.1rem;
}
.real-stats span { display: block; font-size: 0.72rem; color: var(--c-navy-text); font-weight: 600; }
.real-stats b { display: block; font-size: 0.95rem; font-weight: 650; margin-top: 0.1rem; font-variant-numeric: tabular-nums; }
.real-stats small { display: block; margin-top: 0.1rem; font-size: 0.72rem; color: var(--c-navy-text); font-weight: 500; }
.real-sources { margin-top: 1.1rem; padding-top: 1rem; border-top: 1px solid rgba(255, 255, 255, 0.14); }
.real-sources-title { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--c-navy-text); margin-bottom: 0.6rem; }
.real-source + .real-source { margin-top: 0.65rem; }
.real-source-head { display: flex; justify-content: space-between; gap: 1rem; font-size: 0.875rem; font-weight: 600; }
.real-source-value { font-variant-numeric: tabular-nums; white-space: nowrap; }
.real-source-share { margin-left: 0.5rem; color: var(--c-navy-text); font-weight: 500; }
.real-source-track { height: 6px; margin-top: 0.3rem; background: rgba(255, 255, 255, 0.14); border-radius: 999px; overflow: hidden; }
.real-source-track i { display: block; height: 100%; background: #fff; border-radius: 999px; opacity: 0.85; }
.real-source-empty { font-size: 0.85rem; color: var(--c-navy-text); }
.real-source-status { color: var(--c-navy-text); font-weight: 500; font-size: 0.8125rem; }
.real-source-warn { margin-top: 0.3rem; font-size: 0.74rem; color: #ffd9a0; }
.real-note { font-size: 0.74rem; color: var(--c-navy-text); margin-top: 0.7rem; }

.section-title {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--c-muted);
  margin: 1.6rem 0 0.75rem;
}
.section-title span { text-transform: none; letter-spacing: 0; font-weight: 500; color: var(--c-faint); margin-left: 0.4rem; }

.kpi-value.kpi-text { font-size: clamp(1rem, 1.5vw, 1.2rem); white-space: normal; overflow-wrap: anywhere; }
.insight-list { list-style: none; margin: 0; padding: 0.4rem 1.2rem 0.6rem; }
.insight-list li {
  position: relative;
  padding: 0.55rem 0 0.55rem 1.1rem;
  font-size: 0.875rem;
  border-bottom: 1px solid var(--c-line-soft);
}
.insight-list li:last-child { border-bottom: 0; }
.insight-list li::before { content: ""; position: absolute; left: 0; top: 1.05rem; width: 6px; height: 6px; border-radius: 50%; background: var(--c-accent); }

/* data tables */
.table-scroll { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.8125rem; font-variant-numeric: tabular-nums; }
.data-table th {
  background: var(--c-surface-2);
  color: var(--c-muted);
  font-weight: 650;
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-align: left;
  padding: 0.65rem 1.1rem;
  border-bottom: 1px solid var(--c-line);
  white-space: nowrap;
}
.data-table td { padding: 0.75rem 1.1rem; border-bottom: 1px solid var(--c-line-soft); vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr { transition: background-color 0.1s; }
.data-table tbody tr:hover td { background: #f9fafc; }
.data-table .cell-name { min-width: 130px; font-weight: 600; }
.data-table .num { text-align: right; white-space: nowrap; }
.data-table .actions { text-align: right; white-space: nowrap; }
.data-table .actions .btn + .btn { margin-left: 0.3rem; }
.data-table .empty-row td { text-align: center; color: var(--c-muted); padding: 2.2rem 1rem; }

.data-table .cell-missing { color: var(--c-faint); font-style: italic; }
.data-table .cell-total { font-weight: 650; }
.data-table tr.row-total td { font-weight: 700; background: var(--c-surface-2); }
.data-table .cell-warn { color: var(--c-warn); font-weight: 600; margin-left: 0.25rem; }

/* status tags (pills) */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.7rem;
  font-weight: 650;
  letter-spacing: 0.02em;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid var(--c-line);
  background: var(--c-surface-2);
  color: var(--c-muted);
  white-space: nowrap;
}
.tag-ok { background: var(--c-ok-soft); border-color: var(--c-ok-line); color: var(--c-ok); }
.tag-danger { background: var(--c-danger-soft); border-color: var(--c-danger-line); color: var(--c-danger); }
.tag-accent { background: var(--c-accent-soft); border-color: var(--c-accent-line); color: var(--c-accent); }
.tag-dark { background: var(--c-navy); border-color: var(--c-navy); color: #fff; }

/* charts */
.chart { width: 100%; }
.chart svg { display: block; width: 100%; height: auto; }
.chart .grid-line { stroke: var(--c-line-soft); stroke-width: 1; }
.chart .axis-text { fill: var(--c-muted); font-size: 10px; font-family: var(--font); }
.chart .bar { fill: var(--c-navy-3); transition: fill 0.12s; }
.chart .bar:hover { fill: var(--c-accent); }
.chart .bar.bar-hi { fill: var(--c-accent); }
.chart .line { fill: none; stroke: var(--c-navy-3); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: var(--c-navy-3); fill-opacity: 0.1; }
.chart .dot { fill: var(--c-accent); stroke: var(--c-surface); stroke-width: 2; pointer-events: none; }
.chart .hit-zone { fill: transparent; cursor: pointer; }
.chart .col-selected { fill: var(--c-accent); fill-opacity: 0.1; pointer-events: none; }
.chart .hit { fill: transparent; }
.chart .hit:hover { fill: rgba(140, 29, 51, 0.18); }
.chart .hit.is-clickable { cursor: pointer; }
.chart .hit.is-clickable:focus { outline: none; fill: rgba(140, 29, 51, 0.22); stroke: var(--c-accent); stroke-width: 1.5; }
.chart .dot-selected { fill: none; stroke: var(--c-accent); stroke-width: 2; pointer-events: none; }

/* Small popup with a day's summary, next to the chosen dot */
.chart-host { position: relative; }
.day-pop { position: absolute; z-index: 5; width: min(340px, calc(100% - 8px)); background: var(--c-surface); border: 1px solid var(--c-line); border-radius: 10px; box-shadow: 0 8px 24px rgba(15, 23, 42, 0.16); padding: 0.6rem 0.75rem 0.7rem; font-size: 0.8rem; line-height: 1.4; }
.day-pop-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.15rem; }
.day-pop-head b { font-size: 0.86rem; }
.day-pop-close { border: 0; background: transparent; color: var(--c-muted); font-size: 1.25rem; line-height: 1; padding: 0 0.25rem; cursor: pointer; }
.day-pop-close:hover { color: var(--c-accent); }
.day-pop-sum { margin: 0 0 0.4rem; font-weight: 650; color: var(--c-accent); }
.day-pop-line { margin: 0 0 0.2rem; color: var(--c-ink, inherit); }
.day-pop-line b { color: var(--c-muted); font-weight: 650; }
.day-pop-link { display: inline-block; margin-top: 0.35rem; font-weight: 650; color: var(--c-accent); text-decoration: none; }
.day-pop-link:hover { text-decoration: underline; }

/* stacked columns + legend (sources: navy, maroon, slate) */
.chart .seg-0, .chart-legend .swatch.seg-0 { fill: var(--c-navy-3); background: var(--c-navy-3); }
.chart .seg-1, .chart-legend .swatch.seg-1 { fill: var(--c-accent); background: var(--c-accent); }
.chart .seg-2, .chart-legend .swatch.seg-2 { fill: #8493b0; background: #8493b0; }
.chart .stack:hover .seg { opacity: 0.82; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 0.35rem 1.1rem; margin-top: 0.7rem; font-size: 0.78rem; color: var(--c-muted); }
.chart-legend-item { display: inline-flex; align-items: center; gap: 0.4rem; }
.chart-legend .swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }

/* ranked horizontal bars */
.hbar-list { display: grid; gap: 0.85rem; }
.hbar-head { display: flex; align-items: baseline; justify-content: space-between; gap: 0.75rem; font-size: 0.84rem; }
.hbar-label { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.hbar-value { font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--c-text); font-weight: 650; }
.hbar-share { margin-left: 0.45rem; color: var(--c-muted); font-weight: 500; font-size: 0.78rem; }
.hbar-track { height: 10px; margin-top: 0.3rem; background: var(--c-line-soft); border-radius: 999px; overflow: hidden; }
.hbar-track i { display: block; height: 100%; background: var(--c-navy-3); border-radius: 999px; }
.hbar-track i.is-top { background: var(--c-accent); }
.empty-state { color: var(--c-muted); font-size: 0.8125rem; text-align: center; padding: 2.4rem 1rem; }

.info-list dt { font-size: 0.7rem; font-weight: 650; color: var(--c-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.info-list dd { margin: 0.15rem 0 1rem; word-break: break-word; font-weight: 500; }
.info-list dd:last-child { margin-bottom: 0; }

.soft-note {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  color: var(--c-muted);
  font-size: 0.8rem;
  padding: 0.85rem 1.1rem;
  border: 1px dashed #cdd5e3;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.6);
}

/* ---------------------------------------------------------- auth + utility */
body.auth {
  background:
    radial-gradient(circle at 85% 10%, rgba(140, 29, 51, 0.55) 0, rgba(140, 29, 51, 0) 38%),
    radial-gradient(circle at 10% 90%, rgba(28, 47, 94, 0.9) 0, rgba(28, 47, 94, 0) 45%),
    var(--c-navy);
  min-height: 100vh;
}
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.5rem; }
.auth-card {
  width: 100%;
  max-width: 410px;
  background: var(--c-surface);
  border: 0;
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}
.auth-head { padding: 2rem 1.9rem 0; }
.auth-brand { display: flex; align-items: center; gap: 0.65rem; font-weight: 750; letter-spacing: 0.06em; font-size: 1.15rem; }
.auth-brand .brand-mark { width: 32px; height: 32px; border-radius: 9px; }
.auth-brand .brand-mark::after { inset: 10px; }
.auth-sub { color: var(--c-muted); font-size: 0.85rem; margin: 0.5rem 0 0; }
.auth-body { padding: 1.5rem 1.9rem 1.9rem; }
.auth-body .btn-primary { padding-top: 0.65rem; padding-bottom: 0.65rem; }
.auth-foot { padding: 0.85rem 1.9rem; border-top: 1px solid var(--c-line-soft); text-align: center; font-size: 0.78rem; background: var(--c-surface-2); }
.util-page { max-width: 760px; margin: 0 auto; padding: 1.5rem 1rem 2.5rem; }
.util-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.status-row { display: flex; align-items: center; justify-content: space-between; padding: 0.65rem 0; border-bottom: 1px solid var(--c-line-soft); font-size: 0.875rem; }
.status-row:last-child { border-bottom: 0; }
.status-badge { font-size: 0.72rem; font-weight: 650; padding: 2px 10px; border-radius: 999px; border: 1px solid var(--c-line); background: var(--c-surface-2); color: var(--c-muted); }
.status-badge.is-ok { background: var(--c-ok-soft); border-color: var(--c-ok-line); color: var(--c-ok); }
.status-badge.is-error { background: var(--c-danger-soft); border-color: var(--c-danger-line); color: var(--c-danger); }
.status-badge.is-warn { background: var(--c-warn-soft); border-color: var(--c-warn-line); color: var(--c-warn); }
.status-badge.is-busy { background: var(--c-accent-soft); border-color: var(--c-accent-line); color: var(--c-accent); }

:focus-visible { outline: 2px solid var(--c-accent); outline-offset: 2px; }
.side-link:focus-visible { outline-offset: -2px; outline-color: var(--c-accent-bright); }
.visually-hidden-focusable { position: absolute; left: -999px; }

/* ------------------------------------------------ Gojek-style menu (phone) */
.tabbar { display: none; }
.phone-only { display: none; }

.menu-section + .menu-section { margin-top: 1.5rem; }
.menu-section-title {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--c-muted);
  margin: 0 0 0.8rem;
}
.menu-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1.1rem 0.4rem;
}
.menu-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  padding: 0;
  border: 0;
  background: none;
  color: var(--c-text);
  text-decoration: none;
  text-align: center;
  font-size: 0.74rem;
  line-height: 1.2;
}
.menu-tile:hover { color: var(--c-text); }
.menu-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: var(--c-accent-soft);
  color: var(--c-accent);
  transition: transform 0.1s, background-color 0.12s;
}
.menu-icon .icon { width: 25px; height: 25px; }
.menu-tile:nth-child(even) .menu-icon { background: #e9edf7; color: var(--c-navy-3); }
.menu-tile:hover .menu-icon { transform: translateY(-1px); }
.menu-tile:active .menu-icon { transform: scale(0.95); }
.menu-label { font-weight: 600; }
.menu-sub { font-size: 0.62rem; color: var(--c-faint); margin-top: -0.2rem; }
.menu-tile.is-disabled { color: var(--c-muted); cursor: default; }
.menu-tile.is-disabled .menu-icon,
.menu-tile.is-disabled:nth-child(even) .menu-icon { background: var(--c-surface-2); color: var(--c-faint); border: 1px dashed var(--c-line); transform: none; }

.toast-lite {
  display: none;
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(84px + env(safe-area-inset-bottom));
  max-width: 88vw;
  background: var(--c-navy);
  color: #fff;
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 0.65rem 1.1rem;
  border-radius: 999px;
  box-shadow: var(--shadow-md);
  z-index: 1060;
  text-align: center;
}

/* ------------------------------------------------ update dialog (blocking) */
.update-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(11, 21, 48, 0.7);
}
.update-box {
  width: 100%;
  max-width: 380px;
  background: var(--c-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 1.5rem;
  border-top: 4px solid var(--c-accent);
}
.update-title { font-size: 1.1rem; font-weight: 700; margin: 0 0 0.5rem; }
.update-text { font-size: 0.875rem; color: var(--c-muted); margin: 0 0 1.1rem; }

/* ------------------------------------------------ activity log page */
.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.7rem 0.8rem;
  align-items: end;
}
.filter-grid .form-label { margin-bottom: 0.25rem; font-size: 0.72rem; color: var(--c-muted); }
.filter-toggle { display: none; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; }
.pager-buttons { display: inline-flex; align-items: center; gap: 0.6rem; }
.pager-page { font-variant-numeric: tabular-nums; color: var(--c-text); font-size: 0.8125rem; font-weight: 600; }

/* Buku Tamu: choice groups and long addresses */
.choice-group { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.choice-group .form-check {
  margin: 0;
  padding: 0.4rem 0.8rem 0.4rem 2rem;
  border: 1px solid var(--c-line);
  border-radius: 999px;
  background: var(--c-surface);
  transition: border-color 0.12s, background-color 0.12s;
}
.choice-group .form-check:hover { border-color: #c9d1e0; }
.choice-group .form-check:has(.form-check-input:checked) { border-color: var(--c-accent); background: var(--c-accent-soft); }
.choice-group .form-check-input { margin-left: -1.4rem; margin-top: 0.2rem; }
.choice-group .form-check-label { font-size: 0.85rem; font-weight: 500; cursor: pointer; }
.form-check-input { border-color: #b9c2d3; }
.form-check-input:checked { background-color: var(--c-accent); border-color: var(--c-accent); }
.form-check-input:focus { border-color: var(--c-accent); box-shadow: var(--ring); }
@media (min-width: 576px) {
  .cell-address { max-width: 220px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}

@media (prefers-reduced-motion: reduce) {
  body:not(.is-loading) .app-main-inner { animation: none; }
  .progress-fill, .menu-icon, .btn { transition: none; }
}

/* Report Penjahit: two balance cards */
.kpi-strip.kpi-strip-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.kpi-strip.kpi-strip-2 .kpi-value { white-space: normal; overflow-wrap: anywhere; }

/* Revenue popup lines: label on the left, amount on the right */
.day-pop-row { display: flex; justify-content: space-between; gap: 0.75rem; margin: 0 0 0.15rem; }
.day-pop-row span:last-child { font-variant-numeric: tabular-nums; font-weight: 650; white-space: nowrap; }
.day-pop-sub { display: block; font-size: 0.72rem; color: var(--c-muted); }
