/* ============================================================
   OsemStock - Design System & Styles
   Font: Plus Jakarta Sans (display), JetBrains Mono (code/data)
   Theme: Organic-industrial — earthy greens, warm stone
============================================================ */

:root {
  /* Color Palette */
  --green-50:  #f0fdf4;
  --green-100: #dcfce7;
  --green-200: #bbf7d0;
  --green-300: #86efac;
  --green-400: #4ade80;
  --green-500: #22c55e;
  --green-600: #16a34a;
  --green-700: #15803d;
  --green-800: #166534;
  --green-900: #14532d;

  --stone-50:  #fafaf9;
  --stone-100: #f5f5f4;
  --stone-200: #e7e5e4;
  --stone-300: #d6d3d1;
  --stone-400: #a8a29e;
  --stone-500: #78716c;
  --stone-600: #57534e;
  --stone-700: #44403c;
  --stone-800: #292524;
  --stone-900: #1c1917;

  --amber-400: #fbbf24;
  --amber-500: #f59e0b;
  --amber-600: #d97706;
  --red-500:   #ef4444;
  --red-600:   #dc2626;
  --blue-500:  #3b82f6;
  --blue-600:  #2563eb;

  /* Semantic */
  --bg:          #f8f7f5;
  --bg-card:     #ffffff;
  --bg-sidebar:  #1c1917;
  --bg-topnav:   #ffffff;
  --border:      #e7e5e4;
  --border-dark: #d6d3d1;
  --text-primary:   #1c1917;
  --text-secondary: #57534e;
  --text-muted:     #a8a29e;
  --text-on-dark:   rgba(255,255,255,0.85);

  --brand:       #16a34a;
  --brand-hover: #15803d;
  --brand-light: #dcfce7;

  --danger:      #dc2626;
  --warning:     #d97706;
  --success:     #16a34a;

  /* Spacing */
  --nav-h: 56px;
  --sidebar-w: 220px;

  /* Typography */
  --font-body:  'Plus Jakarta Sans', system-ui, sans-serif;
  --font-mono:  'JetBrains Mono', monospace;

  /* Radius */
  --r-sm:  6px;
  --r-md:  10px;
  --r-lg:  14px;
  --r-xl:  20px;

  /* Shadow */
  --shadow-sm:  0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:  0 4px 12px rgba(0,0,0,.08), 0 2px 4px rgba(0,0,0,.04);
  --shadow-lg:  0 10px 30px rgba(0,0,0,.12), 0 4px 8px rgba(0,0,0,.06);
  --shadow-modal: 0 24px 64px rgba(0,0,0,.2);
}

/* ── Reset ─────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; }
body {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg);
  height: 100%;
  overflow-x: hidden;
}
input, select, textarea, button { font-family: inherit; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* ── Auth Screen ────────────────────────── */
.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 24px;
}
.auth-bg {
  position: fixed; inset: 0; z-index: 0;
  background: linear-gradient(135deg, #0a2e14 0%, #1a4a28 40%, #0f3520 70%, #071a0c 100%);
}
.auth-bg-pattern {
  position: absolute; inset: 0;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(22,163,74,.15) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(34,197,94,.1) 0%, transparent 45%),
    radial-gradient(circle at 50% 90%, rgba(16,83,37,.2) 0%, transparent 40%);
}
.auth-bg-overlay {
  position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='60'%3E%3Ccircle cx='30' cy='30' r='1' fill='rgba(255,255,255,.03)'/%3E%3C/svg%3E");
}
.auth-container {
  background: var(--bg-card);
  border-radius: var(--r-xl);
  padding: 40px;
  width: 100%; max-width: 440px;
  box-shadow: var(--shadow-modal);
  position: relative; z-index: 1;
  animation: slideUp .4s ease;
}
@keyframes slideUp { from { opacity:0; transform:translateY(20px); } to { opacity:1; transform:translateY(0); } }

