/* ============================================================
   styles.css - Escalia Design System
   Dark Mode Premium — Violet Accent — Linear/Vercel Style
   ============================================================ */

/* ---- Google Fonts Import (fallback if not loaded via HTML) ---- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* ---- CSS Custom Properties ---- */
:root {
  /* Backgrounds (darkest to lightest) */
  --bg-primary: #050508;
  --bg-secondary: #0a0a0f;
  --bg-card: #0f0f16;
  --bg-card-hover: #14141e;

  /* Accent (Violet gradient identity) */
  --accent-1: #7C6EF7;
  --accent-2: #A78BFA;
  --accent-3: #C4B5FD;

  /* Legacy aliases for existing class references */
  --color-primary: #7C6EF7;
  --color-primary-hover: #A78BFA;
  --color-primary-light: rgba(124, 110, 247, 0.1);
  --color-primary-100: rgba(124, 110, 247, 0.15);
  --color-primary-shadow: rgba(124, 110, 247, 0.25);

  /* Accent (secondary) */
  --color-accent: #A78BFA;

  /* Texts */
  --text-primary: #F0F0F8;
  --text-secondary: #8888A8;
  --text-muted: #555568;

  /* Legacy text aliases */
  --text-900: #F0F0F8;
  --text-700: #B0B0C8;
  --text-500: #8888A8;
  --text-400: #555568;

  /* Borders */
  --border-default: #1A1A2E;
  --border-hover: #2A2A40;
  --border-active: #7C6EF7;

  /* Legacy border aliases */
  --border-200: #1A1A2E;
  --border-300: #2A2A40;

  /* Semantic Colors */
  --color-success: #34D399;
  --color-success-light: rgba(52, 211, 153, 0.1);
  --color-success-dark: #34D399;
  --color-warning: #FB923C;
  --color-warning-light: rgba(251, 146, 60, 0.1);
  --color-warning-dark: #FB923C;
  --color-error: #F87171;
  --color-error-light: rgba(248, 113, 113, 0.1);
  --color-error-dark: #F87171;
  --color-info: #60A5FA;
  --color-info-light: rgba(96, 165, 250, 0.1);
  --color-info-dark: #60A5FA;

  /* Sidebar */
  --sidebar-bg: #0a0a0f;
  --sidebar-hover: #14141e;
  --sidebar-active: rgba(124, 110, 247, 0.1);
  --sidebar-text: #8888A8;
  --sidebar-text-active: #F0F0F8;
  --sidebar-width: 260px;
  --sidebar-collapsed-width: 72px;

  /* Page */
  --page-bg: #050508;
  --card-bg: #0f0f16;
  --card-border: #1A1A2E;

  /* Hover/Subtle backgrounds */
  --warm-hover: #14141e;
  --warm-subtle: #0a0a0f;
  --warm-alt: #0f0f16;

  /* Radius */
  --radius-sm: 8px;
  --radius-default: 8px;
  --radius-card: 12px;
  --radius-modal: 16px;
  --radius-xl: 24px;

  /* Shadows */
  --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-card-hover: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-dropdown: 0 8px 24px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px rgba(124, 110, 247, 0.15);
  --shadow-glow-strong: 0 0 30px rgba(124, 110, 247, 0.25);

  /* Fonts */
  --font-body: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --font-heading: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', ui-monospace, monospace;
}

/* ---- Reset & Base ---- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
}

/* Selection */
::selection {
  background: rgba(124, 110, 247, 0.3);
  color: #F0F0F8;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #2A2A40;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #3A3A55;
}

/* Links */
a {
  color: var(--accent-1);
  text-decoration: none;
  transition: color 0.2s ease-out;
}

a:hover {
  color: var(--accent-2);
  text-decoration: underline;
}

/* ---- Skip Link (Accessibility) ---- */
.skip-link {
  position: absolute;
  top: -100px;
  left: 16px;
  background: linear-gradient(to right, var(--accent-1), var(--accent-2));
  color: #fff;
  padding: 8px 16px;
  border-radius: var(--radius-default);
  z-index: 9999;
  font-size: 14px;
  font-weight: 600;
  transition: top 0.2s ease-out;
}

.skip-link:focus {
  top: 16px;
  text-decoration: none;
}

