/* ============================================================
   STANLEY ULTRA MODERN FARM — App Stylesheet
   Design system: #1B4D0F · #8CC63F (from mobile UI mockup)
   ============================================================ */

/* ── Google Font ─────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

:root {
  /* Primary greens */
  --primary:        #1B4D0F;
  --primary-mid:    #2E7D1A;
  --primary-light:  #5BA83A;
  --primary-pale:   #EDF5E4;

  /* Accent lime */
  --accent:         #8CC63F;
  --accent-bg:      rgba(140,198,63,0.12);
  --accent-border:  rgba(140,198,63,0.25);

  /* Amber / gold (wholesale) */
  --amber:          #BA7517;
  --amber-bg:       #FFF3DC;
  --amber-mid:      #FFF8EC;

  /* Semantic */
  --danger:         #E53935;
  --danger-bg:      #FFEDED;
  --blue:           #1565C0;
  --blue-bg:        #E8F0FE;
  --teal:           #00796B;
  --teal-bg:        #E0F2F1;

  /* Backgrounds */
  --bg:             #FAFAF5;
  --bg-card:        #ffffff;
  --bg-section:     #F5F2EE;
  --bg-input:       #F7F7F7;

  /* Borders */
  --border:         #F0EDE8;
  --border-mid:     #E8E4DC;
  --border-strong:  #D8D4CC;

  /* Text */
  --text:           #111111;
  --text-muted:     #888888;
  --text-faint:     #bbbbbb;

  /* Sidebar */
  --sidebar-bg:     #1B4D0F;
  --sidebar-mid:    #2E7D1A;
  --sidebar-hover:  rgba(140,198,63,0.12);
  --sidebar-active: rgba(140,198,63,0.18);

  /* Misc */
  --shadow-sm:   0 1px 4px rgba(27,77,15,0.08);
  --shadow:      0 2px 12px rgba(27,77,15,0.10);
  --shadow-lg:   0 8px 32px rgba(27,77,15,0.14);
  --radius-sm:   8px;
  --radius:      12px;
  --radius-lg:   16px;
  --radius-xl:   20px;
  --sidebar-w:   256px;
}

/* ── Reset ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', Arial, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 13.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }

/* ── LAYOUT ──────────────────────────────────────────────── */
.app-wrapper { display: flex; min-height: 100vh; }

