:root {
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --bg-body: #f8fafc;
  --bg-card: #ffffff;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -2px rgb(0 0 0 / 0.05);
  --radius: 0.75rem;
}

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-body);
  color: var(--text-main);
  margin: 0;
  padding: 0;
  line-height: 1.5;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

/* Header / Nav */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 2rem;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  margin-bottom: 2rem;
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-icon {
  font-size: 1.5rem;
  background: #e0e7ff;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
}

header h1 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0;
  letter-spacing: -0.025em;
}

nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-link {
  text-decoration: none;
  color: var(--text-muted);
  font-weight: 500;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  background: transparent;
  border: none;
  cursor: pointer;
}

.nav-link:hover,
.nav-link:focus {
  color: var(--primary);
  background-color: #f1f5f9;
  outline: none;
}

.nav-icon {
  font-size: 1.1rem;
}

/* Dropdowns */
.nav-dropdown {
  position: relative;
}

.dropdown-trigger {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.dropdown-arrow {
  font-size: 0.7rem;
  opacity: 0.5;
  transition: transform 0.2s;
}

.nav-dropdown:hover .dropdown-arrow {
  transform: rotate(180deg);
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 0.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 220px;
  display: none;
  z-index: 100;
  padding: 0.5rem;
  animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.dropdown-menu a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  color: var(--text-main);
  text-decoration: none;
  border-radius: 0.5rem;
  transition: background 0.2s;
  font-size: 0.9rem;
}

.dropdown-menu a:hover {
  background-color: #f8fafc;
  color: var(--primary);
}

.menu-icon {
  font-size: 1.1rem;
  width: 24px;
  text-align: center;
}

.dropdown-divider {
  height: 1px;
  background-color: var(--border);
  margin: 0.5rem 0;
}

/* User Menu */
.user-menu {
  position: relative;
  margin-left: 1rem;
  padding-left: 1rem;
  border-left: 1px solid var(--border);
}

.user-menu-btn {
  background: transparent;
  border: none;
  padding: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  border-radius: 2rem;
  transition: background 0.2s;
}

.user-menu-btn:hover,
.user-menu-btn:focus {
  background-color: #f1f5f9;
  outline: none;
}

.user-avatar {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--primary) 0%, #4f46e5 100%);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.9rem;
}

.user-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-main);
}

.user-dropdown {
  width: 260px;
  padding: 0;
  overflow: hidden;
}

.user-dropdown a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  color: var(--text-main);
  text-decoration: none;
  transition: background-color 0.2s;
}

.user-dropdown a:hover {
  background-color: #f8fafc;
}

.user-info {
  padding: 1.25rem;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 1rem;
}

.user-avatar-large {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, var(--primary) 0%, #4f46e5 100%);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.25rem;
}

.user-details {
  display: flex;
  flex-direction: column;
}

.user-name-large {
  font-weight: 700;
  color: var(--text-main);
}

.user-plan-badge {
  font-size: 0.75rem;
  color: var(--text-muted);
  background: #e2e8f0;
  padding: 0.1rem 0.5rem;
  border-radius: 1rem;
  align-self: flex-start;
  margin-top: 0.25rem;
}

.logout-link {
  color: #ef4444 !important;
}

.logout-link:hover {
  background-color: #fef2f2 !important;
}

/* Upgrade Button */
.upgrade-btn {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 2rem;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  box-shadow: 0 4px 6px -1px rgba(99, 102, 241, 0.3);
  transition: transform 0.2s, box-shadow 0.2s;
  display: inline-block;
}

.upgrade-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 8px -1px rgba(99, 102, 241, 0.4);
  color: white;
}

.btn-primary {
  background-color: var(--primary);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  text-decoration: none;
  font-weight: 600;
  transition: background-color 0.2s;
}

.btn-primary:hover {
  background-color: var(--primary-hover);
}

/* Cards */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  margin-bottom: 2rem;
  border: 1px solid var(--border);
}

/* Typography */
h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-top: 0;
  margin-bottom: 1rem;
}

/* Forms */
form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 400px;
}

label {
  display: flex;
  flex-direction: column;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
}

input,
select {
  margin-top: 0.25rem;
  padding: 0.625rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  font-size: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input[type="text"],
input[type="email"],
input[type="password"] {
  width: 100%;
  padding: 0.75em 1em;
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: 0.5em;
  background: var(--bg-card);
  color: var(--text-main);
  box-sizing: border-box;
  margin-bottom: 1em;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus,
select:focus,
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

button {
  background-color: var(--primary);
  color: white;
  padding: 0.75rem;
  border: none;
  border-radius: 0.5rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s;
}

button:hover {
  background-color: var(--primary-hover);
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
}

th {
  text-align: left;
  padding: 0.75rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

td {
  padding: 1rem 0.75rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.95rem;
}

tr:last-child td {
  border-bottom: none;
}

/* Utilities */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

.flash {
  padding: 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-weight: 500;
}

.flash.error {
  background-color: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.flash.success {
  background-color: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
}

/* Password Eye Icon */
.toggle-password {
  font-size: 1.2rem;
  color: #888;
  user-select: none;
  transition: color 0.2s;
}

.toggle-password:hover {
  color: #333;
}

.password-box {
  position: relative;
  display: flex;
  align-items: center;
}

.password-box input[type="password"],
.password-box input[type="text"] {
  width: 100%;
  padding-right: 2.2em;
  box-sizing: border-box;
}

.password-box .toggle-password {
  position: absolute;
  right: 0.7em;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.2rem;
  color: #888;
  user-select: none;
  cursor: pointer;
  transition: color 0.2s;
}

.password-box .toggle-password:hover {
  color: #333;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .container {
    padding: 1rem;
  }

  header {
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
    position: relative;
  }

  nav {
    flex-wrap: wrap;
    justify-content: center;
    width: 100%;
  }

  .user-menu {
    margin-left: 0;
    padding-left: 0;
    border-left: none;
    margin-top: 0.5rem;
  }

  .user-name {
    display: none;
  }

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

  table {
    font-size: 0.875rem;
  }

  th,
  td {
    padding: 0.5rem;
  }

  .card {
    padding: 1rem;
  }

  form {
    max-width: 100%;
  }
}

@media (max-width: 480px) {
  header h1 {
    font-size: 1.1rem;
  }

  nav a span:not(.nav-icon) {
    display: none;
  }

  .nav-link {
    padding: 0.5rem;
  }

  .user-menu-btn {
    padding: 0.25rem;
  }

  button {
    padding: 0.625rem;
    font-size: 0.875rem;
  }

  table {
    display: block;
    overflow-x: auto;
  }
}