/* ---- Focus Visible System ---- */
*:focus-visible {
  outline: 2px solid var(--accent-1);
  outline-offset: 2px;
}

button:focus:not(:focus-visible),
a:focus:not(:focus-visible),
select:focus:not(:focus-visible),
input:focus:not(:focus-visible),
textarea:focus:not(:focus-visible) {
  outline: none;
}

/* ---- Layout ---- */
.layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 40;
  transition: width 0.25s ease-out, transform 0.25s ease-out;
  overflow: hidden;
  border-right: 1px solid var(--border-default);
}

.main-area {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left 0.25s ease-out;
}

/* ---- Sidebar Collapsed (Desktop: icon-only 72px) ---- */
.sidebar-icon-collapsed .sidebar {
  width: var(--sidebar-collapsed-width);
}

.sidebar-icon-collapsed .main-area {
  margin-left: var(--sidebar-collapsed-width);
}

.sidebar-icon-collapsed .sidebar-brand-text,
.sidebar-icon-collapsed .sidebar-nav-label,
.sidebar-icon-collapsed .sidebar-user-details {
  opacity: 0;
  width: 0;
  overflow: hidden;
  white-space: nowrap;
}

.sidebar-icon-collapsed .sidebar-brand {
  justify-content: center;
  padding-left: 0;
  padding-right: 0;
}

.sidebar-icon-collapsed .sidebar-nav-item {
  justify-content: center;
  padding-left: 0;
  padding-right: 0;
}

.sidebar-icon-collapsed .sidebar-footer {
  justify-content: center;
  padding-left: 8px;
  padding-right: 8px;
}

.sidebar-icon-collapsed .sidebar-user-info {
  justify-content: center;
}

/* ---- Mobile Sidebar (fully hidden, overlay mode) ---- */
@media (max-width: 768px) {
  .sidebar {
    width: var(--sidebar-width);
    transform: translateX(calc(-1 * var(--sidebar-width)));
  }

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

  .sidebar-icon-collapsed .sidebar {
    width: var(--sidebar-width);
    transform: translateX(calc(-1 * var(--sidebar-width)));
  }

  .sidebar-icon-collapsed .main-area {
    margin-left: 0;
  }

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

  .sidebar-mobile-open .sidebar .sidebar-brand-text,
  .sidebar-mobile-open .sidebar .sidebar-nav-label,
  .sidebar-mobile-open .sidebar .sidebar-user-details {
    opacity: 1;
    width: auto;
  }

  .sidebar-mobile-open .sidebar .sidebar-brand {
    justify-content: flex-start;
    padding-left: 20px;
    padding-right: 20px;
  }

  .sidebar-mobile-open .sidebar .sidebar-nav-item {
    justify-content: flex-start;
    padding-left: 12px;
    padding-right: 12px;
  }

  .sidebar-mobile-open .sidebar .sidebar-footer {
    justify-content: flex-start;
    padding-left: 16px;
    padding-right: 16px;
  }

  .sidebar-mobile-open .sidebar .sidebar-user-info {
    justify-content: flex-start;
  }
}

/* ---- Sidebar Overlay (Mobile) ---- */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 35;
  opacity: 0;
  transition: opacity 0.25s ease-out;
}

.sidebar-mobile-open .sidebar-overlay {
  display: block;
  opacity: 1;
}

/* ---- Sidebar Components ---- */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border-default);
  transition: padding 0.25s ease-out, justify-content 0.25s ease-out;
}

.sidebar-logo {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  border-radius: var(--radius-default);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-weight: 900;
  font-size: 16px;
  color: #fff;
  flex-shrink: 0;
  box-shadow: var(--shadow-glow);
}

.sidebar-brand-text {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  transition: opacity 0.2s ease-out, width 0.25s ease-out;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-default);
  font-size: 14px;
  font-weight: 500;
  color: var(--sidebar-text);
  transition: all 0.2s ease-out;
  text-decoration: none;
  position: relative;
  border-left: 3px solid transparent;
}

.sidebar-nav-item:hover {
  background: var(--sidebar-hover);
  color: var(--text-primary);
  text-decoration: none;
}

.sidebar-nav-item.active {
  background: var(--sidebar-active);
  color: var(--sidebar-text-active);
  border-left-color: var(--accent-1);
}

.sidebar-nav-label {
  transition: opacity 0.2s ease-out, width 0.25s ease-out;
  white-space: nowrap;
}

