/* ========================================
   Bakuldigital — Main Stylesheet
   ======================================== */

/* ---------- Base ---------- */
:root {
  color-scheme: light;
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-hover: #f8fafc;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --text-primary: #1e293b;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-faint: #94a3b8;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 20px 35px rgba(15, 23, 42, 0.08);
  --radius: 1rem;
  --radius-sm: 0.75rem;
  --transition: 0.25s ease;
  --icon-surface: #f1f5f9;
  --badge-online-bg: #dcfce7;
  --badge-online-text: #15803d;
  --badge-offline-bg: #fee2e2;
  --badge-offline-text: #b91c1c;
  --products-badge-bg: #ffedd5;
  --products-badge-text: #ea580c;
}

/* Dark mode — dukung html.dark, .dark, body.theme-dark (HP lebih andal) */
html.dark,
html.dark body,
.dark,
body.theme-dark {
  color-scheme: dark;
  --bg: #0f172a;
  --surface: #1e293b;
  --surface-hover: #334155;
  --border: #334155;
  --border-light: #1e293b;
  --text-primary: #f8fafc;
  --text-secondary: #e2e8f0;
  --text-muted: #94a3b8;
  --text-faint: #64748b;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 20px 35px rgba(0, 0, 0, 0.4);
  --icon-surface: #334155;
  --badge-online-bg: #14532d;
  --badge-online-text: #86efac;
  --badge-offline-bg: #7f1d1d;
  --badge-offline-text: #fca5a5;
  --products-badge-bg: #7c2d12;
  --products-badge-text: #fdba74;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  /* cegah overscroll glow aneh di mobile browser */
  background: var(--bg);
}

body {
  font-family: "Plus Jakarta Sans", sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  margin: 0;
  min-height: 100%;
  min-height: 100dvh;
  transition: background var(--transition), color var(--transition);
  /* iOS Safari: pastikan background penuh */
  -webkit-text-size-adjust: 100%;
}

/* ---------- Theme Toggle ---------- */
.theme-toggle {
  width: 2.75rem;
  height: 2.75rem;
  min-width: 2.75rem;
  min-height: 2.75rem;
  border-radius: 9999px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  color: var(--text-primary);
  transition: box-shadow var(--transition), background var(--transition),
    border-color var(--transition), color var(--transition);
}

.theme-toggle:active {
  transform: scale(0.96);
}

.theme-toggle-icon {
  font-size: 1rem;
  line-height: 1;
  pointer-events: none;
}

.theme-toggle-icon--moon {
  color: #334155;
}

.theme-toggle-icon--sun {
  color: #facc15;
}

html.dark .theme-toggle-icon--moon,
body.theme-dark .theme-toggle-icon--moon {
  color: #e2e8f0;
}

/* ---------- Cards / Menu Items ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: background var(--transition), border-color var(--transition),
    box-shadow var(--transition), transform var(--transition);
}

.menu-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

.menu-item-left {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-width: 0;
  flex: 1;
}

.menu-item-text {
  min-width: 0;
}

.menu-item-text h3 {
  margin: 0;
  line-height: 1.3;
}

.menu-item-text p {
  margin: 0.15rem 0 0;
}

/* Arrow kanan — selaras untuk link & submenu */
.menu-arrow {
  flex-shrink: 0;
  width: 1.25rem;
  height: 1.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  line-height: 1;
  color: var(--text-faint);
}

@media (hover: hover) and (pointer: fine) {
  .menu-item:hover,
  .card-btn.menu-item:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
  }

  .product-card:hover {
    background: var(--surface-hover);
    transform: translateY(-2px);
  }

  .theme-toggle:hover {
    box-shadow: var(--shadow-md);
  }
}

.menu-item:active,
.card-btn.menu-item:active {
  background: var(--surface-hover);
}

.card-btn {
  width: 100%;
  background: none;
  border: none;
  font: inherit;
  color: inherit;
  cursor: pointer;
  text-align: left;
}

.card-btn:hover {
  background: var(--surface-hover);
}

