/* === Trellis Ops App Styles === */
/* Matches landing page design tokens */

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --ink: #0a0f1a;
  --chalk: #f8f7f4;
  --sage: #4a7c59;
  --sage-light: #6b9e78;
  --sage-glow: #e8f0ea;
  --sage-dark: #3a6447;
  --warm: #f5f0e8;
  --muted: #6b7280;
  --border: #e5e2db;
  --red: #dc4a4a;
  --red-light: #fef2f2;
  --amber: #d97706;
  --amber-light: #fffbeb;
  --blue: #3b82f6;
  --blue-light: #eff6ff;
}

body {
  font-family: 'DM Sans', sans-serif;
  color: var(--ink);
  background: var(--chalk);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

h1, h2, h3, h4 { font-family: 'Space Grotesk', sans-serif; }

/* === AUTH PAGES === */
.auth-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: var(--warm);
}

.auth-card {
  background: white;
  border-radius: 20px;
  padding: 3rem;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 4px 24px rgba(0,0,0,0.06);
  border: 1px solid var(--border);
}

.auth-logo {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1.5rem;
  color: var(--sage);
  margin-bottom: 0.5rem;
}

.auth-subtitle {
  color: var(--muted);
  font-size: 0.95rem;
  margin-bottom: 2rem;
}

/* === FORMS === */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 0.4rem;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.95rem;
  color: var(--ink);
  background: white;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--sage);
  box-shadow: 0 0 0 3px var(--sage-glow);
}

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

/* === BUTTONS === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: 10px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  text-decoration: none;
}

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

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

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

.btn-secondary {
  background: var(--sage-glow);
  color: var(--sage);
}

.btn-secondary:hover {
  background: #d9e8dd;
}

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

.btn-ghost:hover {
  background: var(--warm);
  color: var(--ink);
}

.btn-danger {
  background: var(--red);
  color: white;
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  border-radius: 8px;
}

.btn-block {
  width: 100%;
}

/* === APP LAYOUT === */
.app-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 260px;
  background: white;
  border-right: 1px solid var(--border);
  padding: 1.5rem;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 50;
}

.sidebar-logo {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--sage);
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 1rem;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: 'DM Sans', sans-serif;
}

.sidebar-link:hover {
  background: var(--sage-glow);
  color: var(--sage);
}

.sidebar-link.active {
  background: var(--sage-glow);
  color: var(--sage);
  font-weight: 600;
}

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

.sidebar-badge {
  margin-left: auto;
  background: var(--sage);
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  min-width: 20px;
  text-align: center;
}

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

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem;
}

.sidebar-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--sage-glow);
  color: var(--sage);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
}

.sidebar-user-info {
  flex: 1;
  overflow: hidden;
}

.sidebar-user-name {
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.main-content {
  margin-left: 260px;
  flex: 1;
  padding: 2rem 2.5rem;
  min-height: 100vh;
}

/* === PAGE HEADER === */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
}

.page-title {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.page-subtitle {
  font-size: 0.95rem;
  color: var(--muted);
  margin-top: 0.25rem;
}

/* === STAT CARDS === */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.5rem;
  transition: border-color 0.2s;
}

.stat-card:hover {
  border-color: var(--sage-light);
}

.stat-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.stat-value {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--ink);
}

.stat-value.sage { color: var(--sage); }
.stat-value.red { color: var(--red); }
.stat-value.amber { color: var(--amber); }
.stat-value.blue { color: var(--blue); }

/* === CARDS === */
.card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 14px;
  margin-bottom: 1.5rem;
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.card-title {
  font-size: 1rem;
  font-weight: 700;
}

.card-body {
  padding: 1.5rem;
}

.card-empty {
  padding: 3rem;
  text-align: center;
  color: var(--muted);
}

.card-empty-icon {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
  opacity: 0.5;
}

.card-empty-text {
  font-size: 0.95rem;
  margin-bottom: 1rem;
}

/* === EMAIL LIST === */
.email-list {
  list-style: none;
}

.email-item {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid #f0ede8;
  cursor: pointer;
  transition: background 0.15s;
}

.email-item:last-child {
  border-bottom: none;
}

.email-item:hover {
  background: var(--sage-glow);
}

.email-item.unread {
  background: var(--warm);
}

.email-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--sage-glow);
  color: var(--sage);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.email-content {
  flex: 1;
  min-width: 0;
}

.email-from {
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.15rem;
}

.email-subject {
  font-size: 0.9rem;
  color: var(--ink);
  margin-bottom: 0.25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.email-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.25rem;
  flex-shrink: 0;
}

.email-time {
  font-size: 0.75rem;
  color: var(--muted);
}

/* === BADGES === */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-new { background: var(--sage-glow); color: var(--sage); }
.badge-pending { background: var(--amber-light); color: var(--amber); }
.badge-replied { background: var(--blue-light); color: var(--blue); }
.badge-sent { background: var(--sage-glow); color: var(--sage); }
.badge-overdue { background: var(--red-light); color: var(--red); }
.badge-high { background: var(--red-light); color: var(--red); }
.badge-medium { background: var(--amber-light); color: var(--amber); }
.badge-low { background: var(--blue-light); color: var(--blue); }
.badge-completed { background: var(--sage-glow); color: var(--sage); }

/* === TASK LIST === */
.task-list {
  list-style: none;
}

.task-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1.5rem;
  border-bottom: 1px solid #f0ede8;
  transition: background 0.15s;
}