.nav-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* ---- Sidebar Tooltip (collapsed mode) ---- */
.sidebar-nav-item[data-tooltip] {
  position: relative;
}

.sidebar-tooltip {
  display: none;
  position: absolute;
  left: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 6px;
  white-space: nowrap;
  z-index: 60;
  pointer-events: none;
  box-shadow: var(--shadow-dropdown);
  border: 1px solid var(--border-default);
}

.sidebar-tooltip::before {
  content: '';
  position: absolute;
  left: -4px;
  top: 50%;
  transform: translateY(-50%);
  border: 4px solid transparent;
  border-right-color: var(--bg-card);
  border-left: 0;
}

.sidebar-icon-collapsed .sidebar-nav-item:hover .sidebar-tooltip {
  display: block;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border-default);
  transition: padding 0.25s ease-out, justify-content 0.25s ease-out;
}

.sidebar-user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  transition: justify-content 0.25s ease-out;
}

.sidebar-user-avatar {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: #fff;
  flex-shrink: 0;
}

.sidebar-user-details {
  overflow: hidden;
  transition: opacity 0.2s ease-out, width 0.25s ease-out;
}

.sidebar-user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ---- Top Header ---- */
.top-header {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-default);
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 30;
  backdrop-filter: blur(12px);
}

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

.sidebar-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  transition: all 0.2s ease-out;
}

.sidebar-toggle:hover {
  background: var(--bg-card);
  color: var(--text-primary);
}

.sidebar-toggle svg {
  width: 22px;
  height: 22px;
}

.page-title {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

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

.top-header-user {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* ---- Page Content ---- */
.page-content {
  padding: 24px;
  flex: 1;
  animation: fadeUp 0.3s ease-out;
}

/* ---- Content Card ---- */
.content-card {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.2s ease-out, transform 0.2s ease-out;
}

.content-card:hover {
  box-shadow: var(--shadow-card-hover);
}

.content-card-limited {
  max-width: 640px;
}

.card-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-default);
}

