:root {
  --bg-primary: #0a0a0b;
  --bg-secondary: #111113;
  --bg-tertiary: #111113;
  --text-primary: #ffffff;
  --text-secondary: #e0e0e0;
  --text-muted: #9ca3af;
  --accent: #10b77f;
  --accent-hover: #10b77fe6;
  --border: #27272b;
  --border-input: #27272b;
  --sidebar-width: 240px;
  --header-height: 56px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: var(--bg-primary);
  color: var(--text-secondary);
  min-height: 100vh;
  font-size: 14px;
}

.dashboard {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.dashboard-body {
  display: flex;
  flex: 1;
  min-height: 0;
}

.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 0;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  color: #878792;
  text-decoration: none;
  border: none;
  background: none;
  width: 100%;
  cursor: pointer;
  font-size: 14px;
  text-align: left;
  transition: background 0.15s, color 0.15s;
}

.sidebar-item:hover {
  background: #1d1d2080;
  color: #f2f2f2;
}

.sidebar-item.active {
  background: rgba(16, 183, 127, 0.1);
  color: var(--accent);
  font-weight: 600;
}

.sidebar-item svg {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
}

.sidebar-footer-brand {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.sidebar-env-app {
  margin-top: 4px;
  display: none;
  flex-direction: column;
  gap: 8px;
}

.sidebar-app-wrap,
.sidebar-env-wrap {
  position: relative;
}

.sidebar-env-app .app-select,
.sidebar-env-app .env-select {
  width: 100%;
  justify-content: space-between;
}

#env-footer-label {
  margin-top: 8px;
}

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

.header {
  height: var(--header-height);
  width: 100%;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  flex-shrink: 0;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-primary);
  font-weight: 700;
  font-size: 18px;
}

.header-app-wrap {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 16px;
}

.app-select {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.app-select:hover {
  border-color: var(--accent);
  color: var(--text-primary);
}

.app-label {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-chevron {
  width: 14px;
  height: 14px;
}

.app-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 200px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.4);
  z-index: 1000;
}

.app-dropdown[hidden] {
  display: none !important;
}

.app-option {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border: none;
  border-radius: 6px;
  background: none;
  color: var(--text-secondary);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.app-option:hover {
  background: #1d1d2080;
  color: #f2f2f2;
}

.app-option-selected {
  background: rgba(16, 183, 127, 0.1);
  color: var(--accent);
}

.app-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--accent);
}

.header-logo-text {
  white-space: nowrap;
}

.header-logo .logo-icon {
  width: 28px;
  height: 28px;
  padding: 4px;
  border-radius: 50%;
  background: #10b77f17;
  color: var(--accent);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-env-wrap {
  position: relative;
}

.env-select {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
}

.env-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.env-dot-staging {
  background: #f59e0b;
}

.env-dot-production {
  background: var(--accent);
}

.env-chevron {
  flex-shrink: 0;
  transition: transform 0.2s;
}

.header-env-wrap[data-open="true"] .env-chevron {
  transform: rotate(180deg);
}

.env-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 180px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.4);
  z-index: 1000;
}

.env-dropdown[hidden] {
  display: none !important;
}

.sidebar-env-wrap .env-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: auto;
  bottom: auto;
  min-width: 100%;
}

.env-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: 6px;
  background: none;
  color: var(--text-primary);
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: background 0.15s;
}

.env-option:hover {
  background: var(--bg-tertiary);
}

.env-option-selected {
  background: var(--accent);
  color: #0d0d0d;
  font-weight: 500;
}

.env-option .env-check {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.env-option:not(.env-option-selected) .env-check {
  display: none !important;
}

.env-option-selected .env-dot-staging {
  background: #b45309;
}

.env-option-selected .env-dot-production {
  background: #0d0d0d;
}

.header-profile-wrap {
  position: relative;
}

.user-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  border: none;
  background: none;
  color: var(--text-primary);
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  border-radius: 8px;
  transition: background 0.15s;
}

.user-trigger:hover {
  background: var(--bg-secondary);
}

.user-name {
  font-weight: 500;
}

.user-chevron {
  flex-shrink: 0;
  transition: transform 0.2s;
}

.header-profile-wrap[data-open="true"] .user-chevron {
  transform: rotate(180deg);
}

.user-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #10b77f17;
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  flex-shrink: 0;
}

.profile-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 240px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.4);
  z-index: 1000;
}