.auth-brand { display:flex; align-items:center; gap:12px; margin-bottom:32px; }
.brand-logo {
  display:block;
  flex-shrink:0;
  object-fit:contain;
  object-position:center;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(22,163,74,0.12), rgba(255,255,255,0.98));
  padding: 4px;
  border: 1px solid rgba(22,163,74,0.16);
  box-shadow: 0 8px 24px rgba(22,163,74,0.12);
}
.brand-logo--auth {
  width: 48px;
  height: 48px;
}
.brand-logo--nav {
  width: 34px;
  height: 34px;
  padding: 3px;
  border-radius: 12px;
}
.auth-brand-name { font-size:22px; font-weight:700; color:var(--text-primary); letter-spacing:-.5px; }
.auth-brand-tagline { font-size:11px; color:var(--text-muted); font-weight:500; margin-top:1px; }
.auth-title { font-size:26px; font-weight:700; letter-spacing:-.6px; margin-bottom:6px; }
.auth-subtitle { color:var(--text-secondary); margin-bottom:28px; }

.auth-panel { display:none; }
.auth-panel.active { display:block; }
.auth-switch { text-align:center; margin-top:20px; color:var(--text-secondary); font-size:13px; }
.auth-switch a { font-weight:600; }

.auth-error {
  background: #fee2e2; border: 1px solid #fecaca; border-radius:var(--r-md);
  color: #991b1b; padding:10px 14px; margin-bottom:16px; font-size:13px;
}

/* ── Forms ──────────────────────────────── */
.form-group { margin-bottom:16px; }
.form-row { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.form-label {
  display:block; font-size:12.5px; font-weight:600; color:var(--text-secondary);
  margin-bottom:6px; letter-spacing:.2px;
}
.label-hint { font-weight:400; color:var(--text-muted); }
.form-input {
  width:100%;
  padding:10px 13px;
  border: 1.5px solid var(--border-dark);
  border-radius: var(--r-md);
  font-size:14px;
  color: var(--text-primary);
  background: var(--bg-card);
  transition: border-color .15s, box-shadow .15s;
  outline: none;
  appearance: none;
}
.form-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(22,163,74,.12);
}
.form-input::placeholder { color:var(--text-muted); }
.form-select { cursor:pointer; }
textarea.form-input { resize:vertical; min-height:80px; }
.required { color:var(--danger); }