.card-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.card-header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.card-title {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.card-description {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ---- Login Page ---- */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.login-grid-pattern {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image:
    linear-gradient(rgba(124, 110, 247, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(124, 110, 247, 0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-modal);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), var(--shadow-glow);
  padding: 40px;
  width: 100%;
  max-width: 420px;
  position: relative;
  z-index: 1;
  animation: fadeUp 0.4s ease-out;
}

.login-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
}

.login-logo-icon {
  width: 72px;
  height: 72px;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  border-radius: var(--radius-card);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-weight: 900;
  font-size: 28px;
  color: #fff;
  box-shadow: var(--shadow-glow-strong);
}

.login-brand-name {
  font-family: var(--font-heading);
  font-size: 28px;
  font-weight: 900;
  color: var(--text-primary);
  background: linear-gradient(to right, var(--accent-1), var(--accent-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-subtitle {
  text-align: center;
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 28px;
  margin-top: -12px;
}

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

/* Password visibility toggle */
.password-wrapper {
  position: relative;
}

.password-toggle-btn {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease-out;
}

.password-toggle-btn:hover {
  color: var(--text-secondary);
}

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

/* ---- Form Components ---- */
.form-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px;
}

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

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

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

.form-input,
.form-select,
.form-textarea {
  padding: 10px 14px;
  font-size: 14px;
  font-family: inherit;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-default);
  background: var(--bg-secondary);
  color: var(--text-primary);
  transition: border-color 0.2s ease-out, box-shadow 0.2s ease-out;
  outline: none;
  width: 100%;
}

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

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--accent-1);
  box-shadow: 0 0 0 3px rgba(124, 110, 247, 0.15);
}

.form-input:disabled,
.form-select:disabled {
  background: var(--bg-card);
  color: var(--text-muted);
  cursor: not-allowed;
  opacity: 0.6;
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238888A8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

.form-select option {
  background: var(--bg-card);
  color: var(--text-primary);
}

.form-select-sm {
  padding: 6px 10px;
  font-size: 13px;
}

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

.form-error {
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.2);
  color: var(--color-error);
  font-size: 13px;
  padding: 10px 14px;
  border-radius: var(--radius-default);
  line-height: 1.5;
}

.form-error.duplicate-alert {
  background: #dc2626;
  border: 3px solid #991b1b;
  color: #ffffff;
  font-size: 15px;
  padding: 20px 24px;
  border-radius: 12px;
  text-align: center;
  animation: duplicate-shake 0.5s ease-in-out;
  box-shadow: 0 4px 24px rgba(220, 38, 38, 0.4);
  margin: 16px 0;
}

.duplicate-alert-icon {
  font-size: 40px;
  line-height: 1;
  margin-bottom: 8px;
}

.duplicate-alert-title {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.duplicate-alert-msg {
  font-size: 14px;
  opacity: 0.95;
  line-height: 1.6;
}

@keyframes duplicate-shake {
  0%, 100% { transform: translateX(0); }
  10%, 50%, 90% { transform: translateX(-6px); }
  30%, 70% { transform: translateX(6px); }
}

.rejection-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 200px;
}

.rejection-reason {
  font-size: 12px;
  color: #fca5a5;
  background: rgba(220, 38, 38, 0.1);
  padding: 4px 8px;
  border-radius: 4px;
  border-left: 3px solid #dc2626;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 8px;
}

.hidden {
  display: none !important;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: inherit;
  font-weight: 600;
  border: 1px solid transparent;
  border-radius: var(--radius-default);
  cursor: pointer;
  transition: all 0.2s ease-out;
  white-space: nowrap;
  text-decoration: none;
  position: relative;
}

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

.btn-xs {
  padding: 4px 8px;
  font-size: 12px;
  border-radius: 6px;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
}

.btn-md {
  padding: 10px 18px;
  font-size: 14px;
}

.btn-lg {
  padding: 12px 22px;
  font-size: 15px;
}

.btn-full {
  width: 100%;
}

.btn-primary {
  background: linear-gradient(to right, var(--accent-1), var(--accent-2));
  color: #fff;
  box-shadow: var(--shadow-glow);
}

.btn-primary:hover:not(:disabled) {
  box-shadow: var(--shadow-glow-strong);
  transform: translateY(-1px);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
}

.btn-secondary {
  background: var(--bg-card);
  border-color: var(--border-default);
  color: var(--text-secondary);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
  color: var(--text-primary);
}

.btn-danger {
  background: rgba(248, 113, 113, 0.15);
  border-color: rgba(248, 113, 113, 0.2);
  color: var(--color-error);
}

.btn-danger:hover:not(:disabled) {
  background: rgba(248, 113, 113, 0.25);
  border-color: rgba(248, 113, 113, 0.3);
}

.btn-success {
  background: rgba(52, 211, 153, 0.15);
  border-color: rgba(52, 211, 153, 0.2);
  color: var(--color-success);
}

.btn-success:hover:not(:disabled) {
  background: rgba(52, 211, 153, 0.25);
  border-color: rgba(52, 211, 153, 0.3);
}

.btn-info {
  background: rgba(96, 165, 250, 0.15);
  border-color: rgba(96, 165, 250, 0.2);
  color: var(--color-info);
}

.btn-info:hover:not(:disabled) {
  background: rgba(96, 165, 250, 0.25);
  border-color: rgba(96, 165, 250, 0.3);
}

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

.btn-ghost:hover:not(:disabled) {
  background: var(--bg-card);
  color: var(--text-primary);
}

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

/* ---- Button Loading State ---- */
.btn-loading {
  color: transparent;
  pointer-events: none;
}

.btn-loading::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: btnSpin 0.6s linear infinite;
}

.btn-secondary.btn-loading::after {
  border-color: rgba(136, 136, 168, 0.2);
  border-top-color: var(--text-secondary);
}

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

