/*
 * MAKIPS — Design System / Global Stylesheet
 * Mobile-first, responsive, accessible, RTL-ready. Zero framework.
 */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--fs-md);
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { margin: 0 0 var(--space-3); line-height: 1.2; font-weight: 700; }
h1 { font-size: var(--fs-3xl); }
h2 { font-size: var(--fs-2xl); }
h3 { font-size: var(--fs-xl); }
p { margin: 0 0 var(--space-3); }
a { color: var(--brand-600); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Focus visible for keyboard navigation (accessibility) */
:focus-visible {
  outline: 3px solid var(--brand-400);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: var(--space-3); top: -60px;
  background: var(--brand-600); color: #fff; padding: var(--space-2) var(--space-4);
  border-radius: var(--radius); z-index: 1000; transition: top var(--transition);
}
.skip-link:focus { top: var(--space-3); }

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

.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-elevated);
  border-inline-end: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: fixed; inset-block: 0; inset-inline-start: 0; z-index: 70;
  transform: translateX(0);
  transition: transform var(--transition);
}
.sidebar__brand {
  display: flex; align-items: center; gap: var(--space-3);
  height: var(--topbar-h); padding-inline: var(--space-4); flex: none;
  border-bottom: 1px solid var(--border); font-weight: 800; font-size: var(--fs-lg);
}
.sidebar__logo {
  width: 34px; height: 34px; border-radius: var(--radius);
  background: linear-gradient(135deg, var(--brand-500), var(--brand-700));
  color: #fff; display: grid; place-items: center; font-weight: 800; flex: none;
}
/* min-height:0 WAJIB agar area menu bisa di-scroll saat daftar panjang
   (flex child default min-height:auto membuat overflow tidak men-scroll). */
.sidebar__nav {
  padding: var(--space-3); flex: 1 1 auto; min-height: 0;
  overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
}
.nav-group__label {
  font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-subtle); padding: var(--space-3) var(--space-3) var(--space-1);
}
.nav-item {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-2) var(--space-3); border-radius: var(--radius);
  color: var(--text-muted); cursor: pointer; font-weight: 600; font-size: var(--fs-sm);
  width: 100%; border: 0; background: transparent; text-align: start;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-item--active { background: var(--brand-50); color: var(--brand-700); }
:root[data-theme="dark"] .nav-item--active { background: rgba(53,111,240,.16); color: var(--brand-300); }
.nav-item__icon { width: 20px; text-align: center; flex: none; }

/* ---------- Accordion sub-menu ---------- */
.nav-item__chevron { font-size: 1rem; transition: transform var(--transition); opacity: .6; flex: none; }
.nav-accordion.is-open > .nav-item--parent .nav-item__chevron { transform: rotate(180deg); }
.nav-accordion.is-open > .nav-item--parent { background: var(--surface-2); color: var(--text); }
.nav-sub {
  display: grid; grid-template-rows: 0fr;
  transition: grid-template-rows var(--transition);
  overflow: hidden;
}
.nav-accordion.is-open > .nav-sub { grid-template-rows: 1fr; }
.nav-sub > * { min-height: 0; }
/* wrapper agar konten bisa di-collapse mulus */
.nav-sub { padding-inline-start: 0; }
.nav-subitem {
  display: flex; align-items: center; gap: var(--space-2);
  width: 100%; border: 0; background: transparent; cursor: pointer; text-align: start;
  padding: var(--space-2) var(--space-3); padding-inline-start: 40px;
  color: var(--text-subtle); font-size: var(--fs-sm); font-weight: 600;
  border-radius: var(--radius);
}
.nav-subitem:hover { background: var(--surface-2); color: var(--text); }
.nav-subitem--active { color: var(--brand-700); background: var(--brand-50); }
:root[data-theme="dark"] .nav-subitem--active { color: var(--brand-300); background: rgba(53,111,240,.16); }
.nav-subitem__icon { width: 18px; text-align: center; flex: none; font-size: .9em; }

.main { flex: 1; min-width: 0; margin-inline-start: var(--sidebar-w); display: flex; flex-direction: column; }

.topbar {
  height: var(--topbar-h); display: flex; align-items: center; gap: var(--space-3);
  padding-inline: var(--space-4); background: var(--bg-elevated);
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 30;
}
.topbar__title { font-weight: 700; font-size: var(--fs-lg); margin: 0; }
.topbar__spacer { flex: 1; }

.content { padding: var(--space-5); max-width: var(--container-max); width: 100%; margin: 0 auto; }

.icon-btn {
  width: 40px; height: 40px; border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--surface); cursor: pointer; display: grid; place-items: center;
  font-size: var(--fs-lg); color: var(--text-muted);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
/* Tombol ☰ tampil di SEMUA ukuran (desktop bisa ciutkan sidebar). */
.menu-toggle { display: grid; }
/* Tombol X di dalam sidebar (sembunyi di desktop saat sidebar permanen). */
.sidebar__close { display: none; }

/* ---------- Desktop: sidebar bisa diciutkan/disembunyikan ---------- */
@media (min-width: 901px) {
  .app-shell.sidebar-collapsed .sidebar { transform: translateX(-100%); }
  :root[dir="rtl"] .app-shell.sidebar-collapsed .sidebar { transform: translateX(100%); }
  .app-shell.sidebar-collapsed .main { margin-inline-start: 0; }
  .main { transition: margin-inline-start var(--transition); }
  /* Tombol X juga tampil di desktop agar pelanggan bisa menyembunyikan menu. */
  .sidebar__close { display: grid; }
}

