/* AgriStat Intelligence — INTALA LAB
   Professional scientific analytics theme (Bootstrap 5 base). */
:root {
  --as-sidebar-w: 264px;
  --as-ink: #14231e;
  --as-ink-2: #3c4b46;
  --as-muted: #6b7a75;
  --as-bg: #f3f5f4;
  --as-surface: #ffffff;
  --as-line: #e1e6e4;
  --as-brand: #1f6b46;
  --as-brand-2: #2f8f5f;
  --as-brand-soft: #e7f3ec;
  --as-accent: #c98a1a;
  --as-side-bg: #0f2620;
  --as-side-bg-2: #143229;
  --as-side-ink: #c7d6d0;
  --as-radius: .75rem;
  --as-shadow: 0 1px 2px rgba(16, 38, 32, .06), 0 4px 16px rgba(16, 38, 32, .05);
  --bs-primary: #1f6b46;
  --bs-primary-rgb: 31, 107, 70;
  --bs-link-color: #1f6b46;
  --bs-link-color-rgb: 31, 107, 70;
  --bs-link-hover-color: #154d32;
  --bs-body-font-family: "Segoe UI", "Inter", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

html, body { height: 100%; }
body { background: var(--as-bg); color: var(--as-ink); font-size: .935rem; }

.btn-primary { --bs-btn-bg: var(--as-brand); --bs-btn-border-color: var(--as-brand); --bs-btn-hover-bg: #185638; --bs-btn-hover-border-color: #185638; --bs-btn-active-bg: #134a2f; --bs-btn-disabled-bg: #6c9b83; --bs-btn-disabled-border-color: #6c9b83; }
.btn-outline-primary { --bs-btn-color: var(--as-brand); --bs-btn-border-color: var(--as-brand); --bs-btn-hover-bg: var(--as-brand); --bs-btn-hover-border-color: var(--as-brand); --bs-btn-active-bg: var(--as-brand); }
.text-primary { color: var(--as-brand) !important; }
.bg-primary-soft { background: var(--as-brand-soft) !important; }
.form-control:focus, .form-select:focus { border-color: #7fb89a; box-shadow: 0 0 0 .2rem rgba(31, 107, 70, .15); }
.form-check-input:checked { background-color: var(--as-brand); border-color: var(--as-brand); }

/* ---------- shell ---------- */
.as-app { display: flex; min-height: 100vh; }
.as-sidebar {
  width: var(--as-sidebar-w); flex: 0 0 var(--as-sidebar-w); background: linear-gradient(180deg, var(--as-side-bg), var(--as-side-bg-2));
  color: var(--as-side-ink); position: sticky; top: 0; height: 100vh; overflow-y: auto; z-index: 1030;
  display: flex; flex-direction: column;
}
.as-brand { display: flex; align-items: center; gap: .7rem; padding: 1.1rem 1.2rem 1rem; color: #fff; text-decoration: none; border-bottom: 1px solid rgba(255,255,255,.07); }
.as-brand:hover { color: #fff; }
.as-brand-mark { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: linear-gradient(135deg, #3aa56f, #1f6b46); box-shadow: inset 0 0 0 1px rgba(255,255,255,.15); font-size: 1.25rem; }
.as-brand-title { font-weight: 700; letter-spacing: .2px; line-height: 1.05; }
.as-brand-sub { font-size: .68rem; color: #8fb3a4; letter-spacing: .6px; text-transform: uppercase; }
.as-nav { padding: .6rem .6rem 1rem; flex: 1; }
.as-nav-group { font-size: .68rem; text-transform: uppercase; letter-spacing: .9px; color: #6f9586; padding: .9rem .75rem .35rem; }
.as-nav a { display: flex; align-items: center; gap: .7rem; color: var(--as-side-ink); text-decoration: none; padding: .52rem .75rem; border-radius: .55rem; margin: 1px 0; font-size: .9rem; }
.as-nav a i { font-size: 1.05rem; width: 1.2rem; text-align: center; opacity: .85; }
.as-nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.as-nav a.active { background: rgba(58,165,111,.18); color: #fff; box-shadow: inset 3px 0 0 #3aa56f; }
.as-sidebar-foot { padding: .9rem 1.2rem; font-size: .72rem; color: #6f9586; border-top: 1px solid rgba(255,255,255,.07); }

.as-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.as-topbar { position: sticky; top: 0; z-index: 1020; background: rgba(255,255,255,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--as-line); display: flex; align-items: center; gap: .75rem; padding: .6rem 1.4rem; min-height: 58px; }
.as-topbar .as-page-title { font-weight: 600; font-size: 1.02rem; margin: 0; }
.as-content { padding: 1.4rem; flex: 1; }
.as-footer { padding: .8rem 1.4rem; font-size: .78rem; color: var(--as-muted); border-top: 1px solid var(--as-line); background: #fafbfa; }

@media (max-width: 991.98px) {
  .as-sidebar { position: fixed; left: 0; transform: translateX(-100%); transition: transform .2s ease; }
  .as-sidebar.open { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.35); }
  .as-content { padding: 1rem; }
}

/* ---------- components ---------- */
.as-card { background: var(--as-surface); border: 1px solid var(--as-line); border-radius: var(--as-radius); box-shadow: var(--as-shadow); }
.as-card > .as-card-h { padding: .85rem 1.1rem; border-bottom: 1px solid var(--as-line); display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.as-card > .as-card-h h2, .as-card > .as-card-h h3 { font-size: .98rem; font-weight: 600; margin: 0; }
.as-card > .as-card-b { padding: 1.1rem; }
.as-card-h .as-card-tools { margin-left: auto; display: flex; gap: .35rem; align-items: center; }
.as-hero { background: radial-gradient(1200px 300px at 10% -40%, rgba(58,165,111,.35), transparent), linear-gradient(120deg, #123a2d, #1f6b46); color: #fff; border-radius: var(--as-radius); padding: 1.6rem 1.8rem; position: relative; overflow: hidden; }
.as-hero h1 { font-size: 1.55rem; font-weight: 700; }
.as-hero p { color: #d3e7dc; max-width: 760px; }
.as-hero .as-flow { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: 1rem; }
.as-hero .as-flow span { background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.18); border-radius: 999px; padding: .3rem .8rem; font-size: .82rem; }
.as-kpi { padding: 1rem 1.1rem; }
.as-kpi .as-kpi-l { font-size: .74rem; text-transform: uppercase; letter-spacing: .6px; color: var(--as-muted); }
.as-kpi .as-kpi-v { font-size: 1.55rem; font-weight: 700; line-height: 1.15; margin-top: .2rem; font-variant-numeric: tabular-nums; }
.as-kpi .as-kpi-s { font-size: .8rem; color: var(--as-muted); }
.as-kpi .as-kpi-i { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--as-brand-soft); color: var(--as-brand); font-size: 1.2rem; }
.as-chart { width: 100%; height: 380px; }
.as-chart.tall { height: 520px; }
.as-chart.short { height: 260px; }
.as-map { width: 100%; height: 560px; border-radius: .6rem; background: #f7faf8; border: 1px solid var(--as-line); }
.as-map.half { height: 440px; }
.leaflet-container { font-family: inherit; background: #f2f6f4; }
.as-legend { background: rgba(255,255,255,.95); padding: .55rem .7rem; border-radius: .5rem; box-shadow: var(--as-shadow); font-size: .78rem; line-height: 1.35; }
.as-legend .sw { display: inline-block; width: 16px; height: 12px; margin-right: .4rem; vertical-align: -1px; border: 1px solid rgba(0,0,0,.15); }
.as-legend .sw.na { background: repeating-linear-gradient(45deg, #e6e6e6, #e6e6e6 3px, #fff 3px, #fff 6px); }
.as-legend .lg-item { cursor: pointer; user-select: none; }
.as-legend .lg-item.off { opacity: .35; }
.as-badge-soft { background: var(--as-brand-soft); color: var(--as-brand); font-weight: 600; }
.as-pill { display: inline-flex; align-items: center; gap: .3rem; border-radius: 999px; padding: .15rem .6rem; font-size: .75rem; font-weight: 600; border: 1px solid var(--as-line); background: #fff; }
.as-muted { color: var(--as-muted); }
.as-num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.table-as { font-size: .86rem; }
.table-as thead th { font-size: .74rem; text-transform: uppercase; letter-spacing: .4px; color: var(--as-muted); background: #f7f9f8; border-bottom-width: 1px; white-space: nowrap; cursor: default; }
.table-as thead th.sortable { cursor: pointer; }
.table-as td, .table-as th { padding: .45rem .6rem; vertical-align: middle; }
.as-table-wrap { max-height: 520px; overflow: auto; border: 1px solid var(--as-line); border-radius: .5rem; }
.as-table-wrap thead th { position: sticky; top: 0; z-index: 1; }
.as-empty { text-align: center; padding: 2.6rem 1rem; color: var(--as-muted); }
.as-empty i { font-size: 2.2rem; display: block; margin-bottom: .6rem; color: #9fb5ab; }
.as-loading { position: relative; min-height: 120px; }
.as-loading::after { content: ""; position: absolute; inset: 0; background: rgba(255,255,255,.65) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='38' height='38' viewBox='0 0 38 38' stroke='%231f6b46'><g fill='none' fill-rule='evenodd'><g transform='translate(1 1)' stroke-width='3'><circle stroke-opacity='.2' cx='18' cy='18' r='18'/><path d='M36 18c0-9.94-8.06-18-18-18'><animateTransform attributeName='transform' type='rotate' from='0 18 18' to='360 18 18' dur='0.9s' repeatCount='indefinite'/></path></g></g></svg>") center/38px no-repeat; border-radius: inherit; z-index: 5; }
.as-checks .alert { padding: .5rem .8rem; margin-bottom: .45rem; font-size: .85rem; display: flex; gap: .55rem; align-items: flex-start; }
.as-checks .alert i { margin-top: .1rem; }
.as-stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .6rem; }
.as-stat { border: 1px solid var(--as-line); border-radius: .55rem; padding: .55rem .7rem; background: #fbfcfb; }
.as-stat .l { font-size: .74rem; color: var(--as-muted); }
.as-stat .v { font-weight: 650; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.as-method { font-size: .82rem; color: var(--as-ink-2); background: #f6f8f7; border-left: 3px solid var(--as-brand-2); padding: .6rem .8rem; border-radius: .35rem; }
.as-rec { border: 1px solid var(--as-line); border-radius: .6rem; padding: .7rem .85rem; display: flex; gap: .7rem; align-items: flex-start; background: #fff; height: 100%; }
.as-rec.off { background: #fafafa; opacity: .78; }
.as-rec .ic { width: 32px; height: 32px; flex: 0 0 32px; border-radius: 8px; display: grid; place-items: center; background: var(--as-brand-soft); color: var(--as-brand); }
.as-rec.off .ic { background: #eee; color: #888; }
.as-picker .form-label { font-size: .74rem; text-transform: uppercase; letter-spacing: .5px; color: var(--as-muted); margin-bottom: .2rem; }
.as-geo-list { max-height: 210px; overflow-y: auto; border: 1px solid var(--as-line); border-radius: .4rem; padding: .3rem .5rem; background: #fff; }
.as-grid-preview { font-size: .76rem; }
.as-grid-preview td, .as-grid-preview th { padding: .2rem .4rem; white-space: nowrap; max-width: 220px; overflow: hidden; text-overflow: ellipsis; border: 1px solid #edf0ef; }
.as-grid-preview td.hdr { background: #fff7e3; }
.as-grid-preview td.dim { background: #eaf4ee; }
.as-grid-preview td.val { background: #f5f8ff; }
.as-step { display: flex; gap: .4rem; flex-wrap: wrap; font-size: .8rem; }
.as-step span { padding: .25rem .65rem; border-radius: 999px; background: #eef2f0; color: var(--as-muted); }
.as-step span.on { background: var(--as-brand); color: #fff; }
.as-step span.done { background: var(--as-brand-soft); color: var(--as-brand); }
.as-section-list .list-group-item { display: flex; align-items: center; gap: .6rem; }
.as-section-list .handle { cursor: grab; color: var(--as-muted); }
.as-section-list .list-group-item.dragging { opacity: .5; }
.as-dropzone { border: 2px dashed #b9cbc2; border-radius: var(--as-radius); padding: 2rem; text-align: center; background: #fbfdfc; transition: background .15s; }
.as-dropzone.over { background: var(--as-brand-soft); border-color: var(--as-brand-2); }
.as-version-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--as-brand-2); display: inline-block; }
.nav-tabs .nav-link { color: var(--as-ink-2); }
.nav-tabs .nav-link.active { color: var(--as-brand); font-weight: 600; }
.as-toast-wrap { position: fixed; right: 1rem; bottom: 1rem; z-index: 2000; }
code.as-code { font-size: .78rem; background: #f1f4f3; padding: .1rem .35rem; border-radius: .25rem; color: #2b3a35; }
.as-doc h2 { font-size: 1.15rem; margin-top: 1.6rem; }
.as-doc h3 { font-size: 1rem; margin-top: 1.1rem; }
.as-doc p, .as-doc li { line-height: 1.6; }
@media print { .as-sidebar, .as-topbar, .as-footer, .no-print { display: none !important; } .as-content { padding: 0; } }