/* ---- Badges (dark mode: transparent bg + text color + border) ---- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 9999px;
  white-space: nowrap;
  border: 1px solid transparent;
}

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

.badge-success {
  background: rgba(52, 211, 153, 0.1);
  color: var(--color-success);
  border-color: rgba(52, 211, 153, 0.2);
}

.badge-success .badge-dot {
  background: var(--color-success);
}

.badge-warning {
  background: rgba(251, 146, 60, 0.1);
  color: var(--color-warning);
  border-color: rgba(251, 146, 60, 0.2);
}

.badge-warning .badge-dot {
  background: var(--color-warning);
}

.badge-danger {
  background: rgba(248, 113, 113, 0.1);
  color: var(--color-error);
  border-color: rgba(248, 113, 113, 0.2);
}

.badge-danger .badge-dot {
  background: var(--color-error);
}

.badge-info {
  background: rgba(96, 165, 250, 0.1);
  color: var(--color-info);
  border-color: rgba(96, 165, 250, 0.2);
}

.badge-info .badge-dot {
  background: var(--color-info);
}

.badge-purple {
  background: rgba(124, 110, 247, 0.1);
  color: var(--accent-2);
  border-color: rgba(124, 110, 247, 0.2);
}

.badge-purple .badge-dot {
  background: var(--accent-1);
}

.badge-gray {
  background: var(--bg-card);
  color: var(--text-secondary);
  border-color: var(--border-default);
}

.badge-gray .badge-dot {
  background: var(--text-muted);
}

/* ---- DataTable ---- */
.dt-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  gap: 16px;
  flex-wrap: wrap;
}

.dt-search {
  position: relative;
  flex: 1;
  max-width: 320px;
}

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

.dt-search-input {
  width: 100%;
  padding: 8px 12px 8px 36px;
  font-size: 13px;
  font-family: inherit;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-default);
  background: var(--bg-secondary);
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.2s ease-out, box-shadow 0.2s ease-out;
}

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

.dt-search-input:focus {
  border-color: var(--accent-1);
  box-shadow: 0 0 0 3px rgba(124, 110, 247, 0.15);
}

.dt-page-size {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}

.dt-select {
  padding: 6px 10px;
  font-size: 13px;
  font-family: inherit;
  border: 1px solid var(--border-default);
  border-radius: 6px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.2s ease-out;
}

.dt-select:focus {
  border-color: var(--accent-1);
}

.dt-select option {
  background: var(--bg-card);
  color: var(--text-primary);
}

.dt-table-wrapper {
  overflow-x: auto;
}

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

.dt-table thead th {
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 10px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border-default);
  white-space: nowrap;
  user-select: none;
}

.dt-sortable {
  cursor: pointer;
  transition: color 0.2s ease-out;
}

.dt-sortable:hover {
  color: var(--accent-1);
}

.dt-table tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-default);
  color: var(--text-secondary);
  vertical-align: middle;
}

.dt-row-even {
  background: var(--bg-card);
}

.dt-row-odd {
  background: rgba(10, 10, 15, 0.5);
}

.dt-row-even:hover,
.dt-row-odd:hover {
  background: var(--bg-card-hover);
}

.dt-empty {
  text-align: center;
  padding: 48px 16px !important;
  color: var(--text-muted);
}

.dt-empty-icon {
  display: block;
  width: 48px;
  height: 48px;
  margin: 0 auto 12px;
  color: var(--text-muted);
  opacity: 0.5;
}

.dt-empty-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.dt-empty-description {
  font-size: 13px;
  color: var(--text-muted);
}

.dt-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  border-top: 1px solid var(--border-default);
  flex-wrap: wrap;
  gap: 12px;
}

.dt-pagination-info {
  font-size: 13px;
  color: var(--text-secondary);
}

.dt-pagination-btns {
  display: flex;
  gap: 8px;
}

/* ---- DataTable Column Widths ---- */
.dt-col-w-60 { width: 60px; }
.dt-col-w-90 { width: 90px; }
.dt-col-w-120 { width: 120px; }
.dt-col-w-150 { width: 150px; }
.dt-col-w-180 { width: 180px; }

/* ---- Action Dropdown ---- */
.action-dropdown {
  position: relative;
  display: inline-block;
}

.action-dropdown-trigger {
  background: none;
  border: 1px solid var(--border-default);
  border-radius: 6px;
  cursor: pointer;
  padding: 4px 8px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease-out;
}

.action-dropdown-trigger:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--border-hover);
}

.action-dropdown-trigger svg {
  width: 16px;
  height: 16px;
}

.action-dropdown-menu {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-default);
  box-shadow: var(--shadow-dropdown);
  min-width: 160px;
  z-index: 50;
  padding: 4px;
  animation: dropdownFadeIn 0.15s ease-out;
}

.action-dropdown-menu.show {
  display: block;
}

.action-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.15s ease-out;
  font-family: inherit;
}

.action-dropdown-item:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.action-dropdown-item svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.action-dropdown-item-danger {
  color: var(--color-error);
}

