:root {
  --bg: #0b1220;
  --card: #121b2d;
  --text: #e9eef8;
  --muted: #a9b4c7;
  --line: #22304b;
  --btn: #1e2a44;
  --btnHover: #2a3a5c;
  --danger: #ff4d4d;
}

* { box-sizing: border-box; }

/* Dark mode scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--line) var(--bg);
}

*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

*::-webkit-scrollbar-track {
  background: var(--bg);
}

*::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 4px;
}

*::-webkit-scrollbar-thumb:hover {
  background: #2a3a5c;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji";
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

.page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.card {
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px;
}

h1 { margin: 0 0 6px 0; font-size: 22px; }
h2 { margin: 0 0 10px 0; font-size: 16px; }
.muted { color: var(--muted); }

label { display:block; margin: 14px 0 6px; font-size: 13px; color: var(--muted); }
input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #0e1626;
  color: var(--text);
}

.form-input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #0e1626;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
}

.form-input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

button {
  width: 100%;
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--btn);
  color: var(--text);
  cursor: pointer;
}
button:hover { background: var(--btnHover); }

.alert {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--danger);
  color: var(--text);
  background: rgba(255,77,77,0.08);
}

.row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
}

a { color: var(--text); }
a.link { text-decoration: none; color: var(--muted); }
a.link:hover { color: var(--text); }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 32px;
  border-bottom: 1px solid var(--line);
  background: #0c1426;
  position: sticky;
  top: 0;
  z-index: 100;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  margin-left: 0;
  margin-right: 0;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 32px;
  flex-shrink: 0;
}

.brand {
  font-weight: 700;
  font-size: 16px;
  white-space: nowrap;
  flex-shrink: 0;
}

.topbar-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
  margin-left: auto;
}

.topbar-btn {
  padding: 6px 12px;
  border-radius: 6px;
  background: var(--btn);
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
  border: 1px solid var(--line);
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
}

.topbar-btn:hover {
  background: var(--btnHover);
  border-color: var(--btnHover);
  color: var(--text);
}

.topbar-btn.active {
  background: rgba(59, 130, 246, 0.15);
  border-color: #3b82f6;
  color: #3b82f6;
  font-weight: 600;
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.2);
}

.customer-switcher-wrapper {
  display: inline-block;
  margin: 0;
}

.customer-switcher {
  padding: 6px 12px;
  border-radius: 6px;
  background: var(--btn);
  color: var(--text);
  border: 1px solid var(--line);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  min-width: 150px;
}

.customer-switcher:hover {
  background: var(--btnHover);
  border-color: var(--btnHover);
}

.customer-switcher:focus {
  outline: none;
  border-color: var(--btnHover);
  box-shadow: 0 0 0 2px rgba(42, 58, 92, 0.3);
}

.topbar-customer-name {
  color: var(--muted);
  font-size: 13px;
  padding: 6px 12px;
}

/* Admin Icon Button (for Recent Actions) */
.admin-icon-btn {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0;
  margin-right: 12px;
  cursor: pointer;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  line-height: 1;
  height: 36px;
  width: 36px;
  flex-shrink: 0;
}

.admin-icon-btn:hover {
  background: var(--btn);
  border-color: var(--btnHover);
  color: var(--text);
  transform: translateY(-1px);
}

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

/* User Avatar */
.user-avatar-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
}

.user-avatar-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  vertical-align: middle;
  margin: 0;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
  border: 2px solid var(--line);
  transition: all 0.2s;
}

.user-avatar-btn:hover .user-avatar {
  border-color: var(--btnHover);
  transform: scale(1.05);
}

.user-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  min-width: 200px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s ease;
  z-index: 1000;
  margin-top: 0;
}

.user-menu.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.user-menu-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

.user-menu-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  margin-bottom: 4px;
}

.user-menu-email {
  font-size: 12px;
  color: var(--muted);
}

.user-menu-divider {
  height: 1px;
  background: var(--line);
  margin: 8px 0;
}

.user-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
  transition: all 0.2s;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  cursor: pointer;
  box-sizing: border-box;
}

.user-menu-item:hover {
  background: var(--btn);
  color: var(--text);
}

.user-menu-item svg {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  color: var(--muted);
}

.user-menu-item:hover svg {
  color: var(--text);
}
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.container {
  max-width: 980px;
  margin: 0 auto;
  padding: 20px;
  flex: 1;
  width: 100%;
  box-sizing: border-box;
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  margin-top: 14px;
}

.list { list-style: none; padding: 0; margin: 10px 0 0 0; }
.list-item { padding: 10px 0; border-top: 1px solid var(--line); }
.list-item:first-child { border-top: 0; }
.list-title { font-weight: 600; }

.footer {
  margin-top: auto;
  padding: 30px 20px;
  border-top: 1px solid var(--line);
  background: #0c1426;
  flex-shrink: 0;
}

/* Toast Messages */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 400px;
  pointer-events: none;
}

.toast {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  pointer-events: auto;
  animation: toastSlideIn 0.3s ease-out;
  min-width: 300px;
}

@keyframes toastSlideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes toastSlideOut {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(100%);
    opacity: 0;
  }
}

.toast-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  gap: 12px;
}

.toast-message {
  flex: 1;
  font-size: 14px;
  color: var(--text);
  line-height: 1.5;
}

