/* =============================================================================
   Server Kerja · Little Project — design system
   Material "glass" ala iOS: permukaan tembus pandang + blur, hairline, radius besar.
   Tema terang & gelap dirancang terpisah (bukan sekadar invert).
   ============================================================================= */

:root {
  color-scheme: light;
  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'SF Pro Display', 'Segoe UI Variable Text', 'Segoe UI', system-ui, Roboto, 'Helvetica Neue', sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI Variable Display', 'Segoe UI', system-ui, sans-serif;
  --mono: ui-monospace, 'SF Mono', 'Cascadia Code', 'JetBrains Mono', Menlo, Consolas, monospace;

  --bg: #f2f3f7;
  --bg-tint-1: rgba(0, 122, 255, 0.11);
  --bg-tint-2: rgba(52, 199, 89, 0.08);
  --bg-tint-3: rgba(255, 149, 0, 0.07);

  --surface: rgba(255, 255, 255, 0.7);
  --surface-strong: rgba(255, 255, 255, 0.9);
  --surface-solid: #ffffff;
  --fill: rgba(118, 118, 128, 0.08);
  --fill-strong: rgba(118, 118, 128, 0.14);
  --hairline: rgba(60, 60, 67, 0.1);
  --hairline-strong: rgba(60, 60, 67, 0.18);
  --glass-edge: rgba(255, 255, 255, 0.75);
  --glass-highlight: inset 0 1px 0 rgba(255, 255, 255, 0.85);

  --text: #1c1c1e;
  --text-2: rgba(60, 60, 67, 0.74);
  --text-3: rgba(60, 60, 67, 0.48);
  --text-on-accent: #ffffff;

  --accent: #007aff;
  --accent-hover: #0068db;
  --accent-soft: rgba(0, 122, 255, 0.1);
  --accent-ink: #0060d1;

  --green: #34c759;
  --green-ink: #1f8a3b;
  --green-soft: rgba(52, 199, 89, 0.13);
  --orange: #ff9500;
  --orange-ink: #b95a00;
  --orange-soft: rgba(255, 149, 0, 0.14);
  --red: #ff3b30;
  --red-ink: #d0021b;
  --red-soft: rgba(255, 59, 48, 0.11);
  --indigo: #5856d6;
  --indigo-ink: #4b49c2;
  --indigo-soft: rgba(88, 86, 214, 0.12);
  --gray: #8e8e93;
  --gray-soft: rgba(142, 142, 147, 0.14);

  --shadow-sm: 0 1px 2px rgba(20, 24, 40, 0.04), 0 1px 1px rgba(20, 24, 40, 0.02);
  --shadow-md: 0 1px 2px rgba(20, 24, 40, 0.04), 0 8px 24px -6px rgba(20, 24, 40, 0.1);
  --shadow-lg: 0 2px 6px rgba(20, 24, 40, 0.05), 0 24px 64px -16px rgba(20, 24, 40, 0.24);
  --focus-ring: 0 0 0 4px rgba(0, 122, 255, 0.22);

  --radius-xs: 8px;
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --radius-xl: 28px;

  --blur: blur(28px) saturate(185%);
  --ease: cubic-bezier(0.32, 0.72, 0, 1);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --sidebar-w: 268px;
}

:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #0a0b0f;
  --bg-tint-1: rgba(10, 132, 255, 0.16);
  --bg-tint-2: rgba(48, 209, 88, 0.07);
  --bg-tint-3: rgba(94, 92, 230, 0.1);

  --surface: rgba(28, 29, 34, 0.62);
  --surface-strong: rgba(36, 37, 43, 0.86);
  --surface-solid: #1c1c21;
  --fill: rgba(118, 118, 128, 0.16);
  --fill-strong: rgba(118, 118, 128, 0.24);
  --hairline: rgba(255, 255, 255, 0.07);
  --hairline-strong: rgba(255, 255, 255, 0.13);
  --glass-edge: rgba(255, 255, 255, 0.08);
  --glass-highlight: inset 0 1px 0 rgba(255, 255, 255, 0.06);

  --text: #f5f5f7;
  --text-2: rgba(235, 235, 245, 0.66);
  --text-3: rgba(235, 235, 245, 0.38);

  --accent: #0a84ff;
  --accent-hover: #3395ff;
  --accent-soft: rgba(10, 132, 255, 0.16);
  --accent-ink: #5aa9ff;

  --green: #30d158;
  --green-ink: #4cd964;
  --green-soft: rgba(48, 209, 88, 0.15);
  --orange: #ff9f0a;
  --orange-ink: #ffb340;
  --orange-soft: rgba(255, 159, 10, 0.16);
  --red: #ff453a;
  --red-ink: #ff6961;
  --red-soft: rgba(255, 69, 58, 0.16);
  --indigo: #5e5ce6;
  --indigo-ink: #8e8cf2;
  --indigo-soft: rgba(94, 92, 230, 0.2);
  --gray-soft: rgba(142, 142, 147, 0.2);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 30px -8px rgba(0, 0, 0, 0.55);
  --shadow-lg: 0 2px 8px rgba(0, 0, 0, 0.4), 0 30px 80px -20px rgba(0, 0, 0, 0.75);
  --focus-ring: 0 0 0 4px rgba(10, 132, 255, 0.35);
}

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

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  transition: background-color 0.4s var(--ease), color 0.4s var(--ease);
}