.action-dropdown-item-danger:hover {
  background: rgba(248, 113, 113, 0.1);
  color: var(--color-error);
}

@keyframes dropdownFadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---- Action Buttons in Table (legacy fallback) ---- */
.action-btns {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

/* ---- Table Link ---- */
.table-link {
  color: var(--accent-1);
  font-size: 13px;
  transition: color 0.2s ease-out;
}

.table-link:hover {
  color: var(--accent-2);
  text-decoration: underline;
}

/* ---- Modal ---- */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 20px;
  animation: fadeIn 0.2s ease-out;
}

.modal-closing {
  animation: fadeOut 0.2s ease-out forwards;
}

.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-modal);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), var(--shadow-glow);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.2s ease-out;
}

.modal-lg {
  max-width: 700px;
}

.modal-sm {
  max-width: 380px;
}

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

.modal-title {
  font-family: var(--font-heading);
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-close-btn {
  background: none;
  border: none;
  font-size: 22px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  line-height: 1;
  transition: all 0.2s ease-out;
}

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

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

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 24px;
  border-top: 1px solid var(--border-default);
}

/* ---- Confirm Dialog (centered icon + text) ---- */
.confirm-dialog-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  margin: 0 auto 16px;
}

.confirm-dialog-icon-danger {
  background: rgba(248, 113, 113, 0.1);
  color: var(--color-error);
}

.confirm-dialog-icon-warning {
  background: rgba(251, 146, 60, 0.1);
  color: var(--color-warning);
}

.confirm-dialog-icon svg {
  width: 28px;
  height: 28px;
}

.confirm-dialog-title {
  font-family: var(--font-heading);
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  text-align: center;
  margin-bottom: 8px;
}

.confirm-dialog-message {
  font-size: 14px;
  color: var(--text-secondary);
  text-align: center;
  line-height: 1.5;
}

/* ---- Toast (bottom-right) ---- */
.toast-container {
  position: fixed;
  bottom: 16px;
  right: 16px;
  z-index: 100;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  max-width: 420px;
}

.toast {
  display: flex;
  flex-direction: column;
  border-radius: 10px;
  box-shadow: var(--shadow-dropdown);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.3s ease-out;
  animation: slideInUp 0.3s ease-out;
  overflow: hidden;
  border: 1px solid transparent;
}

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

.toast-enter {
  opacity: 0;
  transform: translateY(100%);
}

.toast-exit {
  opacity: 0;
  transform: translateY(100%);
}

.toast-success {
  background: rgba(52, 211, 153, 0.1);
  border-color: rgba(52, 211, 153, 0.2);
  color: var(--color-success);
}

.toast-error {
  background: rgba(248, 113, 113, 0.1);
  border-color: rgba(248, 113, 113, 0.2);
  color: var(--color-error);
}

.toast-info {
  background: rgba(96, 165, 250, 0.1);
  border-color: rgba(96, 165, 250, 0.2);
  color: var(--color-info);
}

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

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

.toast-close {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  opacity: 0.5;
  padding: 0 4px;
  line-height: 1;
  color: inherit;
  transition: opacity 0.2s ease-out;
}

.toast-close:hover {
  opacity: 1;
}

/* Toast Progress Bar */
.toast-progress {
  height: 3px;
  background: rgba(255, 255, 255, 0.05);
  width: 100%;
}

.toast-progress-bar {
  height: 100%;
  width: 100%;
  transform-origin: left;
  animation: toastProgress 3s linear forwards;
}

.toast-success .toast-progress-bar {
  background: var(--color-success);
}

.toast-error .toast-progress-bar {
  background: var(--color-error);
}

.toast-info .toast-progress-bar {
  background: var(--color-info);
}

@keyframes toastProgress {
  from { transform: scaleX(1); }
  to { transform: scaleX(0); }
}

/* ---- Report Filters ---- */
.report-filters {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  padding: 20px 24px;
  flex-wrap: wrap;
}

.report-filter-btn {
  justify-content: flex-end;
}

.report-summary {
  padding: 24px;
}

/* ---- Summary Cards (dark mode semantic) ---- */
.summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.summary-card {
  border-radius: var(--radius-card);
  padding: 24px;
  border: 1px solid var(--border-default);
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: transform 0.2s ease-out, box-shadow 0.2s ease-out;
  cursor: default;
  background: var(--bg-card);
}

