/* App shell */
.app-body {
  min-height: 100vh;
  background: var(--bg);
}

.app-shell {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 240px;
  min-height: 100vh;
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-brand {
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--border);
}

.brand-logo {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--fg);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.brand-logo .accent {
  color: var(--accent);
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--fg-muted);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

.nav-item:hover {
  background: var(--bg-card);
  color: var(--fg);
}

.nav-item.active {
  background: var(--accent-dim);
  color: var(--accent);
}

.nav-icon {
  font-size: 1rem;
  width: 20px;
  text-align: center;
}

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid var(--border);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent-dim);
  color: var(--accent);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1px solid rgba(34, 214, 122, 0.2);
}

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

.user-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-email {
  font-size: 0.75rem;
  color: var(--fg-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-logout {
  width: 100%;
  padding: 8px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--fg-muted);
  font-size: 0.82rem;
  cursor: pointer;
  font-family: var(--font-body);
  transition: background 0.15s, color 0.15s;
}

.btn-logout:hover {
  background: var(--bg-card);
  color: var(--fg);
}

/* Main content area */
.app-main {
  flex: 1;
  padding: 40px 48px;
  max-width: 1000px;
  min-width: 0;
}

/* Page header */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 32px;
  gap: 16px;
}

.page-title {
  font-family: var(--font-heading);
  font-size: 1.8rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 4px;
}

.page-sub {
  font-size: 0.92rem;
  color: var(--fg-muted);
}

/* Stats grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 36px;
}

.stats-grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.stat-card-value {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 700;
  color: #fff;
  line-height: 1;
  margin-bottom: 6px;
}

.stat-card-value.accent {
  color: var(--accent);
}

.stat-card-label {
  font-size: 0.82rem;
  color: var(--fg-muted);
}

/* Section header */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-title {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 600;
  color: #fff;
}

.link-muted {
  font-size: 0.85rem;
  color: var(--fg-muted);
  text-decoration: none;
}

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

/* Card */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
}

.card-title {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 600;
  color: #fff;
  margin-bottom: 20px;
}

/* Table */
.table-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  background: var(--bg-elevated);
  padding: 12px 16px;
  text-align: left;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-muted);
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 14px 16px;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--border);
  color: var(--fg);
}

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

.data-table tbody tr:hover td {
  background: rgba(255,255,255,0.02);
}

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

/* Badges */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: capitalize;
}

.badge-sent {
  background: rgba(251, 191, 36, 0.12);
  color: var(--accent-secondary);
  border: 1px solid rgba(251, 191, 36, 0.25);
}

.badge-completed {
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid rgba(34, 214, 122, 0.25);
}

/* Buttons */
.btn-primary {
  display: inline-block;
  padding: 10px 20px;
  background: var(--accent);
  color: #0a0a0f;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.9rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.15s;
  white-space: nowrap;
}

.btn-primary:hover {
  opacity: 0.88;
}

.btn-full {
  display: block;
  width: 100%;
  text-align: center;
}

.btn-sm {
  display: inline-block;
  padding: 6px 12px;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  border: none;
  font-family: var(--font-body);
  text-decoration: none;
  transition: opacity 0.15s;
}

.btn-accent {
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid rgba(34, 214, 122, 0.2);
}

.btn-accent:hover {
  background: rgba(34, 214, 122, 0.2);
}

.btn-ghost {
  background: transparent;
  color: var(--fg-muted);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  background: var(--bg-elevated);
  color: var(--fg);
}

/* Forms */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.form-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.form-input {
  padding: 10px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--fg);
  font-size: 0.92rem;
  font-family: var(--font-body);
  outline: none;
  transition: border-color 0.15s;
  width: 100%;
}

.form-input:focus {
  border-color: var(--accent);
}

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

.form-hint {
  font-size: 0.78rem;
  color: var(--fg-muted);
  margin-top: 4px;
}

.form-row {
  display: flex;
  gap: 16px;
}

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}

.form-divider {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--fg-muted);
  padding: 16px 0 8px;
  border-top: 1px solid var(--border);
  margin-top: 8px;
}

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

/* Auth pages */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  background: linear-gradient(180deg, #0f1118 0%, var(--bg) 100%);
}

.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px;
  width: 100%;
  max-width: 440px;
}

.auth-brand {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--fg);
  margin-bottom: 24px;
}

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

.auth-title {
  font-size: 1.5rem;
  color: #fff;
  margin-bottom: 8px;
}

.auth-sub {
  color: var(--fg-muted);
  font-size: 0.92rem;
  margin-bottom: 28px;
}

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

.auth-switch {
  margin-top: 20px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--fg-muted);
}

.auth-switch a {
  color: var(--accent);
  text-decoration: none;
}

/* Flash messages */
.flash {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 500;
  margin-bottom: 20px;
}

.flash-success {
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid rgba(34, 214, 122, 0.2);
}

.flash-error {
  background: rgba(239, 68, 68, 0.1);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.flash-warning {
  background: rgba(251, 191, 36, 0.1);
  color: var(--accent-secondary);
  border: 1px solid rgba(251, 191, 36, 0.2);
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 64px 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.empty-icon {
  font-size: 2.5rem;
  margin-bottom: 16px;
}

.empty-state h3 {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 600;
  color: #fff;
  margin-bottom: 8px;
}

.empty-state p {
  color: var(--fg-muted);
  font-size: 0.92rem;
}

/* Landing page CTA button */
.cta-btn {
  display: inline-block;
  padding: 16px 40px;
  background: var(--accent);
  color: #0a0a0f;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1rem;
  border-radius: 10px;
  text-decoration: none;
  margin-top: 40px;
  transition: opacity 0.15s, transform 0.15s;
  box-shadow: 0 0 40px rgba(34, 214, 122, 0.2);
}

.cta-btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

/* Responsive */
@media (max-width: 900px) {
  .sidebar {
    width: 60px;
  }
  .sidebar-brand, .user-info, .nav-item span:not(.nav-icon), .btn-logout {
    display: none;
  }
  .nav-item {
    justify-content: center;
    padding: 12px;
  }
  .sidebar-user {
    justify-content: center;
  }
  .app-main {
    padding: 24px 20px;
  }
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .form-row {
    flex-direction: column;
  }
}

@media (max-width: 600px) {
  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }
  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .auth-card {
    padding: 28px 20px;
  }
}