.profile-dropdown[hidden] {
  display: none !important;
}

.profile-dropdown-header {
  margin-bottom: 10px;
}

.profile-dropdown-name {
  font-weight: 700;
  font-size: 15px;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.profile-dropdown-email {
  font-size: 13px;
  color: var(--text-muted);
}

.profile-dropdown-role {
  margin-bottom: 12px;
}

.role-pill {
  display: inline-block;
  padding: 6px 12px;
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 20px;
}

.profile-dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 12px 0;
}

.profile-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 0;
  border: none;
  background: none;
  color: #ef4444;
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  text-decoration: none;
  transition: opacity 0.15s;
}

.profile-dropdown-item:hover {
  opacity: 0.9;
}

.profile-dropdown-signout svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.page-content {
  flex: 1;
  padding: 24px;
  overflow: auto;
}

.page-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 4px 0;
}

.page-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin: 0 0 24px 0;
}

.panels {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}


.panel {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.panel:hover {
  border-color: rgba(16, 183, 127, 0.3);
  box-shadow: 0 0 30px #10b98114;
  transform: translateY(-1px);
}

.gems-panel {
  padding: 24px 24px 20px 24px;
}

.gems-panel-header {
  margin-bottom: 20px;
}

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

.gems-toggle-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-radius: 10px;
  background: #1d1d204d;
}

.gems-toggle-card .switch-wrap {
  width: auto;
  justify-content: flex-end;
}

.gems-divider {
  height: 1px;
  background: #27272b;
  margin: 24px 0 20px 0;
}

.gems-section-card {
  border-radius: 12px;
  border: 1px solid rgba(39, 39, 43, 0.6);
  background: rgba(24, 24, 27, 0.8);
  padding: 18px 20px 20px 20px;
  margin-bottom: 16px;
}

.gems-section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 14px;
}

.gems-section-header svg {
  width: 16px;
  height: 16px;
  color: var(--accent);
}

.gems-section-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px 20px;
}

.gems-section-grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.panel-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 4px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-title svg {
  width: 20px;
  height: 20px;
  color: var(--text-muted);
}

.panel-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0 0 20px 0;
}

.form-group {
  margin-bottom: 20px;
}

.form-group:last-of-type {
  margin-bottom: 24px;
}

.form-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-description {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
}

.form-group-inline {
  padding: 14px 18px;
  border-radius: 12px;
  background: #1d1d204d;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.form-group-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

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

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

.input {
  width: 100%;
  padding: 10px 14px;
  background: #0a0a0b;
  border: 1px solid var(--border-input);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 14px;
  transition: border-color 0.15s;
  display: inherit !important;
}

.input:focus {
  outline: none;
  border-color: var(--accent);
  border-width: 2px;
}

textarea.input {
  min-height: 80px;
  resize: vertical;
}

.input-mono {
  font-family: ui-monospace, monospace;
  font-size: 13px;
}

.overrides-kill-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

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

.switch-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.switch {
  position: relative;
  width: 48px;
  height: 26px;
  background: var(--border-input);
  border-radius: 13px;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
}

.switch.on {
  background: var(--accent);
}

.switch-knob {
  position: absolute;
  top: 1px;
  left: 1px;
  width: 20px;
  height: 20px;
  background: #0a0a0b;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

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

.switch.on .switch-knob {
  transform: translateX(22px);
}

.actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 500;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  text-decoration: none;
  border: 1px solid transparent;
  font-family: inherit;
}

.btn svg {
  width: 18px;
  height: 18px;
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text-secondary);
}

.btn-ghost:hover {
  background: var(--bg-tertiary);
  border-color: var(--border-input);
}

.btn-primary {
  background: #10b77ffb;
  color: #ffffff;
  border: none;
}

.btn-primary:hover {
  background: #10b77fe6;
}

