/* ─── Login Page ─── */
.login-container {
  max-width: 380px;
  margin: 100px auto;
  text-align: center;
}

.login-container h1 {
  margin-bottom: 0.4rem;
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.login-container p {
  color: var(--muted-foreground);
  margin-bottom: 2rem;
  font-size: 0.82rem;
  line-height: 1.5;
}

/* ─── Top Navigation Bar ─── */
nav[data-topnav] {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

nav[data-topnav] .brand {
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: -0.01em;
}

nav[data-topnav] .spacer {
  flex: 1;
}

/* ─── Profile Menu ─── */
.profile-menu {
  position: relative;
}

.profile-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--primary);
  color: var(--primary-foreground);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.15s;
  padding: 0;
}

.profile-avatar:hover {
  opacity: 0.85;
}

.profile-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 220px;
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  z-index: 50;
  overflow: hidden;
}

.profile-dropdown-header {
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--border);
}

.profile-email {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-dropdown-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0.85rem;
  font-size: 0.78rem;
  color: var(--foreground);
  width: 100%;
  border: none;
  background: none;
  text-align: left;
  cursor: default;
}

.profile-dropdown-label {
  font-size: 0.78rem;
}

.profile-dropdown-action {
  cursor: pointer;
  border-top: 1px solid var(--border);
  color: var(--danger);
  font-weight: 500;
  transition: background 0.15s;
}

.profile-dropdown-action:hover {
  background: var(--muted);
}

/* ─── Nav Tab Buttons ─── */
.nav-tabs {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  padding: 2px;
  background-color: var(--muted);
  border-radius: 6px;
  margin-left: 0.25rem;
}

.nav-tab {
  padding: 0.25rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 500;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--muted-foreground);
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.15s, color 0.15s;
}

.nav-tab:hover {
  color: var(--foreground);
}

.nav-tab.active {
  background-color: var(--background);
  color: var(--foreground);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* ─── Sidebar ─── */
body.no-sidebar {
  grid-template-columns: 1fr !important;
}

body.no-sidebar > aside[data-sidebar] {
  display: none;
}

.sidebar-header {
  padding: 0.75rem 0.75rem 0.5rem;
  text-align: center;
  border-bottom: 1px solid var(--border);
}

.sidebar-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted-foreground);
}

#groups-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 0.4rem;
}

#groups-list a {
  display: flex;
  flex-direction: column;
  padding: 0.45rem 0.65rem;
  text-decoration: none;
  border-radius: 5px;
  color: inherit;
  font-size: 0.78rem;
  cursor: pointer;
  transition: background 0.15s;
}

#groups-list a:hover {
  background: var(--muted);
}

#groups-list a.active {
  background: var(--primary);
  color: var(--primary-foreground);
}

#groups-list a small {
  display: block;
  font-size: 0.65rem;
  opacity: 0.65;
  margin-top: 1px;
  line-height: 1.3;
}

/* ─── Email Panel Header ─── */
#email-panel header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border);
}

#email-panel header h2 {
  font-size: 0.85rem;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.01em;
  color: var(--foreground);
}

#email-panel header .controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.75rem;
}

#email-panel header .controls label {
  font-size: 0.75rem;
  color: var(--muted-foreground);
}

#email-panel header .controls button {
  font-size: 0.75rem;
}

/* ─── Email Cards ─── */
#emails-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.email-card {
  cursor: pointer;
  transition: box-shadow 0.15s, border-color 0.15s;
  padding: 0.65rem 0.85rem !important;
}

.email-card:hover {
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.06);
  border-color: var(--ring);
}

.email-card header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.email-card .email-from {
  font-weight: 600;
  font-size: 0.78rem;
}

.email-card .email-date {
  font-size: 0.68rem;
  color: var(--muted-foreground);
  white-space: nowrap;
}

.email-card .email-subject {
  margin: 0.2rem 0;
  font-size: 0.78rem;
  font-weight: 500;
}

.email-card .email-snippet {
  font-size: 0.72rem;
  color: var(--muted-foreground);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.4;
}

/* ─── Email Dialog ─── */
#email-dialog {
  max-width: 680px;
  width: 90vw;
  max-height: 80vh;
}

#email-dialog header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

#email-dialog header h3 {
  font-size: 0.9rem;
  font-weight: 600;
  margin: 0;
}

#dialog-close {
  font-size: 0.78rem;
  padding: 0.2rem 0.6rem;
  flex-shrink: 0;
  cursor: pointer;
}

#email-dialog .email-meta {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  margin-bottom: 0.75rem;
}

#dialog-body {
  overflow-y: auto;
  max-height: 60vh;
  line-height: 1.6;
  font-size: 0.85rem;
}

#dialog-body img {
  max-width: 100%;
  height: auto;
}

/* ─── Subscriptions Table ─── */
#subscriptions-panel {
  padding-top: 0.25rem;
}

#subscriptions-table {
  table-layout: auto;
}

#subscriptions-table th {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

#subscriptions-table td {
  font-size: 0.78rem;
}

#subscriptions-table code {
  cursor: pointer;
  user-select: all;
  font-size: 0.75rem;
  padding: 0.15rem 0.35rem;
  border-radius: 3px;
  background: var(--muted);
  transition: background 0.15s;
}

#subscriptions-table code:hover {
  background: var(--accent);
}

#subscriptions-table td:nth-child(5) {
  white-space: nowrap;
}

/* ─── Empty State ─── */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--muted-foreground);
  font-size: 0.82rem;
}

/* ─── Utilities ─── */
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.hidden { display: none !important; }