/* Latar ambient: gradasi lembut agar efek kaca terlihat, tetap tenang untuk mata. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(48vmax 40vmax at 4% -4%, var(--bg-tint-1), transparent 70%),
    radial-gradient(40vmax 34vmax at 100% 10%, var(--bg-tint-3), transparent 70%),
    radial-gradient(48vmax 40vmax at 84% 104%, var(--bg-tint-2), transparent 70%);
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

a {
  color: var(--accent-ink);
  text-decoration: none;
}

::selection {
  background: var(--accent-soft);
}

:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: var(--radius-xs);
}

.num {
  font-variant-numeric: tabular-nums;
}

.mono {
  font-family: var(--mono);
  font-size: 0.92em;
}

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

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

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

/* Glass ------------------------------------------------------------------------ */
.glass {
  background: var(--surface);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 1px solid var(--glass-edge);
  box-shadow: var(--glass-highlight), var(--shadow-md);
}

.glass-strong {
  background: var(--surface-strong);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 1px solid var(--glass-edge);
  box-shadow: var(--glass-highlight), var(--shadow-lg);
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass,
  .glass-strong {
    background: var(--surface-solid);
  }
}

.card {
  border-radius: var(--radius-lg);
  padding: 20px;
}

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

.card-title {
  margin: 0;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.card-subtitle {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--text-2);
}

/* Shell ------------------------------------------------------------------------ */
.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 14px 0 14px 14px;
}

.sidebar-panel {
  height: 100%;
  border-radius: var(--radius-xl);
  display: flex;
  flex-direction: column;
  padding: 18px 12px 12px;
  overflow: hidden;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 2px 8px 18px;
  color: var(--text);
}

.brand-mark {
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 11px;
  box-shadow: 0 6px 16px -6px rgba(0, 96, 223, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.brand-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.brand-sub {
  font-size: 12px;
  color: var(--text-3);
  font-weight: 500;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-section {
  margin: 18px 10px 6px;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 10px;
  border-radius: 11px;
  color: var(--text-2);
  font-weight: 550;
  font-size: 14.5px;
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease), transform 0.2s var(--ease);
}

.nav-item svg {
  flex: none;
}

.nav-item:hover {
  background: var(--fill);
  color: var(--text);
}

.nav-item:active {
  transform: scale(0.985);
}

.nav-item[aria-current='page'] {
  background: var(--accent-soft);
  color: var(--accent-ink);
}

.nav-badge {
  margin-left: auto;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-size: 11.5px;
  font-weight: 700;
  display: inline-grid;
  place-items: center;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--hairline);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  cursor: pointer;
  text-align: left;
  transition: background-color 0.2s var(--ease);
}

.user-chip:hover {
  background: var(--fill);
}

.user-chip-name {
  font-weight: 600;
  font-size: 14px;
  line-height: 1.2;
}

.user-chip-role {
  font-size: 12px;
  color: var(--text-3);
}

.main {
  min-width: 0;
  padding: 26px 36px 48px;
}

.main-inner {
  max-width: 1320px;
  margin: 0 auto;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.page-eyebrow {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-3);
  margin-bottom: 4px;
}

.page-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 30px;
  line-height: 1.12;
  font-weight: 700;
  letter-spacing: -0.028em;
}

.page-subtitle {
  margin: 6px 0 0;
  color: var(--text-2);
  font-size: 15px;
}

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

.icon-btn {
  position: relative;
  width: 40px;
  height: 40px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  border: 1px solid var(--glass-edge);
  background: var(--surface);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  box-shadow: var(--glass-highlight), var(--shadow-sm);
  color: var(--text-2);
  cursor: pointer;
  transition: transform 0.2s var(--ease), color 0.2s var(--ease), background-color 0.2s var(--ease);
}

.icon-btn:hover {
  color: var(--text);
  background: var(--surface-strong);
}

.icon-btn:active {
  transform: scale(0.94);
}

.icon-btn .dot {
  position: absolute;
  top: 8px;
  right: 9px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 0 2px var(--surface-solid);
}

/* Tab bar (mobile) ----------------------------------------------------------------- */
.tabbar {
  display: none;
}