/* ---------- Icon Boxes ---------- */
.icon-box {
  width: 3.5rem;
  height: 3.5rem;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.icon-box--sm {
  width: 3rem;
  height: 3rem;
}

/* ---------- Product Grid ---------- */
.product-card {
  display: block;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  text-decoration: none;
  color: inherit;
  text-align: center;
  transition: background var(--transition), transform var(--transition);
}

.product-card .icon-box i {
  font-size: 1.1rem;
}

/* product-card hover handled in @media (hover: hover) */

/* ---------- Dropdown ---------- */
.dropdown-panel {
  border-top: 1px solid var(--border-light);
}

.dropdown-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  text-decoration: none;
  color: inherit;
  transition: background var(--transition);
}

.dropdown-link:hover {
  background: var(--surface-hover);
}

.dropdown-sub {
  background: var(--bg);
}

.dropdown-sub .dropdown-link {
  padding-left: 3rem;
}

/* ---------- Status Badge ---------- */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1.25rem;
  border-radius: 9999px;
  font-weight: 600;
  font-size: 0.875rem;
}

.status-badge--online {
  background: var(--badge-online-bg);
  color: var(--badge-online-text);
}

.status-badge--offline {
  background: var(--badge-offline-bg);
  color: var(--badge-offline-text);
}

.status-dot {
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 9999px;
  background: #22c55e;
  animation: pulse 2s infinite;
}

.status-dot--offline {
  background: #ef4444;
  animation: none;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* ---------- Divider ---------- */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1rem 0;
}

/* ---------- Chevron rotation ---------- */
/* Default: kanan (tertutup). Open: bawah (terbuka) */
.chevron {
  transition: transform 0.3s ease;
  color: var(--text-faint);
}

.chevron.open {
  transform: rotate(90deg);
}

/* Nested group arrow selaras ukuran dengan arrow item link */
.dropdown-link .menu-arrow {
  width: 1rem;
  height: 1rem;
  font-size: 0.75rem;
}

/* ---------- Typography helpers ---------- */
.text-primary {
  color: var(--text-primary);
}

.text-secondary {
  color: var(--text-secondary);
}

.text-muted {
  color: var(--text-muted);
}

.text-faint {
  color: var(--text-faint);
}

/* ---------- Utility ---------- */
.hidden {
  display: none !important;
}

/* ---------- Page structure (shared) ---------- */
.page-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1.25rem;
}

.page-container {
  width: 100%;
  max-width: 28rem;
}

.top-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 1rem;
}

.site-header {
  text-align: center;
  margin-bottom: 2.5rem;
}

.site-logo-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.site-logo {
  width: 6rem;
  height: 6rem;
  border-radius: 1.5rem;
  box-shadow: var(--shadow-lg);
  object-fit: cover;
  background: white;
  ring: 4px solid white;
  outline: 4px solid white;
}

.site-greeting {
  margin: 0;
  font-size: 2.25rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.15;
}

.site-subtitle {
  margin: 0.75rem 0 0;
  font-size: 1.125rem;
  color: var(--text-secondary);
}

.site-description {
  margin: 0.35rem 0 0;
  color: var(--text-muted);
}

.site-header .status-badge {
  margin-top: 1.5rem;
}

.products-section {
  padding: 1.25rem;
}

.products-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1.15rem;
}

.products-title {
  margin: 0;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1rem;
}

.products-subtitle {
  margin: 0.2rem 0 0;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.products-badge {
  font-size: 0.7rem;
  background: var(--products-badge-bg);
  color: var(--products-badge-text);
  padding: 0.25rem 0.7rem;
  border-radius: 9999px;
  font-weight: 700;
  flex-shrink: 0;
}

.products-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}

.product-card-icon-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 0.65rem;
}

.product-card-name {
  margin: 0;
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.875rem;
}

