:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --border: #e3e6eb;
  --border-focus: #3b62d9;
  --text: #1a1e26;
  --text-muted: #64748b;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --danger-bg: #fef2f2;
  --danger-border: #fecaca;
  --danger: #dc2626;
  --ok-bg: #f0fdf4;
  --ok-border: #bbf7d0;
  --ok: #16a34a;
  --warning-bg: #fffbeb;
  --warning-border: #fef3c7;
  --warning: #d97706;
  --sidebar-w: 210px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Helvetica Neue", Arial, sans-serif;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* =========================================================
   Layout: App with Sidebar
   ========================================================= */
.app-wrapper {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 50;
}

.sidebar-brand {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.2px;
}
.sidebar-brand a {
  color: var(--text);
  text-decoration: none;
}

.sidebar-nav {
  padding: 12px 10px;
  flex: 1;
  overflow-y: auto;
}

.sidebar-section-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  padding: 4px 8px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  margin-bottom: 2px;
  border-radius: 5px;
  color: #334155;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.12s ease;
}
.nav-item:hover {
  background: #f1f5f9;
  color: var(--text);
}
.nav-item.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}

.sidebar-footer {
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: #fafbfc;
}
.sidebar-user-info {
  overflow: hidden;
}
.sidebar-user-name {
  font-weight: 600;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 110px;
}
.sidebar-user-role {
  margin-top: 2px;
}

.btn-logout {
  background: none;
  border: 1px solid var(--border);
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  color: var(--text-muted);
  cursor: pointer;
}
.btn-logout:hover {
  background: #f1f5f9;
  color: var(--danger);
  border-color: var(--danger-border);
}

.main-content {
  flex: 1;
  padding: 20px 24px;
  max-width: 1200px;
  min-width: 0;
}

.mobile-topbar {
  display: none;
}
.sidebar-overlay {
  display: none;
}

/* =========================================================
   Auth Wrapper (Login / Register / Maintenance)
   ========================================================= */
.auth-wrapper {
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 0;
  min-height: 100vh;
}

/* =========================================================
   Cards
   ========================================================= */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 14px;
}
.form-card {
  max-width: 600px;
}
.card-header-flex {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.card-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}
.card-subtitle {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 600;
}

/* =========================================================
   Stats Grid (Dashboard)
   ========================================================= */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}
.stat-card {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px;
}
.stat-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.stat-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}
.stat-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.quick-links-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.quick-link-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  text-decoration: none;
  color: var(--text);
  background: #fff;
  transition: all 0.12s ease;
}
.quick-link-item:hover {
  border-color: var(--primary);
  background: #fafcff;
}
.quick-link-item .arrow {
  color: var(--text-muted);
  font-size: 16px;
  font-weight: 600;
}

/* =========================================================
   Sync Notification Banners
   ========================================================= */
.sync-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 6px;
  margin-bottom: 14px;
  font-size: 13px;
}
.sync-banner-content {
  display: flex;
  align-items: center;
  gap: 10px;
}
.sync-banner-running {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e40af;
}
.sync-banner-success {
  background: var(--ok-bg);
  border: 1px solid var(--ok-border);
  color: #14532d;
}
.sync-banner-failed {
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  color: #7f1d1d;
}
.sync-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid #93c5fd;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
  flex-shrink: 0;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

.maintenance-alert-admin {
  background: var(--warning-bg);
  border: 1px solid var(--warning-border);
  color: #92400e;
  padding: 8px 12px;
  border-radius: 6px;
  margin-bottom: 14px;
  font-size: 12px;
}

/* =========================================================
   Filters & Search
   ========================================================= */