@media (max-width: 900px) {
  .shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    display: none;
  }

  .main {
    padding: 18px 16px 110px;
  }

  .page-title {
    font-size: 26px;
  }

  /* Header mobile: baris aksi di atas, judul besar selebar layar (pola iOS). */
  .topbar {
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 18px;
  }

  .topbar > div:first-child {
    order: 2;
    flex: 1 1 100%;
  }

  .topbar-actions {
    order: 1;
    width: 100%;
    justify-content: flex-end;
    flex-wrap: wrap;
  }

  .topbar-actions .hero-status {
    margin-right: auto;
  }

  .tabbar {
    position: fixed;
    z-index: 40;
    left: 50%;
    bottom: max(14px, env(safe-area-inset-bottom));
    transform: translateX(-50%);
    display: flex;
    gap: 2px;
    padding: 6px;
    border-radius: 999px;
    width: min(calc(100% - 24px), 440px);
  }

  .tabbar a {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 7px 4px 6px;
    border-radius: 999px;
    color: var(--text-2);
    font-size: 10.5px;
    font-weight: 600;
    transition: background-color 0.2s var(--ease), color 0.2s var(--ease);
  }

  .tabbar a[aria-current='page'] {
    color: var(--accent-ink);
    background: var(--accent-soft);
  }

  .tabbar .nav-badge {
    position: absolute;
    top: 2px;
    left: calc(50% + 6px);
    min-width: 17px;
    height: 17px;
    font-size: 10px;
  }
}

/* Buttons -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 38px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: -0.005em;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.18s var(--ease), background-color 0.2s var(--ease), box-shadow 0.2s var(--ease), opacity 0.2s;
  user-select: none;
}

.btn:active {
  transform: scale(0.97);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: var(--accent);
  color: var(--text-on-accent);
  box-shadow: 0 6px 16px -8px rgba(0, 122, 255, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

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

.btn-secondary:hover:not(:disabled) {
  background: var(--fill-strong);
}

.btn-tinted {
  background: var(--accent-soft);
  color: var(--accent-ink);
}

.btn-tinted:hover:not(:disabled) {
  background: color-mix(in srgb, var(--accent) 18%, transparent);
}

.btn-danger {
  background: var(--red-soft);
  color: var(--red-ink);
}

.btn-danger:hover:not(:disabled) {
  background: color-mix(in srgb, var(--red) 20%, transparent);
}

.btn-ghost {
  background: transparent;
  color: var(--accent-ink);
  padding: 0 10px;
}

.btn-ghost:hover:not(:disabled) {
  background: var(--accent-soft);
}

.btn-sm {
  height: 32px;
  padding: 0 12px;
  font-size: 13px;
}

.btn-lg {
  height: 48px;
  font-size: 16px;
  padding: 0 22px;
}

.btn-block {
  width: 100%;
}

.spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-right-color: transparent;
  animation: spin 0.7s linear infinite;
  opacity: 0.85;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Forms ------------------------------------------------------------------------------ */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field + .field {
  margin-top: 14px;
}

.field-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
}

.field-hint {
  font-size: 12px;
  color: var(--text-3);
}

.field-error {
  font-size: 12.5px;
  color: var(--red-ink);
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: 42px;
  padding: 10px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: var(--fill);
  transition: background-color 0.2s var(--ease), box-shadow 0.2s var(--ease), border-color 0.2s var(--ease);
}

.textarea {
  min-height: 88px;
  resize: vertical;
  line-height: 1.5;
}

.input::placeholder,
.textarea::placeholder {
  color: var(--text-3);
}

.input:hover,
.select:hover,
.textarea:hover {
  background: var(--fill-strong);
}

.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  background: var(--surface-solid);
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

.input[aria-invalid='true'] {
  border-color: var(--red);
}

.input-group {
  position: relative;
}

.input-group .input {
  padding-right: 44px;
}

.input-group .input-addon {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
}

.input-group .input-addon:hover {
  color: var(--text);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.form-grid .field + .field {
  margin-top: 0;
}

.form-grid .span-2 {
  grid-column: span 2;
}

.form-section {
  padding: 18px 0;
  border-top: 1px solid var(--hairline);
}

.form-section:first-child {
  border-top: 0;
  padding-top: 0;
}

.form-section-title {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text-2);
}

@media (max-width: 640px) {
  .form-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .form-grid .span-2 {
    grid-column: auto;
  }
}

/* Segmented control (iOS) --------------------------------------------------------------- */
.segmented {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  border-radius: 12px;
  background: var(--fill);
}

.segmented button {
  position: relative;
  border: 0;
  background: transparent;
  padding: 6px 14px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  cursor: pointer;
  transition: background-color 0.25s var(--ease), color 0.25s var(--ease), box-shadow 0.25s var(--ease);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.segmented button[aria-pressed='true'] {
  background: var(--surface-solid);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 1px rgba(0, 0, 0, 0.04);
}

:root[data-theme='dark'] .segmented button[aria-pressed='true'] {
  background: #3a3a40;
}

.segmented-scroll {
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}

/* Switch (iOS) --------------------------------------------------------------------------- */
.switch {
  position: relative;
  width: 51px;
  height: 31px;
  flex: none;
  border: 0;
  border-radius: 999px;
  background: var(--fill-strong);
  cursor: pointer;
  transition: background-color 0.25s var(--ease);
  padding: 0;
}

.switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15), 0 1px 1px rgba(0, 0, 0, 0.06);
  transition: transform 0.3s var(--ease);
}

.switch[aria-checked='true'] {
  background: var(--green);
}

.switch[aria-checked='true']::after {
  transform: translateX(20px);
}