.task-item:last-child {
  border-bottom: none;
}

.task-item:hover {
  background: var(--warm);
}

.task-checkbox {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-radius: 50%;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.task-checkbox:hover {
  border-color: var(--sage);
}

.task-checkbox.checked {
  background: var(--sage);
  border-color: var(--sage);
  color: white;
  font-size: 0.7rem;
}

.task-info {
  flex: 1;
}

.task-title {
  font-size: 0.9rem;
  font-weight: 500;
}

.task-title.completed {
  text-decoration: line-through;
  color: var(--muted);
}

.task-due {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.15rem;
}

.task-due.overdue {
  color: var(--red);
  font-weight: 600;
}

/* === DRAFT PANEL === */
.draft-panel {
  background: white;
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}

.draft-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--warm);
}

.draft-email-info {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.25rem;
}

.draft-content {
  padding: 1.5rem;
  white-space: pre-wrap;
  font-size: 0.95rem;
  line-height: 1.7;
  min-height: 200px;
}

.draft-actions {
  display: flex;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  background: #fafaf8;
}

/* === MORNING BRIEF === */
.brief-content {
  padding: 1.5rem;
  font-size: 0.95rem;
  line-height: 1.8;
}

.brief-content h1, .brief-content h2, .brief-content h3 {
  margin-top: 1.25rem;
  margin-bottom: 0.5rem;
}

.brief-content h2 { font-size: 1.15rem; }
.brief-content h3 { font-size: 1rem; }

.brief-content ul, .brief-content ol {
  padding-left: 1.5rem;
  margin-bottom: 0.75rem;
}

.brief-content li {
  margin-bottom: 0.35rem;
}

.brief-content p {
  margin-bottom: 0.75rem;
}

/* === ACTIVITY FEED === */
.activity-feed {
  list-style: none;
}

.activity-item {
  display: flex;
  gap: 0.75rem;
  padding: 0.75rem 1.5rem;
  border-bottom: 1px solid #f0ede8;
}

.activity-item:last-child {
  border-bottom: none;
}

.activity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--sage);
  flex-shrink: 0;
  margin-top: 0.5rem;
}

.activity-dot.email { background: var(--blue); }
.activity-dot.task { background: var(--amber); }
.activity-dot.brief { background: var(--sage); }
.activity-dot.draft { background: #8b5cf6; }

.activity-text {
  font-size: 0.85rem;
  color: var(--ink);
  flex: 1;
}

.activity-time {
  font-size: 0.75rem;
  color: var(--muted);
  flex-shrink: 0;
}

/* === ONBOARDING === */
.onboarding-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: var(--warm);
}

.onboarding-card {
  background: white;
  border-radius: 20px;
  padding: 3rem;
  max-width: 560px;
  width: 100%;
  box-shadow: 0 4px 24px rgba(0,0,0,0.06);
  border: 1px solid var(--border);
}

.onboarding-step {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--sage);
  margin-bottom: 1rem;
}

.onboarding-title {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.onboarding-desc {
  color: var(--muted);
  font-size: 0.95rem;
  margin-bottom: 2rem;
  line-height: 1.6;
}

.tone-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.tone-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem;
  border: 2px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
  background: white;
  font-family: 'DM Sans', sans-serif;
}

.tone-option:hover {
  border-color: var(--sage-light);
}

.tone-option.selected {
  border-color: var(--sage);
  background: var(--sage-glow);
}

.tone-option-icon {
  font-size: 1.5rem;
}

.tone-option-label {
  font-size: 0.85rem;
  font-weight: 600;
}

.tone-option-desc {
  font-size: 0.75rem;
  color: var(--muted);
  text-align: center;
}

/* === MODAL === */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(10, 15, 26, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 2rem;
}

.modal {
  background: white;
  border-radius: 20px;
  max-width: 600px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}

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

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: var(--warm);
  cursor: pointer;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.modal-close:hover {
  background: var(--border);
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
}

/* === LOADING & EMPTY STATES === */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  color: var(--muted);
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--sage);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 1rem;
}

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

/* === TWO COLUMN LAYOUT === */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

/* === RESPONSIVE === */
@media (max-width: 900px) {
  .sidebar {
    display: none;
  }
  .main-content {
    margin-left: 0;
    padding: 1.5rem;
  }
  .two-col {
    grid-template-columns: 1fr;
  }
  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }
  .tone-options {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
}

/* === LINK === */
.link {
  color: var(--sage);
  text-decoration: none;
  font-weight: 500;
  cursor: pointer;
}

.link:hover {
  text-decoration: underline;
}

/* === ALERT === */
.alert {
  padding: 0.85rem 1.25rem;
  border-radius: 10px;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.alert-error {
  background: var(--red-light);
  color: var(--red);
  border: 1px solid #fecaca;
}

.alert-success {
  background: var(--sage-glow);
  color: var(--sage-dark);
  border: 1px solid #bbdbc4;
}

/* === DRAFT QUEUE CARD === */
.draft-queue-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid #f0ede8;
  cursor: pointer;
  transition: background 0.15s;
}

.draft-queue-item:last-child {
  border-bottom: none;
}

.draft-queue-item:hover {
  background: var(--sage-glow);
}

.draft-queue-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #f3e8ff;
  color: #8b5cf6;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

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

.draft-queue-subject {
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.draft-queue-from {
  font-size: 0.8rem;
  color: var(--muted);
}

/* Hidden by default */
.hidden { display: none !important; }
