/* =========================================================
   AGRIVISION — design tokens
   Field green + corn gold + paddy leaf, on a pale mist ground
   ========================================================= */
:root {
  --forest: #12402a;
  --forest-deep: #0b2b1c;
  --leaf: #2f7d4a;
  --paddy: #5fa84b;
  --corn: #f0b429;
  --corn-deep: #c98d0b;
  --corn-soft: #fdf1c9;
  --paddy-soft: #e3f2dc;
  --ink: #17251c;
  --muted: #667a6d;
  --mist: #eff4ec;
  --paper: #ffffff;
  --line: #dbe5d7;
  --water: #2f73b8;
  --danger: #d64545;
  --warn: #e59a1b;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(18, 64, 42, .06), 0 8px 24px -12px rgba(18, 64, 42, .18);
  --shadow-lift: 0 2px 4px rgba(18, 64, 42, .08), 0 18px 36px -14px rgba(18, 64, 42, .28);
  --ease: cubic-bezier(.22, .8, .24, 1);
  --sidebar: 268px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Figtree', system-ui, sans-serif;
  color: var(--ink);
  background: var(--mist);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
@keyframes pageIn { from { opacity: 0; } to { opacity: 1; } }

h1, h2, h3, h4, h5, .display { font-family: 'Bricolage Grotesque', 'Figtree', sans-serif; letter-spacing: -.015em; color: var(--forest); }
a { color: var(--leaf); text-decoration: none; }
a:hover { color: var(--forest); }
::selection { background: var(--corn); color: var(--forest-deep); }
:focus-visible { outline: 3px solid rgba(240, 180, 41, .65); outline-offset: 2px; border-radius: 6px; }

/* ---------- Buttons ---------- */
.btn-av {
  --bg: var(--forest); --fg: #fff;
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  background: var(--bg); color: var(--fg); border: 0; border-radius: 12px;
  padding: .65rem 1.15rem; font-weight: 600; font-size: .95rem; cursor: pointer;
  transition: transform .18s var(--ease), box-shadow .18s var(--ease), background .18s;
  position: relative; overflow: hidden;
}
.btn-av:hover { transform: translateY(-2px); box-shadow: 0 10px 20px -8px rgba(18, 64, 42, .55); color: var(--fg); }
.btn-av:active { transform: translateY(0) scale(.98); }
.btn-av.gold { --bg: var(--corn); --fg: var(--forest-deep); }
.btn-av.gold:hover { box-shadow: 0 10px 20px -8px rgba(201, 141, 11, .7); }
.btn-av.ghost { --bg: transparent; --fg: var(--forest); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn-av.ghost:hover { box-shadow: inset 0 0 0 1.5px var(--leaf); background: var(--paddy-soft); }
.btn-av.danger { --bg: var(--danger); }
.btn-av.leaf { --bg: var(--leaf); }
.btn-av.sm { padding: .4rem .75rem; font-size: .85rem; border-radius: 9px; }
.btn-av.block { width: 100%; }
.btn-av[disabled] { opacity: .7; pointer-events: none; }
.btn-av .spin {
  width: 1em; height: 1em; border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 50%; animation: spin .7s linear infinite; display: none;
}
.btn-av.loading .spin { display: inline-block; }
.btn-av.loading .lbl-icon { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Forms ---------- */
.field { margin-bottom: 1rem; }
.field label { display: block; font-weight: 600; font-size: .86rem; margin-bottom: .35rem; color: var(--forest); }
.input, .select, .textarea {
  width: 100%; padding: .68rem .9rem; border: 1.5px solid var(--line); border-radius: 12px;
  background: #fff; font: inherit; color: var(--ink);
  transition: border-color .18s, box-shadow .18s, transform .18s;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--leaf); box-shadow: 0 0 0 4px rgba(95, 168, 75, .18);
}
.input.invalid { border-color: var(--danger); animation: shake .35s; }
.input-icon { position: relative; }
.input-icon > i { position: absolute; left: .9rem; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input-icon .input { padding-left: 2.6rem; }
.input-icon .toggle-pw { position: absolute; right: .6rem; top: 50%; transform: translateY(-50%); background: none; border: 0; color: var(--muted); padding: .3rem .5rem; cursor: pointer; }
.field-error { color: var(--danger); font-size: .8rem; margin-top: .25rem; min-height: 0; }
.hint { color: var(--muted); font-size: .8rem; }
@keyframes shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }

/* Segmented crop picker */
.seg { display: flex; gap: .5rem; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label {
  flex: 1; text-align: center; margin: 0; padding: .6rem .5rem; border: 1.5px solid var(--line);
  border-radius: 12px; cursor: pointer; font-weight: 600; color: var(--muted); background: #fff;
  transition: all .18s var(--ease);
}
.seg label:hover { border-color: var(--leaf); }
.seg input:checked + label { border-color: var(--forest); background: var(--forest); color: #fff; transform: translateY(-1px); }
.seg input[value="corn"]:checked + label { background: var(--corn); border-color: var(--corn); color: var(--forest-deep); }
.seg input[value="rice"]:checked + label { background: var(--paddy); border-color: var(--paddy); color: #fff; }

/* ---------- Shell (sidebar + topbar) ---------- */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar); z-index: 40;
  background:
    radial-gradient(120% 60% at 0% 100%, rgba(240, 180, 41, .16), transparent 60%),
    linear-gradient(180deg, var(--forest) 0%, var(--forest-deep) 100%);
  color: #cfe3d4; display: flex; flex-direction: column; padding: 1.4rem 1rem;
  transition: transform .3s var(--ease);
}
.brand { display: flex; align-items: center; gap: .7rem; padding: .2rem .6rem 1.4rem; color: #fff; }
.brand:hover { color: #fff; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--corn), #f7d36a); color: var(--forest-deep); font-size: 1.3rem;
  box-shadow: 0 6px 14px -6px rgba(240, 180, 41, .8);
}
.brand-name { font-family: 'Bricolage Grotesque'; font-weight: 800; font-size: 1.25rem; letter-spacing: .02em; line-height: 1; }
.brand-sub { font-size: .68rem; color: #8fb59b; letter-spacing: .04em; }
.nav-group { margin-top: .6rem; font-size: .74rem; color: #7fa38b; padding: .4rem .8rem; }
.nav-link-av {
  display: flex; align-items: center; gap: .8rem; padding: .7rem .9rem; margin: .12rem 0; border-radius: 12px;
  color: #cfe3d4; font-weight: 500; position: relative; transition: background .2s, color .2s, transform .2s var(--ease);
}
.nav-link-av i { font-size: 1.1rem; width: 1.3rem; text-align: center; }
.nav-link-av:hover { background: rgba(255, 255, 255, .08); color: #fff; transform: translateX(3px); }
.nav-link-av.active { background: rgba(240, 180, 41, .16); color: #fff; }
.nav-link-av.active::before { content: ''; position: absolute; left: -1rem; top: 20%; bottom: 20%; width: 4px; border-radius: 0 4px 4px 0; background: var(--corn); }
.nav-link-av .count { margin-left: auto; background: var(--corn); color: var(--forest-deep); font-size: .72rem; font-weight: 800; padding: .05rem .5rem; border-radius: 99px; }
.nav-link-av .count:empty, .nav-link-av .count[data-n="0"] { display: none; }
.sidebar-foot { margin-top: auto; background: rgba(255, 255, 255, .06); border-radius: 14px; padding: .8rem; display: flex; gap: .7rem; align-items: center; }
.avatar {
  width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; flex: 0 0 auto;
  background: var(--paddy); color: #fff; font-weight: 700; font-family: 'Bricolage Grotesque';
}
.sidebar-foot .who { min-width: 0; line-height: 1.2; }
.sidebar-foot .who b { display: block; color: #fff; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-foot .who small { color: #8fb59b; text-transform: capitalize; }
.sidebar-foot a.out { margin-left: auto; color: #cfe3d4; font-size: 1.2rem; padding: .3rem; }
.sidebar-foot a.out:hover { color: var(--corn); }

.main { margin-left: var(--sidebar); min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 1rem;
  padding: .9rem 2rem; background: rgba(239, 244, 236, .85); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar h1 { font-size: 1.35rem; margin: 0; font-weight: 700; }
.topbar .crumb { color: var(--muted); font-size: .82rem; }
.menu-btn { display: none; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: .4rem .6rem; font-size: 1.3rem; }
.content { padding: 1.6rem 2rem 3rem; max-width: 1500px; }

/* Notification bell */
.bell-wrap { position: relative; margin-left: auto; }
.bell {
  width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: #fff;
  display: grid; place-items: center; font-size: 1.2rem; color: var(--forest); position: relative; cursor: pointer;
  transition: transform .2s var(--ease), box-shadow .2s;
}
.bell:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.bell.ring i { animation: ring 1s var(--ease); transform-origin: 50% 0; }
@keyframes ring { 0%, 100% { transform: rotate(0); } 15% { transform: rotate(18deg); } 30% { transform: rotate(-16deg); } 45% { transform: rotate(10deg); } 60% { transform: rotate(-6deg); } }
.bell .dot {
  position: absolute; top: -6px; right: -6px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 99px;
  background: var(--danger); color: #fff; font-size: .7rem; font-weight: 800; display: grid; place-items: center;
  border: 2px solid var(--mist); transform: scale(0); transition: transform .3s var(--ease);
}
.bell .dot.show { transform: scale(1); }
.notif-panel {
  position: absolute; right: 0; top: 54px; width: 370px; max-width: calc(100vw - 2rem); background: #fff;
  border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lift); overflow: hidden;
  opacity: 0; transform: translateY(-8px) scale(.98); pointer-events: none; transform-origin: top right;
  transition: opacity .2s, transform .25s var(--ease);
}
.notif-panel.open { opacity: 1; transform: none; pointer-events: auto; }
.notif-head { display: flex; align-items: center; justify-content: space-between; padding: .85rem 1rem; border-bottom: 1px solid var(--line); }
.notif-head b { font-family: 'Bricolage Grotesque'; font-size: 1.05rem; color: var(--forest); }
.notif-head button { background: none; border: 0; color: var(--leaf); font-weight: 600; font-size: .82rem; cursor: pointer; }
.notif-list { max-height: 380px; overflow-y: auto; }
.notif-item { display: flex; gap: .75rem; padding: .8rem 1rem; border-bottom: 1px solid #eef3ec; cursor: pointer; transition: background .15s; color: inherit; }
.notif-item:hover { background: var(--mist); color: inherit; }
.notif-item.unread { background: #f8fbf3; }
.notif-item .ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: 0 0 auto; }
.ico.info { background: #e3eefa; color: var(--water); }
.ico.success { background: var(--paddy-soft); color: var(--leaf); }
.ico.warning { background: var(--corn-soft); color: var(--corn-deep); }
.ico.danger { background: #fbe4e4; color: var(--danger); }
.notif-item b { display: block; font-size: .88rem; line-height: 1.25; }
.notif-item p { margin: .1rem 0 0; font-size: .82rem; color: var(--muted); line-height: 1.35; }
.notif-item small { color: #94a59a; font-size: .74rem; }
.notif-empty { padding: 2rem 1rem; text-align: center; color: var(--muted); }

/* ---------- Cards ---------- */
.card-av { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.3rem; }
.card-av.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: .8rem; margin-bottom: 1rem; flex-wrap: wrap; }
.card-head h3 { font-size: 1.1rem; margin: 0; font-weight: 700; }
.card-head small { color: var(--muted); display: block; font-family: 'Figtree'; font-weight: 400; font-size: .8rem; }
.card-av.flush .card-head { padding: 1.2rem 1.3rem 0; }

/* Stat cards — the one orchestrated entrance on each page */
.stat {
  position: relative; overflow: hidden; background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.1rem 1.2rem; box-shadow: var(--shadow); height: 100%;
  transition: transform .25s var(--ease), box-shadow .25s var(--ease);
}
.stat:hover { transform: translateY(-4px); box-shadow: var(--shadow-lift); }
.stat .ico { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-size: 1.2rem; margin-bottom: .8rem; }
.stat .num { font-family: 'Bricolage Grotesque'; font-size: 2rem; font-weight: 800; color: var(--forest); line-height: 1; }
.stat .num small { font-size: .9rem; font-weight: 600; color: var(--muted); margin-left: .2rem; }
.stat .lbl { color: var(--muted); font-size: .85rem; margin-top: .3rem; }
.stat::after { content: ''; position: absolute; right: -30px; bottom: -30px; width: 100px; height: 100px; border-radius: 50%; background: var(--tint, var(--paddy-soft)); opacity: .7; transition: transform .4s var(--ease); }
.stat:hover::after { transform: scale(1.4); }
.stat.gold { --tint: var(--corn-soft); }
.stat.gold .ico { background: var(--corn-soft); color: var(--corn-deep); }
.stat.green .ico { background: var(--paddy-soft); color: var(--leaf); }
.stat.blue { --tint: #e3eefa; }
.stat.blue .ico { background: #e3eefa; color: var(--water); }
.stat.red { --tint: #fbe4e4; }
.stat.red .ico { background: #fbe4e4; color: var(--danger); }

/* Charts */
.chart-box { position: relative; height: 300px; }
.chart-box.tall { height: 360px; }
.chart-box.short { height: 240px; }
.chart-box.loading::before {
  content: ''; position: absolute; inset: 0; border-radius: 12px;
  background: linear-gradient(100deg, #eef3ec 30%, #f7faf4 50%, #eef3ec 70%); background-size: 200% 100%; animation: shimmer 1.3s infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }
.legend-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: .35rem; }
.dot-corn { background: var(--corn); } .dot-rice { background: var(--paddy); } .dot-fc { background: var(--water); }

/* Chips & badges */
.chip { display: inline-flex; align-items: center; gap: .3rem; padding: .18rem .65rem; border-radius: 99px; font-size: .78rem; font-weight: 700; }
.chip.corn { background: var(--corn-soft); color: #8a5f00; }
.chip.rice { background: var(--paddy-soft); color: #2f6b23; }
.chip.pending { background: var(--corn-soft); color: #8a5f00; }
.chip.approved { background: var(--paddy-soft); color: #2f6b23; }
.chip.rejected { background: #fbe4e4; color: #a12b2b; }
.chip.wet { background: #e3eefa; color: #245c96; }
.chip.dry { background: #f6ebd9; color: #8a5a1a; }
.trend-up { color: var(--leaf); font-weight: 700; } .trend-down { color: var(--danger); font-weight: 700; }

/* Tables */
.table-wrap { overflow-x: auto; }
.av-table { width: 100%; border-collapse: collapse; }
.av-table th { text-align: left; font-size: .78rem; color: var(--muted); font-weight: 700; padding: .8rem 1.1rem; background: #f6f9f3; border-bottom: 1px solid var(--line); white-space: nowrap; }
.av-table td { padding: .85rem 1.1rem; border-bottom: 1px solid #eef3ec; vertical-align: middle; }
.av-table tbody tr { transition: background .15s; }
.av-table tbody tr:hover { background: #f8fbf5; }
.av-table tr.gone { animation: gone .4s var(--ease) forwards; }
@keyframes gone { to { opacity: 0; transform: translateX(30px); height: 0; } }
.person { display: flex; align-items: center; gap: .7rem; }
.person .avatar { width: 36px; height: 36px; font-size: .85rem; }
.person b { display: block; line-height: 1.2; } .person small { color: var(--muted); }
.actions { display: flex; gap: .35rem; justify-content: flex-end; flex-wrap: wrap; }
.icon-btn { width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--line); background: #fff; color: var(--forest); display: inline-grid; place-items: center; cursor: pointer; transition: all .18s var(--ease); }
.icon-btn:hover { transform: translateY(-2px); border-color: var(--leaf); background: var(--paddy-soft); }
.icon-btn.del:hover { border-color: var(--danger); background: #fbe4e4; color: var(--danger); }
.icon-btn.ok { background: var(--paddy); color: #fff; border-color: var(--paddy); }
.icon-btn.ok:hover { background: var(--leaf); }

.toolbar { display: flex; flex-wrap: wrap; gap: .7rem; align-items: center; padding: 1rem 1.3rem; border-bottom: 1px solid var(--line); }
.toolbar .input, .toolbar .select { width: auto; min-width: 150px; padding: .5rem .8rem; }
.toolbar .grow { flex: 1; min-width: 200px; }
.pager { display: flex; justify-content: space-between; align-items: center; padding: .9rem 1.3rem; color: var(--muted); font-size: .85rem; }
.pager .pg { display: flex; gap: .3rem; }
.pager button { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: .25rem .65rem; cursor: pointer; }
.pager button.on { background: var(--forest); color: #fff; border-color: var(--forest); }
.pager button:disabled { opacity: .4; cursor: not-allowed; }

.tabs { display: inline-flex; background: #e6eee2; border-radius: 12px; padding: 4px; gap: 2px; }
.tabs button { border: 0; background: transparent; padding: .45rem 1rem; border-radius: 9px; font-weight: 600; color: var(--muted); cursor: pointer; transition: all .2s var(--ease); }
.tabs button.on { background: #fff; color: var(--forest); box-shadow: 0 1px 4px rgba(18, 64, 42, .15); }

.empty { text-align: center; padding: 2.5rem 1rem; color: var(--muted); }
.empty i { font-size: 2.4rem; color: var(--paddy); display: block; margin-bottom: .4rem; }

/* Forecast summary tiles */
.fc-tile { border-radius: var(--radius); padding: 1.1rem 1.2rem; color: #fff; background: linear-gradient(135deg, var(--forest), var(--leaf)); position: relative; overflow: hidden; height: 100%; }
.fc-tile.corn { background: linear-gradient(135deg, #b9820a, var(--corn)); color: var(--forest-deep); }
.fc-tile .big { font-family: 'Bricolage Grotesque'; font-size: 2.3rem; font-weight: 800; line-height: 1; }
.fc-tile small { opacity: .85; }
.fc-tile i.bg { position: absolute; right: -8px; bottom: -14px; font-size: 5rem; opacity: .16; }
.meter { height: 8px; background: rgba(255, 255, 255, .3); border-radius: 99px; overflow: hidden; margin-top: .6rem; }
.meter > span { display: block; height: 100%; background: #fff; border-radius: 99px; width: 0; transition: width 1.2s var(--ease); }

/* ---------- Toasts ---------- */
#toasts { position: fixed; top: 1rem; right: 1rem; z-index: 2000; display: flex; flex-direction: column; gap: .6rem; width: 360px; max-width: calc(100vw - 2rem); }
.toast-av {
  display: flex; gap: .8rem; align-items: flex-start; background: #fff; border-radius: 14px; padding: .85rem 1rem;
  box-shadow: var(--shadow-lift); border-left: 5px solid var(--leaf); position: relative; overflow: hidden;
}
.toast-av.out { animation: toastOut .3s ease forwards; }
.toast-av .ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: 0 0 auto; }
.toast-av b { display: block; line-height: 1.2; } .toast-av p { margin: .1rem 0 0; color: var(--muted); font-size: .86rem; line-height: 1.35; }
.toast-av.success { border-color: var(--paddy); } .toast-av.danger { border-color: var(--danger); } .toast-av.warning { border-color: var(--corn); } .toast-av.info { border-color: var(--water); }
.toast-av .bar { position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: currentColor; opacity: .35; }
.toast-av.success .bar { color: var(--paddy); } .toast-av.danger .bar { color: var(--danger); } .toast-av.warning .bar { color: var(--corn); } .toast-av.info .bar { color: var(--water); }
.toast-av .x { margin-left: auto; background: none; border: 0; color: #9aa9a0; font-size: 1.1rem; cursor: pointer; }
@keyframes toastIn { from { opacity: 0; transform: translateX(40px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateX(40px); } }
@keyframes bar { from { width: 100%; } to { width: 0; } }

/* Confirm dialog */
.dlg-back { position: fixed; inset: 0; background: rgba(11, 43, 28, .5); backdrop-filter: blur(3px); z-index: 1900; display: grid; place-items: center; padding: 1rem; }
.dlg { background: #fff; border-radius: 20px; padding: 1.6rem; width: 420px; max-width: 100%; box-shadow: var(--shadow-lift); }
.dlg .ico { width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; font-size: 1.5rem; margin-bottom: .8rem; }
.dlg h4 { margin: 0 0 .3rem; } .dlg p { color: var(--muted); margin-bottom: 1rem; }
.dlg .btns { display: flex; gap: .6rem; justify-content: flex-end; }
@keyframes pop { from { opacity: 0; transform: scale(.9) translateY(10px); } to { opacity: 1; transform: none; } }


/* ---------- Animated crop field ---------- */
.field-scene { position: absolute; inset: 0; overflow: hidden; }
.field-scene svg { position: absolute; bottom: 0; left: 0; width: 100%; height: 100%; }
.sway { transform-box: fill-box; transform-origin: 50% 100%; animation: sway 4.8s ease-in-out infinite; animation-delay: var(--d, 0s); }
@keyframes sway { 0%, 100% { transform: rotate(-2.2deg); } 50% { transform: rotate(2.6deg); } }
.sun { animation: sunPulse 6s ease-in-out infinite; transform-origin: center; transform-box: fill-box; }
@keyframes sunPulse { 50% { transform: scale(1.06); opacity: .9; } }

/* ---------- Auth pages ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.auth-art {
  position: relative; overflow: hidden; color: #fff; padding: 2.5rem;
  background: linear-gradient(180deg, #f8e7a8 0%, #f4d475 32%, #9fcf7f 64%, #3f8a4d 100%);
  display: flex; flex-direction: column;
}
.auth-art .brand { position: relative; z-index: 2; color: var(--forest-deep); padding: 0; }
.auth-art .brand:hover { color: var(--forest-deep); }
.auth-art .brand-sub { color: #5e6f1e; }
.auth-art .pitch { position: relative; z-index: 2; margin-top: 2.2rem; max-width: 460px; }
.auth-art .pitch h2 { color: var(--forest-deep); font-size: 2.5rem; font-weight: 800; line-height: 1.05; }
.auth-art .pitch p { color: #34502f; font-size: 1.05rem; }
.auth-form { display: grid; place-items: center; padding: 2rem; background: #fff; }
.auth-card { width: 100%; max-width: 460px; }
.auth-card h1 { font-size: 2rem; font-weight: 800; margin-bottom: .25rem; }
.auth-card .sub { color: var(--muted); margin-bottom: 1.6rem; }
.role-note { background: var(--corn-soft); border-radius: 12px; padding: .75rem 1rem; color: #7a5300; font-size: .88rem; display: flex; gap: .6rem; margin-bottom: 1.2rem; }
.success-screen { text-align: center; padding: 1rem 0; }
.success-screen .check { width: 92px; height: 92px; margin: 0 auto 1rem; }
.check circle { stroke: var(--paddy); stroke-width: 4; fill: none; stroke-dasharray: 260; stroke-dashoffset: 260; animation: draw .8s var(--ease) forwards; }
.check path { stroke: var(--leaf); stroke-width: 5; fill: none; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 60; stroke-dashoffset: 60; animation: draw .5s .6s var(--ease) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.demo-box { margin-top: 1.4rem; background: var(--mist); border-radius: 12px; padding: .8rem 1rem; font-size: .84rem; color: var(--muted); }
.demo-box code { background: #fff; padding: .05rem .4rem; border-radius: 6px; color: var(--forest); }

/* ---------- Responsive ---------- */
@media (max-width: 991px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: none; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .4); }
  .main { margin-left: 0; }
  .menu-btn { display: block; }
  .content { padding: 1.2rem 1rem 3rem; }
  .topbar { padding: .8rem 1rem; }
  .auth { grid-template-columns: 1fr; }
  .auth-art { min-height: 260px; padding: 1.5rem; }
  .auth-art .pitch h2 { font-size: 1.7rem; } .auth-art .pitch p { display: none; }
  .strip-card { grid-template-columns: repeat(2, 1fr); gap: 1.2rem 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* =========================================================
   v3 additions — anime.js reveals, clickable stats, modals,
   crop panels (corn / rice are always shown separately)
   ========================================================= */
html.js .reveal { opacity: 0; }
html.js.ready .reveal { opacity: 1; }
[hidden], .hide { display: none !important; }
.muted { color: var(--muted); } .sm { font-size: .85rem; } .b { font-weight: 700; } .nowrap { white-space: nowrap; }
.row-flex { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; } .between { justify-content: space-between; }
.grow { flex: 1 1 auto; } .mt1 { margin-top: .5rem; } .mt2 { margin-top: 1rem; } .mt3 { margin-top: 1.5rem; } .mb2 { margin-bottom: 1rem; }
.cols { display: grid; gap: 1rem; grid-template-columns: repeat(var(--n, 1), minmax(0, 1fr)); }
.c2 { --n: 2; } .c3 { --n: 3; } .c4 { --n: 4; } .c5 { --n: 5; } .c6 { --n: 6; }
.c-2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); } .c-1-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.c-3-2 { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
@media (max-width: 1200px) { .c6, .c5 { --n: 3; } .c4 { --n: 2; } .c-2-1, .c-1-2, .c-3-2 { grid-template-columns: 1fr; } }
@media (max-width: 720px) { .c2, .c3, .c4, .c5, .c6 { --n: 1; } .c-mobile2 { --n: 2; } }

/* stat cards that are shortcuts */
a.stat { display: block; color: inherit; text-decoration: none; cursor: pointer; }
a.stat:hover { color: inherit; }
.stat .go { position: absolute; right: 1rem; top: 1rem; z-index: 2; font-size: 1rem; color: var(--muted); opacity: 0; transform: translate(-6px, 6px); transition: all .25s var(--ease); }
a.stat:hover .go, a.stat:focus-visible .go { opacity: 1; transform: none; color: var(--forest); }
.stat .sub { font-size: .8rem; margin-top: .35rem; position: relative; z-index: 2; }
.stat .num, .stat .lbl, .stat .ico { position: relative; z-index: 2; }
.stat.corn { --tint: var(--corn-soft); } .stat.corn .ico { background: var(--corn-soft); color: var(--corn-deep); }
.stat.rice { --tint: var(--paddy-soft); } .stat.rice .ico { background: var(--paddy-soft); color: var(--leaf); }
.stat.alert { --tint: #fbe4e4; } .stat.alert .ico { background: #fbe4e4; color: var(--danger); }
.delta { display: inline-flex; align-items: center; gap: .2rem; font-weight: 700; font-size: .8rem; padding: .1rem .5rem; border-radius: 99px; }
.delta.up { background: var(--paddy-soft); color: #2f6b23; } .delta.down { background: #fbe4e4; color: #a12b2b; } .delta.flat { background: #eef2ee; color: var(--muted); }

/* crop panels */
.crop-panel { border-top: 5px solid var(--cc); } .crop-panel.corn { --cc: var(--corn); } .crop-panel.rice { --cc: var(--paddy); }
.crop-title { display: flex; align-items: center; gap: .6rem; } .crop-title .ico { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; font-size: 1.2rem; background: var(--cc); color: #fff; }
.crop-panel.corn .crop-title .ico { color: var(--forest-deep); }
.yr-pill { display: inline-flex; align-items: center; gap: .4rem; padding: .3rem .8rem; border-radius: 99px; border: 1.5px solid var(--line); background: #fff; font-weight: 600; cursor: pointer; transition: all .18s var(--ease); font-size: .88rem; }
.yr-pill:hover { border-color: var(--leaf); } .yr-pill.on { background: var(--forest); color: #fff; border-color: var(--forest); }
.vs { display: grid; grid-template-columns: 1fr auto 1fr; gap: 1rem; align-items: center; text-align: center; }
.vs .yr { font-family: 'Bricolage Grotesque'; font-size: 2rem; font-weight: 800; color: var(--forest); line-height: 1; } .vs .v { font-size: .9rem; color: var(--muted); }
.vs .mid { display: grid; gap: .3rem; justify-items: center; }
.bar-row { display: grid; grid-template-columns: 90px 1fr 110px; gap: .8rem; align-items: center; padding: .35rem 0; font-size: .9rem; }
.bar-track { height: 10px; background: #e9f0e5; border-radius: 99px; overflow: hidden; } .bar-track > span { display: block; height: 100%; width: 0; border-radius: 99px; background: var(--cc, var(--leaf)); }

/* modal */
.modal-back { position: fixed; inset: 0; background: rgba(11, 43, 28, .5); backdrop-filter: blur(3px); z-index: 1800; display: none; align-items: center; justify-content: center; padding: 1rem; overflow-y: auto; }
.modal-back.open { display: flex; }
.modal-box { background: #fff; border-radius: 20px; width: 640px; max-width: 100%; box-shadow: var(--shadow-lift); margin: auto; }
.modal-box.wide { width: 820px; } .modal-box.narrow { width: 460px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 1.1rem 1.4rem; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font-size: 1.15rem; } .modal-x { background: none; border: 0; font-size: 1.4rem; color: var(--muted); cursor: pointer; }
.modal-body { padding: 1.3rem 1.4rem; } .modal-foot { display: flex; justify-content: flex-end; gap: .6rem; padding: .9rem 1.4rem; border-top: 1px solid var(--line); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .9rem 1rem; } .form-grid .full { grid-column: 1 / -1; } .form-grid .field { margin: 0; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }
.readonly { background: #f3f7f0; color: var(--muted); cursor: not-allowed; }

/* review & data-quality */
.issue { display: inline-flex; align-items: center; gap: .25rem; padding: .12rem .55rem; border-radius: 99px; font-size: .74rem; font-weight: 700; background: #fbe4e4; color: #a12b2b; margin: 0 .25rem .25rem 0; }
.issue.warn { background: var(--corn-soft); color: #8a5f00; } .issue.ok { background: var(--paddy-soft); color: #2f6b23; }
.ring { --p: 0; width: 132px; height: 132px; border-radius: 50%; display: grid; place-items: center; position: relative; flex: 0 0 auto;
  background: conic-gradient(var(--leaf) calc(var(--p) * 1%), #e6eee2 0); }
.ring::before { content: ''; position: absolute; inset: 12px; background: #fff; border-radius: 50%; }
.ring b { position: relative; font-family: 'Bricolage Grotesque'; font-size: 1.9rem; color: var(--forest); }
.attach { display: inline-flex; align-items: center; gap: .3rem; padding: .12rem .55rem; border-radius: 8px; background: #eef4ea; color: var(--forest); font-size: .78rem; font-weight: 600; }
.attach:hover { background: var(--paddy-soft); color: var(--forest); }
.dup-group { border: 1.5px dashed #e7b3b3; border-radius: 14px; padding: .9rem 1rem; margin-bottom: .9rem; background: #fffafa; }
.chip.inactive { background: #eceeed; color: #5b665f; } .chip.super { background: var(--forest); color: #fff; }
.chip.bad { background: #fbe4e4; color: #a12b2b; }
.slot { display: flex; align-items: center; gap: .6rem; padding: .7rem .9rem; border: 1.5px dashed var(--line); border-radius: 12px; color: var(--ink); transition: all .2s var(--ease); }
a.slot:hover { border-color: var(--leaf); background: var(--paddy-soft); transform: translateY(-2px); color: var(--ink); }
.slot.done { border-style: solid; background: #f4f9f1; } .slot i { font-size: 1.2rem; }
.pw-box { background: var(--corn-soft); border-radius: 12px; padding: 1rem; text-align: center; } .pw-box code { font-size: 1.4rem; font-weight: 800; letter-spacing: .08em; color: var(--forest); }
.tabs.scroll { max-width: 100%; overflow-x: auto; }
.stack-sm > * + * { margin-top: .5rem; }
.avatar.big { width: 84px; height: 84px; font-size: 2rem; background: var(--forest); }
hr.soft { border: 0; border-top: 1px solid var(--line); margin: 1rem 0; }
.filter-chip { display: inline-flex; align-items: center; gap: .4rem; background: var(--corn-soft); color: #7a5300; border-radius: 99px; padding: .2rem .7rem; font-size: .8rem; font-weight: 600; }
.note { border-radius: 12px; padding: .8rem 1rem; display: flex; gap: .6rem; font-size: .9rem; background: var(--corn-soft); color: #7a5300; }
.note.info { background: #e3eefa; color: #245c96; } .note.ok { background: var(--paddy-soft); color: #2f6b23; } .note.bad { background: #fbe4e4; color: #a12b2b; }

/* auth: photo panel */
.auth-art.photo { background: var(--forest-deep); color: #fff; }
.auth-art.photo::before { content: ''; position: absolute; inset: 0; background: url('../images/bg.webp') center/cover; opacity: .9; filter: saturate(1.05); transform: scale(1.04); }
.auth-art.photo::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(11, 43, 28, .55) 0%, rgba(11, 43, 28, .25) 45%, rgba(11, 43, 28, .88) 100%); }
.auth-art.photo .brand, .auth-art.photo .brand:hover { color: #fff; } .auth-art.photo .brand-sub { color: #cfe3d4; }
.auth-art.photo .pitch h2 { color: #fff; } .auth-art.photo .pitch p { color: #dcebdf; }
.auth-art .brand, .auth-art .pitch, .auth-art .art-foot { position: relative; z-index: 2; }
.art-foot { margin-top: auto; display: flex; gap: 1.6rem; flex-wrap: wrap; } .art-foot b { display: block; font-family: 'Bricolage Grotesque'; font-size: 1.6rem; } .art-foot small { color: #cfe3d4; }
.switch { display: grid; grid-template-columns: 1fr 1fr; background: #e9f0e5; border-radius: 14px; padding: 4px; margin-bottom: 1.6rem; position: relative; }
.switch a { text-align: center; padding: .6rem; border-radius: 11px; font-weight: 700; color: var(--muted); position: relative; z-index: 1; }
.switch a.on { color: var(--forest); } .switch .thumb { position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px); background: #fff; border-radius: 11px; box-shadow: 0 2px 8px rgba(18, 64, 42, .15); }
.switch.reg .thumb { left: calc(50%); }
.auth-form { overflow-y: auto; max-height: 100vh; }
.check circle, .check path { stroke-dasharray: 260; }

@media print {
  .sidebar, .topbar, .no-print, #toasts { display: none !important; } .main { margin: 0; } .content { padding: 0; }
  .card-av, .stat { box-shadow: none; break-inside: avoid; } body { background: #fff; }
}

/* ---------- v4 fixes: fixed sidebar, mobile auth, chart spacing ---------- */
.sidebar { height: 100vh; height: 100dvh; overflow: hidden; }
.brand { flex: 0 0 auto; }
.nav-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 0 .2rem .8rem; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.2) transparent; }
.nav-scroll::-webkit-scrollbar { width: 5px; } .nav-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,.2); border-radius: 9px; }
.nav-link-av.active::before { left: 0; }
.sidebar-foot { flex: 0 0 auto; margin-top: .6rem; }
.chart-box { margin-top: 1.1rem; padding: .25rem .2rem 0; }
.vs { padding: .3rem 0 .4rem; }
.crop-panel .card-head { margin-bottom: 1.1rem; }
.chart-empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--muted); gap: .3rem; text-align: center; padding: 1rem; }
.chart-empty i { font-size: 2rem; opacity: .5; }
.chart-box.is-empty canvas { visibility: hidden; }

@media (max-width: 991px) {
  .auth { display: flex; flex-direction: column; min-height: 100dvh; }
  .auth-art { min-height: 0; padding: 1.1rem 1.3rem 1.4rem; flex: 0 0 auto; }
  .auth-art .pitch { margin-top: 1rem; }
  .auth-art .pitch h2 { font-size: 1.25rem; line-height: 1.2; }
  .auth-form { max-height: none; overflow: visible; display: block; padding: 1.4rem 1.1rem 2.5rem; flex: 1 1 auto; }
  .auth-card, .auth-card[style] { margin: 0 auto; max-width: 520px !important; }
  .auth-card h1 { font-size: 1.6rem; }
}
@media (max-width: 480px) { .auth-art .brand-sub { display: none; } .auth-form { padding-top: 1.1rem; } }

.av-table tr.row-on td { background: #fff8e1; }
.av-table tr[data-y]:hover td { background: #f4f9f1; }
@media (min-width: 1201px) { .sticky-card { position: sticky; top: 84px; } }
html, body { margin: 0; } body { min-height: 100vh; } .auth-art.photo { width: 100%; }

.no-link { cursor: default; pointer-events: none; }
.perm-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
.perm-grid label { display: flex; align-items: center; gap: .5rem; padding: .55rem .7rem; border: 1.5px solid var(--line); border-radius: 10px; cursor: pointer; font-weight: 500; }
.perm-grid label:has(input:checked) { border-color: var(--leaf); background: var(--paddy-soft); }
@media (max-width: 640px) { .perm-grid { grid-template-columns: 1fr; } }
.input-icon > .input { padding-left: 2.5rem; } .input-icon > i:first-child { left: .9rem; }