.switch:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Status & badges ------------------------------------------------------------------------- */
.status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 26px;
  padding: 0 10px 0 9px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 650;
  white-space: nowrap;
}

.status-dot {
  position: relative;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}

.status-online {
  color: var(--green-ink);
  background: var(--green-soft);
}

.status-online .status-dot {
  background: var(--green);
}

.status-online .status-dot::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: var(--green);
  opacity: 0.35;
  animation: pulse 2.4s var(--ease-out) infinite;
}

.status-warning {
  color: var(--orange-ink);
  background: var(--orange-soft);
}

.status-warning .status-dot {
  background: var(--orange);
}

.status-offline {
  color: var(--red-ink);
  background: var(--red-soft);
}

.status-offline .status-dot {
  background: var(--red);
}

.status-maintenance {
  color: var(--indigo-ink);
  background: var(--indigo-soft);
}

.status-maintenance .status-dot {
  background: var(--indigo);
}

.status-unknown,
.status-disabled {
  color: var(--text-2);
  background: var(--gray-soft);
}

.status-unknown .status-dot,
.status-disabled .status-dot {
  background: var(--gray);
}

@keyframes pulse {
  0% {
    transform: scale(0.6);
    opacity: 0.5;
  }
  70%,
  100% {
    transform: scale(1.9);
    opacity: 0;
  }
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 8px;
  border-radius: 7px;
  font-size: 11.5px;
  font-weight: 650;
  background: var(--fill);
  color: var(--text-2);
  white-space: nowrap;
}

.badge-accent {
  background: var(--accent-soft);
  color: var(--accent-ink);
}

.badge-green {
  background: var(--green-soft);
  color: var(--green-ink);
}

.badge-orange {
  background: var(--orange-soft);
  color: var(--orange-ink);
}

.badge-red {
  background: var(--red-soft);
  color: var(--red-ink);
}

.badge-indigo {
  background: var(--indigo-soft);
  color: var(--indigo-ink);
}