.product-card-label {
  margin: 0.15rem 0 0;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.main-nav {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.info-section {
  padding: 1.25rem;
  margin-top: 2rem;
}

.info-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.info-row--start {
  align-items: flex-start;
}

.info-row--start > i {
  margin-top: 0.15rem;
}

.info-title {
  margin: 0;
  font-weight: 600;
  color: var(--text-primary);
}

.info-text {
  margin: 0.15rem 0 0;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.info-text--relaxed {
  line-height: 1.6;
}

.site-footer {
  text-align: center;
  margin-top: 2rem;
}

.footer-copy {
  margin: 0;
  font-size: 0.75rem;
  color: var(--text-faint);
}

.footer-text {
  margin: 0.5rem 0 0;
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* ========================================
   Layout Templates
   ======================================== */

/* --- 1. Classic Stack (default) --- */
body.tpl-classic .page-container {
  max-width: 28rem;
}

/* --- 2. Hero Banner --- */
body.tpl-hero {
  --bg: #eef2ff;
  --surface: #ffffff;
  --border: #e0e7ff;
  --text-primary: #1e1b4b;
  --text-secondary: #4338ca;
  --text-muted: #6366f1;
  --text-faint: #a5b4fc;
  background: var(--bg);
}

html.dark body.tpl-hero,
body.tpl-hero.theme-dark {
  --bg: #0f172a;
  --surface: #1e293b;
  --border: #334155;
  --text-primary: #f8fafc;
  --text-secondary: #c7d2fe;
  --text-muted: #a5b4fc;
  --text-faint: #818cf8;
  background: var(--bg);
}

body.tpl-hero .page-shell {
  align-items: stretch;
  padding: 0;
}

body.tpl-hero .page-container {
  max-width: 32rem;
  margin: 0 auto;
  padding: 0 0 2rem;
}

body.tpl-hero .top-actions {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 5;
  margin: 0;
}

body.tpl-hero .page-shell {
  position: relative;
}

body.tpl-hero .site-header {
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #db2777 100%);
  color: white;
  padding: 2.5rem 1.5rem 4rem;
  margin: 0 0 -2.5rem;
  border-radius: 0 0 2rem 2rem;
  text-align: center;
}

body.tpl-hero .site-header-text {
  color: white;
}

body.tpl-hero .site-greeting,
body.tpl-hero .site-subtitle,
body.tpl-hero .site-description {
  color: white !important;
}

body.tpl-hero .site-subtitle,
body.tpl-hero .site-description {
  opacity: 0.9;
}

body.tpl-hero .site-logo {
  outline: 4px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
}

body.tpl-hero .status-badge {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

body.tpl-hero .status-badge--online .status-dot {
  background: #86efac;
}

body.tpl-hero .products-section,
body.tpl-hero .main-nav,
body.tpl-hero .info-section {
  position: relative;
  z-index: 2;
  margin-left: 1rem;
  margin-right: 1rem;
}

body.tpl-hero .products-section {
  box-shadow: 0 12px 30px rgba(79, 70, 229, 0.12);
}

body.tpl-hero .main-nav {
  margin-top: 1rem;
}

body.tpl-hero .info-section {
  margin-top: 1rem;
}

body.tpl-hero .site-footer {
  margin: 1.5rem 1rem 0;
}

body.tpl-hero .theme-toggle {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.35);
  color: white;
}

body.tpl-hero .theme-toggle-icon--moon {
  color: #ffffff !important;
}

body.tpl-hero .theme-toggle-icon--sun {
  color: #facc15 !important;
}

/* --- 3. Grid Tiles --- */
body.tpl-grid {
  --bg: #f1f5f9;
  --radius: 1rem;
  background: var(--bg);
}

html.dark body.tpl-grid,
body.tpl-grid.theme-dark {
  --bg: #0f172a;
  background: var(--bg);
}

body.tpl-grid .page-container {
  max-width: 30rem;
}

body.tpl-grid .site-header {
  margin-bottom: 1.5rem;
}

body.tpl-grid .site-logo {
  width: 4.5rem;
  height: 4.5rem;
  border-radius: 1.15rem;
}

body.tpl-grid .site-greeting {
  font-size: 1.75rem;
}

body.tpl-grid .main-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

/* Menu link = tile. Dropdown/nested = full width biar sub-menu nyaman */
body.tpl-grid .main-nav > a.card {
  min-height: 100%;
}

body.tpl-grid .main-nav > .card:not(a) {
  grid-column: 1 / -1;
}

body.tpl-grid .main-nav > a.card.menu-item {
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 0.85rem;
  padding: 1rem;
  height: 100%;
  min-height: 8.5rem;
}

body.tpl-grid .main-nav > a.card .menu-item-left {
  flex-direction: column;
  align-items: flex-start;
  gap: 0.65rem;
  width: 100%;
}

body.tpl-grid .main-nav > a.card .menu-item-text h3 {
  font-size: 0.95rem;
}

body.tpl-grid .main-nav > a.card .menu-item-text p {
  font-size: 0.75rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

body.tpl-grid .main-nav > a.card .menu-arrow {
  align-self: flex-end;
  margin-top: auto;
}

body.tpl-grid .products-grid {
  grid-template-columns: repeat(3, 1fr);
  gap: 0.55rem;
}

body.tpl-grid .product-card {
  padding: 0.7rem 0.5rem;
}

/* --- 4. Profile Card --- */
body.tpl-profile {
  --bg: #eff6ff;
  --border: #dbeafe;
  --text-primary: #0f172a;
  --text-secondary: #1d4ed8;
  --text-muted: #64748b;
  background:
    radial-gradient(900px 420px at 0% 0%, #dbeafe 0%, transparent 55%),
    var(--bg);
}

html.dark body.tpl-profile,
body.tpl-profile.theme-dark {
  --bg: #0b1220;
  --border: #1e3a5f;
  --text-primary: #f8fafc;
  --text-secondary: #93c5fd;
  --text-muted: #94a3b8;
  background:
    radial-gradient(900px 420px at 0% 0%, rgba(37, 99, 235, 0.18) 0%, transparent 55%),
    var(--bg);
}

body.tpl-profile .page-container {
  max-width: 30rem;
}

body.tpl-profile .site-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 1.25rem;
  padding: 1.15rem 1.25rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-md);
}

body.tpl-profile .site-logo-wrap {
  margin: 0;
  flex-shrink: 0;
}

body.tpl-profile .site-logo {
  width: 4.25rem;
  height: 4.25rem;
  border-radius: 1.1rem;
  outline: none;
}

body.tpl-profile .site-header-text {
  min-width: 0;
  flex: 1;
}

body.tpl-profile .site-greeting {
  font-size: 1.35rem;
}

body.tpl-profile .site-subtitle {
  margin-top: 0.25rem;
  font-size: 0.9rem;
}

body.tpl-profile .site-description {
  display: none;
}

body.tpl-profile .site-header .status-badge {
  margin-top: 0.65rem;
}

body.tpl-profile .main-nav {
  gap: 0.55rem;
}

body.tpl-profile .menu-item {
  padding: 0.9rem 1rem;
}

body.tpl-profile .icon-box {
  width: 2.75rem;
  height: 2.75rem;
}

body.tpl-profile .info-section {
  margin-top: 1.15rem;
}

/* --- 5. Bento Box --- */
body.tpl-bento {
  --bg: #faf5ff;
  --border: #e9d5ff;
  --text-primary: #3b0764;
  --text-secondary: #7e22ce;
  --text-muted: #9333ea;
  --text-faint: #c084fc;
  background:
    radial-gradient(800px 420px at 10% 0%, #f3e8ff 0%, transparent 50%),
    radial-gradient(700px 360px at 100% 10%, #ffedd5 0%, transparent 45%),
    var(--bg);
}

html.dark body.tpl-bento,
body.tpl-bento.theme-dark {
  --bg: #0b1020;
  --border: #3b2764;
  --text-primary: #f8fafc;
  --text-secondary: #d8b4fe;
  --text-muted: #c084fc;
  --text-faint: #a78bfa;
  background:
    radial-gradient(800px 420px at 10% 0%, rgba(124, 58, 237, 0.22) 0%, transparent 50%),
    radial-gradient(700px 360px at 100% 10%, rgba(219, 39, 119, 0.12) 0%, transparent 45%),
    var(--bg);
}

body.tpl-bento .page-container {
  max-width: 34rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
  align-items: start;
}

body.tpl-bento .top-actions {
  grid-column: 1 / -1;
  margin-bottom: 0;
}

body.tpl-bento .site-header {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1rem;
  align-items: center;
  text-align: left;
  background: linear-gradient(135deg, #7c3aed, #db2777);
  color: white;
  border-radius: 1.35rem;
  padding: 1.25rem 1.35rem;
  margin: 0;
  box-shadow: 0 16px 36px rgba(124, 58, 237, 0.25);
}

body.tpl-bento .site-logo-wrap {
  margin: 0;
}

body.tpl-bento .site-logo {
  width: 4rem;
  height: 4rem;
  border-radius: 1rem;
  outline: 3px solid rgba(255, 255, 255, 0.3);
}

body.tpl-bento .site-greeting,
body.tpl-bento .site-subtitle,
body.tpl-bento .site-description {
  color: white !important;
}

body.tpl-bento .site-greeting {
  font-size: 1.45rem;
}

body.tpl-bento .site-subtitle {
  margin-top: 0.25rem;
  font-size: 0.9rem;
  opacity: 0.92;
}

body.tpl-bento .site-description {
  display: none;
}

body.tpl-bento .site-header .status-badge {
  margin-top: 0.6rem;
  background: rgba(255, 255, 255, 0.18);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.28);
}

body.tpl-bento .products-section {
  grid-column: 1 / -1;
  margin: 0;
  border-radius: 1.15rem;
}

body.tpl-bento .main-nav {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
  margin: 0;
}

/* Link menu = tile 2 kolom; dropdown/nested full width */
body.tpl-bento .main-nav > a.card {
  min-height: 5.5rem;
}

body.tpl-bento .main-nav > .card:not(a) {
  grid-column: 1 / -1;
}

body.tpl-bento .main-nav > a.card.menu-item {
  flex-direction: column;
  align-items: flex-start;
  gap: 0.7rem;
  min-height: 5.5rem;
}

body.tpl-bento .main-nav > a.card .menu-item-left {
  flex-direction: column;
  align-items: flex-start;
  gap: 0.55rem;
}

body.tpl-bento .info-section {
  grid-column: 1 / -1;
  margin: 0;
  border-radius: 1.15rem;
}

body.tpl-bento .site-footer {
  grid-column: 1 / -1;
  margin: 0.25rem 0 0;
}

body.tpl-bento .card {
  border-color: rgba(147, 51, 234, 0.15);
  box-shadow: 0 8px 22px rgba(147, 51, 234, 0.08);
}

/* --- 6. App Shell (dark-first, tetap hormati light mode) --- */
body.tpl-app {
  --bg: #0b1220;
  --surface: #151e2e;
  --surface-hover: #1f2a3d;
  --border: #243247;
  --border-light: #1a2436;
  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --text-faint: #64748b;
  --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.4);
  background: var(--bg);
}

/* Light mode override untuk App Shell */
html:not(.dark) body.tpl-app {
  --bg: #f1f5f9;
  --surface: #ffffff;
  --surface-hover: #f8fafc;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --text-faint: #94a3b8;
  --shadow-lg: 0 20px 35px rgba(15, 23, 42, 0.08);
  background: var(--bg);
}

html.dark body.tpl-app {
  --bg: #0b1220;
  --surface: #151e2e;
  --surface-hover: #1f2a3d;
  --border: #243247;
  --border-light: #1a2436;
  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --text-faint: #64748b;
  background: var(--bg);
}

body.tpl-app .page-shell {
  align-items: stretch;
  padding: 0;
}

body.tpl-app .page-container {
  max-width: 28rem;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  padding: 0 0 1.5rem;
}

body.tpl-app .top-actions {
  margin: 0;
  padding: 0.85rem 1rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

body.tpl-app .site-header {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  text-align: left;
  padding: 1.15rem 1rem 0.5rem;
  margin: 0;
}

body.tpl-app .site-logo-wrap {
  margin: 0;
}

body.tpl-app .site-logo {
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 1rem;
  outline: none;
  box-shadow: none;
}

body.tpl-app .site-greeting {
  font-size: 1.2rem;
}

body.tpl-app .site-subtitle {
  margin-top: 0.15rem;
  font-size: 0.85rem;
}

body.tpl-app .site-description {
  display: none;
}

body.tpl-app .site-header .status-badge {
  margin-top: 0.45rem;
  font-size: 0.75rem;
  padding: 0.3rem 0.7rem;
}

body.tpl-app .products-section,
body.tpl-app .info-section {
  margin: 0.85rem 1rem 0;
  background: var(--surface);
  border-color: var(--border);
}

body.tpl-app .main-nav {
  margin: 0.85rem 1rem 0;
  gap: 0.55rem;
}

body.tpl-app .card {
  background: var(--surface);
  border-color: var(--border);
}

body.tpl-app .menu-item {
  padding: 1rem 1.05rem;
}

body.tpl-app .product-card {
  border-color: var(--border);
}

body.tpl-app .dropdown-panel {
  border-top-color: var(--border-light);
}

body.tpl-app .dropdown-sub {
  background: var(--bg);
}

body.tpl-app .theme-toggle {
  background: var(--surface-hover);
  border-color: var(--border);
}

body.tpl-app .site-footer {
  margin: 1.25rem 1rem 0;
}

/* ---------- Dark mode: icon utility colors (Tailwind classes di data) ---------- */
html.dark .bg-slate-100,
body.theme-dark .bg-slate-100 { background-color: #334155 !important; }
html.dark .bg-green-100,
body.theme-dark .bg-green-100 { background-color: rgba(22, 163, 74, 0.2) !important; }
html.dark .bg-sky-100,
body.theme-dark .bg-sky-100 { background-color: rgba(14, 165, 233, 0.2) !important; }
html.dark .bg-indigo-100,
body.theme-dark .bg-indigo-100 { background-color: rgba(99, 102, 241, 0.22) !important; }
html.dark .bg-red-100,
body.theme-dark .bg-red-100 { background-color: rgba(239, 68, 68, 0.2) !important; }
html.dark .bg-orange-100,
body.theme-dark .bg-orange-100 { background-color: rgba(249, 115, 22, 0.2) !important; }
html.dark .bg-emerald-100,
body.theme-dark .bg-emerald-100 { background-color: rgba(16, 185, 129, 0.2) !important; }
html.dark .bg-blue-100,
body.theme-dark .bg-blue-100 { background-color: rgba(59, 130, 246, 0.2) !important; }
html.dark .bg-yellow-100,
body.theme-dark .bg-yellow-100 { background-color: rgba(234, 179, 8, 0.18) !important; }
html.dark .bg-purple-100,
body.theme-dark .bg-purple-100 { background-color: rgba(168, 85, 247, 0.2) !important; }
html.dark .bg-pink-100,
body.theme-dark .bg-pink-100 { background-color: rgba(236, 72, 153, 0.2) !important; }

html.dark .text-black,
body.theme-dark .text-black { color: #f8fafc !important; }
html.dark .text-slate-700,
body.theme-dark .text-slate-700 { color: #e2e8f0 !important; }
html.dark .text-slate-600,
body.theme-dark .text-slate-600 { color: #cbd5e1 !important; }

/* Hero toggle di dark mode: tetap kontras di banner */
html.dark body.tpl-hero .theme-toggle,
body.tpl-hero.theme-dark .theme-toggle {
  background: rgba(15, 23, 42, 0.35);
  border-color: rgba(255, 255, 255, 0.28);
}

html.dark body.tpl-hero .theme-toggle-icon--sun,
body.tpl-hero.theme-dark .theme-toggle-icon--sun {
  color: #facc15 !important;
}

html.dark body.tpl-profile .site-header,
body.tpl-profile.theme-dark .site-header {
  background: var(--surface);
  border-color: var(--border);
}

html.dark body.tpl-bento .card,
body.tpl-bento.theme-dark .card {
  border-color: rgba(167, 139, 250, 0.25);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.25);
}

/* Safe area HP (notch / home indicator) */
@supports (padding: env(safe-area-inset-top)) {
  body.tpl-app .top-actions {
    padding-top: calc(0.85rem + env(safe-area-inset-top));
  }

  .page-shell {
    padding-left: max(1.25rem, env(safe-area-inset-left));
    padding-right: max(1.25rem, env(safe-area-inset-right));
    padding-bottom: max(2.5rem, env(safe-area-inset-bottom));
  }

  body.tpl-hero .page-shell,
  body.tpl-app .page-shell {
    padding-left: 0;
    padding-right: 0;
  }
}

@media (max-width: 480px) {
  body.tpl-grid .main-nav,
  body.tpl-bento .main-nav {
    grid-template-columns: 1fr 1fr;
  }

  body.tpl-bento .page-container {
    max-width: 100%;
  }

  /* Area sentuh tombol tema lebih nyaman di HP */
  .theme-toggle {
    width: 3rem;
    height: 3rem;
    min-width: 3rem;
    min-height: 3rem;
  }
}

/* ========================================
   Responsive polish + interaction effects
   ======================================== */

/* Touch targets & fluid type */
html {
  scroll-behavior: smooth;
}

@media (max-width: 360px) {
  .page-shell {
    padding: 1.25rem 0.85rem 2rem;
  }

  .site-greeting {
    font-size: 1.35rem;
  }

  .products-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.55rem;
  }

  .product-card {
    padding: 0.75rem 0.5rem;
  }

  .menu-item {
    padding: 1rem 0.9rem;
    gap: 0.75rem;
  }

  .icon-box {
    width: 3rem;
    height: 3rem;
  }

  .icon-box i,
  .icon-box .fa-solid,
  .icon-box .fas,
  .icon-box .fab {
    font-size: 1.15rem !important;
  }
}

@media (min-width: 768px) {
  .page-shell {
    padding: 3rem 1.5rem;
  }

  body.tpl-classic .page-container {
    max-width: 30rem;
  }
}

/* Prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Entrance animation (stagger via --i) */
@keyframes bd-fade-up {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes bd-pop {
  0% { transform: scale(1); }
  40% { transform: scale(0.96); }
  100% { transform: scale(1); }
}

@keyframes bd-ripple {
  to {
    transform: scale(2.4);
    opacity: 0;
  }
}

@keyframes bd-shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.bd-enter {
  animation: bd-fade-up 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-delay: calc(var(--i, 0) * 45ms);
}

/* Interactive press / hover feedback */
.menu-item,
.product-card,
.dropdown-link,
.theme-toggle,
.card-btn {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.menu-item,
.product-card,
.dropdown-link {
  position: relative;
  overflow: hidden;
  transition:
    transform 0.2s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.2s ease,
    background 0.2s ease,
    border-color 0.2s ease;
}

.menu-item:active,
.product-card:active,
.dropdown-link:active,
.card-btn:active {
  transform: scale(0.985);
  animation: bd-pop 0.28s ease;
}

@media (hover: hover) and (pointer: fine) {
  .menu-item:hover,
  .card-btn.menu-item:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
  }

  .product-card:hover {
    background: var(--surface-hover);
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
  }

  .dropdown-link:hover {
    padding-left: 1.65rem;
  }

  .icon-box {
    transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
  }

  .menu-item:hover .icon-box,
  .product-card:hover .icon-box {
    transform: scale(1.08) rotate(-3deg);
  }

  .theme-toggle:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
  }
}

/* Focus visible for keyboard / a11y */
.menu-item:focus-visible,
.product-card:focus-visible,
.dropdown-link:focus-visible,
.theme-toggle:focus-visible,
.card-btn:focus-visible {
  outline: 2px solid #818cf8;
  outline-offset: 2px;
}

/* Logo subtle float */
.site-logo {
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.35s ease;
}

.site-logo:hover {
  transform: scale(1.04);
}

/* Status badge breathe */
.status-badge {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.status-badge--online {
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.25);
}

/* Card lift on open dropdown */
.card:has(.dropdown-panel:not(.hidden)) {
  box-shadow: var(--shadow-md);
  border-color: color-mix(in srgb, var(--border) 60%, #818cf8);
}

/* Skeleton / loading shimmer for empty grid during load */
.bd-loading .products-grid,
.bd-loading .main-nav {
  min-height: 4rem;
  border-radius: var(--radius);
  background: linear-gradient(
    90deg,
    var(--border-light) 25%,
    var(--surface) 50%,
    var(--border-light) 75%
  );
  background-size: 200% 100%;
  animation: bd-shimmer 1.2s ease infinite;
}

/* Landscape phone: tighter vertical spacing */
@media (max-height: 480px) and (orientation: landscape) {
  .page-shell {
    align-items: flex-start;
    padding-top: 1rem;
    padding-bottom: 1rem;
  }

  .site-header {
    margin-bottom: 1.25rem;
  }

  .site-logo {
    width: 64px;
    height: 64px;
  }
}