.scrim {
  position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 65;
  opacity: 0; pointer-events: none; transition: opacity var(--transition);
}

/* ---------- Components ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  padding: var(--space-3) var(--space-5); border-radius: var(--radius);
  font-weight: 700; font-size: var(--fs-sm); cursor: pointer; border: 1px solid transparent;
  background: var(--surface-2); color: var(--text); transition: filter var(--transition);
  min-height: 44px; /* touch target */
}
.btn:hover { filter: brightness(0.97); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn--primary { background: var(--brand-600); color: var(--text-on-brand); }
.btn--accent { background: var(--accent-600); color: #fff; }
.btn--ghost { background: transparent; border-color: var(--border); }
.btn--block { width: 100%; }
.btn--lg { font-size: var(--fs-md); padding: var(--space-4) var(--space-6); }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: var(--space-5); box-shadow: var(--shadow-sm);
}
.card__title { font-size: var(--fs-lg); margin-bottom: var(--space-4); }

.grid { display: grid; gap: var(--space-4); }
.grid--stats { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.grid--cards { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.grid--types { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }

.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: var(--space-5); box-shadow: var(--shadow-sm);
}
.stat__label { color: var(--text-muted); font-size: var(--fs-sm); margin-bottom: var(--space-2); }
.stat__value { font-size: var(--fs-2xl); font-weight: 800; letter-spacing: -0.02em; }
.stat__delta { font-size: var(--fs-xs); font-weight: 700; margin-top: var(--space-2); }
.stat__delta--up { color: var(--success); }
.stat__delta--down { color: var(--danger); }

.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px;
  border-radius: var(--radius-full); font-size: var(--fs-xs); font-weight: 700;
  background: var(--surface-2); color: var(--text-muted);
}
.badge--brand { background: var(--brand-50); color: var(--brand-700); }
.badge--success { background: #dcfce7; color: #166534; }
.badge--warning { background: #fef3c7; color: #92400e; }

/* Forms */
.field { margin-bottom: var(--space-4); }
.field__label { display: block; font-weight: 600; font-size: var(--fs-sm); margin-bottom: var(--space-2); }
.input, .select {
  width: 100%; padding: var(--space-3) var(--space-4); border: 1px solid var(--border-strong);
  border-radius: var(--radius); background: var(--surface); color: var(--text);
  font-size: var(--fs-md); min-height: 44px;
}
.input:focus, .select:focus { border-color: var(--brand-500); outline: none; box-shadow: 0 0 0 3px var(--brand-100); }

/* Table */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-lg); }
table.data { width: 100%; border-collapse: collapse; min-width: 520px; }
table.data th, table.data td { padding: var(--space-3) var(--space-4); text-align: start; border-bottom: 1px solid var(--border); font-size: var(--fs-sm); }
table.data th { background: var(--surface-2); font-weight: 700; color: var(--text-muted); }
table.data tr:last-child td { border-bottom: 0; }

/* Selectable tile (business type, etc.) */
.tile {
  border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--space-4);
  background: var(--surface); cursor: pointer; text-align: center; transition: var(--transition);
  display: flex; flex-direction: column; align-items: center; gap: var(--space-2);
}
.tile:hover { border-color: var(--brand-400); box-shadow: var(--shadow); transform: translateY(-2px); }
.tile--selected { border-color: var(--brand-500); background: var(--brand-50); box-shadow: var(--shadow); }
:root[data-theme="dark"] .tile--selected { background: rgba(53,111,240,.14); }
.tile__emoji { font-size: 1.9rem; }
.tile__label { font-weight: 700; font-size: var(--fs-sm); }
.tile__hint { font-size: var(--fs-xs); color: var(--text-subtle); }

/* Auth / onboarding centered layout */
.center-stage { min-height: 100vh; display: grid; place-items: center; padding: var(--space-5); background: radial-gradient(1200px 600px at 70% -10%, var(--brand-50), transparent), var(--bg); }
.auth-card { width: 100%; max-width: 420px; }
.brand-row { display: flex; align-items: center; gap: var(--space-3); margin-bottom: var(--space-5); }

.muted { color: var(--text-muted); }
.text-center { text-align: center; }
.mt-2 { margin-top: var(--space-2); } .mt-4 { margin-top: var(--space-4); } .mt-5 { margin-top: var(--space-5); }
.row { display: flex; gap: var(--space-3); align-items: center; flex-wrap: wrap; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-4); flex-wrap: wrap; }

.offline-banner {
  background: var(--warning); color: #fff; text-align: center; padding: var(--space-2);
  font-size: var(--fs-sm); font-weight: 600;
}