/* App icon ------------------------------------------------------------------------------ */
.app-icon {
  --app: #007aff;
  position: relative;
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 48px;
  height: 48px;
  border-radius: 13px;
  color: #fff;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0) 52%),
    linear-gradient(145deg, color-mix(in srgb, var(--app) 78%, #fff), var(--app) 55%, color-mix(in srgb, var(--app) 82%, #000));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    inset 0 -1px 0 rgba(0, 0, 0, 0.12),
    0 8px 18px -10px color-mix(in srgb, var(--app) 90%, transparent);
}

.app-icon-sm {
  width: 32px;
  height: 32px;
  border-radius: 9px;
}

.app-icon-lg {
  width: 72px;
  height: 72px;
  border-radius: 19px;
}

/* Avatar ---------------------------------------------------------------------------------- */
.avatar {
  width: 36px;
  height: 36px;
  flex: none;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(145deg, #8e8e93, #636366);
  letter-spacing: 0.01em;
  overflow: hidden;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-sm {
  width: 28px;
  height: 28px;
  font-size: 11px;
}

/* Grids ----------------------------------------------------------------------------------- */
.stack {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.row-wrap {
  flex-wrap: wrap;
}

.spacer {
  flex: 1;
}

.grid-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.grid-apps {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(262px, 1fr));
  gap: 14px;
}

.grid-split {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: 14px;
  align-items: start;
}

@media (max-width: 1180px) {
  .grid-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grid-split {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 520px) {
  .grid-stats {
    gap: 10px;
  }
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin: 8px 2px 12px;
}

.section-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* Stat card --------------------------------------------------------------------------------- */
.stat {
  position: relative;
  padding: 16px 18px 17px;
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.stat-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.stat-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
}

.stat-icon {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: var(--fill);
  color: var(--text-2);
}

.stat-value {
  margin-top: 10px;
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.stat-foot {
  margin-top: 8px;
  font-size: 12.5px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tone-green .stat-icon {
  background: var(--green-soft);
  color: var(--green-ink);
}

.tone-orange .stat-icon {
  background: var(--orange-soft);
  color: var(--orange-ink);
}

.tone-red .stat-icon {
  background: var(--red-soft);
  color: var(--red-ink);
}

.tone-accent .stat-icon {
  background: var(--accent-soft);
  color: var(--accent-ink);
}

/* App card (launcher) --------------------------------------------------------------------------- */
.app-card {
  --app: #007aff;
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 206px;
  padding: 18px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  isolation: isolate;
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease);
}

.app-card::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: radial-gradient(120% 80% at 0% 0%, color-mix(in srgb, var(--app) 13%, transparent), transparent 62%);
  opacity: 0.9;
  transition: opacity 0.35s var(--ease);
}

.app-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--glass-highlight), var(--shadow-lg);
}

.app-card:hover::before {
  opacity: 1.4;
}

.app-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.app-card-name {
  margin: 16px 0 4px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.018em;
}

.app-card-desc {
  margin: 0;
  color: var(--text-2);
  font-size: 13.5px;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.app-card-foot {
  margin-top: auto;
  padding-top: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.app-card-meta {
  font-size: 12px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Lists ------------------------------------------------------------------------------------------ */
.list {
  display: flex;
  flex-direction: column;
}

.list-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 4px;
  border-top: 1px solid var(--hairline);
  min-width: 0;
}

.list-row:first-child {
  border-top: 0;
}

.list-row-main {
  flex: 1;
  min-width: 0;
}

.list-row-title {
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-row-sub {
  font-size: 12.5px;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-row-aside {
  flex: none;
  font-size: 12.5px;
  color: var(--text-3);
  text-align: right;
}

.list-row.interactive {
  cursor: pointer;
  border-radius: 12px;
  padding-left: 10px;
  padding-right: 10px;
  margin: 0 -6px;
  transition: background-color 0.2s var(--ease);
}

.list-row.interactive:hover {
  background: var(--fill);
}

.list-row.interactive:hover + .list-row,
.list-row.interactive:hover {
  border-top-color: transparent;
}

.level-icon {
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 11px;
  display: grid;
  place-items: center;
}

.level-info {
  background: var(--accent-soft);
  color: var(--accent-ink);
}

.level-success {
  background: var(--green-soft);
  color: var(--green-ink);
}

.level-warning {
  background: var(--orange-soft);
  color: var(--orange-ink);
}

.level-critical {
  background: var(--red-soft);
  color: var(--red-ink);
}

.unread-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  flex: none;
}

.day-label {
  margin: 18px 4px 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-3);
}

/* Table (admin) ------------------------------------------------------------------------------------ */
.table-wrap {
  overflow-x: auto;
  margin: 0 -20px -8px;
  padding: 0 20px 8px;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.table th {
  text-align: left;
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 0 10px 10px;
  white-space: nowrap;
}

.table td {
  padding: 12px 10px;
  border-top: 1px solid var(--hairline);
  vertical-align: middle;
  white-space: nowrap;
}

/* Kolom fleksibel: mengambil sisa lebar dan memotong teks dengan elipsis (tanpa scroll horizontal). */
.table td.cell-fill {
  width: 100%;
  max-width: 0;
}

.table td.cell-fill > * {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 1100px) {
  .table .hide-md {
    display: none;
  }
}

.table tbody tr {
  transition: background-color 0.2s var(--ease);
}

.table tbody tr.clickable {
  cursor: pointer;
}

.table tbody tr.clickable:hover {
  background: var(--fill);
}

.table td:first-child,
.table th:first-child {
  padding-left: 4px;
}

/* Sheet / modal ---------------------------------------------------------------------------------- */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.28);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  animation: fade-in 0.25s var(--ease);
}

.sheet {
  width: min(640px, 100%);
  max-height: min(88vh, 900px);
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-xl);
  overflow: hidden;
  animation: sheet-in 0.45s var(--ease);
}

/* Sheet form hampir solid (seperti sheet iOS) agar isian selalu terbaca. */
.sheet.glass-strong {
  background: color-mix(in srgb, var(--surface-solid) 96%, transparent);
}

.sheet-wide {
  width: min(760px, 100%);
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--hairline);
}

.sheet-title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.sheet-body {
  padding: 18px 20px;
  overflow-y: auto;
}

.sheet-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--hairline);
}

@media (max-width: 640px) {
  .sheet-backdrop {
    place-items: end stretch;
    padding: 0;
  }

  .sheet {
    width: 100%;
    max-height: 92vh;
    border-radius: 26px 26px 0 0;
    animation: sheet-up 0.45s var(--ease);
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

@keyframes sheet-in {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.98);
  }
}

@keyframes sheet-up {
  from {
    transform: translateY(100%);
  }
}

/* Toast ------------------------------------------------------------------------------------------- */
.toasts {
  position: fixed;
  z-index: 80;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  width: min(420px, calc(100% - 24px));
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-radius: 16px;
  font-size: 14px;
  font-weight: 550;
  pointer-events: auto;
  animation: toast-in 0.45s var(--ease);
}

.toast-success svg {
  color: var(--green);
}

.toast-error svg {
  color: var(--red);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(-12px) scale(0.97);
  }
}

/* Empty & skeleton -------------------------------------------------------------------------------- */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  padding: 34px 20px;
  color: var(--text-2);
}

.empty-icon {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: var(--fill);
  color: var(--text-3);
  margin-bottom: 4px;
}

.empty-title {
  font-weight: 650;
  color: var(--text);
}

.empty-text {
  font-size: 13.5px;
  max-width: 360px;
}

.skeleton {
  border-radius: 10px;
  background: linear-gradient(90deg, var(--fill) 0%, var(--fill-strong) 50%, var(--fill) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}

@keyframes shimmer {
  from {
    background-position: 200% 0;
  }
  to {
    background-position: -200% 0;
  }
}

/* Misc components -------------------------------------------------------------------------------- */
.alert {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: 14px;
  font-size: 13.5px;
}

.alert-error {
  background: var(--red-soft);
  color: var(--red-ink);
}

.alert-warning {
  background: var(--orange-soft);
  color: var(--orange-ink);
}

.alert-info {
  background: var(--accent-soft);
  color: var(--accent-ink);
}

.alert svg {
  flex: none;
  margin-top: 1px;
}

.secret-box {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 10px 10px 14px;
  border-radius: 14px;
  background: var(--fill);
  font-family: var(--mono);
  font-size: 13px;
  word-break: break-all;
}

.secret-box code {
  flex: 1;
  min-width: 0;
}

.kv {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}

.kv-item {
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--fill);
  min-width: 0;
}