.filters-bar {
  margin-bottom: 12px;
}
.filter-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.filter-inputs {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.input-search {
  min-width: 220px;
  flex: 1;
}

.category-pills {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.pill {
  display: inline-block;
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 500;
  border-radius: 12px;
  background: #f1f5f9;
  color: #475569;
  text-decoration: none;
}
.pill:hover {
  background: #e2e8f0;
  color: var(--text);
}
.pill.active {
  background: var(--primary);
  color: #ffffff;
  font-weight: 600;
}

/* =========================================================
   Games Grid
   ========================================================= */
.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.game-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.game-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}
.game-thumb-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #0f172a;
  overflow: hidden;
}
.game-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.game-thumb-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  font-weight: 700;
  font-size: 13px;
}
.badge-tag {
  position: absolute;
  top: 6px;
  left: 6px;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.tag-top20 {
  background: #f59e0b;
  color: #ffffff;
}
.tag-new {
  background: #10b981;
  color: #ffffff;
}

.game-info-block {
  padding: 8px 9px;
  display: flex;
  flex-direction: column;
  flex: 1;
}
.game-name {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.game-meta-row {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: auto;
  flex-wrap: wrap;
}
.badge-provider {
  font-size: 10px;
  background: #f1f5f9;
  color: #475569;
  padding: 1px 5px;
  border-radius: 3px;
  font-weight: 600;
}
.badge-rtp {
  font-size: 10px;
  background: #ecfdf5;
  color: #047857;
  padding: 1px 5px;
  border-radius: 3px;
  font-weight: 600;
}
.game-cats {
  display: flex;
  gap: 3px;
  margin-top: 4px;
  overflow: hidden;
}
.cat-chip {
  font-size: 9px;
  color: var(--text-muted);
  background: #f8fafc;
  padding: 1px 4px;
  border-radius: 2px;
  white-space: nowrap;
}

/* =========================================================
   Pagination
   ========================================================= */
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  gap: 10px;
  flex-wrap: wrap;
}
.pagination-links {
  display: flex;
  align-items: center;
  gap: 4px;
}
.pagination-current {
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-light);
  border-radius: 4px;
}

/* =========================================================
   Table
   ========================================================= */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.table th, .table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}
.table th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  background: #fafbfc;
}
.table tr:last-child td {
  border-bottom: none;
}
.action-buttons {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

/* =========================================================
   Buttons & Badges
   ========================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  line-height: 1.3;
}
.btn:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}
.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}
.btn-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  color: #ffffff;
}
.btn-sm {
  padding: 4px 8px;
  font-size: 11px;
}
.btn-danger-outline {
  color: var(--danger);
  border-color: var(--danger-border);
  background: transparent;
}
.btn-danger-outline:hover {
  background: var(--danger-bg);
}
.btn-link {
  border: none;
  background: none;
  color: var(--primary);
  padding: 0;
  cursor: pointer;
}
.btn-link:hover {
  text-decoration: underline;
}
.btn-block {
  width: 100%;
}

.badge {
  display: inline-block;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 600;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.badge-admin {
  background: #e0e7ff;
  color: #3730a3;
}
.badge-user {
  background: #f1f5f9;
  color: #475569;
}
.badge-subtle {
  background: #e2e8f0;
  color: #1e293b;
}
.badge-success {
  background: #dcfce7;
  color: #166534;
}

/* =========================================================
   Forms
   ========================================================= */
.form .field {
  margin-bottom: 12px;
}
.form label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 4px;
  color: #334155;
}
.form input[type="text"],
.form input[type="email"],
.form input[type="password"],
.form textarea,
.select-field,
.input-sm,
.select-sm {
  width: 100%;
  padding: 6px 9px;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: #ffffff;
  color: var(--text);
  font-family: inherit;
}
.input-sm, .select-sm {
  width: auto;
  padding: 4px 8px;
  font-size: 12px;
}
.form input:focus,
.form textarea:focus,
.select-field:focus,
.input-sm:focus,
.select-sm:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}
.field-checkbox label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 400;
  cursor: pointer;
}
.field-checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
}
.form-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.settings-section {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.section-subtitle {
  font-size: 13px;
  font-weight: 700;
  margin: 0 0 10px;
  color: var(--text);
}

/* Flash */
.flash {
  padding: 8px 12px;
  border-radius: 6px;
  margin-bottom: 14px;
  font-size: 12px;
}
.flash.notice {
  background: var(--ok-bg);
  border: 1px solid var(--ok-border);
  color: var(--ok);
}
.flash.alert {
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  color: var(--danger);
}
.flash ul {
  margin: 0;
  padding-left: 16px;
}

.muted { color: var(--text-muted); font-size: 12px; margin: 2px 0; }
.muted-sm { color: var(--text-muted); font-size: 11px; margin: 2px 0; }
.center { text-align: center; }

/* =========================================================
   Responsive Design (<768px)
   ========================================================= */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: -220px;
    height: 100vh;
    transition: left 0.2s ease;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
  }
  .sidebar.open {
    left: 0;
  }
  .sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.3);
    z-index: 40;
  }
  .sidebar-overlay.open {
    display: block;
  }

  .mobile-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 46px;
    padding: 0 14px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 30;
  }
  .sidebar-toggle {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    width: 26px;
    height: 22px;
    background: transparent;
    border: none;
    padding: 2px;
    cursor: pointer;
  }
  .sidebar-toggle span {
    width: 100%;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
  }
  .mobile-brand {
    font-size: 13px;
    font-weight: 700;
  }

  .main-content {
    padding: 14px 12px;
  }
  .grid-2col {
    grid-template-columns: 1fr;
  }
  .games-grid {
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 8px;
  }
}