.toast-stack { position: fixed; inset-block-end: var(--space-5); inset-inline: 0; display: flex; flex-direction: column; align-items: center; gap: var(--space-2); z-index: 100; pointer-events: none; }
.toast { background: var(--text); color: var(--bg-elevated); padding: var(--space-3) var(--space-5); border-radius: var(--radius-full); box-shadow: var(--shadow-lg); font-size: var(--fs-sm); font-weight: 600; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  :root[dir="rtl"] .sidebar { transform: translateX(100%); }
  .app-shell.nav-open .sidebar { transform: translateX(0); }
  .app-shell.nav-open .scrim { opacity: 1; pointer-events: auto; }
  .main { margin-inline-start: 0; }
  .sidebar__close { display: grid; }
  .content { padding: var(--space-4); }

  /* Gunakan dynamic viewport height agar tinggi benar di browser mobile
     (bar URL yang muncul/hilang tidak memotong menu). */
  .sidebar { height: 100vh; height: 100dvh; }
  /* Beri ruang di bawah daftar menu agar item terakhir tidak tertutup
     bottom navigation + safe area; sekaligus pastikan bisa scroll penuh. */
  .sidebar__nav {
    padding-bottom: calc(var(--bottomnav-h, 64px) + env(safe-area-inset-bottom) + var(--space-5));
  }
}

@media (min-width: 1600px) {
  .content { max-width: 1440px; }
}


/* ============================ Onboarding ============================ */
.onb-page { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; background: var(--bg); }

.onb-header {
  background: linear-gradient(150deg, var(--brand-600), var(--brand-800));
  color: #fff; padding: var(--space-5) var(--space-4) var(--space-6);
  border-end-start-radius: 22px; border-end-end-radius: 22px;
  padding-top: max(var(--space-5), env(safe-area-inset-top));
}
.onb-header__top { display: flex; align-items: center; gap: var(--space-3); font-size: var(--fs-lg); margin-bottom: var(--space-4); }
.onb-header__top .sidebar__logo { background: rgba(255,255,255,.18); }
.onb-header__title { color: #fff; font-size: var(--fs-2xl); margin: 0 0 6px; }
.onb-header__sub { color: rgba(255,255,255,.85); margin: 0 0 var(--space-4); font-size: var(--fs-sm); }

.onb-search { position: relative; }
.onb-search__icon { position: absolute; inset-inline-start: 14px; top: 50%; transform: translateY(-50%); opacity: .6; }
.onb-search__input { padding-inline-start: 42px; border: 0; box-shadow: var(--shadow); }

.onb-body { flex: 1; width: 100%; max-width: 1100px; margin: 0 auto; padding: var(--space-4) var(--space-4) 110px; }
.onb-tools { display: flex; gap: var(--space-2); flex-wrap: wrap; margin-bottom: var(--space-4); }

.onb-chip {
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-muted);
  border-radius: var(--radius-full); padding: 8px 16px; font-weight: 700; font-size: var(--fs-sm);
  cursor: pointer; min-height: 40px;
}
.onb-chip--on { background: var(--brand-50); color: var(--brand-700); border-color: var(--brand-300); }

.onb-cat { margin-bottom: var(--space-5); }
.onb-cat__title { display: flex; align-items: center; gap: var(--space-2); font-weight: 800; margin-bottom: var(--space-3); }
.onb-cat__emoji { font-size: 1.15rem; }
.onb-cat__count { margin-inline-start: auto; font-size: var(--fs-xs); font-weight: 700; color: var(--text-subtle); background: var(--surface-2); padding: 2px 10px; border-radius: var(--radius-full); }

.onb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: var(--space-3); }

.onb-tile {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  min-height: 104px; padding: var(--space-3); border-radius: var(--radius-lg);
  border: 1.5px solid var(--border); background: var(--surface); color: var(--text);
  cursor: pointer; text-align: center; transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
}
.onb-tile:hover { border-color: var(--brand-300); box-shadow: var(--shadow); }
.onb-tile:active { transform: scale(0.97); }
.onb-tile--active { border-color: var(--brand-500); background: var(--brand-50); box-shadow: 0 0 0 3px var(--brand-100); }
:root[data-theme="dark"] .onb-tile--active { background: rgba(53,111,240,.16); box-shadow: 0 0 0 3px rgba(53,111,240,.25); }
.onb-tile__emoji { font-size: 1.9rem; line-height: 1; }
.onb-tile__label { font-weight: 700; font-size: var(--fs-sm); line-height: 1.15; }
.onb-tile__soon { font-size: 10px; font-weight: 700; color: var(--warning); text-transform: uppercase; letter-spacing: .04em; }
.onb-tile__check {
  position: absolute; inset-block-start: 6px; inset-inline-end: 6px; width: 22px; height: 22px;
  background: var(--brand-600); color: #fff; border-radius: var(--radius-full);
  display: grid; place-items: center; font-size: 13px; font-weight: 800;
}
.onb-empty { padding: var(--space-8) 0; }