.kv-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
}

.kv-value {
  margin-top: 4px;
  font-weight: 600;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--hairline-strong);
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.2s var(--ease);
}

.chip:hover {
  background: var(--fill);
}

.chip[aria-pressed='true'] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.icon-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
  gap: 6px;
}

.icon-picker button {
  height: 44px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: var(--fill);
  color: var(--text-2);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all 0.2s var(--ease);
}

.icon-picker button:hover {
  background: var(--fill-strong);
  color: var(--text);
}

.icon-picker button[aria-pressed='true'] {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.swatch {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 0;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.swatch:hover {
  transform: scale(1.08);
}

.swatch[aria-pressed='true'] {
  box-shadow: 0 0 0 2px var(--surface-solid), 0 0 0 4px currentColor;
}

.menu {
  position: absolute;
  z-index: 50;
  bottom: calc(100% + 8px);
  left: 0;
  right: 0;
  padding: 6px;
  border-radius: 18px;
  animation: sheet-in 0.3s var(--ease);
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  font-size: 14px;
  font-weight: 550;
  cursor: pointer;
  text-align: left;
  color: var(--text);
}

.menu-item:hover {
  background: var(--fill);
}

.menu-item.danger {
  color: var(--red-ink);
}

.menu-sep {
  height: 1px;
  margin: 5px 8px;
  background: var(--hairline);
}

.theme-choice {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 4px;
  margin: 2px 0 4px;
  border-radius: 12px;
  background: var(--fill);
}

.theme-choice button {
  display: grid;
  place-items: center;
  height: 32px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
}

.theme-choice button[aria-pressed='true'] {
  background: var(--surface-solid);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.hero-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 14px 0 12px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 600;
}

/* Page loader (lazy per halaman) -------------------------------------------------------------- */
.page-loader {
  position: relative;
  min-height: 60vh;
  display: grid;
  place-items: center;
}

.page-loader-bar {
  position: fixed;
  z-index: 70;
  top: 0;
  left: 0;
  height: 3px;
  width: 100%;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  background-size: 50% 100%;
  background-repeat: no-repeat;
  animation: loader-bar 1.1s var(--ease) infinite;
}

.page-loader-card {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-2);
  animation: fade-in 0.3s var(--ease);
}

.page-loader-card .spinner {
  color: var(--accent);
}

@keyframes loader-bar {
  from {
    background-position: -50% 0;
  }
  to {
    background-position: 150% 0;
  }
}

/* Page transition ------------------------------------------------------------------------------- */
.page {
  animation: page-in 0.5s var(--ease-out);
}

@keyframes page-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

/* Auth pages ------------------------------------------------------------------------------------- */
.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 16px;
  position: relative;
}

.auth-screen::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(28vmax 24vmax at 28% 30%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%),
    radial-gradient(24vmax 22vmax at 72% 70%, color-mix(in srgb, var(--green) 14%, transparent), transparent 70%);
  filter: blur(10px);
}

.auth-card {
  width: min(400px, 100%);
  padding: 30px 28px 26px;
  border-radius: 30px;
}

.auth-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
  margin-bottom: 24px;
}

.auth-brand .brand-mark {
  width: 60px;
  height: 60px;
  border-radius: 17px;
}

.auth-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.auth-foot {
  margin-top: 18px;
  text-align: center;
  font-size: 12.5px;
  color: var(--text-3);
}

.auth-theme {
  position: fixed;
  top: 16px;
  right: 16px;
}

/* Detail header ----------------------------------------------------------------------------------- */
.detail-hero {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 22px;
  border-radius: var(--radius-xl);
}

.detail-hero-main {
  flex: 1;
  min-width: 0;
}

.detail-hero h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 26px;
  letter-spacing: -0.025em;
}

@media (max-width: 720px) {
  .detail-hero {
    flex-direction: column;
    align-items: flex-start;
  }
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 12px;
  font-size: 14px;
  font-weight: 600;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* =============================================================================
   APP SHELL (vanilla) — sidebar dengan grup aplikasi, header, area konten
   ============================================================================= */
svg.i {
  flex: none;
  display: inline-block;
  vertical-align: middle;
}

body.is-booting .shell {
  visibility: hidden;
}

.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
  transition: grid-template-columns 0.35s var(--ease);
}

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

.main {
  padding: 22px 36px 48px;
  outline: none;
}

.main > .page {
  max-width: 1320px;
  margin: 0 auto;
  width: 100%;
}

/* Mode tamu (login / sso-error): tanpa sidebar & header */
body.is-guest .shell {
  display: block;
}