/* ── SIDEBAR ─────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  overflow-y: auto;
  z-index: 100;
  transition: transform 0.3s ease;
  scrollbar-width: thin;
  scrollbar-color: rgba(140,198,63,0.2) transparent;
}

/* decorative top gradient stripe */
.sidebar::before {
  content: '';
  display: block;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), #C8E6A8, var(--accent));
  flex-shrink: 0;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 18px 16px 16px;
  border-bottom: 1px solid rgba(140,198,63,0.12);
}
.brand-icon {
  width: 40px; height: 40px;
  border-radius: 11px;
  background: rgba(140,198,63,0.15);
  border: 1px solid rgba(140,198,63,0.3);
  display: flex; align-items: center; justify-content: center;
  color: var(--accent); font-size: 18px;
  flex-shrink: 0;
}
.brand-name  { display: block; color: #fff; font-weight: 800; font-size: 14px; line-height: 1.2; }
.brand-sub   { display: block; color: rgba(140,198,63,0.6); font-size: 10px; letter-spacing: 0.5px; }

.sidebar-nav { padding: 10px 0 24px; }

.nav-section {
  padding: 14px 16px 4px;
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: rgba(140,198,63,0.45);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  color: rgba(255,255,255,0.65);
  border-radius: 0;
  transition: all 0.18s ease;
  font-size: 13px;
  font-weight: 500;
  position: relative;
}
.nav-item i { width: 17px; text-align: center; font-size: 13.5px; flex-shrink: 0; }
.nav-item:hover {
  background: var(--sidebar-hover);
  color: var(--accent);
}
.nav-item.active {
  background: var(--sidebar-active);
  color: var(--accent);
  font-weight: 700;
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}

/* ── MAIN CONTENT ────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* ── TOPBAR ──────────────────────────────────────────────── */
.topbar {
  background: var(--bg-card);
  border-bottom: 1.5px solid var(--border);
  padding: 0 22px;
  height: 58px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 90;
  box-shadow: var(--shadow-sm);
}
.sidebar-toggle {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: 18px;
  padding: 6px; border-radius: 8px;
  transition: background 0.15s;
}
.sidebar-toggle:hover { background: var(--bg); color: var(--primary); }
.topbar-title { font-weight: 800; font-size: 15px; flex: 1; color: var(--text); }
.topbar-right { display: flex; align-items: center; gap: 6px; }

/* Notification button */
.notif-wrapper, .user-menu-wrapper { position: relative; }
.notif-btn {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: 16px;
  padding: 8px; border-radius: 9px; position: relative;
  transition: background 0.15s;
}
.notif-btn:hover { background: var(--primary-pale); color: var(--primary); }
.badge {
  position: absolute; top: 3px; right: 3px;
  background: var(--danger);
  color: #fff; font-size: 9.5px;
  width: 16px; height: 16px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
}

/* Dropdowns */
.notif-dropdown, .user-dropdown {
  position: absolute; right: 0; top: calc(100% + 8px);
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  min-width: 290px;
  display: none; z-index: 200;
  overflow: hidden;
}
.notif-dropdown.open, .user-dropdown.open { display: block; }

.notif-header {
  padding: 12px 16px;
  font-weight: 800; font-size: 13px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.notif-item {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  border-left: 3px solid transparent;
}
.notif-item.notif-info    { border-left-color: var(--blue); }
.notif-item.notif-warning { border-left-color: var(--amber); }
.notif-item.notif-alert   { border-left-color: var(--danger); }
.notif-item.notif-success { border-left-color: var(--accent); }
.notif-title { font-weight: 700; font-size: 12.5px; color: var(--text); }
.notif-msg   { color: var(--text-muted); font-size: 11.5px; margin-top: 2px; }
.notif-time  { color: var(--text-faint); font-size: 10.5px; margin-top: 3px; }
.notif-empty { padding: 20px 16px; text-align: center; color: var(--text-muted); font-size: 12.5px; }
.notif-viewall {
  display: block; text-align: center;
  padding: 10px; color: var(--primary);
  font-size: 12.5px; font-weight: 700;
  border-top: 1px solid var(--border);
}
.notif-viewall:hover { background: var(--primary-pale); }

/* User menu button */
.user-menu-btn {
  background: none; border: none; cursor: pointer;
  display: flex; align-items: center; gap: 8px;
  padding: 5px 10px 5px 5px;
  border-radius: 30px;
  border: 1.5px solid var(--border);
  transition: border-color 0.15s;
}
.user-menu-btn:hover { border-color: var(--accent); background: var(--primary-pale); }
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--primary);
  border: 2px solid var(--accent);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 13px;
}
.user-name { display: block; font-weight: 700; font-size: 12.5px; text-align: left; color: var(--text); }
.user-role { display: block; color: var(--text-muted); font-size: 10.5px; }

.user-dropdown { min-width: 180px; }
.user-dropdown a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px;
  color: var(--text); font-size: 13px; font-weight: 500;
  transition: background 0.15s;
}
.user-dropdown a:hover { background: var(--primary-pale); color: var(--primary); }
.user-dropdown a i { width: 15px; }

/* ── PAGE CONTENT ────────────────────────────────────────── */
.page-content { padding: 22px 24px 40px; flex: 1; }