.onb-actionbar {
  position: fixed; inset-inline: 0; inset-block-end: 0; z-index: 50;
  display: flex; align-items: center; gap: var(--space-4); justify-content: space-between;
  padding: var(--space-3) var(--space-4); padding-bottom: max(var(--space-3), env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg-elevated) 92%, transparent);
  backdrop-filter: blur(10px); border-top: 1px solid var(--border);
}
.onb-bar__info { display: flex; flex-direction: column; min-width: 0; }
.onb-bar__label { font-weight: 800; font-size: var(--fs-md); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.onb-actionbar .btn { white-space: nowrap; }

@media (min-width: 560px) {
  .onb-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .onb-header { padding-inline: var(--space-6); }
  .onb-body { padding-inline: var(--space-6); }
}


/* ============================ Charts & demo widgets ============================ */
.chart { width: 100%; height: auto; display: block; }
.spark { width: 100%; height: 48px; display: block; }

.chart-legend { display: flex; flex-direction: column; gap: 8px; margin-top: var(--space-3); }
.chart-legend__item { display: flex; align-items: center; gap: 8px; font-size: var(--fs-sm); }
.chart-legend__dot { width: 12px; height: 12px; border-radius: 4px; flex: none; }

.progress { background: var(--surface-2); border-radius: var(--radius-full); height: 8px; overflow: hidden; }
.progress__bar { height: 100%; border-radius: var(--radius-full); transition: width var(--transition); }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: var(--radius-full); font-size: var(--fs-xs); font-weight: 700; background: var(--surface-2); color: var(--text-muted); }
.pill--neutral { background: var(--surface-2); color: var(--text-muted); }
.pill--info { background: #dbeafe; color: #1e40af; }
.pill--success { background: #dcfce7; color: #166534; }
.pill--warning { background: #fef3c7; color: #92400e; }
.pill--danger { background: #fee2e2; color: #991b1b; }
.pill--brand { background: var(--brand-50); color: var(--brand-700); }
:root[data-theme="dark"] .pill--info { background: rgba(59,130,246,.2); color: #93c5fd; }
:root[data-theme="dark"] .pill--success { background: rgba(34,197,94,.2); color: #86efac; }
:root[data-theme="dark"] .pill--warning { background: rgba(234,179,8,.2); color: #fde047; }
:root[data-theme="dark"] .pill--danger { background: rgba(239,68,68,.2); color: #fca5a5; }

/* Segmented tabs */
.tabs { display: inline-flex; gap: 4px; background: var(--surface-2); padding: 4px; border-radius: var(--radius); flex-wrap: wrap; }
.tab { border: 0; background: transparent; color: var(--text-muted); font-weight: 700; font-size: var(--fs-sm); padding: 8px 14px; border-radius: calc(var(--radius) - 2px); cursor: pointer; min-height: 38px; }
.tab--active { background: var(--surface); color: var(--brand-700); box-shadow: var(--shadow-sm); }
:root[data-theme="dark"] .tab--active { color: var(--brand-300); }

/* List rows */
.list { display: flex; flex-direction: column; }
.list-row { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) 0; border-bottom: 1px solid var(--border); }
.list-row:last-child { border-bottom: 0; }
.list-row__main { min-width: 0; flex: 1; }
.list-row__title { font-weight: 700; font-size: var(--fs-sm); }
.list-row__sub { color: var(--text-muted); font-size: var(--fs-xs); }
.list-row__end { margin-inline-start: auto; text-align: end; white-space: nowrap; }

.avatar { width: 40px; height: 40px; border-radius: var(--radius-full); background: linear-gradient(135deg, var(--brand-400), var(--brand-700)); color: #fff; display: grid; place-items: center; font-weight: 800; flex: none; }
.avatar--sm { width: 30px; height: 30px; font-size: .8rem; }

/* Kanban */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(220px, 1fr); gap: var(--space-3); overflow-x: auto; padding-bottom: var(--space-2); }
.kanban__col { background: var(--surface-2); border-radius: var(--radius-lg); padding: var(--space-3); }
.kanban__head { display: flex; align-items: center; justify-content: space-between; font-weight: 800; font-size: var(--fs-sm); margin-bottom: var(--space-3); }
.kanban__card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--space-3); margin-bottom: var(--space-2); box-shadow: var(--shadow-sm); }

/* KDS tickets */
.tickets { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--space-3); }
.ticket { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); overflow: hidden; }
.ticket--urgent { border-color: var(--danger); }
.ticket__head { display: flex; justify-content: space-between; align-items: center; padding: var(--space-3); background: var(--surface-2); font-weight: 800; }
.ticket__body { padding: var(--space-3); }
.ticket__item { display: flex; justify-content: space-between; font-size: var(--fs-sm); padding: 3px 0; }
.ticket--done { opacity: .55; }

/* Tables grid (restaurant) */
.tables-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: var(--space-3); }
.table-card { aspect-ratio: 1; border-radius: var(--radius-lg); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-weight: 800; border: 1.5px solid var(--border); background: var(--surface); cursor: pointer; }
.table-card--free { border-color: var(--success); }
.table-card--occupied { background: var(--brand-50); border-color: var(--brand-400); color: var(--brand-700); }
.table-card--reserved { background: #fef3c7; border-color: var(--warning); color: #92400e; }
.table-card__sub { font-size: var(--fs-xs); font-weight: 600; }

/* Toolbar */
.toolbar { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; margin-bottom: var(--space-4); }
.toolbar__spacer { flex: 1; }

.demo-note { font-size: var(--fs-xs); color: var(--text-subtle); margin-top: var(--space-2); }

/* KPI mini rows */
.kpi { display: flex; align-items: baseline; justify-content: space-between; padding: 8px 0; border-bottom: 1px dashed var(--border); }
.kpi:last-child { border-bottom: 0; }
.kpi__label { color: var(--text-muted); font-size: var(--fs-sm); }
.kpi__value { font-weight: 800; }


/* ============================ Modal ============================ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200; display: grid; place-items: center;
  background: rgba(15, 23, 42, 0.5); padding: var(--space-4); opacity: 0;
  transition: opacity var(--transition); backdrop-filter: blur(2px);
}
.modal-overlay.is-open { opacity: 1; }
.modal {
  width: 100%; max-width: 460px; max-height: 92vh; overflow: auto;
  background: var(--bg-elevated); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  transform: translateY(12px) scale(0.98); transition: transform var(--transition); outline: none;
}
.modal-overlay.is-open .modal { transform: none; }
.modal--sm { max-width: 360px; }
.modal--lg { max-width: 720px; }
.modal__head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-4) var(--space-5); border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--bg-elevated); }
.modal__title { margin: 0; font-size: var(--fs-lg); }
.modal__close { position: relative; }
.modal__body { padding: var(--space-5); }
.modal__foot { display: flex; gap: var(--space-3); justify-content: flex-end; padding: var(--space-4) var(--space-5); border-top: 1px solid var(--border); flex-wrap: wrap; }
.modal__foot .btn { flex: 1; min-width: 120px; }

/* ============================ Empty state ============================ */
.empty { text-align: center; padding: var(--space-8) var(--space-4); color: var(--text-muted); }
.empty__icon { font-size: 3rem; margin-bottom: var(--space-3); opacity: .8; }
.empty__title { margin: 0 0 var(--space-2); color: var(--text); }

/* ============================ Search ============================ */
.search { position: relative; flex: 1; min-width: 160px; }
.search__icon { position: absolute; inset-inline-start: 12px; top: 50%; transform: translateY(-50%); opacity: .55; pointer-events: none; }
.search__input { padding-inline-start: 38px; }

/* ============================ FAB ============================ */
.fab {
  position: fixed; inset-block-end: calc(var(--bottomnav-h, 0px) + 16px); inset-inline-end: 16px; z-index: 60;
  display: inline-flex; align-items: center; gap: 8px; border: 0; cursor: pointer;
  background: var(--brand-600); color: #fff; font-weight: 800; font-size: var(--fs-sm);
  padding: 14px 18px; border-radius: var(--radius-full); box-shadow: var(--shadow-lg);
}
.fab__icon { font-size: 1.1rem; }

/* ============================ Mobile bottom navigation ============================ */
.bottomnav { display: none; }
@media (max-width: 900px) {
  .bottomnav {
    display: flex; position: fixed; inset-inline: 0; inset-block-end: 0; z-index: 45;
    background: var(--bg-elevated); border-top: 1px solid var(--border);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .bottomnav__item {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 8px 4px; border: 0; background: transparent; color: var(--text-subtle);
    font-size: 10px; font-weight: 700; cursor: pointer; min-height: 56px;
  }
  .bottomnav__item--active { color: var(--brand-600); }
  :root[data-theme="dark"] .bottomnav__item--active { color: var(--brand-300); }
  .bottomnav__icon { font-size: 1.3rem; line-height: 1; }
  .main { padding-bottom: 64px; }
  :root { --bottomnav-h: 64px; }
}

/* ============================ Topbar avatar ============================ */
.topbar__user { display: flex; align-items: center; gap: 8px; cursor: pointer; border: 0; background: transparent; padding: 4px; border-radius: var(--radius-full); }
.topbar__user:hover { background: var(--surface-2); }
.topbar__user-name { font-weight: 700; font-size: var(--fs-sm); }
@media (max-width: 560px) { .topbar__user-name { display: none; } .topbar__title { font-size: var(--fs-md); } }

/* ============================ POS ============================ */
.pos { display: grid; grid-template-columns: 1.55fr 0.95fr; gap: var(--space-4); align-items: start; }
.pos__catalog { min-width: 0; }
.pos__cart { position: sticky; top: calc(var(--topbar-h) + var(--space-4)); }
.pos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: var(--space-3); }
.pos-card {
  display: flex; flex-direction: column; gap: 6px; padding: var(--space-3); min-height: 96px;
  border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface);
  cursor: pointer; text-align: start; transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
}
.pos-card:hover { border-color: var(--brand-300); box-shadow: var(--shadow); }
.pos-card:active { transform: scale(0.97); }
.pos-card__name { font-weight: 700; font-size: var(--fs-sm); line-height: 1.2; }
.pos-card__price { color: var(--brand-700); font-weight: 800; font-size: var(--fs-sm); margin-top: auto; }
:root[data-theme="dark"] .pos-card__price { color: var(--brand-300); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: var(--space-3); }
.chip {
  white-space: nowrap; border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text-muted); border-radius: var(--radius-full); padding: 7px 14px; font-weight: 700;
  font-size: var(--fs-sm); cursor: pointer; min-height: 36px;
}
.chip--on { background: var(--brand-600); color: #fff; border-color: var(--brand-600); }

.cart-line { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-2) 0; border-bottom: 1px solid var(--border); }
.cart-line:last-child { border-bottom: 0; }
.cart-line__name { flex: 1; min-width: 0; font-size: var(--fs-sm); font-weight: 600; }
.cart-line__price { font-size: var(--fs-xs); color: var(--text-muted); }
.qty { display: inline-flex; align-items: center; gap: 6px; }
.qty__btn { width: 30px; height: 30px; border-radius: var(--radius); border: 1px solid var(--border-strong); background: var(--surface); cursor: pointer; font-weight: 800; font-size: 1rem; line-height: 1; }
.qty__val { min-width: 22px; text-align: center; font-weight: 700; }

.cart-bar { display: none; }
.cash-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-2); }
.pay-methods { display: grid; grid-template-columns: repeat(auto-fit, minmax(80px,1fr)); gap: var(--space-2); }
.pay-method { border: 1.5px solid var(--border); border-radius: var(--radius); padding: 10px; text-align: center; font-weight: 700; font-size: var(--fs-sm); cursor: pointer; background: var(--surface); }
.pay-method--on { border-color: var(--brand-500); background: var(--brand-50); color: var(--brand-700); }
:root[data-theme="dark"] .pay-method--on { background: rgba(53,111,240,.16); }