body.is-guest .sidebar,
body.is-guest .appbar {
  display: none;
}

body.is-guest .main {
  padding: 0;
}

body.is-guest .main > .page {
  max-width: none;
}

.auth-theme {
  position: fixed;
  top: 16px;
  right: 16px;
}

/* Header */
.appbar {
  position: sticky;
  top: 10px;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 14px 0;
  padding: 8px 10px 8px 16px;
  border-radius: 18px;
}

.appbar-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
}

.appbar-crumb {
  color: var(--text-3);
  font-weight: 550;
}

.appbar-sep {
  color: var(--text-3);
}

.appbar-page {
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
}

.appbar-menu {
  display: none;
}

.icon-btn-sm {
  width: 32px;
  height: 32px;
}

/* Page head (judul besar di dalam konten) */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin: 8px 0 22px;
}

.page-head-text {
  min-width: 0;
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* Sidebar */
.sidebar-panel {
  height: 100%;
  border-radius: var(--radius-xl);
  display: flex;
  flex-direction: column;
  padding: 14px 10px 10px;
  overflow: hidden;
}

.sidebar-top {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 0 12px;
}

.sidebar-top .brand {
  flex: 1;
  min-width: 0;
  padding: 2px 6px;
}

.brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.nav-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  margin: 0 -4px;
  padding: 0 4px;
  scrollbar-width: thin;
}

.nav-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.nav-item {
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.nav-group-toggle .app-icon {
  width: 24px;
  height: 24px;
  border-radius: 7px;
}

.nav-chevron {
  margin-left: auto;
  color: var(--text-3);
  transition: transform 0.3s var(--ease);
}

.nav-group.open .nav-chevron {
  transform: rotate(180deg);
}

.nav-group.has-active > .nav-group-toggle {
  color: var(--text);
}

/* Buka-tutup grup tanpa layout jump: grid-template-rows 0fr → 1fr */
.nav-group-body {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.32s var(--ease);
}

.nav-group.open .nav-group-body {
  grid-template-rows: 1fr;
}

.nav-group-inner {
  overflow: hidden;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin-left: 21px;
  padding-left: 10px;
  border-left: 1px solid var(--hairline-strong);
}

.nav-group.open .nav-group-inner {
  padding-top: 3px;
  padding-bottom: 6px;
}

.nav-sub {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 550;
  color: var(--text-2);
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease);
}

.nav-sub span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-sub:hover {
  background: var(--fill);
  color: var(--text);
}

.nav-sub[aria-current='page'] {
  background: var(--accent-soft);
  color: var(--accent-ink);
}

.nav-ext {
  margin-left: auto;
  color: var(--text-3);
}

.sidebar-footer {
  position: relative;
}

.user-chip-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.user-chip-name,
.user-chip-role {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Sidebar rail (diciutkan) */
body.sidebar-rail .shell {
  grid-template-columns: 84px minmax(0, 1fr);
}

body.sidebar-rail .nav-label,
body.sidebar-rail .brand-text,
body.sidebar-rail .nav-chevron,
body.sidebar-rail .nav-group-body,
body.sidebar-rail .user-chip-text,
body.sidebar-rail .nav-badge {
  display: none;
}

body.sidebar-rail .sidebar-top {
  flex-direction: column;
}

body.sidebar-rail .nav-item,
body.sidebar-rail .user-chip {
  justify-content: center;
  padding-left: 0;
  padding-right: 0;
}

body.sidebar-rail .nav-section {
  height: 1px;
  margin: 10px 8px;
  background: var(--hairline);
}

body.sidebar-rail .menu {
  right: auto;
  width: 220px;
}

/* Aplikasi di dalam dashboard (iframe) */
.frame-view {
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: calc(100vh - 110px);
  min-height: 480px;
}

.frame-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px 8px 12px;
  border-radius: 16px;
}

.frame-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
}

.frame-title span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.frame-sep {
  color: var(--text-3);
}

.frame-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.app-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
  opacity: 0;
  transition: opacity 0.35s var(--ease);
}

.app-frame.ready {
  opacity: 1;
}

.frame-skeleton {
  position: absolute;
  inset: 0;
  padding: 26px;
}

.frame-loading {
  display: flex;
  align-items: center;
  gap: 14px;
}

.frame-loading p {
  margin: 2px 0 0;
  font-size: 13.5px;
}

.frame-slow {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 2;
}

body.frame-focus .sidebar,
body.frame-focus .appbar {
  display: none;
}

body.frame-focus .shell {
  grid-template-columns: minmax(0, 1fr);
}

body.frame-focus .main {
  padding: 10px;
}

body.frame-focus .main > .page {
  max-width: none;
}

body.frame-focus .frame-view {
  height: calc(100vh - 20px);
}

