@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  --bg: #070b14;
  --card: rgba(15, 23, 42, 0.75);
  --card-border: rgba(255, 255, 255, 0.08);
  --line: #1e293b;
  --ink: #f8fafc;
  --mut: #94a3b8;
  --faint: #64748b;
  --brand: #6366f1;
  --brand-hover: #4f46e5;
  --brand-grad: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  --teal: #14b8a6;
  --err-bg: rgba(239, 68, 68, 0.12);
  --err-border: rgba(239, 68, 68, 0.25);
  --err-text: #fca5a5;
  --ok-bg: rgba(34, 197, 94, 0.12);
  --ok-border: rgba(34, 197, 94, 0.25);
  --ok-text: #86efac;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Auth Page Styling */
body.auth {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  background-color: #070b14;
  background-image: 
    radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.18) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(139, 92, 246, 0.18) 0px, transparent 50%),
    radial-gradient(at 50% 50%, rgba(20, 184, 166, 0.08) 0px, transparent 50%);
  background-attachment: fixed;
}

.card {
  background: var(--card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--card-border);
  border-radius: 24px;
  padding: 36px 32px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), 0 0 35px rgba(99, 102, 241, 0.12);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--brand-grad);
}

.brand-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 24px;
  text-align: center;
}

.brand-badge {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: var(--brand-grad);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: 0 8px 20px rgba(99, 102, 241, 0.35);
  margin-bottom: 16px;
}

.brand-logo-img {
  max-width: 240px;
  height: auto;
  max-height: 80px;
  object-fit: contain;
  margin-bottom: 16px;
  filter: drop-shadow(0 6px 16px rgba(0, 0, 0, 0.6));
}

.card h1 {
  margin: 0 0 6px;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #ffffff;
}

.sub {
  color: var(--mut);
  font-size: 14px;
  margin: 0 0 24px;
  line-height: 1.5;
  text-align: center;
}

.input-group {
  margin-bottom: 18px;
}

label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #cbd5e1;
  margin-bottom: 6px;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-wrapper input, select {
  width: 100%;
  padding: 12px 14px 12px 42px;
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  color: var(--ink);
  font-size: 14px;
  font-family: inherit;
  transition: all 0.2s ease;
}

.input-wrapper input.no-icon {
  padding-left: 14px;
}

.input-wrapper input:focus, select:focus {
  outline: none;
  border-color: #818cf8;
  background: rgba(15, 23, 42, 0.9);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2);
}

.input-wrapper .input-icon {
  position: absolute;
  left: 14px;
  color: #64748b;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  transition: color 0.2s ease;
}

.input-wrapper input:focus ~ .input-icon,
.input-wrapper:focus-within .input-icon {
  color: #818cf8;
}

.toggle-pwd {
  position: absolute;
  right: 12px;
  background: transparent;
  border: none;
  padding: 6px;
  margin: 0;
  color: #64748b;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: color 0.2s ease;
}

.toggle-pwd:hover {
  color: #f8fafc;
}

.hint { color: var(--faint); font-size: 11px; margin-top: 4px; display: block; }

button.primary, .btn.primary {
  width: 100%;
  height: 46px;
  margin-top: 24px;
  padding: 0 16px;
  border-radius: 12px;
  border: none;
  background: var(--brand-grad);
  color: #ffffff;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
  transition: all 0.2s ease;
}

button.primary:hover, .btn.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.45);
  filter: brightness(1.06);
  text-decoration: none;
}

button.primary:active, .btn.primary:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

button.danger {
  background: #3a1620;
  border: 1px solid #5b2530;
  color: #ffd9d9;
  margin: 0;
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 8px;
  cursor: pointer;
}

.err, .ok {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 13.5px;
  line-height: 1.4;
  margin-bottom: 20px;
}

.err {
  background: var(--err-bg);
  border: 1px solid var(--err-border);
  color: var(--err-text);
}

.ok {
  background: var(--ok-bg);
  border: 1px solid var(--ok-border);
  color: var(--ok-text);
}

.alert-icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
}

.alt {
  margin-top: 24px;
  font-size: 14px;
  color: var(--mut);
  text-align: center;
}

.alt a {
  color: #818cf8;
  font-weight: 600;
}

.alt a:hover {
  color: #a5b4fc;
}

/* Main App Layout */
body.app {
  padding: 0;
  min-height: 100vh;
  background-color: #070b14;
  background-image: 
    radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.12) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(139, 92, 246, 0.12) 0px, transparent 50%),
    radial-gradient(at 50% 50%, rgba(20, 184, 166, 0.06) 0px, transparent 50%);
  background-attachment: fixed;
}

.wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 20px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 22px;
  background: var(--card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--card-border);
  border-radius: 18px;
  margin-bottom: 24px;
  font-size: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  font-size: 16px;
  color: #ffffff;
}

.topbar-nav {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
  transition: all 0.2s ease;
}

.nav-btn:hover {
  background: rgba(99, 102, 241, 0.15);
  border-color: rgba(99, 102, 241, 0.4);
  color: #ffffff;
  text-decoration: none;
}

.nav-btn.primary-nav {
  background: var(--brand-grad);
  border: none;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.nav-btn.primary-nav:hover {
  filter: brightness(1.08);
}

.panel {
  background: var(--card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  padding: 28px;
  margin-bottom: 24px;
  box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.4);
}

.panel h2 {
  margin: 0 0 20px;
  font-size: 18px;
  font-weight: 700;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.grid .caps, .grid .mods {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ck-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 4px;
}

.ck {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  font-size: 13px;
  color: #cbd5e1;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.ck:hover {
  border-color: #818cf8;
  background: rgba(99, 102, 241, 0.1);
  color: #ffffff;
}

.ck input {
  width: 16px;
  height: 16px;
  accent-color: #6366f1;
  cursor: pointer;
  margin: 0;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin-top: 6px;
}

th {
  text-align: left;
  padding: 12px 14px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #94a3b8;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

td {
  text-align: left;
  padding: 14px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 14px;
  vertical-align: middle;
  color: #f8fafc;
}

tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.badge-owner {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.2), rgba(236, 72, 153, 0.2));
  border: 1px solid rgba(168, 85, 247, 0.4);
  color: #f472b6;
}

.badge-member {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: #818cf8;
}

.cap-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 600;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
  margin: 2px;
}

code {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 3px 8px;
  border-radius: 6px;
  color: var(--teal);
  font-family: monospace;
  font-size: 12.5px;
}