/* AgroLogix R3B REV2 — single canonical shell and responsive screen system */
:root {
  --r3b-ink:#173249;
  --r3b-muted:#6b7f8c;
  --r3b-green:#087443;
  --r3b-green-dark:#075d39;
  --r3b-lime:#65b832;
  --r3b-soft:#f4f8f5;
  --r3b-line:#dfe9e3;
  --r3b-danger:#b64738;
  --r3b-warning:#b57616;
  --r3b-shadow:0 8px 24px rgba(36,74,54,.08);
}

body.auth-authenticated { background:#f3f7f4; }
body.auth-authenticated .app-shell { margin:14px; width:calc(100% - 28px); height:calc(100vh - 28px); min-height:680px; }
.sidebar { width:222px; padding:8px 11px 12px; }
.brand-block { height:72px; padding:0; }
.brand-logo { width:184px; max-height:68px; }
.main-nav { gap:1px; min-height:0; }
.nav-item { height:34px; padding:0 11px; gap:10px; border-radius:8px; font-size:12.5px; }
.nav-item img,.nav-symbol { width:23px; height:23px; flex:none; object-fit:contain; }
.nav-symbol { display:grid; place-items:center; color:var(--r3b-green); font-size:19px; font-weight:800; }
.sidebar-motto { padding-top:5px; }
.sidebar-motto img { width:49px; max-height:40px; }
.sidebar-motto p { font-size:7.5px; letter-spacing:1.25px; line-height:1.4; }
.sidebar-motto .motto-line { margin-top:5px; }
.workspace { margin-left:222px; }
.topbar { height:61px; padding:0 22px; }
.topbar-left { flex:1; min-width:0; gap:18px; }
.product-name { white-space:nowrap; }
.global-search-wrap { margin-left:8px; width:min(340px,38vw); height:36px; border:1px solid var(--r3b-line); border-radius:9px; display:flex; align-items:center; gap:8px; padding:0 12px; background:#f8fbf9; color:#6f8478; }
.global-search-wrap input { width:100%; min-width:0; border:0; outline:0; background:transparent; color:var(--r3b-ink); font:inherit; }
.global-search-results { position:fixed; z-index:90; width:340px; max-height:360px; overflow:auto; background:#fff; border:1px solid var(--r3b-line); border-radius:12px; box-shadow:0 18px 40px rgba(22,55,39,.18); padding:7px; }
.global-search-results button { width:100%; border:0; background:#fff; padding:10px 12px; border-radius:8px; display:flex; justify-content:space-between; gap:10px; text-align:left; color:var(--r3b-ink); }
.global-search-results button:hover,.global-search-results button:focus { background:#eef6f1; }
.global-search-results small { color:var(--r3b-muted); }
.admin-only[hidden] { display:none!important; }
.rancher-only[hidden] { display:none!important; }
.notification-button { cursor:pointer; }
.user-menu { display:none!important; }
.mobile-nav button.active { color:var(--r3b-green); background:#eef7f1; }

.r3b-view { padding:24px 26px 36px; overflow:auto; background:#f7faf8; }
.r3b-page { max-width:1480px; margin:0 auto; }
.r3b-page-header { display:flex; align-items:flex-start; justify-content:space-between; gap:22px; margin-bottom:20px; }
.r3b-eyebrow { margin:0 0 5px; color:var(--r3b-green); font-size:11px; font-weight:800; letter-spacing:.11em; text-transform:uppercase; }
.r3b-page-header h1 { margin:0; font-size:29px; color:var(--r3b-ink); letter-spacing:-.025em; }
.r3b-page-header p:not(.r3b-eyebrow) { margin:6px 0 0; color:var(--r3b-muted); font-size:14px; }
.r3b-header-actions { display:flex; flex-wrap:wrap; justify-content:flex-end; gap:9px; }
.r3b-primary,.r3b-secondary,.r3b-danger,.r3b-link-button { min-height:38px; border-radius:9px; padding:0 15px; font-weight:700; cursor:pointer; }
.r3b-primary { border:1px solid var(--r3b-green); background:var(--r3b-green); color:#fff; }
.r3b-primary:hover { background:var(--r3b-green-dark); }
.r3b-secondary { border:1px solid #bfd1c5; background:#fff; color:var(--r3b-green-dark); }
.r3b-danger { border:1px solid #e4bcb6; background:#fff6f4; color:var(--r3b-danger); }
.r3b-link-button { border:0; background:transparent; color:var(--r3b-green); padding:0 7px; }
.r3b-primary:disabled,.r3b-secondary:disabled,.r3b-danger:disabled { opacity:.48; cursor:not-allowed; }

.r3b-context { min-height:48px; display:flex; align-items:center; justify-content:space-between; gap:16px; padding:9px 13px; margin-bottom:17px; border:1px solid #d8e7dd; border-radius:11px; background:#fff; color:#486458; }
.r3b-context strong { color:var(--r3b-ink); }
.r3b-context button { border:0; background:#edf6f0; color:var(--r3b-green); border-radius:8px; padding:8px 11px; font-weight:700; }
.r3b-kpis { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:13px; margin-bottom:17px; }
.r3b-kpi { min-height:108px; border:1px solid var(--r3b-line); border-radius:13px; background:#fff; box-shadow:var(--r3b-shadow); padding:17px; display:flex; flex-direction:column; justify-content:center; }
.r3b-kpi span { color:var(--r3b-muted); font-size:12px; font-weight:700; }
.r3b-kpi strong { color:var(--r3b-ink); font-size:25px; margin-top:5px; }
.r3b-kpi small { color:#708579; margin-top:3px; }
.r3b-kpi.good { border-top:3px solid var(--r3b-green); }
.r3b-kpi.warn { border-top:3px solid #e0a22b; }
.r3b-kpi.info { border-top:3px solid #3d89ad; }
.r3b-kpi.lime { border-top:3px solid var(--r3b-lime); }

.r3b-grid { display:grid; grid-template-columns:repeat(12,minmax(0,1fr)); gap:16px; }
.r3b-card { grid-column:span 4; min-width:0; background:#fff; border:1px solid var(--r3b-line); border-radius:13px; box-shadow:var(--r3b-shadow); padding:18px; }
.r3b-card.span-6 { grid-column:span 6; }
.r3b-card.span-8 { grid-column:span 8; }
.r3b-card.span-12 { grid-column:1/-1; }
.r3b-card h2,.r3b-card h3 { margin:0; color:var(--r3b-ink); }
.r3b-card h2 { font-size:18px; }
.r3b-card h3 { font-size:15px; }
.r3b-card-copy { color:var(--r3b-muted); margin:6px 0 15px; font-size:13px; line-height:1.5; }
.r3b-card-head { display:flex; justify-content:space-between; align-items:center; gap:12px; margin-bottom:14px; }
.r3b-card-head a,.r3b-card-head button { color:var(--r3b-green); text-decoration:none; }
.r3b-settings-card { cursor:pointer; transition:transform .15s ease,border-color .15s ease; }
.r3b-settings-card:hover { transform:translateY(-2px); border-color:#9dc5ad; }
.r3b-settings-icon { width:42px;height:42px;border-radius:11px;display:grid;place-items:center;background:#eaf5ed;color:var(--r3b-green);font-size:21px;margin-bottom:13px; }

.r3b-table-wrap { overflow:auto; border:1px solid var(--r3b-line); border-radius:11px; }
.r3b-table { width:100%; border-collapse:collapse; font-size:12.5px; }
.r3b-table th { padding:11px 12px; background:#f1f6f3; color:#617569; text-align:left; font-size:10.5px; text-transform:uppercase; letter-spacing:.04em; white-space:nowrap; }
.r3b-table td { padding:12px; border-top:1px solid #e8efea; color:#2d4657; vertical-align:middle; }
.r3b-table tr:hover td { background:#fbfdfc; }
.r3b-table .r3b-row-actions { white-space:nowrap; text-align:right; }
.r3b-empty { min-height:170px; display:grid; place-items:center; text-align:center; color:var(--r3b-muted); padding:28px; }
.r3b-empty strong { display:block; color:var(--r3b-ink); margin-bottom:5px; }
.r3b-badge { display:inline-flex; align-items:center; min-height:25px; border-radius:999px; padding:3px 9px; background:#edf5ef; color:#247348; font-size:10.5px; font-weight:800; text-transform:uppercase; letter-spacing:.025em; }
.r3b-badge.warn { background:#fff4dc; color:#986511; }
.r3b-badge.danger { background:#fff0ed; color:#a74034; }
.r3b-badge.info { background:#eaf3f8; color:#32718e; }

.r3b-form { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px 16px; }
.r3b-form label { display:flex; flex-direction:column; gap:6px; color:#405c4e; font-size:12px; font-weight:700; }
.r3b-form label.span-2,.r3b-form .span-2 { grid-column:1/-1; }
.r3b-form input,.r3b-form select,.r3b-form textarea { width:100%; min-height:42px; border:1px solid #cfded4; border-radius:9px; background:#fff; padding:9px 11px; color:var(--r3b-ink); font:inherit; }
.r3b-form textarea { min-height:92px; resize:vertical; }
.r3b-form input:focus,.r3b-form select:focus,.r3b-form textarea:focus { outline:3px solid rgba(8,116,67,.12); border-color:var(--r3b-green); }
.r3b-form-actions { grid-column:1/-1; display:flex; justify-content:flex-end; gap:9px; padding-top:4px; }
.r3b-choice-list { display:grid; gap:8px; max-height:380px; overflow:auto; padding-right:3px; }
.r3b-choice { display:grid; grid-template-columns:auto 1fr auto; align-items:center; gap:11px; min-height:53px; padding:9px 11px; border:1px solid var(--r3b-line); border-radius:9px; }
.r3b-choice input { width:18px;height:18px;accent-color:var(--r3b-green); }
.r3b-choice strong,.r3b-choice small { display:block; }
.r3b-choice small { color:var(--r3b-muted); margin-top:2px; }
.r3b-summary-list { display:grid; gap:8px; margin:0; }
.r3b-summary-list div { display:flex; justify-content:space-between; gap:12px; padding:8px 0; border-bottom:1px solid #edf2ef; }
.r3b-summary-list dt { color:var(--r3b-muted); }
.r3b-summary-list dd { margin:0; color:var(--r3b-ink); font-weight:750; text-align:right; }
.r3b-callout { padding:13px 15px; border-radius:10px; background:#eef7f1; color:#2c6645; line-height:1.45; }
.r3b-callout.warn { background:#fff7e7; color:#805917; }
.r3b-callout.danger { background:#fff1ef; color:#913c32; }
.r3b-feedback { margin:13px 0 0; padding:11px 13px; border-radius:9px; background:#eef7f1; color:#286545; }
.r3b-feedback.error { background:#fff1ef; color:#963c31; }
.r3b-feedback:empty { display:none; }
.r3b-agreement-actions { display:flex; flex-wrap:wrap; gap:10px; margin-top:16px; }
.r3b-agreement-actions a { display:inline-flex; align-items:center; justify-content:center; text-decoration:none; }
.r3b-acceptance-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; margin-top:14px; }
.r3b-acceptance-grid article { border:1px solid var(--r3b-line); border-radius:9px; padding:11px; background:#f8fbf9; }
.r3b-acceptance-grid strong,.r3b-acceptance-grid span { display:block; }
.r3b-acceptance-grid span { margin-top:4px; color:var(--r3b-muted); font-size:12px; }

.r3b-tabs { display:flex; gap:5px; overflow:auto; margin-bottom:17px; padding:4px; border:1px solid var(--r3b-line); border-radius:11px; background:#fff; }
.r3b-tabs button { white-space:nowrap; border:0; border-radius:8px; background:transparent; padding:9px 12px; color:#617769; font-weight:700; cursor:pointer; }
.r3b-tabs button.active { background:#e8f3ec; color:var(--r3b-green); }
.r3b-progress { height:9px; border-radius:999px; overflow:hidden; background:#e8efe9; }
.r3b-progress i { display:block; height:100%; background:linear-gradient(90deg,var(--r3b-green),var(--r3b-lime)); }
.r3b-metric { display:flex; justify-content:space-between; gap:12px; margin:9px 0; font-size:13px; }
.r3b-metric strong { color:var(--r3b-ink); }

@media (max-width:1180px) {
  .product-name { display:none; }
  .global-search-wrap { width:min(330px,48vw); }
  .r3b-kpis { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .r3b-card,.r3b-card.span-6,.r3b-card.span-8 { grid-column:span 6; }
}

@media (max-width:820px) {
  body.auth-authenticated .app-shell { width:100%; height:100dvh; min-height:0; margin:0; }
  .workspace { margin-left:0; }
  .sidebar { width:min(300px,88vw); padding:9px 13px 16px; overflow:auto; }
  .brand-block { height:74px; }
  .nav-item { height:40px; font-size:13px; }
  .sidebar-motto { margin-top:15px; }
  .topbar { height:101px; }
  .global-search-wrap { display:none; }
  .r3b-view { padding:18px 14px 94px; }
  .r3b-page-header { align-items:flex-start; margin-bottom:15px; }
  .r3b-page-header h1 { font-size:24px; }
  .r3b-page-header p:not(.r3b-eyebrow) { font-size:13px; }
  .r3b-header-actions { width:auto; }
  .r3b-header-actions .r3b-secondary { display:none; }
  .r3b-kpis { gap:9px; }
  .r3b-kpi { min-height:91px; padding:13px; }
  .r3b-kpi strong { font-size:21px; }
  .r3b-grid { display:block; }
  .r3b-card { margin-bottom:12px; padding:15px; }
  .r3b-form { grid-template-columns:1fr; }
  .r3b-acceptance-grid { grid-template-columns:1fr; }
  .r3b-form label.span-2,.r3b-form .span-2,.r3b-form-actions { grid-column:auto; }
  .r3b-context { align-items:flex-start; }
  .r3b-context-copy { min-width:0; }
  .r3b-table-wrap { overflow:visible; border:0; }
  .r3b-table,.r3b-table tbody,.r3b-table tr,.r3b-table td { display:block; width:100%; }
  .r3b-table thead { display:none; }
  .r3b-table tr { margin-bottom:10px; padding:11px 13px; border:1px solid var(--r3b-line); border-radius:11px; background:#fff; box-shadow:0 4px 14px rgba(30,66,47,.05); }
  .r3b-table td { display:flex; justify-content:space-between; gap:14px; padding:6px 0; border:0; text-align:right; }
  .r3b-table td::before { content:attr(data-label); color:var(--r3b-muted); font-size:11px; font-weight:700; text-align:left; }
  .r3b-table .r3b-row-actions { justify-content:flex-end; border-top:1px solid #edf2ef; padding-top:10px; margin-top:5px; }
  .r3b-table .r3b-row-actions::before { content:""; }
  .r3b-tabs { margin-left:-2px; margin-right:-2px; }
}

@media (max-width:480px) {
  .r3b-page-header { display:block; }
  .r3b-header-actions { justify-content:flex-start; margin-top:12px; }
  .r3b-kpis { grid-template-columns:1fr 1fr; }
  .r3b-kpi { min-height:84px; }
  .r3b-kpi span { font-size:10.5px; }
  .r3b-kpi strong { font-size:19px; }
  .r3b-choice { grid-template-columns:auto 1fr; }
  .r3b-choice > :last-child { grid-column:2; }
}
