/* Agent portal (adminse/agent) — made for phones first */
body { background: #eef3ee; color: #13261a; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }

/* sign in */
.ag-login { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: radial-gradient(120% 90% at 50% 0%, #1f4a2c, #0b1a10); }
.ag-login-card { width: 100%; max-width: 400px; background: #fff; border-radius: 22px; padding: 26px 22px; box-shadow: 0 20px 50px -20px rgba(0, 0, 0, .6); }
.ag-login-logo { display: block; height: 70px; margin: 0 auto 10px; }
.ag-login h1 { font-size: 1.4rem; font-weight: 800; text-align: center; margin: 0; }
.ag-login-card > p { text-align: center; color: #5c6b60; font-size: .9rem; margin: 4px 0 18px; }
.ag-msg { background: #fde8e8; color: #9b1c1c; border-radius: 10px; padding: 8px 12px; font-size: .9rem; }
.ag-help { font-size: .8rem; color: #6b776f; text-align: center; margin: 14px 0 0; }

/* top bar */
.ag-top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: #13331e; color: #fff; }
.ag-top img { height: 28px; background: #fff; border-radius: 6px; padding: 2px 6px; }
.ag-who { flex: 1; display: grid; line-height: 1.15; min-width: 0; }
.ag-who b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ag-who small { opacity: .7; font-family: monospace; }

.ag-main { max-width: 900px; margin: 0 auto; padding: 16px; }
.ag-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.ag-bar label { font-weight: 600; font-size: .9rem; }
.ag-bar .form-select { width: auto; flex: 1; max-width: 200px; }

.ag-tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 16px; }
@media (min-width: 768px) { .ag-tiles { grid-template-columns: repeat(4, 1fr); } }
.ag-tiles > div { background: #fff; border-radius: 16px; padding: 12px 14px; display: grid; gap: 2px; box-shadow: 0 6px 16px -14px rgba(0, 0, 0, .5); }
.ag-tiles small { color: #5c6b60; font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .02em; }
.ag-tiles b { font-size: 1.15rem; }
.ag-tiles span { color: #6b776f; font-size: .78rem; }
.ag-tiles .in b { color: #b45309; }
.ag-tiles .comm { background: #e3f6d9; }

.ag-tabs { gap: 6px; margin-bottom: 12px; }
.ag-tabs .nav-link { border-radius: 999px; color: #13261a; background: #fff; font-weight: 600; }
.ag-tabs .nav-link.active { background: #2f7d3a; color: #fff; }

.ag-line { background: #fff; border-radius: 16px; padding: 10px 14px; margin-bottom: 10px; box-shadow: 0 6px 16px -14px rgba(0, 0, 0, .5); }
.ag-line.bf { background: #f5f7f4; }
.ag-date { font-weight: 700; padding: 2px 0 6px; border-bottom: 1px solid #e6ebe5; margin-bottom: 4px; }
.ag-kv { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; font-size: .92rem; }
.ag-kv span { color: #5c6b60; }
.ag-kv.bal { border-top: 1px dashed #dfe5de; margin-top: 4px; padding-top: 6px; }
.ag-empty { text-align: center; color: #6b776f; padding: 20px; }

.ag-table { background: #fff; border-radius: 16px; padding: 8px 12px; }
.ag-table tfoot th { border-top: 2px solid #2f7d3a; }
.ag-sum { display: grid; gap: 8px; margin-top: 12px; }
.ag-sum div { display: flex; justify-content: space-between; background: #fff; border-radius: 12px; padding: 10px 14px; }
.ag-sum div:last-child { background: #e3f6d9; }
.ag-foot { text-align: center; font-size: .8rem; color: #6b776f; margin-top: 20px; }
.ag-table .table { font-size: .85rem; }
.ag-table th, .ag-table td { padding-left: 4px; padding-right: 4px; white-space: nowrap; }

/* tabs under the top bar */
.ag-nav { display: flex; gap: 6px; padding: 8px 16px; background: #1b4428; position: sticky; top: 48px; z-index: 9; }
.ag-nav a { flex: 1; text-align: center; padding: 8px 10px; border-radius: 999px; color: #d6ead9; text-decoration: none; font-weight: 600; font-size: .9rem; }
.ag-nav a.on { background: #fff; color: #13331e; }
.ag-top img.ag-av { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; padding: 0; }

/* profile */
.ag-card { background: #fff; border-radius: 18px; padding: 16px; margin-bottom: 14px; box-shadow: 0 6px 16px -14px rgba(0, 0, 0, .5); }
.ag-card h2 { font-size: 1.05rem; font-weight: 800; margin: 0 0 12px; }
.ag-card h3 { font-size: .9rem; font-weight: 700; margin: 6px 0 0; color: #2f7d3a; }
.ag-me { display: flex; align-items: center; gap: 16px; }
.ag-me h1 { font-size: 1.2rem; font-weight: 800; margin: 0; }
.ag-me p { margin: 2px 0 0; color: #5c6b60; }
.ag-photo { position: relative; width: 84px; height: 84px; flex: none; cursor: pointer; margin: 0; }
.ag-photo img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; border: 3px solid #e3f6d9; background: #fff; }
.ag-photo span { position: absolute; right: -2px; bottom: -2px; width: 30px; height: 30px; border-radius: 50%; background: #2f7d3a; color: #fff; display: grid; place-items: center; border: 2px solid #fff; }
.ag-msg.ok { background: #e3f6d9; color: #1f5f2b; }

/* sidebar (slides in on phones, stays open on big screens) */
.ag-side { background: #13331e; color: #fff; --bs-offcanvas-width: 250px; }
.ag-side-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid rgba(255, 255, 255, .1); }
.ag-side-head img { height: 28px; background: #fff; border-radius: 6px; padding: 2px 6px; }
.ag-side-nav { display: grid; gap: 4px; padding: 12px 10px; }
.ag-side-nav a { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 12px; color: #d6ead9; text-decoration: none; font-weight: 600; }
.ag-side-nav a:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.ag-side-nav a.on { background: #fff; color: #13331e; }
.ag-side-nav a.out { margin-top: 10px; border-top: 1px solid rgba(255, 255, 255, .1); border-radius: 0 0 12px 12px; color: #f3c5c5; }
.ag-side-nav i { font-size: 1.15rem; }
@media (min-width: 992px) {
  .ag-body { padding-left: 250px; }
  .ag-side { position: fixed; top: 0; bottom: 0; left: 0; width: 250px; overflow-y: auto; z-index: 20; background: #13331e !important; }
}

/* buying pages */
.ag-h { font-size: 1rem; font-weight: 800; margin: 18px 0 10px; }
.ag-btns { display: flex; gap: 8px; flex-wrap: wrap; padding-top: 8px; }
.ag-btns .btn { flex: 1; }
.ag-find { flex: 1; min-width: 150px; }
.ag-tiles .spent { background: #fff7e6; }
.ag-tiles .spent b { color: #9a5b00; }
.ag-tiles > div:last-child:nth-child(odd) { grid-column: 1 / -1; }
@media (min-width: 768px) {
  .ag-tiles { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
  .ag-tiles > div:last-child:nth-child(odd) { grid-column: auto; }
}
.ag-card .form-control, .ag-card .form-select { min-height: 44px; }

/* ---------- top bar: bell + my account menu ---------- */
.ag-bell { position: relative; color: #fff; font-size: 1.25rem; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; text-decoration: none; }
.ag-bell:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.ag-bell b { position: absolute; top: 3px; right: 2px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 999px; background: #e0a526; color: #13261a; font-size: .65rem; display: grid; place-items: center; }
.ag-me-btn { display: flex; align-items: center; gap: 4px; background: transparent; border: 0; color: #fff; padding: 0; }
.ag-top .ag-av, .ag-me-btn .ag-av { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; padding: 0; background: #e3f6d9; color: #13331e; font-weight: 800; font-size: .85rem; display: grid; place-items: center; border: 2px solid rgba(255, 255, 255, .6); }
.ag-menu { min-width: 220px; border-radius: 14px; padding: 6px; border: 0; box-shadow: 0 16px 40px -16px rgba(0, 0, 0, .45); }
.ag-menu-head { padding: 8px 12px 10px; border-bottom: 1px solid #eef1ee; margin-bottom: 4px; display: grid; }
.ag-menu-head small { color: #6b776f; }
.ag-menu .dropdown-item { border-radius: 10px; padding: 9px 12px; display: flex; gap: 10px; align-items: center; font-weight: 600; }

/* sidebar: me, badges, locked link */
.ag-side-me { display: flex; align-items: center; gap: 10px; padding: 14px 16px 4px; }
.ag-side-me img, .ag-side-me > span { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; flex: none; background: #e3f6d9; color: #13331e; font-weight: 800; display: grid; place-items: center; }
.ag-side-me div { display: grid; min-width: 0; line-height: 1.2; }
.ag-side-me b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ag-side-me small { opacity: .7; font-size: .75rem; }
.ag-badge { margin-left: auto; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: #e0a526; color: #13261a; font-size: .72rem; display: grid; place-items: center; }
.ag-side-nav a.off { opacity: .45; cursor: not-allowed; }
.ag-side-nav a.off:hover { background: transparent; color: #d6ead9; }
.ag-side-nav a.lock { margin-top: 10px; border-top: 1px solid rgba(255, 255, 255, .1); border-radius: 0; }
.ag-side-nav a.lock + a.out { margin-top: 0; border-top: 0; }

/* ---------- home ---------- */
.hm-hero { background: linear-gradient(135deg, #13331e 0%, #2f7d3a 70%, #4b9a3f 100%); color: #fff; border-radius: 22px; padding: 18px; margin-bottom: 14px; position: relative; overflow: hidden; }
.hm-hero::after { content: ""; position: absolute; width: 220px; height: 220px; right: -70px; top: -80px; border-radius: 50%; background: rgba(255, 255, 255, .07); }
.hm-hi { display: flex; align-items: center; gap: 12px; position: relative; z-index: 1; }
.hm-hi img, .hm-hi > span { width: 54px; height: 54px; border-radius: 50%; object-fit: cover; border: 3px solid rgba(255, 255, 255, .35); background: #e3f6d9; color: #13331e; font-weight: 800; display: grid; place-items: center; flex: none; }
.hm-hi h1 { font-size: 1.2rem; font-weight: 800; margin: 0; }
.hm-hi p { margin: 0; opacity: .8; font-size: .85rem; }
.hm-price { position: relative; z-index: 1; margin-top: 14px; display: flex; align-items: center; gap: 12px; background: rgba(255, 255, 255, .12); border-radius: 16px; padding: 12px 14px; }
.hm-price i { font-size: 1.6rem; color: #f5d27a; }
.hm-price small { display: block; font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; opacity: .8; }
.hm-price b { font-size: 1.35rem; }
.hm-price em { font-style: normal; margin-left: auto; font-size: .75rem; opacity: .85; text-align: right; }
.hm-quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 14px; }
.hm-quick a { background: #fff; border-radius: 16px; padding: 12px 6px; text-align: center; text-decoration: none; color: #13261a; font-size: .75rem; font-weight: 700; box-shadow: 0 6px 16px -14px rgba(0, 0, 0, .5); position: relative; }
.hm-quick a i { display: grid; place-items: center; width: 40px; height: 40px; margin: 0 auto 6px; border-radius: 12px; background: #e3f6d9; color: #2f7d3a; font-size: 1.15rem; }
.hm-quick a.off { opacity: .5; pointer-events: none; }
.hm-quick a .ag-badge { position: absolute; top: 6px; right: 6px; }
.hm-cols { display: grid; gap: 14px; }
@media (min-width: 900px) { .hm-cols { grid-template-columns: 1.4fr 1fr; align-items: start; } }
.hm-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.hm-head h2 { font-size: 1rem; font-weight: 800; margin: 0; }
.hm-head a { font-size: .8rem; font-weight: 700; color: #2f7d3a; text-decoration: none; }
.hm-feed { list-style: none; margin: 0; padding: 0; }
.hm-feed li { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid #eef1ee; }
.hm-feed li:last-child { border-bottom: 0; }
.hm-ico { width: 38px; height: 38px; border-radius: 12px; flex: none; display: grid; place-items: center; font-size: 1rem; background: #e3f6d9; color: #2f7d3a; }
.hm-ico.k-stock { background: #e6efff; color: #1d4ed8; }
.hm-ico.k-buy { background: #fff7e6; color: #9a5b00; }
.hm-ico.k-msg { background: #f2e9ff; color: #6d28d9; }
.hm-ico.k-price { background: #fff1e6; color: #c2570c; }
.hm-feed .tx { min-width: 0; flex: 1; }
.hm-feed .tx b { display: block; font-size: .9rem; }
.hm-feed .tx span { display: block; font-size: .8rem; color: #5c6b60; overflow: hidden; text-overflow: ellipsis; }
.hm-feed .tm { font-size: .72rem; color: #6b776f; white-space: nowrap; }
.hm-top { list-style: none; margin: 0; padding: 0; counter-reset: t; }
.hm-top li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid #eef1ee; }
.hm-top li:last-child { border-bottom: 0; }
.hm-top li::before { counter-increment: t; content: counter(t); width: 24px; height: 24px; border-radius: 50%; background: #f3f7f2; display: grid; place-items: center; font-size: .75rem; font-weight: 800; color: #2f7d3a; flex: none; }
.hm-top .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; font-size: .9rem; }
.hm-top .kg { font-weight: 800; font-size: .85rem; }
.hm-bar { height: 8px; border-radius: 999px; background: #eef1ee; overflow: hidden; margin: 6px 0 2px; }
.hm-bar i { display: block; height: 100%; background: linear-gradient(90deg, #2f7d3a, #8cc63f); border-radius: 999px; }

/* ---------- my farmers ---------- */
.fm-tools { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; align-items: center; }
.fm-tools .form-select { width: auto; min-width: 120px; }
.fm-tools .ag-find { min-width: 180px; }
.fm-chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; margin-bottom: 12px; }
.fm-chips button { flex: none; border: 0; border-radius: 999px; padding: 7px 14px; background: #fff; color: #13261a; font-weight: 600; font-size: .85rem; box-shadow: 0 6px 16px -14px rgba(0, 0, 0, .5); }
.fm-chips button.on { background: #2f7d3a; color: #fff; }
.fm-card { background: #fff; border-radius: 20px; overflow: hidden; box-shadow: 0 6px 16px -14px rgba(0, 0, 0, .5); display: flex; flex-direction: column; }
.fm-band { height: 44px; background: linear-gradient(135deg, #13331e, #2f7d3a); position: relative; }
.fm-band small { position: absolute; right: 12px; top: 10px; font-size: .7rem; color: #fff; background: rgba(255, 255, 255, .16); padding: 3px 8px; border-radius: 999px; }
.fm-body { padding: 0 14px 14px; display: flex; flex-direction: column; gap: 10px; }
.fm-who { display: flex; align-items: flex-end; gap: 12px; margin-top: -26px; }
.fm-who .kf-av { width: 60px; height: 60px; border: 3px solid #fff; font-size: 1.1rem; }
.fm-who .kf-name { padding-bottom: 2px; }
.fm-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.fm-meta span { font-size: .75rem; background: #f3f7f2; color: #3b4a40; border-radius: 999px; padding: 4px 10px; }
.fm-share { font-size: .72rem; color: #6b776f; display: flex; justify-content: space-between; }
.fm-card .kf-acts .btn { padding: 8px 6px; font-size: .85rem; }
.fm-none { background: #fff7e6 !important; }

/* ---------- messages ---------- */
.ms-wrap { background: #fff; border-radius: 20px; box-shadow: 0 6px 16px -14px rgba(0, 0, 0, .5); display: flex; flex-direction: column; overflow: hidden; }
.ms-thread { padding: 14px; display: flex; flex-direction: column; gap: 10px; max-height: 60vh; min-height: 220px; overflow-y: auto; background: #f6f9f5; }
.ms-b { max-width: 82%; padding: 10px 12px; border-radius: 16px; font-size: .92rem; line-height: 1.35; word-wrap: break-word; }
.ms-tx { white-space: pre-wrap; }
.ms-b small { display: block; font-size: .68rem; opacity: .7; margin-top: 4px; }
.ms-b strong { display: block; font-size: .8rem; margin-bottom: 2px; }
.ms-me { align-self: flex-end; background: #2f7d3a; color: #fff; border-bottom-right-radius: 4px; }
.ms-them { align-self: flex-start; background: #fff; border: 1px solid #e3e9e2; border-bottom-left-radius: 4px; }
.ms-form { padding: 12px; border-top: 1px solid #eef1ee; display: grid; gap: 8px; }
.ms-form textarea { resize: none; }

/* ---------- notifications ---------- */
.nt-item { display: flex; gap: 12px; background: #fff; border-radius: 16px; padding: 12px 14px; margin-bottom: 8px; box-shadow: 0 6px 16px -14px rgba(0, 0, 0, .5); }
.nt-item.new { border-left: 4px solid #e0a526; }
.nt-item .tx { flex: 1; min-width: 0; }
.nt-item .tx b { display: block; }
.nt-item .tx p { margin: 2px 0 0; font-size: .88rem; color: #3b4a40; white-space: pre-wrap; }
.nt-item .tm { font-size: .72rem; color: #6b776f; white-space: nowrap; }

/* ---------- lock screen ---------- */
.lk-av { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; display: grid; place-items: center; margin: 0 auto 10px; background: #e3f6d9; color: #13331e; font-size: 1.8rem; font-weight: 800; border: 4px solid #e3f6d9; }

/* ---------- ID card ---------- */
.ic-wrap { display: flex; justify-content: center; overflow-x: auto; padding: 4px 0 10px; }
.ic-closed { text-align: center; background: #fff; border-radius: 20px; padding: 30px 18px; box-shadow: 0 6px 16px -14px rgba(0, 0, 0, .5); }
.ic-closed i { font-size: 2.6rem; color: #9aa79e; }
@media print {
  .ag-side, .ag-top, .ag-noprint { display: none !important; }
  .ag-body { padding: 0 !important; background: #fff; }
  .ag-main { padding: 0; max-width: none; }
}
.fm-body { position: relative; z-index: 1; }
.fm-who .kf-name { padding-top: 30px; }

/* ---------- my farmers table (DataTables) ---------- */
.ag-main.ag-wide { max-width: 1200px; }
.fm-chips a.btn { flex: none; border: 0; border-radius: 999px; padding: 8px 14px; background: #fff; color: #13261a; font-weight: 600; font-size: .85rem; box-shadow: 0 6px 16px -14px rgba(0, 0, 0, .5); }
.fm-chips a.btn.on { background: #2f7d3a; color: #fff; }
.ft-card { background: #fff; border-radius: 20px; padding: 14px; box-shadow: 0 6px 16px -14px rgba(0, 0, 0, .5); }
.ft-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; }
.ft-head h2 { font-size: 1rem; font-weight: 800; margin: 0; flex: 1; min-width: 160px; }
.ft-head .form-select { width: auto; min-width: 150px; border-radius: 999px; }
.ft-table { font-size: .88rem; }
.ft-table thead th { font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; color: #5c6b60; background: #f3f7f2 !important; border-bottom: 0; white-space: nowrap; }
.ft-table thead th:first-child { border-radius: 12px 0 0 12px; }
.ft-table thead th:last-child { border-radius: 0 12px 12px 0; }
.ft-table td { white-space: nowrap; border-color: #eef1ee; }
.ft-table tbody tr:hover td { background: #f8fbf7; }
.ft-table tfoot th { border-top: 2px solid #2f7d3a; border-bottom: 0; white-space: nowrap; }
.ft-table tr.ft-on td { background: #eef8e9; }
.ft-who { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.ft-who b { display: block; color: #13261a; }
.ft-who small { display: block; color: #6b776f; font-size: .75rem; }
.ft-av { width: 38px; height: 38px; border-radius: 50%; flex: none; overflow: hidden; background: #e3f6d9; color: #1f5f2b; font-weight: 800; font-size: .8rem; display: grid; place-items: center; }
.ft-av img { width: 38px; height: 38px; object-fit: cover; }
.kf-av img { width: 100%; height: 100%; object-fit: cover; }
.ft-paid { display: inline-block; background: #fff7e6; color: #9a5b00; font-weight: 700; border-radius: 999px; padding: 2px 10px; }
.ft-paid.none { background: #f3f4f3; color: #8a948d; }
.ft-type { display: inline-block; font-size: .75rem; font-weight: 700; border-radius: 999px; padding: 2px 10px; background: #e3f6d9; color: #1f5f2b; }
.ft-type.buy { background: #e6efff; color: #1d4ed8; }
/* DataTables 3 layout on phones: the table scrolls sideways, the controls stay full width */
.ft-card div.dt-container .dt-layout-row { margin: 6px 0; }
.ft-card div.dt-container .dt-layout-table > div { display: block !important; overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
.ft-card div.dt-container .row { --bs-gutter-x: 0; margin-left: 0; margin-right: 0; }
.ft-card div.dt-container .dt-length, .ft-card div.dt-container .dt-info { text-align: left; }
.ft-card div.dt-container .dt-search input { border-radius: 999px; min-width: 220px; margin-left: 0; }
.ft-card div.dt-container .dt-length select { border-radius: 999px; }
.ft-card div.dt-container .dt-paging .page-link { border-radius: 10px; margin: 0 2px; border: 0; color: #2f7d3a; }
.ft-card div.dt-container .dt-paging .active .page-link { background: #2f7d3a; color: #fff; }
@media (max-width: 767px) {
  .ft-card div.dt-container .dt-layout-row:not(.dt-layout-table) { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; }
  .ft-card div.dt-container .dt-layout-cell { padding: 0; }
  .ft-card div.dt-container .dt-search, .ft-card div.dt-container .dt-search input { width: 100%; min-width: 0; }
}
.ft-table th.dt-type-date, .ft-table td.dt-type-date { text-align: left; }