.toast-close {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s;
  flex-shrink: 0;
}

.toast-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

.toast-success {
  border-color: rgba(16, 185, 129, 0.3);
  background: rgba(16, 185, 129, 0.1);
}

.toast-error {
  border-color: rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.1);
}

.toast-warning {
  border-color: rgba(245, 158, 11, 0.3);
  background: rgba(245, 158, 11, 0.1);
}

.toast-info {
  border-color: rgba(59, 130, 246, 0.3);
  background: rgba(59, 130, 246, 0.1);
}

/* Form Buttons */
.form-btn {
  padding: 10px 20px;
  border-radius: 8px;
  border: 1px solid var(--line);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  min-width: 120px;
}

.form-btn-primary {
  background: #3b82f6;
  border-color: #3b82f6;
  color: white;
}

.form-btn-primary:hover {
  background: #2563eb;
  border-color: #2563eb;
  color: white;
}

.form-btn-secondary {
  background: var(--btn);
  border-color: var(--line);
  color: var(--text);
}

.form-btn-secondary:hover {
  background: var(--btnHover);
  border-color: var(--btnHover);
  color: var(--text);
}

/* Admin Modal (for Recent Actions) */
.admin-modal {
  display: none;
  position: fixed;
  z-index: 10000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.admin-modal-content {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.5);
  max-width: 700px;
  width: 100%;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.admin-modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.02);
}

.admin-modal-header h2 {
  margin: 0;
  padding: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

.admin-modal-close {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.2s;
}

.admin-modal-close:hover {
  background: var(--btn);
  color: var(--text);
}

.admin-modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

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

.recent-action-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--line);
  transition: all 0.2s;
}

.recent-action-item:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--btnHover);
}

.recent-action-icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(59, 130, 246, 0.1);
  border-radius: 8px;
  color: #3b82f6;
}

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

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

.recent-action-text {
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 4px;
}

.recent-action-text a {
  color: #3b82f6;
  text-decoration: none;
}

.recent-action-text a:hover {
  text-decoration: underline;
}

.recent-action-time {
  color: var(--muted);
  font-size: 12px;
}

.footer-content {
  max-width: 980px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 30px;
}

.footer-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

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

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

.footer-link {
  font-size: 12px;
  color: var(--muted);
  text-decoration: none;
  margin-top: 4px;
}

.footer-link:hover {
  color: var(--text);
}

.footer-changelog {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.5;
  max-height: 150px;
  overflow-y: auto;
}


/* Modal Styles */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-content {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  max-width: 800px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

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

.modal-header h2 {
  margin: 0;
  font-size: 20px;
}

.modal-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 28px;
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
}

.modal-close:hover {
  background: var(--btn);
  color: var(--text);
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.changelog-section {
  margin-bottom: 16px;
}

.changelog-content {
  font-family: 'Courier New', monospace;
  font-size: 12px;
  line-height: 1.6;
  color: var(--text);
  background: #0e1626;
  padding: 16px;
  border-radius: 8px;
  border: 1px solid var(--line);
  white-space: pre-wrap;
  word-wrap: break-word;
  margin: 0;
  max-height: 60vh;
  overflow-y: auto;
}

.modal-actions {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.modal-btn {
  padding: 8px 16px;
  font-size: 12px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--btn);
  color: var(--text);
  cursor: pointer;
}

.modal-btn:hover {
  background: var(--btnHover);
}

/* Profile Settings Layout */
.profile-layout {
  display: flex;
  gap: 32px;
  margin-top: 24px;
}

.profile-sidebar {
  flex-shrink: 0;
  width: 240px;
}

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

.profile-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: var(--muted);
  text-decoration: none;
  border-radius: 8px;
  transition: all 0.2s;
  font-size: 14px;
  border: 1px solid transparent;
}

.profile-nav-item:hover {
  background: var(--btn);
  color: var(--text);
  border-color: var(--line);
}

.profile-nav-item.active {
  background: rgba(59, 130, 246, 0.15);
  border-color: #3b82f6;
  color: #3b82f6;
  font-weight: 500;
}

.profile-nav-item-danger {
  color: #ef4444;
}

.profile-nav-item-danger:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: #ef4444;
  color: #ef4444;
}

.profile-nav-item svg {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
}

.profile-nav-divider {
  height: 1px;
  background: var(--line);
  margin: 8px 0;
}

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

.profile-section {
  display: none;
}

.profile-section.active {
  display: block;
}

/* Danger Zone Styling */
.modal-content-danger {
  border-color: #ef4444;
}

.modal-header-danger {
  border-bottom-color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
}

.danger-zone {
  text-align: center;
  padding: 8px 0;
}

.danger-zone-icon {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
  color: #ef4444;
}

.danger-zone h3 {
  color: #ef4444;
  margin-bottom: 16px;
  font-size: 18px;
}

.danger-zone p {
  color: var(--text);
  margin-bottom: 12px;
  text-align: left;
}

.danger-list {
  text-align: left;
  margin: 16px 0;
  padding-left: 24px;
  color: var(--text);
}

.danger-list li {
  margin-bottom: 8px;
}

.form-btn-danger {
  background: #ef4444;
  border-color: #ef4444;
  color: white;
}

.form-btn-danger:hover {
  background: #dc2626;
  border-color: #dc2626;
  color: white;
}
