/* Sowline Dashboard — Farm theme */

:root {
  --earth: #2d1b0e;
  --soil: #4a3728;
  --leaf: #4a7c59;
  --leaf-light: #6da67a;
  --wheat: #e8d5a3;
  --cream: #faf6ee;
  --sky: #f0f4f1;
  --white: #ffffff;
  --text: #1a1a1a;
  --text-muted: #6b6b6b;
  --danger: #c0392b;
  --success: #27ae60;
  --warning: #e67e22;
}

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

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--sky);
  color: var(--text);
  min-height: 100vh;
}

a { color: var(--leaf); text-decoration: none; }

/* Nav */
.navbar {
  background: var(--cream);
  border-bottom: 1px solid rgba(0,0,0,0.06);
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}
.navbar .logo {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--leaf);
}
.navbar .logo span { color: var(--earth); }
.navbar-actions { display: flex; gap: 0.75rem; align-items: center; }

/* Layout */
.app-layout {
  display: flex;
  min-height: calc(100vh - 70px);
}
.sidebar {
  width: 240px;
  background: var(--white);
  border-right: 1px solid rgba(0,0,0,0.06);
  padding: 1.5rem 0;
  flex-shrink: 0;
}
.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.5rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  border-left: 3px solid transparent;
  text-decoration: none;
}
.sidebar-nav-item:hover { background: var(--sky); color: var(--text); }
.sidebar-nav-item.active {
  color: var(--leaf);
  background: rgba(74,124,89,0.06);
  border-left-color: var(--leaf);
}
.sidebar-nav-item .badge {
  background: var(--leaf);
  color: white;
  font-size: 0.75rem;
  padding: 0.1rem 0.5rem;
  border-radius: 100px;
  margin-left: auto;
}
.main-content {
  flex: 1;
  padding: 2rem 2.5rem;
  max-width: 900px;
}

/* Page header */
.page-header {
  margin-bottom: 2rem;
}
.page-header h1 {
  font-family: 'Syne', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--earth);
}
.page-header p { color: var(--text-muted); font-size: 0.9rem; margin-top: 0.25rem; }

/* Stat cards */
.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}
.stat-card {
  background: var(--white);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  border: 1px solid rgba(0,0,0,0.05);
}
.stat-card .stat-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}
.stat-card .stat-value {
  font-family: 'Syne', sans-serif;
  font-size: 2rem;
  font-weight: 800;
  color: var(--earth);
}
.stat-card .stat-sub { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.25rem; }

/* Section header */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.section-title {
  font-family: 'Syne', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--earth);
}

/* Order cards */
.order-list { display: flex; flex-direction: column; gap: 0.75rem; }
.order-card {
  background: var(--white);
  border-radius: 12px;
  border: 1px solid rgba(0,0,0,0.06);
  padding: 1.25rem 1.5rem;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  display: block;
  color: inherit;
}
.order-card:hover { border-color: var(--leaf); box-shadow: 0 2px 12px rgba(74,124,89,0.1); transform: translateY(-1px); }
.order-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}
.order-customer { font-weight: 600; color: var(--earth); font-size: 0.95rem; }
.order-subject { font-size: 0.85rem; color: var(--text-muted); margin-top: 0.1rem; }
.order-status-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.25rem 0.65rem;
  border-radius: 100px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}
.status-pending { background: rgba(230,126,34,0.12); color: var(--warning); }
.status-confirmed { background: rgba(74,124,89,0.12); color: var(--leaf); }
.status-fulfilled { background: rgba(39,174,96,0.12); color: var(--success); }
.status-cancelled { background: rgba(192,57,43,0.1); color: var(--danger); }

.order-items {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.75rem 0;
}
.order-item-tag {
  background: var(--sky);
  color: var(--soil);
  font-size: 0.8rem;
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
  font-weight: 500;
}
.order-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(0,0,0,0.04);
}
.order-total { font-weight: 600; color: var(--earth); }
.order-time { font-size: 0.75rem; }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 3rem 2rem;
  background: var(--white);
  border-radius: 12px;
  border: 1px dashed rgba(0,0,0,0.12);
}
.empty-state h3 { color: var(--soil); margin-bottom: 0.5rem; font-size: 1rem; }
.empty-state p { color: var(--text-muted); font-size: 0.85rem; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  text-decoration: none;
}
.btn-primary {
  background: var(--leaf);
  color: white;
}
.btn-primary:hover { background: var(--leaf-light); }
.btn-outline {
  background: transparent;
  border: 1.5px solid var(--leaf);
  color: var(--leaf);
}
.btn-outline:hover { background: rgba(74,124,89,0.06); }
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.8rem; }

/* Seed button */
.seed-section {
  background: var(--wheat);
  border: 1px dashed var(--soil);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 2rem;
  text-align: center;
}
.seed-section h3 { color: var(--earth); margin-bottom: 0.5rem; }
.seed-section p { color: var(--soil); font-size: 0.85rem; margin-bottom: 1rem; }

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 1rem;
}
.modal {
  background: var(--white);
  border-radius: 16px;
  max-width: 600px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.modal-header {
  padding: 1.5rem 1.75rem;
  border-bottom: 1px solid rgba(0,0,0,0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h2 {
  font-family: 'Syne', sans-serif;
  font-size: 1.1rem;
  color: var(--earth);
}
.modal-body { padding: 1.75rem; }
.modal-footer {
  padding: 1rem 1.75rem;
  border-top: 1px solid rgba(0,0,0,0.06);
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

/* Messages in order detail */
.message-list { display: flex; flex-direction: column; gap: 1rem; margin-top: 1rem; }
.message-bubble {
  max-width: 85%;
  padding: 0.85rem 1.1rem;
  border-radius: 12px;
  font-size: 0.9rem;
  line-height: 1.5;
}
.message-inbound {
  background: var(--sky);
  color: var(--text);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}
.message-outbound {
  background: var(--leaf);
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.message-meta {
  font-size: 0.75rem;
  opacity: 0.7;
  margin-top: 0.35rem;
}

/* Detail order */
.detail-section { margin-bottom: 1.75rem; }
.detail-section h4 {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}
.detail-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
.detail-item { background: var(--sky); border-radius: 8px; padding: 0.75rem 1rem; }
.detail-item label { display: block; font-size: 0.7rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.2rem; }
.detail-item span { font-size: 0.9rem; color: var(--earth); font-weight: 500; }

/* Loading */
.loading { display: flex; align-items: center; justify-content: center; padding: 3rem; color: var(--text-muted); font-size: 0.9rem; }

/* Alert */
.alert {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.85rem;
  margin-bottom: 1rem;
}
.alert-success { background: rgba(39,174,96,0.1); color: var(--success); border: 1px solid rgba(39,174,96,0.2); }
.alert-error { background: rgba(192,57,43,0.1); color: var(--danger); border: 1px solid rgba(192,57,43,0.2); }

/* Responsive */
@media (max-width: 640px) {
  .stats-row { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .main-content { padding: 1.25rem; }
}