.summary-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card-hover);
}

.summary-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.summary-card-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-default);
  display: flex;
  align-items: center;
  justify-content: center;
}

.summary-card-icon svg {
  width: 20px;
  height: 20px;
}

.summary-card-label {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.summary-card-value {
  font-family: var(--font-heading);
  font-size: 36px;
  font-weight: 800;
}

.summary-card-success {
  background: var(--bg-card);
  border-color: rgba(52, 211, 153, 0.2);
}

.summary-card-success .summary-card-label { color: var(--color-success); }
.summary-card-success .summary-card-value { color: var(--color-success); }
.summary-card-success .summary-card-icon { background: rgba(52, 211, 153, 0.1); color: var(--color-success); }

.summary-card-danger {
  background: var(--bg-card);
  border-color: rgba(248, 113, 113, 0.2);
}

.summary-card-danger .summary-card-label { color: var(--color-error); }
.summary-card-danger .summary-card-value { color: var(--color-error); }
.summary-card-danger .summary-card-icon { background: rgba(248, 113, 113, 0.1); color: var(--color-error); }

.summary-card-warning {
  background: var(--bg-card);
  border-color: rgba(251, 146, 60, 0.2);
}

.summary-card-warning .summary-card-label { color: var(--color-warning); }
.summary-card-warning .summary-card-value { color: var(--color-warning); }
.summary-card-warning .summary-card-icon { background: rgba(251, 146, 60, 0.1); color: var(--color-warning); }

.summary-card-info {
  background: var(--bg-card);
  border-color: rgba(96, 165, 250, 0.2);
}

.summary-card-info .summary-card-label { color: var(--color-info); }
.summary-card-info .summary-card-value { color: var(--color-info); }
.summary-card-info .summary-card-icon { background: rgba(96, 165, 250, 0.1); color: var(--color-info); }

/* ---- Skeleton Loading ---- */
.skeleton {
  background: linear-gradient(90deg, var(--border-default) 25%, var(--bg-card-hover) 50%, var(--border-default) 75%);
  background-size: 200% 100%;
  animation: skeletonShimmer 1.5s ease-in-out infinite;
  border-radius: 6px;
}

.skeleton-row {
  display: flex;
  gap: 16px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-default);
}

.skeleton-cell {
  height: 16px;
  flex: 1;
}

.skeleton-cell-sm {
  height: 16px;
  width: 80px;
  flex: none;
}

.skeleton-cell-md {
  height: 16px;
  width: 120px;
  flex: none;
}

.skeleton-header {
  height: 12px;
}

.skeleton-w-sm {
  width: 60px;
}

.skeleton-w-md {
  width: 80px;
}

.skeleton-w-lg {
  width: 100px;
}

.skeleton-w-xl {
  width: 120px;
}

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

/* ---- Avatar Component ---- */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  text-transform: uppercase;
}

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

.avatar-md {
  width: 36px;
  height: 36px;
  font-size: 14px;
}

.avatar-lg {
  width: 48px;
  height: 48px;
  font-size: 18px;
}

/* ---- Password Display ---- */
.password-display {
  margin-top: 16px;
}

.password-box {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-default);
  padding: 12px 16px;
  margin-top: 6px;
}

.password-box code {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 500;
  color: var(--accent-2);
  flex: 1;
  word-break: break-all;
}

.password-display-note {
  margin-top: 12px;
}

/* ---- Utility Classes ---- */
.text-muted { color: var(--text-secondary); }
.text-secondary { color: var(--text-secondary); }
.text-success { color: var(--color-success); }
.text-danger { color: var(--color-error); }
.text-warning { color: var(--color-warning); }
.font-semibold { font-weight: 600; }

/* Text gradient utility */
.text-gradient {
  background: linear-gradient(to right, var(--accent-1), var(--accent-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ---- Animations ---- */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

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

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

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .summary-cards {
    grid-template-columns: repeat(2, 1fr);
  }

  .report-filters {
    flex-direction: column;
    align-items: stretch;
  }

  .card-header-row {
    flex-direction: column;
  }

  .top-header-user {
    display: none;
  }
}

@media (max-width: 480px) {
  .summary-cards {
    grid-template-columns: 1fr;
  }

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