.version-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.version-item {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.version-item:last-child {
  border-bottom: none;
}

.version-info {
  flex: 1;
  min-width: 0;
}

.version-name {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.version-meta {
  font-size: 12px;
  color: var(--text-muted);
}

.badge-current {
  display: inline-block;
  padding: 4px 10px;
  background: rgba(0, 255, 153, 0.2);
  color: var(--accent);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  margin-left: 8px;
}

.btn-rollback {
  padding: 6px 12px;
  font-size: 12px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s, border-color 0.15s;
}

.btn-rollback:hover {
  background: var(--bg-tertiary);
  border-color: var(--border-input);
}

.btn-rollback svg {
  width: 14px;
  height: 14px;
}

.auth {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 16px;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  border-radius: 14px;
  padding: 32px 28px;
  box-shadow: 0 0 30px rgba(0,0,0,0.25);
}

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

.auth-logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: #10b77f17;
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.auth-logo svg {
  width: 20px !important;
  height: 20px !important;
  flex-shrink: 0;
}

.auth-title {
  color: var(--text-primary);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.auth-subtitle {
  color: var(--text-muted);
  font-size: 13px;
  display: none;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: -6px;
}

.auth-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  font-size: 13px;
}

.auth-link:hover {
  color: var(--accent-hover);
}

.auth-submit {
  width: 100%;
}

.auth-footer {
  margin-top: 14px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

.auth-alert {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 12px;
  font-size: 13px;
}

.auth-alert-error {
  border-color: rgba(255, 80, 80, 0.35);
  background: rgba(255, 80, 80, 0.07);
  color: #ffd0d0;
}

.auth-alert-success {
  border-color: rgba(16, 183, 127, 0.35);
  background: rgba(16, 183, 127, 0.08);
  color: #d7fff0;
}

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
}

.toast {
  min-width: 320px;
  max-width: 480px;
  padding: 16px 20px;
  border-radius: 12px;
  border: none;
  box-shadow: 0 10px 40px rgba(0,0,0,0.4);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  pointer-events: auto;
  transform: translateX(calc(100% + 24px));
  animation: slideIn 0.3s ease forwards;
}

.toast.hiding {
  animation: slideOut 0.3s ease forwards;
}

@keyframes slideIn {
  to {
    transform: translateX(0);
  }
}

@keyframes slideOut {
  to {
    transform: translateX(calc(100% + 24px));
  }
}

.toast-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  margin-top: 2px;
}

.toast-content {
  flex: 1;
  min-width: 0;
}

.toast-title {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 4px;
}

.toast-message {
  font-size: 13px;
  line-height: 1.5;
  opacity: 0.95;
}

.toast-close {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background 0.15s, opacity 0.15s;
  opacity: 0.8;
}

.toast-close:hover {
  background: rgba(0, 0, 0, 0.2);
  opacity: 1;
}

.toast-close svg {
  width: 16px;
  height: 16px;
}

.toast.success {
  background: #10b77f;
  color: #ffffff;
}

.toast.success .toast-icon,
.toast.success .toast-title,
.toast.success .toast-close {
  color: #ffffff;
}

.toast.error {
  background: #ef4444;
  color: #ffffff;
}

.toast.error .toast-icon,
.toast.error .toast-title,
.toast.error .toast-close {
  color: #ffffff;
}

.toast.warning {
  background: #f59e0b;
  color: #ffffff;
}

.toast.warning .toast-icon,
.toast.warning .toast-title,
.toast.warning .toast-close {
  color: #ffffff;
}

.toast.info {
  background: #3b82f6;
  color: #ffffff;
}

.toast.info .toast-icon,
.toast.info .toast-title,
.toast.info .toast-close {
  color: #ffffff;
}

.input.error {
  border-color: #ef4444;
}

.input.error:focus {
  border-color: #ef4444;
}

.form-error {
  color: #ef4444;
  font-size: 12px;
  margin-top: 4px;
}

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

.page-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal[hidden] {
  display: none !important;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  width: 100%;
  max-width: 520px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  max-height: 90vh;
  overflow: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 28px 20px;
  border-bottom: 1px solid var(--border);
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
  padding: 0;
}

.modal-close:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.modal-close svg {
  width: 18px;
  height: 18px;
}

.modal-body {
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.panel-search {
  position: relative;
  margin-bottom: 20px;
}

.panel-search svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 10px 14px 10px 42px;
  background: var(--bg-primary);
  border: 1px solid var(--border-input);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.15s;
}

.search-input:focus {
  outline: none;
  border-color: var(--accent);
  border-width: 2px;
  padding-left: 41px;
}

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

.table-wrap {
  overflow-x: auto;
  border-radius: 10px;
  border: 1px solid var(--border);
}

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

.data-table thead {
  background: var(--bg-primary);
}

.data-table th {
  text-align: left;
  padding: 14px 16px;
  font-weight: 600;
  color: var(--text-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
}

.data-table tbody tr {
  transition: background 0.15s;
}

.data-table tbody tr:hover {
  background: var(--bg-primary);
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.user-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-avatar-sm {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #10b77f17;
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}

.user-name {
  font-weight: 500;
  color: var(--text-primary);
}

.role-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}

.role-super-admin {
  background: rgba(139, 92, 246, 0.15);
  color: #a78bfa;
}

.role-admin {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
}

.role-editor {
  background: rgba(16, 183, 127, 0.15);
  color: var(--accent);
}

.role-viewer {
  background: rgba(156, 163, 175, 0.15);
  color: #9ca3af;
}

.status-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  border: none;
  font-family: inherit;
}

.status-badge.status-toggle {
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
}

.status-badge.status-toggle:hover {
  opacity: 0.8;
  transform: translateY(-1px);
}

.status-badge.status-toggle:active {
  transform: translateY(0);
}

.status-active {
  background: rgba(16, 183, 127, 0.15);
  color: var(--accent);
}

.status-pending {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
}

.status-inactive {
  background: rgba(156, 163, 175, 0.15);
  color: #9ca3af;
}

.btn-icon {
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
  padding: 0;
}

.btn-icon:hover {
  background: var(--bg-primary);
  color: #ef4444;
}

.btn-icon svg {
  width: 18px;
  height: 18px;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state svg {
  width: 64px;
  height: 64px;
  margin-bottom: 16px;
  opacity: 0.3;
}

.empty-state-text {
  font-size: 16px;
  font-weight: 500;
}

select.input {
  cursor: pointer;
  appearance: none;
  background: #0a0a0b url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23878792' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center;
  background-size: 18px;
  padding-right: 40px;
}

select.input:focus {
  background: #0a0a0b url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2310b77f' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 11px center;
  background-size: 18px;
  padding: 9px 39px 9px 13px;
}

.input:disabled,
.input:read-only {
  opacity: 0.6;
  cursor: not-allowed;
  background: var(--bg-tertiary);
}

select.input:not(:disabled):not([readonly]) {
  opacity: 1;
  cursor: pointer;
  background: #0a0a0b url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23878792' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center;
}

.btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.btn-primary svg,
.btn-ghost svg {
  margin-right: 8px;
}

.auth-alert {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 20px;
}

.auth-alert-success {
  background: rgba(16, 183, 127, 0.15);
  color: var(--accent);
  border: 1px solid rgba(16, 183, 127, 0.3);
}

.auth-alert-error {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.form-description {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  margin-bottom: 0;
}

.coming-soon-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  text-align: center;
  padding: 60px 20px;
}

.coming-soon-icon {
  width: 120px;
  height: 120px;
  border-radius: 24px;
  background: rgba(16, 183, 127, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 32px;
}

.coming-soon-icon svg {
  width: 64px;
  height: 64px;
  color: var(--accent);
}

.coming-soon-title {
  font-size: 32px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 12px 0;
}

.coming-soon-subtitle {
  font-size: 18px;
  font-weight: 600;
  color: var(--accent);
  margin: 0 0 24px 0;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.coming-soon-description {
  font-size: 16px;
  color: var(--text-secondary);
  max-width: 600px;
  line-height: 1.6;
  margin: 0;
}

.mobile-menu-toggle {
  display: none;
  width: 40px;
  height: 40px;
  border: none;
  background: none;
  color: var(--text-primary);
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  transition: background 0.15s;
}

.mobile-menu-toggle:hover {
  background: var(--bg-secondary);
}

.mobile-menu-toggle svg {
  width: 24px;
  height: 24px;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 998;
}

.sidebar-overlay.active {
  display: block;
}

@media (max-width: 1024px) {
  .dashboard-body {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 999;
    width: 260px;
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

  .mobile-menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .main-wrap {
    margin-left: 0;
  }

  .header-left {
    gap: 12px;
  }

  .header-logo-text {
    display: none;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .panels {
    grid-template-columns: 1fr;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .modal-content {
    max-width: 95%;
    margin: 20px;
  }

  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .data-table {
    min-width: 800px;
  }

  .page-header button {
    white-space: nowrap;
  }

  .header-app-wrap,
  .header-env-wrap {
    display: none;
  }

  .sidebar-env-app {
    display: flex;
  }
}

@media (max-width: 768px) {
  .header {
    padding: 12px 16px;
    height: auto;
    min-height: 60px;
  }

  .header-right {
    position: static;
  }

  .header-env-wrap {
    position: relative;
  }

  .env-dropdown {
    position: fixed;
    right: 16px;
    left: auto;
    top: 70px;
  }

  .header-profile-wrap {
    position: relative;
  }

  .profile-dropdown {
    position: fixed;
    right: 16px;
    left: auto;
    top: 70px;
    min-width: 240px;
  }

  .user-name {
    display: none;
  }

  .user-trigger {
    min-width: auto;
  }

  .user-chevron {
    display: none;
  }

  .page-content {
    padding: 20px 16px;
  }

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

  .page-subtitle {
    font-size: 13px;
  }

  .panel {
    padding: 20px 16px;
  }

  .panel-title {
    font-size: 16px;
  }

  .panel-subtitle {
    font-size: 12px;
  }

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

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

  .form-group-inline {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .switch-wrap {
    width: 100%;
    display: flex;
    justify-content: flex-start;
  }

  .actions {
    flex-direction: column;
    gap: 12px;
  }

  .actions .btn {
    width: 100%;
  }

  .btn {
    padding: 12px 20px;
    font-size: 14px;
  }

  .modal-content {
    padding: 0;
  }

  .modal-header {
    padding: 20px 16px;
  }

  .modal-body {
    padding: 20px 16px;
  }

  .modal-footer {
    flex-direction: column-reverse;
    gap: 12px;
  }

  .modal-footer .btn {
    width: 100%;
  }

  .auth-card {
    padding: 28px 20px;
    margin: 20px 16px;
  }

  .coming-soon-page {
    padding: 40px 16px;
  }

  .coming-soon-icon {
    width: 100px;
    height: 100px;
  }

  .coming-soon-icon svg {
    width: 50px;
    height: 50px;
  }

  .coming-soon-title {
    font-size: 24px;
  }

  .coming-soon-subtitle {
    font-size: 14px;
  }

  .coming-soon-description {
    font-size: 14px;
  }

  .toast-container {
    bottom: 16px;
    right: 16px;
    left: 16px;
  }

  .toast {
    min-width: auto;
    width: 100%;
  }
}

@media (max-width: 480px) {
  .header {
    flex-wrap: nowrap;
    gap: 8px;
  }

  .header-left {
    flex: 1;
    min-width: 0;
    gap: 8px;
  }

  .header-logo .logo-icon {
    width: 24px;
    height: 24px;
  }

  .header-logo-text {
    font-size: 14px;
  }

  .header-right {
    flex-shrink: 0;
    gap: 6px;
  }

  .env-select {
    padding: 6px 8px;
    gap: 5px;
    min-width: auto;
  }

  .env-label {
    font-size: 11px;
  }

  .env-dot {
    width: 6px;
    height: 6px;
  }

  .env-chevron {
    width: 11px;
    height: 11px;
  }

  .sidebar-env-app .env-select {
    padding: 8px 14px;
    gap: 8px;
    min-width: 100%;
    justify-content: space-between;
    text-align: left;
  }

  .sidebar-env-app .env-label {
    font-size: 13px;
  }

  .sidebar-env-app .env-dot {
    width: 8px;
    height: 8px;
  }

  .sidebar-env-app .env-chevron {
    width: 14px;
    height: 14px;
  }

  .env-dropdown {
    min-width: 150px;
    right: 8px;
    max-width: calc(100vw - 80px);
  }

  .env-option {
    padding: 8px 10px;
    font-size: 13px;
  }

  .user-avatar {
    width: 32px;
    height: 32px;
    font-size: 13px;
  }

  .user-trigger {
    padding: 4px;
  }

  .sidebar-footer {
    font-size: 11px;
  }

  .panel-search {
    margin-bottom: 16px;
  }

  .search-input {
    font-size: 14px;
  }

  .page-header {
    gap: 12px;
  }

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

  .page-subtitle {
    font-size: 12px;
  }

  .gems-panel {
    padding: 18px 14px 16px 14px;
  }

  .gems-toggle-card {
    padding: 14px 12px;
  }

  .gems-section-card {
    padding: 14px 12px 16px 12px;
  }

  .data-table {
    font-size: 11px;
    min-width: 700px;
  }

  .data-table th,
  .data-table td {
    padding: 10px 6px;
  }

  .data-table th {
    font-size: 10px;
  }

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

  .user-cell {
    gap: 8px;
  }

  .user-name {
    font-size: 12px;
  }

  .role-badge,
  .status-badge {
    font-size: 10px;
    padding: 3px 8px;
    white-space: nowrap;
  }

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

  .btn-icon svg {
    width: 16px;
    height: 16px;
  }

  .empty-state {
    padding: 40px 16px;
  }

  .empty-state svg {
    width: 48px;
    height: 48px;
  }

  .empty-state-text {
    font-size: 14px;
  }

  .input,
  select.input {
    font-size: 16px;
  }

  .form-label {
    font-size: 13px;
  }

  .form-description {
    font-size: 11px;
  }

  .data-table {
    min-width: 600px;
    font-size: 11px;
  }

  .data-table th,
  .data-table td {
    padding: 8px 4px;
  }

  .user-cell {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .table-wrap {
    border-radius: 8px;
  }

  .env-dropdown,
  .profile-dropdown {
    max-width: calc(100vw - 32px);
  }

  .profile-dropdown {
    right: 8px;
  }

  .profile-dropdown-header {
    margin-bottom: 8px;
  }

  .profile-dropdown-name {
    font-size: 14px;
  }

  .profile-dropdown-email {
    font-size: 12px;
    word-break: break-all;
  }
}

.fraud-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.fraud-title-icon {
  width: 24px;
  height: 24px;
  color: var(--accent);
}

.fraud-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.fraud-stat-card {
  padding: 20px;
}

.fraud-stat-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.fraud-stat-header svg {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
}

.fraud-stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.fraud-stat-value-sm {
  font-size: 22px;
}

.fraud-stat-value-danger {
  color: #ef4444;
}

.fraud-stat-value-warning {
  color: #f59e0b;
}

.fraud-stat-value-success {
  color: #10b981;
}

.fraud-stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0;
}

.fraud-stat-split {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.fraud-stat-divider {
  color: var(--text-muted);
  font-weight: 500;
}

.fraud-risk-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.fraud-risk-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.fraud-risk-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.fraud-risk-high {
  background: #ef4444;
}

.fraud-risk-medium {
  background: #f59e0b;
}

.fraud-risk-low {
  background: #10b981;
}

.fraud-risk-label {
  flex: 1;
  font-size: 13px;
  color: var(--text-secondary);
}

.fraud-filters {
  display: grid;
  grid-template-columns: 1fr auto auto auto auto;
  gap: 12px;
  align-items: center;
}

.fraud-search-wrap {
  position: relative;
}

.fraud-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}

.fraud-search-input {
  padding-left: 36px;
  width: 100%;
  min-width: 0;
}

.fraud-filter-select {
  min-width: 140px;
}

.fraud-date-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.fraud-empty-card {
  padding: 0;
  overflow: hidden;
}

.fraud-empty-card .empty-state {
  padding: 48px 24px;
}

.fraud-empty-icon {
  width: 48px !important;
  height: 48px !important;
  margin-bottom: 16px;
}

.fraud-empty-title {
  margin: 0 0 4px 0;
}

.fraud-empty-desc {
  font-size: 14px;
  color: var(--text-muted);
  opacity: 0.8;
  margin: 0;
}

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

  .fraud-filters {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 640px) {
  .fraud-stats {
    grid-template-columns: 1fr;
  }

  .fraud-filters {
    grid-template-columns: 1fr;
  }

  .fraud-filter-select,
  .fraud-date-btn {
    min-width: 0;
    width: 100%;
  }
}

.audit-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.audit-title-icon {
  width: 24px;
  height: 24px;
  color: var(--accent);
}

.audit-filters {
  display: grid;
  grid-template-columns: 180px 180px 180px 180px minmax(260px, 1fr);
  gap: 12px;
  align-items: center;
}

.audit-filter-select {
  min-width: 0;
  width: 100%;
}

.audit-empty-icon {
  width: 48px !important;
  height: 48px !important;
  margin-bottom: 16px;
}

.audit-empty-title {
  margin: 0 0 4px 0;
}

.audit-empty-desc {
  font-size: 14px;
  color: var(--text-muted);
  opacity: 0.8;
  margin: 0;
}

@media (max-width: 1024px) {
  .audit-filters {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 640px) {
  .audit-filters {
    grid-template-columns: 1fr;
  }

  .audit-filter-select {
    min-width: 0;
    width: 100%;
  }
}