/* =========================================================
   Instance Management & Moneysite Scraper Styles
   ========================================================= */
.input-field,
.select-field {
  width: 100%;
  padding: 8px 12px;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input-field:focus,
.select-field:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* Moneysite Scraper Box */
.moneysite-scrape-box {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.04), rgba(168, 85, 247, 0.04));
  border: 1px solid rgba(37, 99, 235, 0.25);
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 20px;
}
.scrape-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.scrape-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  color: #1e40af;
}
.scrape-form-row {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
  align-items: center;
}

/* Instance Segmented Tabs */
.instance-tabs-bar {
  display: flex;
  gap: 6px;
  border-bottom: 2px solid var(--border);
  padding-top: 16px;
  overflow-x: auto;
}
.instance-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: 8px 8px 0 0;
  border: 1px solid transparent;
  border-bottom: none;
  background: transparent;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.instance-tab-btn:hover {
  color: var(--primary);
  background: rgba(37, 99, 235, 0.04);
}
.instance-tab-btn.active {
  color: var(--primary);
  background: #ffffff;
  border-color: var(--border);
  border-bottom: 2px solid #ffffff;
  margin-bottom: -2px;
  font-weight: 700;
  box-shadow: 0 -2px 6px rgba(0,0,0,0.02);
}

/* Star Favorite Toggle */
.star-toggle-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  cursor: pointer;
  user-select: none;
  transition: all 0.15s ease;
}
.star-toggle-label input[type="checkbox"] {
  display: none;
}
.star-toggle-label .star-icon {
  font-size: 18px;
  color: #94a3b8;
  line-height: 1;
  transition: all 0.15s ease;
}
.star-toggle-label input[type="checkbox"]:checked + .star-icon {
  color: #eab308;
  transform: scale(1.15);
  filter: drop-shadow(0 0 3px rgba(234, 179, 8, 0.6));
}
.star-toggle-label:hover {
  background: rgba(234, 179, 8, 0.1);
}

/* Badge Gold */
.badge-gold {
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
  font-weight: 700;
}