/* ── PAGE HEADER ─────────────────────────────────────────── */
.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 22px; gap: 16px;
}
.page-header h1 { font-size: 21px; font-weight: 800; color: var(--text); }
.page-header .subtitle { color: var(--text-muted); font-size: 12.5px; margin-top: 3px; }
.page-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* ── STATS CARDS ─────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}
.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  border: 1.5px solid var(--border);
  display: flex;
  align-items: center;
  gap: 14px;
  transition: box-shadow 0.2s, border-color 0.2s;
}
.stat-card:hover { box-shadow: var(--shadow); border-color: var(--border-mid); }
.stat-icon {
  width: 48px; height: 48px;
  border-radius: 13px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.stat-icon.green  { background: var(--primary-pale); color: var(--primary); }
.stat-icon.lime   { background: rgba(140,198,63,0.15); color: var(--primary-light); }
.stat-icon.amber  { background: var(--amber-bg); color: var(--amber); }
.stat-icon.blue   { background: var(--blue-bg); color: var(--blue); }
.stat-icon.red    { background: var(--danger-bg); color: var(--danger); }
.stat-icon.purple { background: #F3E5F5; color: #6A1B9A; }
.stat-icon.teal   { background: var(--teal-bg); color: var(--teal); }

.stat-value { font-size: 22px; font-weight: 900; line-height: 1.1; color: var(--text); }
.stat-label { color: var(--text-muted); font-size: 11.5px; margin-top: 3px; font-weight: 500; }
.stat-change { font-size: 11px; margin-top: 4px; font-weight: 600; }
.stat-change.up   { color: var(--primary-light); }
.stat-change.down { color: var(--danger); }

/* ── CARDS ───────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1.5px solid var(--border);
  box-shadow: var(--shadow-sm);
  margin-bottom: 18px;
  overflow: hidden;
}
.card:hover { box-shadow: var(--shadow); }
.card-header {
  padding: 14px 18px;
  border-bottom: 1.5px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  background: var(--bg-card);
}
.card-title { font-weight: 800; font-size: 14px; color: var(--text); }
.card-body  { padding: 18px; }

/* ── TABLES ──────────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  background: var(--bg);
  padding: 10px 14px;
  text-align: left;
  font-weight: 700;
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--bg); }

/* ── FORMS ───────────────────────────────────────────────── */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label { font-weight: 700; font-size: 12.5px; color: var(--text); }

.form-group input,
.form-group select,
.form-group textarea {
  padding: 9px 12px;
  border: 1.5px solid var(--border-mid);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  background: var(--bg-input);
  color: var(--text);
  transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--bg-card);
  box-shadow: 0 0 0 3px rgba(27,77,15,0.08);
}
.form-group textarea { resize: vertical; min-height: 80px; }

/* ── BUTTONS ─────────────────────────────────────────────── */
.btn {
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  font-family: inherit;
  display: inline-flex; align-items: center; gap: 6px;
  transition: all 0.18s;
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover { background: var(--primary-mid); box-shadow: 0 4px 12px rgba(27,77,15,0.25); }

.btn-accent {
  background: var(--accent);
  color: #fff;
}
.btn-accent:hover { background: #7ab535; }

.btn-amber {
  background: var(--amber);
  color: #fff;
}
.btn-amber:hover { background: #9d6213; }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #c62828; }

.btn-success { background: var(--primary-mid); color: #fff; }
.btn-success:hover { background: var(--primary); }

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--border-mid);
  color: var(--text);
}
.btn-outline:hover {
  background: var(--primary-pale);
  border-color: var(--primary);
  color: var(--primary);
}

.btn-sm  { padding: 5px 12px; font-size: 11.5px; border-radius: 7px; }
.btn-lg  { padding: 12px 24px; font-size: 14.5px; border-radius: 11px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ── BADGES / STATUS PILLS ───────────────────────────────── */
.badge-status {
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  display: inline-block;
}
.badge-green  { background: var(--primary-pale); color: var(--primary); }
.badge-lime   { background: rgba(140,198,63,0.15); color: var(--primary-light); }
.badge-red    { background: var(--danger-bg); color: var(--danger); }
.badge-amber  { background: var(--amber-bg); color: var(--amber); }
.badge-blue   { background: var(--blue-bg); color: var(--blue); }
.badge-grey   { background: var(--bg-section); color: var(--text-muted); }
.badge-purple { background: #F3E5F5; color: #6A1B9A; }
.badge-teal   { background: var(--teal-bg); color: var(--teal); }

/* ── ALERTS ──────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 13px;
  display: flex; align-items: flex-start; gap: 10px;
  border-left: 4px solid transparent;
}
.alert i { margin-top: 1px; flex-shrink: 0; }
.alert-danger  { background: var(--danger-bg);    color: #B71C1C; border-left-color: var(--danger); }
.alert-success { background: var(--primary-pale); color: var(--primary); border-left-color: var(--accent); }
.alert-warning { background: var(--amber-bg);     color: var(--amber);  border-left-color: var(--amber); }
.alert-info    { background: var(--blue-bg);      color: var(--blue);   border-left-color: var(--blue); }

/* ── FILTER BAR ──────────────────────────────────────────── */
.filter-bar {
  display: flex; flex-wrap: wrap; gap: 8px;
  background: var(--bg-card);
  padding: 12px 14px;
  border-radius: var(--radius-lg);
  border: 1.5px solid var(--border);
  margin-bottom: 16px;
  align-items: center;
}
.filter-bar input,
.filter-bar select {
  padding: 8px 12px;
  border: 1.5px solid var(--border-mid);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  background: var(--bg-input);
  color: var(--text);
  transition: border-color 0.18s;
}
.filter-bar input:focus,
.filter-bar select:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--bg-card);
}

/* ── MODAL ───────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(27,77,15,0.35);
  z-index: 1000;
  align-items: center; justify-content: center;
  backdrop-filter: blur(2px);
}
.modal-overlay.open { display: flex; }

.modal {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  box-shadow: 0 24px 64px rgba(27,77,15,0.2);
  width: 90%; max-width: 560px;
  max-height: 92vh; overflow-y: auto;
  border: 1.5px solid var(--border);
}
.modal-lg { max-width: 800px; }

.modal-header {
  padding: 18px 20px 16px;
  border-bottom: 1.5px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  font-weight: 800; font-size: 15px;
  background: var(--bg-card);
  position: sticky; top: 0; z-index: 10;
}
.modal-close {
  background: var(--bg-section);
  border: none; cursor: pointer;
  color: var(--text-muted); font-size: 18px;
  width: 30px; height: 30px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.modal-close:hover { background: var(--danger-bg); color: var(--danger); }
.modal-body   { padding: 20px; }
.modal-footer {
  padding: 14px 20px;
  border-top: 1.5px solid var(--border);
  display: flex; justify-content: flex-end; gap: 8px;
  background: var(--bg);
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

/* ── TOAST ───────────────────────────────────────────────── */
#toast-container {
  position: fixed; bottom: 20px; right: 20px;
  z-index: 9999;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  padding: 11px 18px;
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 13px; font-weight: 700;
  box-shadow: 0 4px 20px rgba(0,0,0,0.18);
  display: flex; align-items: center; gap: 8px;
  min-width: 240px;
  animation: toastIn 0.3s ease;
}
.toast.success { background: var(--primary); border-left: 4px solid var(--accent); }
.toast.error   { background: var(--danger); }
.toast.info    { background: var(--blue); }
.toast.warning { background: var(--amber); }
@keyframes toastIn {
  from { transform: translateX(110%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* ── PRODUCT GRID (POS) ──────────────────────────────────── */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}
.product-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1.5px solid var(--border);
  padding: 14px 12px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}
.product-card:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 14px rgba(140,198,63,0.2);
  transform: translateY(-2px);
}
.product-card.out-of-stock { opacity: 0.45; cursor: not-allowed; }
.product-card-icon  { font-size: 28px; margin-bottom: 7px; }
.product-card-name  { font-weight: 800; font-size: 12.5px; color: var(--text); }
.product-card-var   { color: var(--text-muted); font-size: 10.5px; margin-top: 2px; }
.product-card-price { color: var(--primary); font-weight: 900; font-size: 13.5px; margin-top: 6px; }
.product-card-stock { font-size: 10.5px; color: var(--text-muted); margin-top: 2px; }
.product-card-stock.low { color: var(--amber); font-weight: 700; }

/* ── CART ITEMS (POS) ────────────────────────────────────── */
.cart-item {
  display: flex; align-items: center; gap: 8px;
  padding: 9px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  margin-bottom: 6px;
  background: var(--bg-card);
  transition: border-color 0.15s;
}
.cart-item:hover { border-color: var(--accent); }
.cart-item-qty { display: flex; align-items: center; gap: 5px; }
.qty-btn {
  width: 24px; height: 24px;
  border-radius: 6px;
  border: 1.5px solid var(--border-mid);
  background: var(--bg);
  cursor: pointer;
  font-weight: 800; font-size: 15px;
  color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.qty-btn:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.cart-item-price { font-weight: 800; color: var(--primary); font-size: 12.5px; }

/* ── EMPTY STATE ─────────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state i { font-size: 44px; margin-bottom: 12px; opacity: 0.2; display: block; color: var(--primary); }
.empty-state h3 { font-size: 15px; margin-bottom: 6px; color: var(--text); }
.empty-state p  { font-size: 13px; }

/* ── LAYOUT GRIDS ────────────────────────────────────────── */
.two-col   { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.three-col { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 18px; }

/* ── SECTION LABEL (mobile-app style) ───────────────────── */
.section-label {
  display: inline-block;
  background: var(--accent-bg);
  border: 1px solid var(--accent-border);
  border-radius: 20px;
  padding: 3px 12px;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 6px;
}

/* ── 403 PAGE ────────────────────────────────────────────── */
.page-403 {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
}

/* ── PORTAL (ROLE SELECTION) ─────────────────────────────── */
.portal-page {
  min-height: 100vh;
  background: linear-gradient(160deg, #061408 0%, #0e2a0a 50%, #061408 100%);
  padding: 40px 20px;
  display: flex; flex-direction: column; align-items: center;
}
.portal-header { text-align: center; margin-bottom: 44px; }
.portal-header .farm-logo {
  width: 68px; height: 68px;
  background: rgba(140,198,63,0.12);
  border: 1.5px solid rgba(140,198,63,0.3);
  border-radius: 20px;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; margin: 0 auto 16px;
}
.portal-header h1 { color: #fff; font-size: 26px; font-weight: 800; margin-bottom: 6px; }
.portal-header p  { color: rgba(255,255,255,0.45); font-size: 13.5px; }

.portal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
  gap: 14px; width: 100%; max-width: 980px;
}
.portal-card {
  background: rgba(255,255,255,0.06);
  border: 1.5px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-xl);
  padding: 24px 20px;
  cursor: pointer;
  text-decoration: none;
  display: flex; flex-direction: column; gap: 10px;
  transition: all 0.22s ease;
  position: relative; overflow: hidden;
}
.portal-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--card-accent, rgba(140,198,63,0.5));
}
.portal-card:hover {
  background: rgba(255,255,255,0.12);
  border-color: rgba(140,198,63,0.3);
  transform: translateY(-3px);
  box-shadow: 0 16px 40px rgba(0,0,0,0.35);
}
.portal-card-icon {
  width: 50px; height: 50px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  background: rgba(255,255,255,0.1);
}
.portal-card-role { color: #fff; font-weight: 800; font-size: 14.5px; }
.portal-card-desc { color: rgba(255,255,255,0.5); font-size: 12px; line-height: 1.5; }
.portal-card-arrow { color: rgba(255,255,255,0.3); font-size: 12.5px; display: flex; align-items: center; gap: 4px; margin-top: auto; transition: gap 0.2s, color 0.2s; }
.portal-card:hover .portal-card-arrow { color: var(--accent); gap: 8px; }

/* ── ROLE LOGIN PAGE ─────────────────────────────────────── */
.role-login-page { min-height: 100vh; display: flex; align-items: stretch; }
.role-login-left {
  flex: 1;
  display: flex; flex-direction: column; justify-content: center;
  padding: 48px;
  color: #fff; position: relative; overflow: hidden;
}
.role-login-left::before {
  content: '';
  position: absolute; top: -60px; right: -60px;
  width: 220px; height: 220px;
  border-radius: 50%;
  background: rgba(140,198,63,0.08);
}
.role-login-left::after {
  content: '';
  position: absolute; bottom: -80px; left: -40px;
  width: 300px; height: 300px;
  border-radius: 50%;
  background: rgba(140,198,63,0.05);
}
.role-login-left .big-icon { font-size: 52px; margin-bottom: 22px; position: relative; z-index: 1; }
.role-login-left h1 { font-size: 28px; font-weight: 900; margin-bottom: 10px; position: relative; z-index: 1; }
.role-login-left p  { font-size: 14px; opacity: 0.7; line-height: 1.7; max-width: 340px; position: relative; z-index: 1; }
.role-login-left .role-perms { margin-top: 26px; display: flex; flex-direction: column; gap: 9px; position: relative; z-index: 1; }
.role-login-left .perm-item  { display: flex; align-items: center; gap: 10px; font-size: 13px; opacity: 0.8; }
.role-login-left .perm-item i { width: 15px; }
.role-login-left .farm-footer { position: absolute; bottom: 24px; left: 48px; font-size: 10px; opacity: 0.25; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; }

.role-login-right {
  width: 420px;
  background: var(--bg-card);
  display: flex; flex-direction: column; justify-content: center;
  padding: 48px 40px;
  border-left: 1px solid rgba(0,0,0,0.06);
}
.role-login-right .back-link {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--text-muted); font-size: 12.5px; font-weight: 600;
  margin-bottom: 32px;
  transition: color 0.15s;
}
.role-login-right .back-link:hover { color: var(--primary); }
.role-login-right h2 { font-size: 21px; font-weight: 900; margin-bottom: 4px; }
.role-login-right .subtitle { color: var(--text-muted); font-size: 12.5px; margin-bottom: 24px; }

/* ── LEGACY .login-page (redirect pages) ─────────────────── */
.login-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #061408 0%, #0e2a0a 50%, #061408 100%);
}
.login-box {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: 40px;
  width: 100%; max-width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  border: 1.5px solid var(--border);
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo .icon { font-size: 40px; color: var(--accent); margin-bottom: 10px; }
.login-logo h1 { font-size: 19px; font-weight: 800; }
.login-logo p  { color: var(--text-muted); font-size: 12.5px; }

/* ── RESPONSIVE ──────────────────────────────────────────── */
@media (max-width: 900px) {
  :root { --sidebar-w: 0px; }
  .sidebar { transform: translateX(-100%); width: 256px; }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .two-col, .three-col { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .role-login-left { display: none; }
  .role-login-right { width: 100%; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .portal-grid { grid-template-columns: repeat(2, 1fr); }
  .page-content { padding: 14px 14px 32px; }
}

/* ── UTILITY ─────────────────────────────────────────────── */
.text-primary { color: var(--primary) !important; }
.text-accent  { color: var(--accent)  !important; }
.text-amber   { color: var(--amber)   !important; }
.text-danger  { color: var(--danger)  !important; }
.text-muted   { color: var(--text-muted) !important; }
.fw-900 { font-weight: 900 !important; }
.fw-800 { font-weight: 800 !important; }
.fw-700 { font-weight: 700 !important; }