/* Receipt */
.receipt { font-family: var(--font-mono); font-size: var(--fs-sm); }
.receipt__center { text-align: center; }
.receipt__divider { border: 0; border-top: 1px dashed var(--border-strong); margin: var(--space-3) 0; }
.receipt__row { display: flex; justify-content: space-between; gap: var(--space-3); }

@media (max-width: 900px) {
  .pos { grid-template-columns: 1fr; }
  .pos__cart { display: none; }
  .cart-bar {
    display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
    position: fixed; inset-inline: 0; inset-block-end: var(--bottomnav-h, 0px); z-index: 44;
    background: var(--brand-600); color: #fff; padding: var(--space-3) var(--space-4);
    box-shadow: var(--shadow-lg); cursor: pointer; border: 0; width: 100%;
  }
  .cart-bar__count { background: rgba(255,255,255,.25); border-radius: var(--radius-full); padding: 2px 10px; font-weight: 800; }
  .cart-bar__total { font-weight: 800; font-size: var(--fs-lg); }
}

/* ============================ Hero header (dashboard) ============================ */
.hero {
  background: linear-gradient(135deg, var(--brand-600), var(--brand-800));
  color: #fff; border-radius: var(--radius-lg); padding: var(--space-5);
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap;
  margin-bottom: var(--space-5);
}
.hero h1 { color: #fff; margin: 0 0 4px; font-size: var(--fs-2xl); }
.hero__sub { color: rgba(255,255,255,.85); margin: 0; }
.hero__spark { width: 160px; max-width: 40vw; }

/* ============================ Auth split layout ============================ */
.auth-split { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-hero {
  background: linear-gradient(150deg, var(--brand-600), var(--brand-900)); color: #fff;
  padding: var(--space-8) var(--space-6); display: flex; flex-direction: column; justify-content: center; gap: var(--space-4);
}
.auth-hero__feature { display: flex; align-items: center; gap: var(--space-3); font-weight: 600; }
.auth-hero__feature span:first-child { font-size: 1.4rem; }
.auth-panel { display: grid; place-items: center; padding: var(--space-5); background: var(--bg); }
@media (max-width: 860px) { .auth-split { grid-template-columns: 1fr; } .auth-hero { display: none; } }

/* ============================ Content fade-in ============================ */
.content > * { animation: fadeUp 220ms ease both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
:root[data-motion="reduced"] .content > * { animation: none; }


/* POS cart bar hidden state (mobile, empty cart) + small-screen badge */
.cart-bar--hidden { display: none !important; }
@media (max-width: 560px) { .sync-badge { display: none; } }


/* ============================ Performance / Battery Saver ============================ */
/* Diaktifkan otomatis oleh Mobile UX Engine pada perangkat lemah (RAM<=4GB / data saver). */
:root[data-perf="saver"] .content > * { animation: none !important; }
:root[data-perf="saver"] .hero { background: var(--brand-700); }
:root[data-perf="saver"] * { backdrop-filter: none !important; box-shadow: none !important; transition: none !important; }
:root[data-perf="saver"] .card, :root[data-perf="saver"] .stat { box-shadow: var(--shadow-sm) !important; }


/* ============================ Attendance (Public) ============================ */
.att-time { font-size: 2.5rem; font-weight: 800; text-align: center; letter-spacing: -0.02em; margin-bottom: 2px; }
.att-preview { border-radius: var(--radius); overflow: hidden; background: #000; min-height: 200px; }
.att-preview__placeholder { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 200px; color: #fff; }


/* ============================ Sub-page back button & menu cards ============================ */
.back-btn {
  display: inline-flex; align-items: center; gap: 6px; border: 0; cursor: pointer;
  background: transparent; color: var(--brand-600); font-weight: 700; font-size: var(--fs-sm);
  padding: 6px 4px; border-radius: var(--radius); min-height: 40px;
}
.back-btn:hover { color: var(--brand-700); text-decoration: underline; }
.back-btn__icon { font-size: 1.2rem; line-height: 1; }
:root[data-theme="dark"] .back-btn { color: var(--brand-300); }

.menu-card {
  display: flex; align-items: center; gap: var(--space-3); width: 100%; text-align: start;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: var(--space-4); cursor: pointer; transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
  min-height: 76px;
}
.menu-card:hover { border-color: var(--brand-300); box-shadow: var(--shadow); transform: translateY(-2px); }
.menu-card:active { transform: scale(0.98); }
.menu-card__icon { font-size: 1.8rem; width: 48px; height: 48px; flex: none; display: grid; place-items: center; background: var(--brand-50); border-radius: var(--radius); }
:root[data-theme="dark"] .menu-card__icon { background: rgba(53,111,240,.16); }
.menu-card__body { flex: 1; min-width: 0; }
.menu-card__title { font-weight: 700; font-size: var(--fs-md); }
.menu-card__desc { color: var(--text-muted); font-size: var(--fs-xs); margin-top: 2px; }
.menu-card__chevron { font-size: 1.5rem; color: var(--text-subtle); flex: none; }


/* ============================ POS edit mode ============================ */
.pos-card--edit { border-style: dashed; border-color: var(--brand-400); }
.pos-card--edit:hover { background: var(--brand-50); }
:root[data-theme="dark"] .pos-card--edit:hover { background: rgba(53,111,240,.16); }
.pos-card__editbadge { position: absolute; top: 6px; inset-inline-end: 8px; font-size: .9rem; }
.pos-card { position: relative; }
.pos-card--add { align-items: center; justify-content: center; color: var(--brand-600); border-style: dashed; border-color: var(--brand-400); }

/* ============================ Sidebar sizing refinement (point 10) ============================ */
:root { --sidebar-w: 256px; }
.sidebar__close { width: 32px; height: 32px; font-size: 1rem; flex: none; }
.sidebar__brand { gap: var(--space-2); }
.nav-item { line-height: 1.25; }
.nav-item__icon { font-size: 1.05rem; }
/* Sedikit lebih rapat agar lebih banyak menu muat tanpa terasa sesak. */
.sidebar__nav { padding: var(--space-2); }
.nav-group__label { padding: var(--space-3) var(--space-2) var(--space-1); }
@media (min-width: 1600px) { :root { --sidebar-w: 280px; } }

/* ============================================================================
 * MAKIPS — UI 2026 OVERHAUL (elegan, modern, sentuhan 3D — tetap RINGAN)
 * Hanya transform/opacity/shadow (GPU-friendly). Semua efek berat otomatis
 * dimatikan pada perangkat hemat: :root[data-perf="saver"] (RAM 4GB tetap mulus).
 * ========================================================================== */

/* Latar ber-gradient halus + aksen cahaya (ringan, statis) */
body {
  background:
    radial-gradient(1100px 700px at 12% -8%, color-mix(in srgb, var(--brand-500) 14%, transparent), transparent 60%),
    radial-gradient(1000px 680px at 110% 0%, color-mix(in srgb, var(--violet-500) 12%, transparent), transparent 55%),
    var(--bg);
  background-attachment: fixed;
}
h1, h2, h3 { letter-spacing: -0.02em; }

/* ---------- Kartu: lebih lembut, sedikit terangkat saat hover ---------- */
.card, .stat {
  border-radius: var(--radius-lg);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  will-change: transform;
}
.card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.stat {
  position: relative; overflow: hidden;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--surface) 100%, transparent), var(--surface)) ,
    var(--surface);
}
.stat::after {
  content: ""; position: absolute; inset-block-start: 0; inset-inline: 0; height: 3px;
  background: var(--grad-brand); opacity: .9;
}
.stat:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.stat__value { background: var(--grad-brand); -webkit-background-clip: text; background-clip: text; color: transparent; }
:root[data-theme="dark"] .stat__value { -webkit-text-fill-color: transparent; }

/* ---------- Tombol: gradien + efek tekan 3D ---------- */
.btn {
  border-radius: var(--radius); font-weight: 700; letter-spacing: .01em;
  transition: transform var(--transition-fast), box-shadow var(--transition), filter var(--transition);
}
.btn:active { transform: translateY(1px) scale(0.985); }
.btn--primary {
  background: var(--grad-brand); color: #fff; border: 0;
  box-shadow: var(--shadow-brand);
}
.btn--primary:hover { filter: brightness(1.05); box-shadow: var(--shadow-brand), var(--shadow); transform: translateY(-1px); }
.btn--accent { background: linear-gradient(135deg, var(--accent-500), var(--accent-600)); border: 0; color: #fff; }
.btn--ghost { background: var(--surface); border: 1px solid var(--border); }
.btn--ghost:hover { border-color: var(--brand-300); background: var(--surface-2); }
.btn--danger { background: linear-gradient(135deg, #f0556a, var(--danger)); color: #fff; border: 0; }

/* ---------- Topbar: glass blur ---------- */
.topbar {
  background: var(--surface-glass);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}

/* ---------- Sidebar: panel kaca + item interaktif ---------- */
.sidebar { background: var(--bg-elevated); border-inline-end: 1px solid var(--border); }
.sidebar__logo {
  background: var(--grad-brand); box-shadow: var(--shadow-brand);
  position: relative; overflow: hidden;
}
.sidebar__logo::after { content: ""; position: absolute; inset: 0; background: var(--grad-sheen); }
.nav-item { border-radius: var(--radius); transition: background var(--transition-fast), color var(--transition-fast), transform var(--transition-fast); }
.nav-item:hover { transform: translateX(2px); }
:root[dir="rtl"] .nav-item:hover { transform: translateX(-2px); }
.nav-item--active {
  background: var(--grad-brand-soft);
  box-shadow: inset 3px 0 0 var(--brand-600);
}
.nav-item__icon { transition: transform var(--transition); }
.nav-item:hover .nav-item__icon { transform: scale(1.12); }

/* ---------- Tiles & menu-cards: interaksi 3D (tilt halus saat hover) ---------- */
.tile, .menu-card, .pos-card, .onb-tile, .table-card {
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  will-change: transform;
}
.menu-card:hover, .tile:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.menu-card__icon { background: var(--grad-brand-soft); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand-300) 40%, transparent); transition: transform var(--transition); }
.menu-card:hover .menu-card__icon { transform: scale(1.08) rotate(-3deg); }
.pos-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--brand-300); }
.pos-card:active { transform: translateY(0) scale(0.97); }

/* ---------- Hero: gradien kaya + cahaya melayang ---------- */
.hero {
  background: var(--grad-brand);
  position: relative; overflow: hidden;
  box-shadow: var(--shadow);
  border-radius: var(--radius-xl);
}
.hero::before {
  content: ""; position: absolute; inset-block-start: -40%; inset-inline-end: -10%;
  width: 380px; height: 380px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.25), transparent 65%);
  animation: floaty 8s var(--ease-spring) infinite alternate;
}
@keyframes floaty { from { transform: translateY(0) } to { transform: translateY(18px) } }