/* Editor menu & akses */
.nav-edit {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-edit-row {
  display: grid;
  grid-template-columns: auto auto 150px minmax(0, 1fr) minmax(0, 1.2fr) auto;
  gap: 6px;
  align-items: center;
}

.nav-edit-row .input,
.nav-edit-row .select {
  min-height: 36px;
  padding: 7px 10px;
}

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

.field.grow {
  flex: 1 1 220px;
}

.chip:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.skeleton-page {
  animation: fade-in 0.2s var(--ease);
}

.back-link {
  color: var(--accent-ink);
}

@media (max-width: 900px) {
  .shell,
  body.sidebar-rail .shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    display: block;
    position: fixed;
    z-index: 55;
    inset: 0 auto 0 0;
    width: min(300px, 86vw);
    height: 100vh;
    height: 100dvh;
    padding: 10px;
    transform: translateX(-105%);
    transition: transform 0.35s var(--ease);
  }

  body.drawer-open .sidebar {
    transform: none;
  }

  /* Mode Fokus menyembunyikan sidebar desktop; di HP sidebar adalah drawer, jadi tetap
     harus bisa dibuka (sebelumnya: scrim buram muncul tanpa menu). */
  body.frame-focus .sidebar {
    display: block;
  }

  body.drawer-open {
    overflow: hidden;
  }

  body.sidebar-rail .nav-label,
  body.sidebar-rail .brand-text,
  body.sidebar-rail .nav-chevron,
  body.sidebar-rail .user-chip-text {
    display: revert;
  }

  body.sidebar-rail .nav-group-body {
    display: grid;
  }

  .rail-toggle {
    display: none;
  }

  .sidebar-scrim {
    position: fixed;
    inset: 0;
    z-index: 50;
    background: rgba(0, 0, 0, 0.32);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
  }

  .appbar-menu {
    display: inline-grid;
  }

  .main {
    padding: 14px 16px 40px;
  }

  .page-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .page-actions {
    justify-content: flex-start;
  }

  .frame-view {
    height: calc(100vh - 96px);
  }

  .hide-sm {
    display: none;
  }

  .nav-edit-row {
    grid-template-columns: auto auto minmax(0, 1fr) auto;
  }

  .nav-edit-row .nav-edit-icon {
    grid-column: 3;
  }

  .nav-edit-row input[name='nav_label'],
  .nav-edit-row input[name='nav_path'] {
    grid-column: 1 / -1;
  }
}

/* =============================================================================
   VERSI: chip "v1.6.0" di header & frame bar, sheet riwayat pembaruan
   ============================================================================= */
.version-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: none;
  height: 26px;
  padding: 0 10px;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  background: var(--fill);
  color: var(--text-2);
  font: 600 12px/1 var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.version-chip:hover {
  background: var(--fill-strong);
  color: var(--text);
}

.version-chip.has-update {
  border-color: transparent;
  background: var(--orange-soft);
  color: var(--orange-ink);
  animation: version-pulse 2.4s ease-in-out infinite;
}

@keyframes version-pulse {
  50% {
    box-shadow: 0 0 0 4px var(--orange-soft);
  }
}

@media (prefers-reduced-motion: reduce) {
  .version-chip.has-update {
    animation: none;
  }
}

.version-update {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 14px;
  margin-bottom: 14px;
  border-radius: 14px;
  background: var(--orange-soft);
  color: var(--orange-ink);
}

.version-update .muted {
  color: var(--text-2);
  font-size: 13px;
  margin-top: 2px;
}

.version-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.version-row {
  padding: 12px 14px;
  border: 1px solid var(--hairline);
  border-radius: 14px;
}

.version-row.is-current {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.version-row-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 14px;
}

.version-row-head .faint {
  margin-left: auto;
  font-size: 12px;
}

.version-now {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 650;
}

.version-row ul {
  margin: 6px 0 0;
  padding-left: 18px;
  font-size: 13.5px;
  color: var(--text-2);
  line-height: 1.5;
}

/* =============================================================================
   FULL FRAME: aplikasi (/app/...) memenuhi seluruh area konten
   ============================================================================= */
body.app-mode .appbar {
  display: none;
}

body.app-mode .main {
  padding: 0;
}

body.app-mode .main > .page {
  max-width: none;
  animation: none;
}

/* Halaman aplikasi dikunci setinggi layar yang TERLIHAT (100dvh): di iOS Safari 100vh lebih
   tinggi dari layar saat toolbar tampil, sehingga muncul blok kosong ±100px di bawah iframe
   (terlihat jelas saat aplikasi membuka pop-up). Scroll terjadi di dalam iframe saja. */
html:has(body.app-mode),
body.app-mode {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
}

body.app-mode .shell {
  min-height: 0;
  height: 100vh;
  height: 100dvh;
}

body.app-mode .frame-view {
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  gap: 0;
}

body.app-mode .frame-bar {
  border-radius: 0;
  border-width: 0 0 1px;
  border-color: var(--hairline);
  box-shadow: none;
  padding: 6px 12px;
  min-height: 48px;
}

body.app-mode .frame-wrap {
  border-radius: 0;
  border: 0;
  box-shadow: none;
}

body.app-mode .sidebar {
  padding-right: 14px;
}

body.app-mode.frame-focus .frame-view {
  height: 100vh;
  height: 100dvh;
}

body.app-mode.frame-focus .main {
  padding: 0;
}