/* ── Buttons ────────────────────────────── */
.btn {
  display:inline-flex; align-items:center; gap:7px;
  padding:9px 18px; border-radius:var(--r-md);
  font-size:13.5px; font-weight:600; cursor:pointer;
  border:1.5px solid transparent;
  transition: background .15s, transform .1s, box-shadow .15s, opacity .15s;
  white-space:nowrap; line-height:1;
}
.btn:active { transform:scale(.98); }
.btn:disabled { opacity:.55; cursor:not-allowed; }
.btn-primary { background:var(--brand); color:#fff; border-color:var(--brand); }
.btn-primary:hover { background:var(--brand-hover); border-color:var(--brand-hover); box-shadow:0 2px 8px rgba(22,163,74,.3); }
.btn-ghost { background:transparent; color:var(--text-secondary); border-color:var(--border-dark); }
.btn-ghost:hover { background:var(--stone-100); color:var(--text-primary); }
.btn-danger { background:var(--danger); color:#fff; border-color:var(--danger); }
.btn-warning { background:var(--warning); color:#fff; border-color:var(--warning); }
.btn-sm { padding:6px 12px; font-size:12.5px; }
.btn-lg { padding:12px 22px; font-size:15px; }
.btn-full { width:100%; justify-content:center; }
.btn-icon { padding:8px; }
.btn-spinner {
  width:16px; height:16px;
  border:2px solid rgba(255,255,255,.4);
  border-top-color:#fff;
  border-radius:50%;
  animation:spin .7s linear infinite;
}
@keyframes spin { to { transform:rotate(360deg); } }

/* ── Top Navigation ─────────────────────── */
.app-shell { height:100vh; display:flex; flex-direction:column; }
.topnav {
  height:var(--nav-h);
  display:flex; align-items:center; justify-content:space-between;
  padding:0 20px;
  background:var(--bg-topnav);
  border-bottom:1.5px solid var(--border);
  position:sticky; top:0; z-index:100;
  box-shadow:var(--shadow-sm);
}
.topnav-left { display:flex; align-items:center; gap:0; }
.topnav-logo { display:flex; align-items:center; gap:9px; margin-right:20px; }
.topnav-brand { font-size:17px; font-weight:800; color:var(--text-primary); letter-spacing:-.5px; }

.farm-selector { margin-right:6px; }
.farm-selector-current {
  display:flex; align-items:center; gap:6px;
  padding:5px 10px; border-radius:var(--r-sm);
  font-size:13px; font-weight:600; color:var(--text-secondary);
  cursor:pointer; border:1.5px solid var(--border);
  transition:background .15s, color .15s;
}
.farm-selector-current:hover { background:var(--stone-100); color:var(--text-primary); }

.main-nav { display:flex; align-items:center; gap:2px; }
.nav-tab {
  display:flex; align-items:center; gap:6px;
  padding:7px 13px; border-radius:var(--r-sm);
  font-size:13px; font-weight:500; color:var(--text-secondary);
  cursor:pointer; border:none; background:none;
  transition:background .15s, color .15s;
  white-space:nowrap;
}
.nav-tab:hover { background:var(--stone-100); color:var(--text-primary); }
.nav-tab.active { background:var(--brand-light); color:var(--brand); font-weight:600; }
.nav-tab-finance { display:none; }
.nav-tab-finance.visible { display:flex; }

.topnav-right { position:relative; }
.user-menu {
  display:flex; align-items:center; gap:8px;
  padding:5px 10px; border-radius:var(--r-md);
  cursor:pointer; transition:background .15s;
}
.user-menu:hover { background:var(--stone-100); }
.user-avatar {
  width:30px; height:30px; border-radius:50%;
  background: linear-gradient(135deg, var(--brand), #065f46);
  color:#fff; font-size:11px; font-weight:700;
  display:flex; align-items:center; justify-content:center;
  letter-spacing:.5px;
}
.user-name { font-size:13px; font-weight:600; color:var(--text-primary); }
.user-dropdown {
  position:absolute; top:calc(100% + 8px); right:0;
  background:var(--bg-card); border:1.5px solid var(--border);
  border-radius:var(--r-lg); padding:8px; min-width:220px;
  box-shadow:var(--shadow-lg); z-index:200;
  animation:fadeIn .15s ease;
}
@keyframes fadeIn { from { opacity:0; transform:translateY(-4px); } to { opacity:1; transform:translateY(0); } }
.dropdown-header { padding:8px 10px 10px; }
.dropdown-user-name { font-weight:700; font-size:14px; }
.dropdown-user-email { font-size:12px; color:var(--text-muted); margin-top:2px; }
.dropdown-divider { height:1px; background:var(--border); margin:4px 0; }
.dropdown-item {
  display:flex; align-items:center; gap:9px;
  width:100%; padding:8px 10px; border-radius:var(--r-sm);
  font-size:13px; font-weight:500; color:var(--text-primary);
  cursor:pointer; border:none; background:none; text-align:left;
  transition:background .12s;
}
.dropdown-item:hover { background:var(--stone-100); }
.dropdown-item.danger { color:var(--danger); }
.dropdown-item.danger:hover { background:#fee2e2; }

/* ── App Main ───────────────────────────── */
.app-main { flex:1; overflow:hidden; display:flex; flex-direction:column; }
.page { display:none; flex:1; overflow:auto; }
.page.active { display:flex; flex-direction:column; }

/* ── My Farms Page ──────────────────────── */
.page-header-simple {
  display:flex; align-items:center; justify-content:space-between;
  padding:32px 40px 0;
}
.page-title { font-size:28px; font-weight:800; letter-spacing:-.7px; }
.page-subtitle { color:var(--text-secondary); margin-top:4px; font-size:14px; }

.section-title {
  display:flex; align-items:center; gap:8px;
  font-size:15px; font-weight:700; color:var(--text-primary);
  padding:28px 40px 12px;
}

.farms-grid {
  display:grid; grid-template-columns:repeat(auto-fill, minmax(280px, 1fr));
  gap:18px; padding:24px 40px 40px;
}
.farm-card {
  background:var(--bg-card); border:1.5px solid var(--border);
  border-radius:var(--r-lg); padding:24px;
  cursor:pointer; transition:border-color .2s, box-shadow .2s, transform .2s;
  position:relative; overflow:hidden;
}
.farm-card::before {
  content:''; position:absolute; top:0; left:0; right:0; height:4px;
  background: linear-gradient(90deg, var(--brand), #4ade80);
}
.farm-card:hover { border-color:var(--brand); box-shadow:var(--shadow-md); transform:translateY(-2px); }
.farm-card-icon {
  width:48px; height:48px; border-radius:var(--r-md);
  background:var(--green-50); display:flex; align-items:center; justify-content:center;
  font-size:22px; margin-bottom:14px;
}
.farm-card-name { font-size:17px; font-weight:700; letter-spacing:-.3px; margin-bottom:4px; }
.farm-card-type { font-size:12px; color:var(--text-muted); font-weight:500; text-transform:uppercase; letter-spacing:.5px; }
.farm-card-meta { display:flex; align-items:center; gap:8px; margin-top:16px; flex-wrap:wrap; }
.farm-role-badge {
  font-size:11px; font-weight:700; padding:3px 9px; border-radius:20px;
  text-transform:uppercase; letter-spacing:.5px;
}
.role-admin    { background:#dcfce7; color:#15803d; }
.role-manager  { background:#dbeafe; color:#1d4ed8; }
.role-operator { background:#fef3c7; color:#92400e; }
.farm-card-location { font-size:12px; color:var(--text-muted); display:flex; align-items:center; gap:4px; }

.farms-empty { grid-column:1/-1; text-align:center; padding:60px 40px; }
.empty-icon { font-size:48px; margin-bottom:12px; }
.farms-empty h3 { font-size:20px; font-weight:700; margin-bottom:8px; }
.farms-empty p { color:var(--text-secondary); margin-bottom:20px; }

.invitations-list { padding:0 40px 8px; display:flex; flex-direction:column; gap:8px; }
.invitation-card {
  display:flex; align-items:center; justify-content:space-between;
  background:#fffbeb; border:1.5px solid #fde68a;
  border-radius:var(--r-md); padding:14px 18px;
}
.inv-text { font-size:13.5px; }
.inv-farm { font-weight:700; }
.inv-role { color:var(--text-muted); font-size:12px; }
.inv-actions { display:flex; gap:8px; }

/* ── Farm Layout ────────────────────────── */
.page-farm { padding:0 !important; }
.page-farm.active { display:flex !important; flex-direction:column !important; overflow:hidden; }
.farm-layout { display:flex; flex:1; overflow:hidden; }

.sidebar {
  width:var(--sidebar-w); flex-shrink:0;
  background:var(--bg-sidebar);
  overflow-y:auto; overflow-x:hidden;
  border-right:1.5px solid rgba(255,255,255,.06);
}
.sidebar-nav { padding:16px 10px; }
.sidebar-section { margin-bottom:6px; }
.sidebar-label {
  font-size:10px; font-weight:700; color:rgba(255,255,255,.3);
  text-transform:uppercase; letter-spacing:1px;
  padding:10px 10px 4px;
}
.sidebar-item {
  display:flex; align-items:center; gap:9px;
  width:100%; padding:9px 10px; border-radius:var(--r-sm);
  font-size:13px; font-weight:500;
  color:rgba(255,255,255,.6);
  cursor:pointer; border:none; background:none; text-align:left;
  transition:background .12s, color .12s;
}
.sidebar-item:hover { background:rgba(255,255,255,.07); color:rgba(255,255,255,.9); }
.sidebar-item.active { background:rgba(22,163,74,.25); color:#4ade80; font-weight:600; }
.sidebar-item svg { opacity:.7; flex-shrink:0; }
.sidebar-item.active svg { opacity:1; }

.farm-content {
  flex:1; overflow:auto;
  display:flex; flex-direction:column;
}

/* ── Section Container ──────────────────── */
.section-container { padding:28px 32px; flex:1; }
.section-header {
  display:flex; align-items:center; justify-content:space-between;
  margin-bottom:24px;
}
.section-title-lg { font-size:22px; font-weight:800; letter-spacing:-.5px; }
.section-subtitle { color:var(--text-secondary); font-size:13px; margin-top:3px; }
.section-actions { display:flex; gap:8px; align-items:center; }

/* ── Cards & Stat Tiles ─────────────────── */
.card {
  background:var(--bg-card); border:1.5px solid var(--border);
  border-radius:var(--r-lg); padding:20px;
}
.stats-grid {
  display:grid; grid-template-columns:repeat(auto-fill, minmax(180px, 1fr));
  gap:14px; margin-bottom:24px;
}
.stat-tile {
  background:var(--bg-card); border:1.5px solid var(--border);
  border-radius:var(--r-lg); padding:18px 20px;
  position:relative; overflow:hidden;
  transition:border-color .2s, box-shadow .2s;
}
.stat-tile:hover { border-color:var(--brand); box-shadow:var(--shadow-sm); }
.stat-icon {
  width:36px; height:36px; border-radius:var(--r-md);
  display:flex; align-items:center; justify-content:center;
  margin-bottom:12px; font-size:16px;
}
.stat-value { font-size:26px; font-weight:800; letter-spacing:-.8px; line-height:1.1; }
.stat-label { font-size:12px; color:var(--text-muted); margin-top:4px; font-weight:500; }
.stat-change { font-size:11.5px; font-weight:600; margin-top:6px; }
.stat-up   { color:var(--success); }
.stat-down { color:var(--danger); }

.ic-green  { background:var(--green-50);  color:var(--green-700); }
.ic-amber  { background:#fffbeb;           color:#92400e; }
.ic-red    { background:#fef2f2;           color:var(--red-600); }
.ic-blue   { background:#eff6ff;           color:var(--blue-600); }
.ic-stone  { background:var(--stone-100); color:var(--stone-600); }

/* ── Tables ─────────────────────────────── */
.table-wrapper {
  background:var(--bg-card); border:1.5px solid var(--border);
  border-radius:var(--r-lg); overflow:hidden;
}
.table-toolbar {
  display:flex; align-items:center; justify-content:space-between;
  padding:14px 18px; border-bottom:1.5px solid var(--border);
  gap:12px; flex-wrap:wrap;
}
.table-search {
  flex:1; min-width:200px;
  display:flex; align-items:center; gap:8px;
  background:var(--stone-100); border:1.5px solid var(--border);
  border-radius:var(--r-md); padding:7px 12px;
}
.table-search input {
  border:none; background:none; outline:none;
  font-size:13px; flex:1; color:var(--text-primary);
}
.table-search svg { color:var(--text-muted); flex-shrink:0; }
table { width:100%; border-collapse:collapse; }
thead tr { background:var(--stone-50); border-bottom:1.5px solid var(--border); }
th {
  padding:10px 16px; text-align:left;
  font-size:11.5px; font-weight:700; color:var(--text-secondary);
  text-transform:uppercase; letter-spacing:.5px; white-space:nowrap;
}
td { padding:12px 16px; border-bottom:1px solid var(--stone-100); font-size:13.5px; vertical-align:middle; }
tbody tr { transition:background .1s; }
tbody tr:hover { background:var(--stone-50); }
tbody tr:last-child td { border-bottom:none; }
.table-empty { text-align:center; padding:48px 20px; color:var(--text-muted); }
.table-empty svg { margin-bottom:10px; opacity:.3; }

/* ── Badges & Tags ──────────────────────── */
.badge {
  display:inline-flex; align-items:center; gap:4px;
  font-size:11.5px; font-weight:600; padding:3px 10px;
  border-radius:20px; white-space:nowrap;
}
.badge-green  { background:#dcfce7; color:#15803d; }
.badge-red    { background:#fee2e2; color:#991b1b; }
.badge-amber  { background:#fef3c7; color:#92400e; }
.badge-blue   { background:#dbeafe; color:#1e40af; }
.badge-stone  { background:var(--stone-100); color:var(--stone-600); }
.badge-dot::before {
  content:''; width:6px; height:6px; border-radius:50%; background:currentColor;
}

/* ── Dashboard ──────────────────────────── */
.dashboard-toolbar {
  display:flex; align-items:center; justify-content:space-between;
  margin-bottom:24px; flex-wrap:wrap; gap:12px;
}
.period-selector {
  display:flex; border:1.5px solid var(--border); border-radius:var(--r-md); overflow:hidden;
}
.period-btn {
  padding:7px 14px; font-size:12.5px; font-weight:500;
  color:var(--text-secondary); background:none; border:none;
  cursor:pointer; transition:background .12s, color .12s;
  border-right:1px solid var(--border);
}
.period-btn:last-child { border-right:none; }
.period-btn:hover { background:var(--stone-100); color:var(--text-primary); }
.period-btn.active { background:var(--brand); color:#fff; font-weight:600; }

.quick-actions { display:grid; grid-template-columns:repeat(auto-fill, minmax(160px,1fr)); gap:10px; margin-bottom:24px; }
.quick-action-btn {
  display:flex; align-items:center; gap:10px;
  padding:14px 16px; background:var(--bg-card);
  border:1.5px solid var(--border); border-radius:var(--r-md);
  cursor:pointer; transition:border-color .15s, box-shadow .15s, transform .15s;
  text-align:left; font-size:13px; font-weight:600; color:var(--text-primary);
}
.quick-action-btn:hover { border-color:var(--brand); box-shadow:var(--shadow-sm); transform:translateY(-1px); }
.qa-icon { width:34px; height:34px; border-radius:var(--r-sm); display:flex; align-items:center; justify-content:center; flex-shrink:0; }

.dashboard-grid { display:grid; grid-template-columns:1fr 340px; gap:18px; }
@media(max-width:900px) { .dashboard-grid { grid-template-columns:1fr; } }
.activity-feed { display:flex; flex-direction:column; gap:0; }
.activity-item {
  display:flex; gap:12px; padding:12px 0;
  border-bottom:1px solid var(--stone-100);
}
.activity-item:last-child { border-bottom:none; }
.activity-dot { width:8px; height:8px; border-radius:50%; background:var(--brand); flex-shrink:0; margin-top:6px; }
.activity-text { font-size:13px; line-height:1.5; }
.activity-meta { font-size:11.5px; color:var(--text-muted); margin-top:2px; }

.alerts-list { display:flex; flex-direction:column; gap:8px; }
.alert-item {
  display:flex; align-items:flex-start; gap:10px;
  padding:12px 14px; border-radius:var(--r-md);
  font-size:13px;
}
.alert-warn { background:#fffbeb; border:1.5px solid #fde68a; }
.alert-error { background:#fef2f2; border:1.5px solid #fecaca; }
.alert-info  { background:#eff6ff; border:1.5px solid #bfdbfe; }

/* ── Modals ─────────────────────────────── */
.modal-overlay {
  position:fixed; inset:0; background:rgba(0,0,0,.5);
  z-index:500; backdrop-filter:blur(2px);
  animation:fadeInBg .2s ease;
}
@keyframes fadeInBg { from{opacity:0} to{opacity:1} }
.modal {
  position:fixed; top:50%; left:50%; transform:translate(-50%,-50%);
  background:var(--bg-card); border-radius:var(--r-xl);
  width:94%; max-width:520px; max-height:90vh;
  overflow:hidden; display:flex; flex-direction:column;
  z-index:600; box-shadow:var(--shadow-modal);
  animation:modalIn .25s ease;
}
.modal-lg { max-width:680px; }
@keyframes modalIn { from{opacity:0;transform:translate(-50%,-48%)} to{opacity:1;transform:translate(-50%,-50%)} }
.modal-header {
  display:flex; align-items:center; justify-content:space-between;
  padding:20px 24px 16px; border-bottom:1.5px solid var(--border);
  flex-shrink:0;
}
.modal-title { font-size:18px; font-weight:700; letter-spacing:-.3px; }
.modal-close {
  width:30px; height:30px; border-radius:var(--r-sm);
  display:flex; align-items:center; justify-content:center;
  font-size:16px; color:var(--text-muted); cursor:pointer;
  border:none; background:none; transition:background .12s;
}
.modal-close:hover { background:var(--stone-100); color:var(--text-primary); }
.modal-body { padding:20px 24px; overflow-y:auto; flex:1; }
.modal-footer {
  display:flex; align-items:center; justify-content:flex-end; gap:10px;
  padding:14px 24px; border-top:1.5px solid var(--border); flex-shrink:0;
}

/* ── Toast ──────────────────────────────── */
.toast-container { position:fixed; bottom:24px; right:24px; z-index:900; display:flex; flex-direction:column; gap:8px; }
.toast {
  display:flex; align-items:center; gap:10px;
  padding:12px 16px; border-radius:var(--r-md);
  font-size:13.5px; font-weight:500;
  box-shadow:var(--shadow-lg); min-width:260px; max-width:360px;
  animation:toastIn .25s ease;
  border:1.5px solid transparent;
}
@keyframes toastIn { from{opacity:0;transform:translateX(20px)} to{opacity:1;transform:translateX(0)} }
.toast-success { background:#dcfce7; border-color:#86efac; color:#14532d; }
.toast-error   { background:#fee2e2; border-color:#fca5a5; color:#7f1d1d; }
.toast-info    { background:#dbeafe; border-color:#93c5fd; color:#1e3a5f; }
.toast-icon    { flex-shrink:0; }

/* ── Filter bar ─────────────────────────── */
.filter-bar {
  display:flex; gap:8px; margin-bottom:16px; flex-wrap:wrap; align-items:center;
}
.filter-chip {
  padding:5px 13px; border-radius:20px;
  font-size:12.5px; font-weight:500;
  border:1.5px solid var(--border); background:var(--bg-card);
  cursor:pointer; color:var(--text-secondary); transition:all .12s;
}
.filter-chip:hover { border-color:var(--brand); color:var(--brand); }
.filter-chip.active { background:var(--brand); border-color:var(--brand); color:#fff; }

/* ── Detail view ────────────────────────── */
.detail-grid { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.detail-item label { font-size:11.5px; font-weight:700; color:var(--text-muted); text-transform:uppercase; letter-spacing:.4px; display:block; margin-bottom:3px; }
.detail-item span { font-size:14px; color:var(--text-primary); }

/* ── Finance chart area ─────────────────── */
.finance-summary-bar {
  display:grid; grid-template-columns:1fr 1fr 1fr; gap:14px; margin-bottom:24px;
}
.fin-bar-tile {
  background:var(--bg-card); border:1.5px solid var(--border);
  border-radius:var(--r-lg); padding:18px 20px;
}
.fin-bar-label { font-size:12px; font-weight:600; color:var(--text-muted); text-transform:uppercase; letter-spacing:.4px; margin-bottom:6px; }
.fin-bar-value { font-size:24px; font-weight:800; letter-spacing:-.6px; font-family:var(--font-mono); }
.fin-income  { color:var(--green-700); }
.fin-expense { color:var(--red-600); }
.fin-profit-pos { color:var(--green-700); }
.fin-profit-neg { color:var(--red-600); }

/* ── Settings page ──────────────────────── */
.settings-layout { display:grid; grid-template-columns:220px 1fr; gap:24px; }
.settings-nav-item {
  display:flex; align-items:center; gap:9px;
  padding:9px 12px; border-radius:var(--r-sm);
  font-size:13.5px; cursor:pointer; color:var(--text-secondary);
  border:none; background:none; text-align:left; width:100%;
  transition:background .12s, color .12s;
}
.settings-nav-item:hover { background:var(--stone-100); color:var(--text-primary); }
.settings-nav-item.active { background:var(--brand-light); color:var(--brand); font-weight:600; }
.settings-panel { display:none; }
.settings-panel.active { display:block; }
.settings-section { margin-bottom:32px; }
.settings-section-title { font-size:16px; font-weight:700; margin-bottom:14px; padding-bottom:8px; border-bottom:1.5px solid var(--border); }

/* ── Members table ──────────────────────── */
.member-row td:first-child { display:flex; align-items:center; gap:10px; }
.member-avatar {
  width:32px; height:32px; border-radius:50%;
  background:linear-gradient(135deg,var(--brand),#065f46);
  color:#fff; font-size:11px; font-weight:700;
  display:flex; align-items:center; justify-content:center;
  flex-shrink:0;
}

/* ── Loading states ─────────────────────── */
.skeleton {
  background:linear-gradient(90deg, var(--stone-100) 25%, var(--stone-50) 50%, var(--stone-100) 75%);
  background-size:200% 100%;
  animation:shimmer 1.5s infinite;
  border-radius:var(--r-sm);
}
@keyframes shimmer { 0%{background-position:200% 0} 100%{background-position:-200% 0} }
.loading-overlay {
  display:flex; align-items:center; justify-content:center;
  padding:48px; color:var(--text-muted);
}
.spinner {
  width:24px; height:24px;
  border:2.5px solid var(--border-dark);
  border-top-color:var(--brand);
  border-radius:50%; animation:spin .8s linear infinite;
}

/* ── Misc utilities ─────────────────────── */
.text-muted    { color:var(--text-muted); }
.text-danger   { color:var(--danger); }
.text-success  { color:var(--success); }
.text-mono     { font-family:var(--font-mono); }
.fw-700        { font-weight:700; }
.mt-12         { margin-top:12px; }
.mb-16         { margin-bottom:16px; }
.flex-center   { display:flex; align-items:center; justify-content:center; }
.flex-between  { display:flex; align-items:center; justify-content:space-between; }
.gap-8         { gap:8px; }
.gap-12        { gap:12px; }

@media(max-width:768px) {
  .topnav { padding:0 14px; }
  .main-nav { display:none; }
  .farms-grid { grid-template-columns:1fr; padding:16px 20px; }
  .page-header-simple { padding:20px 20px 0; }
  .sidebar { width:180px; }
  .section-container { padding:20px 18px; }
  .stats-grid { grid-template-columns:1fr 1fr; }
  .finance-summary-bar { grid-template-columns:1fr; }
  .form-row { grid-template-columns:1fr; }
}