/* Status proses background (scrape moneysite) */
.scrape-status { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; padding: 9px 12px; border-radius: 8px; font-size: 12px; border: 1px solid var(--border); background: #fff; }
.scrape-status em { margin-left: auto; color: var(--text-muted); font-style: normal; font-size: 11px; }
.scrape-running { border-color: var(--warning-border); background: var(--warning-bg); color: var(--warning); }
.scrape-done { border-color: var(--ok-border); background: var(--ok-bg); color: var(--ok); }
.scrape-failed { border-color: var(--danger-border); background: var(--danger-bg); color: var(--danger); }

/* Statistik instance */
.inst-code { display: inline-block; padding: 4px 10px; border-radius: 8px; background: rgba(37, 99, 235, .1); color: var(--primary); font-weight: 800; font-size: 16px; letter-spacing: 1.5px; border: 1px solid rgba(37, 99, 235, .2); }
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 12px; }
.kpi { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; }
.kpi-label { font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; }
.kpi-value { font-size: 26px; font-weight: 800; margin: 4px 0 2px; font-variant-numeric: tabular-nums; }
.delta { font-size: 11px; font-weight: 700; }
.delta.up { color: var(--ok); } .delta.down { color: var(--danger); } .delta.flat { color: var(--text-muted); }
.bars { display: flex; align-items: flex-end; gap: 4px; height: 180px; padding: 8px 0 0; }
.bar-col { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: stretch; }
.bar-pair { flex: 1; display: flex; align-items: flex-end; gap: 1px; }
.bar { flex: 1; min-height: 2px; border-radius: 3px 3px 0 0; }
.bar.v { background: var(--primary); } .bar.c { background: #f59e0b; }
.bar-label { font-size: 9px; color: var(--text-muted); text-align: center; margin-top: 3px; white-space: nowrap; overflow: hidden; }
.bars.hours { height: 120px; }
.legend { display: flex; gap: 14px; font-size: 11px; color: var(--text-muted); margin: 2px 0 6px; }
.lg::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.lg.v::before { background: var(--primary); } .lg.c::before { background: #f59e0b; }
.meter { height: 8px; background: var(--bg); border-radius: 4px; overflow: hidden; flex: 1; min-width: 40px; }
.meter > span { display: block; height: 100%; background: var(--primary); border-radius: 4px; }
.share-row { display: flex; align-items: center; gap: 10px; font-size: 12px; margin: 4px 0; }
.share-row > span { width: 90px; flex-shrink: 0; } .share-row > strong { width: 46px; text-align: right; }
.muted-row { color: var(--text-muted); }

/* Security log */
.sev-high { background: rgba(220, 38, 38, .12); color: #b91c1c; border: 1px solid rgba(220, 38, 38, .3); }
.inline-filter { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.inline-filter select, .inline-filter input[type=text] { padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; }
.pagination-bar { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }

/* Settings: domain panel & whitelist */
.route-rules { background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; margin: 10px 0 14px; }
.route-rules-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--text-muted); margin-bottom: 4px; }
.route-rules .table { margin: 0; }
.ns-chip { display: inline-block; background: rgba(37, 99, 235, .08); color: var(--primary); padding: 2px 8px; border-radius: 4px; font-size: 11px; margin-bottom: 3px; }
.ns-chip.live { background: #fff; color: var(--text); border: 1px solid var(--border); }

/* RTP pill di statistik */
.rtp-pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.rtp-high { background: rgba(22, 163, 74, .14); color: #15803d; }
.rtp-medium { background: rgba(245, 158, 11, .16); color: #b45309; }
.rtp-low { background: rgba(220, 38, 38, .12); color: #b91c1c; }

/* Kepemilikan instance */
.ownership-card { background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; margin: 4px 0 18px; }
.ownership-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--text-muted); margin-bottom: 8px; }
.ownership-row { display: flex; gap: 12px; flex-wrap: wrap; padding: 4px 0; font-size: 14px; }
.ownership-label { min-width: 130px; font-size: 12px; font-weight: 700; color: var(--text-muted); }
.ownership-form { border-top: 1px dashed var(--border); margin-top: 10px; padding-top: 10px; }

/* Log aktivitas instance */
.activity-changes { margin: 6px 0 0; padding-left: 18px; font-size: 12px; line-height: 1.6; }
.chg-add { color: #15803d; word-break: break-word; }
.chg-del { color: #b91c1c; word-break: break-word; margin-right: 6px; }

/* =========================================================
   Responsif & kenyamanan (mobile-first polish)
   ========================================================= */
html { -webkit-text-size-adjust: 100%; }
body { font-size: 14px; }
.card { border-radius: 12px; }
.card-title { font-size: 20px; letter-spacing: -.2px; }
.card-subtitle { font-size: 15px; }
.btn { min-height: 38px; padding: 8px 16px; border-radius: 9px; font-size: 13px; font-weight: 600; line-height: 1.2; }
.btn-sm { min-height: 32px; padding: 6px 12px; font-size: 12px; }
.input-field, .select-field, select, input[type=text], input[type=email], input[type=password], input[type=url], input[type=search], input[type=number], textarea {
  min-height: 40px; font-size: 14px; border-radius: 9px;
}
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; font-weight: 700; color: var(--text-muted); margin-bottom: 5px; letter-spacing: .2px; }
.table th { font-size: 11px; letter-spacing: .4px; text-transform: uppercase; color: var(--text-muted); }
.table td { vertical-align: top; }
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 10px; }
.badge { border-radius: 999px; font-weight: 700; letter-spacing: .3px; }
.flash { border-radius: 10px; font-size: 13px; }
.nav-item { min-height: 40px; display: flex; align-items: center; border-radius: 8px; font-weight: 600; }
.sidebar-section-title { font-size: 10px; letter-spacing: .8px; }

/* Tab instance: bisa digeser di layar sempit, tidak membungkus berantakan */
.instance-tabs-bar { display: flex; gap: 6px; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; padding-bottom: 4px; }
.instance-tabs-bar::-webkit-scrollbar { display: none; }
.instance-tab-btn { flex: 0 0 auto; white-space: nowrap; min-height: 36px; display: inline-flex; align-items: center; gap: 6px; }

/* Halaman masuk/daftar */







@media (max-width: 768px) {
  body { font-size: 14px; }
  .app-wrapper { display: block; }
  .main-content, .content, main.content { padding: 12px !important; width: 100%; }
  .card { padding: 14px !important; margin-bottom: 12px; }
  .card-header-flex { flex-direction: column; align-items: stretch !important; gap: 10px; }
  .card-header-flex > div:last-child { display: flex; flex-wrap: wrap; gap: 8px; }
  .card-header-flex .btn, .form-actions .btn { flex: 1 1 auto; justify-content: center; text-align: center; }
  .card-title { font-size: 18px; }
  .stats-grid, .grid-2col, .kpi-grid { grid-template-columns: 1fr !important; }
  .form-grid, .color-grid, .two-col { grid-template-columns: 1fr !important; }
  .input-field, .select-field, select, input, textarea { width: 100%; max-width: 100% !important; }
  .table th, .table td { padding: 10px 8px; font-size: 13px; }
  .action-buttons { flex-direction: column; align-items: stretch !important; }
  .action-buttons .btn { width: 100%; }
  .btn { min-height: 42px; }
  .inline-filter { flex-direction: column; align-items: stretch; }
  .pagination-bar .btn { min-width: 40px; }
  .auth-card { padding: 24px 18px; box-shadow: none; border: 1px solid var(--border); }
  .bars { height: 140px; }
  .bar-label { font-size: 8px; }
}
@media (max-width: 420px) {
  .card-title { font-size: 17px; }
  .kpi-value { font-size: 22px; }
}

/* Panduan Cara Pakai */
.guide-toc { columns: 2; column-gap: 24px; margin: 6px 0 0; padding-left: 20px; font-size: 13px; line-height: 1.9; }
.guide-step { margin-top: 14px; }
.guide-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.guide-head .card-subtitle { margin: 0; }
.guide-num { width: 28px; height: 28px; border-radius: 50%; background: var(--primary); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 13px; flex-shrink: 0; }
.guide-text { margin: 0 0 12px; color: var(--text); line-height: 1.6; }
.guide-shot img { width: 100%; height: auto; border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 6px 20px rgba(15, 23, 42, .08); display: block; }
@media (max-width: 768px) { .guide-toc { columns: 1; } }

/* Toast Notification */
.toast-container { position: fixed; top: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; transition: opacity .4s; pointer-events: none; }
.toast { display: flex; align-items: flex-start; gap: 12px; width: 340px; max-width: calc(100vw - 40px); padding: 14px 16px; border-radius: 12px; background: #fff; box-shadow: 0 10px 30px rgba(0,0,0,0.12), 0 4px 8px rgba(0,0,0,0.06); border-left: 4px solid var(--border); pointer-events: auto; animation: slideInRight .3s ease-out; }
.toast.notice { border-left-color: var(--ok); }
.toast.alert { border-left-color: var(--danger); }
.toast-icon { flex-shrink: 0; width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800; color: #fff; }
.toast.notice .toast-icon { background: var(--ok); }
.toast.alert .toast-icon { background: var(--danger); }
.toast-text { flex: 1; min-width: 0; font-size: 13px; color: var(--text); line-height: 1.4; margin-top: 2px; }
.toast-close { flex-shrink: 0; background: transparent; border: none; font-size: 20px; color: var(--text-muted); cursor: pointer; padding: 0; line-height: 1; margin-top: -2px; }
.toast-close:hover { color: var(--text); }
@keyframes slideInRight { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* SaaS Login Layout */
.auth-layout { background: #fff; margin: 0; padding: 0; min-height: 100vh; min-height: 100dvh; width: 100%; display: flex; flex-direction: column; overflow-x: hidden; }
.auth-wrapper { width: 100%; flex: 1; margin: 0; padding: 0; display: flex; }
.auth-split { display: flex; flex: 1; width: 100%; align-items: stretch; }
.auth-left { flex: 1 1 50%; display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 48px 40px; background: #ffffff; }
.auth-right { flex: 1 1 50%; background: linear-gradient(135deg, #1e40af 0%, #1e1b4b 60%, #0f172a 100%); display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 60px 48px; color: #fff; position: relative; overflow: hidden; }
.auth-right::before { content: ""; position: absolute; top: -50%; left: -50%; width: 200%; height: 200%; background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, transparent 60%); pointer-events: none; }
.auth-header { margin-bottom: 28px; width: 100%; }
.auth-header h1 { font-size: 32px; font-weight: 800; letter-spacing: -0.6px; margin: 0 0 8px; color: #0f172a; line-height: 1.2; }
.auth-header p { font-size: 15px; color: #64748b; margin: 0; line-height: 1.5; }
.auth-form { width: 100%; max-width: 560px; margin: 0 auto; }
.auth-form .field { margin-bottom: 20px; }
.auth-form .field label { font-size: 14px; font-weight: 700; color: #334155; margin-bottom: 7px; display: block; }
.auth-form .input-field { background: #f8fafc; border: 1.5px solid #cbd5e1; border-radius: 10px; min-height: 52px; padding: 13px 16px; font-size: 16px; width: 100%; transition: all .2s; }
.auth-form .input-field:focus { background: #fff; border-color: #2563eb; box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12); outline: none; }
.auth-form .btn-block { min-height: 52px; font-size: 17px; font-weight: 700; border-radius: 10px; margin-top: 10px; width: 100%; }
.auth-features { max-width: 520px; width: 100%; position: relative; z-index: 1; }
.auth-features h2 { font-size: 34px; font-weight: 800; letter-spacing: -0.8px; margin: 0 0 16px; line-height: 1.25; }
.auth-features p { font-size: 16px; color: rgba(255,255,255,0.85); margin: 0 0 32px; line-height: 1.6; }
.feature-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 16px; }
.feature-list li { display: flex; align-items: flex-start; gap: 14px; font-size: 15px; color: rgba(255,255,255,0.92); line-height: 1.45; background: rgba(255, 255, 255, 0.06); padding: 12px 16px; border-radius: 12px; border: 1px solid rgba(255, 255, 255, 0.1); }
.feature-icon { width: 22px; height: 22px; border-radius: 50%; background: #22c55e; color: #fff; font-weight: 800; font-size: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; margin-top: 1px; }
@media (max-width: 992px) {
  .auth-split { flex-direction: column; }
  .auth-right { padding: 40px 20px; flex: none; min-height: auto; width: 100%; }
  .auth-left { padding: 40px 20px; flex: none; min-height: auto; width: 100%; }
  .auth-form { max-width: 100%; }
  .auth-features h2 { font-size: 26px; }
  .toast-container { top: 12px; right: 12px; left: 12px; align-items: center; }
  .toast { width: 100%; max-width: 100%; }
}