/* ---------- Modal: muncul dengan pop 3D lembut ---------- */
.modal { border-radius: var(--radius-xl); }
.modal-overlay { -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.modal-overlay.is-open .modal { animation: modalpop var(--transition) var(--ease-spring); }
@keyframes modalpop { from { opacity: 0; transform: translateY(10px) scale(0.96) } to { opacity: 1; transform: none } }

/* ---------- Badge & pill: sedikit lebih hidup ---------- */
.badge, .pill { border-radius: var(--radius-full); }

/* ---------- Input: fokus dengan ring brand ---------- */
.input, .select { border-radius: var(--radius); transition: border-color var(--transition-fast), box-shadow var(--transition-fast); }
.input:focus, .select:focus { box-shadow: var(--ring); border-color: var(--brand-500); }

/* ---------- FAB & bottom nav: lebih premium ---------- */
.fab { background: var(--grad-brand); box-shadow: var(--shadow-brand), var(--shadow-lg); }
.fab:active { transform: scale(0.94); }
.bottomnav { background: var(--surface-glass); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.bottomnav__item { transition: color var(--transition-fast), transform var(--transition-fast); }
.bottomnav__item--active .bottomnav__icon { transform: translateY(-2px) scale(1.12); }

/* ---------- Skeleton shimmer untuk kesan hidup (opsional dipakai) ---------- */
.skeleton { background: linear-gradient(90deg, var(--surface-2) 25%, var(--border) 37%, var(--surface-2) 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; border-radius: var(--radius); }
@keyframes shimmer { from { background-position: 100% 0 } to { background-position: -100% 0 } }

/* ============================================================================
 * MODE HEMAT (RAM 4GB / data saver): matikan SEMUA efek berat → tetap ringan
 * ========================================================================== */
:root[data-perf="saver"] body { background: var(--bg); background-attachment: scroll; }
:root[data-perf="saver"] .topbar,
:root[data-perf="saver"] .bottomnav,
:root[data-perf="saver"] .modal-overlay { -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }
:root[data-perf="saver"] .hero::before,
:root[data-perf="saver"] .sidebar__logo::after,
:root[data-perf="saver"] .stat::after { display: none !important; }
:root[data-perf="saver"] .hero { background: var(--brand-700); }
:root[data-perf="saver"] .stat__value { background: none; -webkit-text-fill-color: currentColor; color: var(--text); }
:root[data-perf="saver"] .card:hover,
:root[data-perf="saver"] .stat:hover,
:root[data-perf="saver"] .menu-card:hover,
:root[data-perf="saver"] .pos-card:hover,
:root[data-perf="saver"] .tile:hover,
:root[data-perf="saver"] .nav-item:hover,
:root[data-perf="saver"] .btn:hover { transform: none !important; }
:root[data-perf="saver"] * { will-change: auto !important; }

/* ============================================================================
 * MODAL FIX — tombol tidak terpotong di layar HP (sticky footer + scroll body)
 * ========================================================================== */
.modal { display: flex; flex-direction: column; }
.modal__head { flex: none; }
.modal__body { flex: 1 1 auto; overflow-y: auto; -webkit-overflow-scrolling: touch; min-height: 0; }
.modal__foot {
  flex: none; position: sticky; bottom: 0;
  background: var(--bg-elevated);
  box-shadow: 0 -6px 16px -10px rgba(0,0,0,.25);
  padding-bottom: max(var(--space-4), env(safe-area-inset-bottom));
}

@media (max-width: 560px) {
  /* Modal jadi bottom-sheet: menempel ke bawah, lebih mudah dijangkau jempol */
  .modal-overlay { place-items: end center; padding: 0; }
  .modal {
    max-width: 100%; width: 100%;
    max-height: 92dvh;
    border-end-start-radius: 0; border-end-end-radius: 0;
    border-start-start-radius: var(--radius-xl); border-start-end-radius: var(--radius-xl);
  }
  .modal-overlay.is-open .modal { animation: sheetup var(--transition) ease; }
  @keyframes sheetup { from { transform: translateY(100%) } to { transform: none } }
  /* Tombol footer ditumpuk penuh agar tidak ada yang terpotong */
  .modal__foot { flex-direction: column-reverse; gap: var(--space-2); }
  .modal__foot .btn { width: 100%; flex: none; min-width: 0; }
}
